Skip to content

Commit

Permalink
适配AndroidX
Browse files Browse the repository at this point in the history
  • Loading branch information
880634 committed May 7, 2019
1 parent 9256ddd commit 7dc681e
Show file tree
Hide file tree
Showing 73 changed files with 192 additions and 190 deletions.
14 changes: 7 additions & 7 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ android {
targetSdkVersion rootProject.ext.targetSdkVersion
versionCode 10
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"

// 混淆配置
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-app.pro'
Expand Down Expand Up @@ -139,14 +139,14 @@ dependencies {
// 友盟隔离
implementation project(':umeng')

implementation "com.android.support:appcompat-v7:$rootProject.ext.supportLibraryVersion"
implementation "com.android.support:design:$rootProject.ext.supportLibraryVersion"
implementation "com.android.support:support-v4:$rootProject.ext.supportLibraryVersion"
implementation "com.android.support:cardview-v7:$rootProject.ext.supportLibraryVersion"
implementation "com.android.support.constraint:constraint-layout:$rootProject.ext.constraintLayoutVersion"
implementation 'androidx.appcompat:appcompat:1.1.0-alpha04'
implementation 'com.google.android.material:material:1.1.0-alpha06'
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
implementation 'androidx.cardview:cardview:1.0.0'
implementation 'androidx.constraintlayout:constraintlayout:2.0.0-alpha5'

// Dex分包,解决 64k 问题
implementation 'com.android.support:multidex:1.0.3'
implementation 'androidx.multidex:multidex:2.0.1'

// ButterKnife 注解库:https://github.com/JakeWharton/butterknife
implementation 'com.jakewharton:butterknife:9.0.0-rc1'
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@

<!-- 适配Android 7.0文件意图 -->
<provider
android:name="android.support.v4.content.FileProvider"
android:name="androidx.core.content.FileProvider"
android:authorities="${applicationId}.provider"
android:exported="false"
android:grantUriPermissions="true">
Expand Down
6 changes: 3 additions & 3 deletions app/src/main/java/com/hjq/demo/common/MyActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

import android.content.pm.ActivityInfo;
import android.graphics.drawable.Drawable;
import android.support.annotation.DrawableRes;
import android.support.annotation.Nullable;
import android.support.annotation.StringRes;
import androidx.annotation.DrawableRes;
import androidx.annotation.Nullable;
import androidx.annotation.StringRes;
import android.util.Log;
import android.view.View;

Expand Down
2 changes: 1 addition & 1 deletion app/src/main/java/com/hjq/demo/common/MyApplication.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import android.app.Application;
import android.content.Context;
import android.support.multidex.MultiDex;
import androidx.multidex.MultiDex;

import com.hjq.demo.other.EventBusManager;
import com.hjq.image.ImageLoader;
Expand Down
8 changes: 4 additions & 4 deletions app/src/main/java/com/hjq/demo/common/MyLazyFragment.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@

import android.graphics.drawable.Drawable;
import android.os.Bundle;
import android.support.annotation.DrawableRes;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.annotation.StringRes;
import androidx.annotation.DrawableRes;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.annotation.StringRes;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
Expand Down
8 changes: 4 additions & 4 deletions app/src/main/java/com/hjq/demo/common/MyListViewAdapter.java
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
package com.hjq.demo.common;

import android.content.Context;
import android.support.annotation.ColorInt;
import android.support.annotation.DrawableRes;
import android.support.annotation.IdRes;
import android.support.annotation.StringRes;
import androidx.annotation.ColorInt;
import androidx.annotation.DrawableRes;
import androidx.annotation.IdRes;
import androidx.annotation.StringRes;
import android.view.View;
import android.view.ViewGroup;
import android.widget.CompoundButton;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
package com.hjq.demo.common;

import android.content.Context;
import android.support.annotation.ColorInt;
import android.support.annotation.DrawableRes;
import android.support.annotation.IdRes;
import android.support.annotation.StringRes;
import androidx.annotation.ColorInt;
import androidx.annotation.DrawableRes;
import androidx.annotation.IdRes;
import androidx.annotation.StringRes;
import android.view.View;
import android.view.ViewGroup;
import android.widget.CompoundButton;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.hjq.demo.helper;

import android.app.Activity;
import android.support.v4.util.ArrayMap;
import androidx.collection.ArrayMap;

/**
* author : Android 轮子哥
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ public IntentExtraUtils startActivity(Fragment fragment, int requestCode) {
return this;
}

public IntentExtraUtils startActivity(android.support.v4.app.Fragment fragment, int requestCode) {
public IntentExtraUtils startActivity(androidx.fragment.app.Fragment fragment, int requestCode) {
fragment.startActivityForResult(new Intent(fragment.getActivity(), sCurrentClass), requestCode);
return this;
}
Expand Down
4 changes: 2 additions & 2 deletions app/src/main/java/com/hjq/demo/helper/PopupWindowHelper.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
import android.content.Context;
import android.graphics.Color;
import android.graphics.drawable.ColorDrawable;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import android.view.View;
import android.view.ViewGroup;
import android.view.animation.Animation;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.hjq.demo.helper;

import android.support.annotation.IdRes;
import androidx.annotation.IdRes;
import android.view.View;
import android.widget.CompoundButton;
import android.widget.RadioButton;
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/java/com/hjq/demo/other/EventBusManager.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.hjq.demo.other;

import android.support.v4.util.ArrayMap;
import androidx.collection.ArrayMap;

import com.hjq.demo.MyEventBusIndex;

Expand Down
8 changes: 4 additions & 4 deletions app/src/main/java/com/hjq/demo/other/StatusManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@
import android.graphics.drawable.Drawable;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
import android.support.annotation.DrawableRes;
import android.support.annotation.RequiresPermission;
import android.support.annotation.StringRes;
import android.support.v4.app.FragmentActivity;
import androidx.annotation.DrawableRes;
import androidx.annotation.RequiresPermission;
import androidx.annotation.StringRes;
import androidx.fragment.app.FragmentActivity;
import android.view.View;
import android.view.ViewGroup;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import android.app.Dialog;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.support.annotation.Nullable;
import androidx.annotation.Nullable;
import android.view.Gravity;
import android.view.View;
import android.widget.ImageView;
Expand Down
6 changes: 3 additions & 3 deletions app/src/main/java/com/hjq/demo/ui/activity/HomeActivity.java
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package com.hjq.demo.ui.activity;

import android.support.annotation.NonNull;
import android.support.design.widget.BottomNavigationView;
import android.support.v4.view.ViewPager;
import androidx.annotation.NonNull;
import com.google.android.material.bottomnavigation.BottomNavigationView;
import androidx.viewpager.widget.ViewPager;
import android.view.KeyEvent;
import android.view.MenuItem;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.hjq.demo.ui.activity;

import android.content.Intent;
import android.support.annotation.Nullable;
import androidx.annotation.Nullable;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.hjq.demo.ui.activity;

import android.support.v4.view.ViewPager;
import androidx.viewpager.widget.ViewPager;

import com.hjq.demo.R;
import com.hjq.demo.common.MyActivity;
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/java/com/hjq/demo/ui/adapter/CopyAdapter.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.hjq.demo.ui.adapter;

import android.content.Context;
import android.support.annotation.NonNull;
import androidx.annotation.NonNull;
import android.view.ViewGroup;

import com.hjq.demo.R;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package com.hjq.demo.ui.adapter;

import android.app.Activity;
import android.support.annotation.NonNull;
import android.support.v4.view.PagerAdapter;
import androidx.annotation.NonNull;
import androidx.viewpager.widget.PagerAdapter;
import android.view.View;
import android.view.ViewGroup;

Expand Down
2 changes: 1 addition & 1 deletion app/src/main/java/com/hjq/demo/ui/dialog/CopyDialog.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.hjq.demo.ui.dialog;

import android.support.v4.app.FragmentActivity;
import androidx.fragment.app.FragmentActivity;
import android.view.Gravity;

import com.hjq.base.BaseDialog;
Expand Down
10 changes: 5 additions & 5 deletions app/src/main/java/com/hjq/demo/ui/dialog/ShareDialog.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@
import android.content.Context;
import android.graphics.drawable.Drawable;
import android.os.Build;
import android.support.annotation.DrawableRes;
import android.support.annotation.NonNull;
import android.support.v4.app.FragmentActivity;
import android.support.v7.widget.GridLayoutManager;
import android.support.v7.widget.RecyclerView;
import androidx.annotation.DrawableRes;
import androidx.annotation.NonNull;
import androidx.fragment.app.FragmentActivity;
import androidx.recyclerview.widget.GridLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import android.util.TypedValue;
import android.view.Gravity;
import android.view.View;
Expand Down
4 changes: 2 additions & 2 deletions app/src/main/java/com/hjq/demo/ui/dialog/UpdateDialog.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
import android.os.Handler;
import android.os.Looper;
import android.os.Message;
import android.support.v4.app.FragmentActivity;
import android.support.v4.content.FileProvider;
import androidx.fragment.app.FragmentActivity;
import androidx.core.content.FileProvider;
import android.text.format.Formatter;
import android.view.Gravity;
import android.view.View;
Expand Down
4 changes: 2 additions & 2 deletions app/src/main/java/com/hjq/demo/ui/fragment/TestFragmentA.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.hjq.demo.ui.fragment;

import android.support.design.widget.AppBarLayout;
import android.support.v7.widget.Toolbar;
import com.google.android.material.appbar.AppBarLayout;
import androidx.appcompat.widget.Toolbar;
import android.widget.TextView;

import com.gyf.barlibrary.ImmersionBar;
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/java/com/hjq/demo/widget/PhotoViewPager.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.hjq.demo.widget;

import android.content.Context;
import android.support.v4.view.ViewPager;
import androidx.viewpager.widget.ViewPager;
import android.util.AttributeSet;
import android.view.MotionEvent;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.hjq.demo.widget;

import android.content.Context;
import android.support.design.widget.CollapsingToolbarLayout;
import com.google.android.material.appbar.CollapsingToolbarLayout;
import android.util.AttributeSet;

/**
Expand Down
4 changes: 2 additions & 2 deletions app/src/main/res/layout/activity_dialog.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
android:layout_height="wrap_content"
app:title="对话框案例" />

<android.support.v4.widget.NestedScrollView
<androidx.core.widget.NestedScrollView
android:layout_width="match_parent"
android:layout_height="match_parent">

Expand Down Expand Up @@ -139,6 +139,6 @@

</LinearLayout>

</android.support.v4.widget.NestedScrollView>
</androidx.core.widget.NestedScrollView>

</LinearLayout>
2 changes: 1 addition & 1 deletion app/src/main/res/layout/activity_home.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
android:layout_weight="1"
android:fitsSystemWindows="false" />

<android.support.design.widget.BottomNavigationView
<com.google.android.material.bottomnavigation.BottomNavigationView
android:id="@+id/bv_home_navigation"
android:layout_width="match_parent"
android:layout_height="wrap_content"
Expand Down
4 changes: 2 additions & 2 deletions app/src/main/res/layout/activity_register.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
app:leftTitle="@string/register_login"
app:title="" />

<android.support.v4.widget.NestedScrollView
<androidx.core.widget.NestedScrollView
android:layout_width="match_parent"
android:layout_height="match_parent">

Expand Down Expand Up @@ -122,6 +122,6 @@

</LinearLayout>

</android.support.v4.widget.NestedScrollView>
</androidx.core.widget.NestedScrollView>

</LinearLayout>
2 changes: 1 addition & 1 deletion app/src/main/res/layout/activity_status.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
android:layout_width="match_parent"
android:layout_height="match_parent">

<android.support.v7.widget.RecyclerView
<androidx.recyclerview.widget.RecyclerView
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:listCount="10"
Expand Down
4 changes: 2 additions & 2 deletions app/src/main/res/layout/dialog_update.xml
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
</LinearLayout>

<!--这个地方需要设置可以滚动-->
<android.support.v4.widget.NestedScrollView
<androidx.core.widget.NestedScrollView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:overScrollMode="never"
Expand All @@ -73,7 +73,7 @@
android:textSize="13sp"
tools:text="更新内容\n更新内容\n更新内容\n更新内容\n更新内容\n更新内容\n更新内容\n更新内容\n更新内容\n更新内容\n更新内容\n更新内容\n更新内容\n更新内容\n" />

</android.support.v4.widget.NestedScrollView>
</androidx.core.widget.NestedScrollView>

<com.hjq.widget.NumberProgressBar
android:id="@+id/pb_dialog_update_progress"
Expand Down
Loading

0 comments on commit 7dc681e

Please sign in to comment.