diff --git a/.idea/caches/build_file_checksums.ser b/.idea/caches/build_file_checksums.ser index 9537c81..62a16db 100644 Binary files a/.idea/caches/build_file_checksums.ser and b/.idea/caches/build_file_checksums.ser differ diff --git a/.idea/misc.xml b/.idea/misc.xml index 3cd688f..5beea4f 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -63,7 +63,7 @@ - + diff --git a/README.md b/README.md index 8b1be77..60fbb4a 100644 --- a/README.md +++ b/README.md @@ -56,7 +56,18 @@ Base是针对于Android开发封装好一些常用的基类,主要包括通用 ``` ### Gradle: ```gradle +//---------- AndroidX 版本 +//base +implementation 'com.king.base:base:3.2.1-androidx' + +//base-adapter +implementation 'com.king.base:adapter:3.2.1-androidx' + +//base-util +implementation 'com.king.base:util:3.2.1-androidx' + +//---------- Android 版本 //base implementation 'com.king.base:base:3.2.1' @@ -65,6 +76,8 @@ implementation 'com.king.base:adapter:3.2.1' //base-util implementation 'com.king.base:util:3.2.1' + + ``` ### Lvy: ```lvy @@ -96,20 +109,33 @@ allprojects { ### 引入的库: ```gradle +//---------- AndroidX 版本 //base -compileOnly 'com.android.support:appcompat-v7:28.0.0' -compileOnly 'com.king.base:util:3.2.1' +compileOnly 'androidx.appcompat:appcompat:1.0.0+' +compileOnly 'com.king.base:util:3.2.1-androidx' + +//base-adapter +compileOnly 'androidx.appcompat:appcompat:1.0.0+' +compileOnly 'androidx.recyclerview:recyclerview:1.0.0+' + +//base-util +compileOnly 'androidx.appcompat:appcompat:1.0.0+' + ``` ```gradle +//---------- Android 版本 +//base +compileOnly 'com.android.support:appcompat-v7:28.0.0' +compileOnly 'com.king.base:util:3.2.1' + //base-adapter compileOnly 'com.android.support:appcompat-v7:28.0.0' compileOnly 'com.android.support:recyclerview-v7:28.0.0' -``` -```gradle //base-util compileOnly 'com.android.support:appcompat-v7:28.0.0' + ``` @@ -322,6 +348,7 @@ public class TestDialogFragment extends BaseDialogFragment { #### v3.2.1:2019-7-1 * 优化部分细节,为迁移AndroidX版本做准备 +* 支持AndroidX对应版本 #### v3.2.0:2019-5-28 * 统一版本,方便维护 diff --git a/app/build.gradle b/app/build.gradle index 02b6cb5..6003540 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -10,7 +10,7 @@ android { targetSdkVersion build_versions.targetSdk versionCode app_version.versionCode versionName app_version.versionName - testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" + testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" } buildTypes { @@ -34,7 +34,6 @@ dependencies { implementation deps.support.appcompat implementation deps.support.recyclerview implementation deps.support.constraintlayout - implementation deps.superswiperefreshlayout implementation project(':base') implementation project(':base-adapter') diff --git a/app/release/app-release.apk b/app/release/app-release.apk index 6dbbe90..add1858 100644 Binary files a/app/release/app-release.apk and b/app/release/app-release.apk differ diff --git a/app/release/output.json b/app/release/output.json index 3fa9333..f2f9c82 100644 --- a/app/release/output.json +++ b/app/release/output.json @@ -1 +1 @@ -[{"outputType":{"type":"APK"},"apkInfo":{"type":"MAIN","splits":[],"versionCode":11,"versionName":"3.2.1","enabled":true,"outputFile":"app-release.apk","fullName":"release","baseName":"release"},"path":"app-release.apk","properties":{}}] \ No newline at end of file +[{"outputType":{"type":"APK"},"apkInfo":{"type":"MAIN","splits":[],"versionCode":12,"versionName":"3.2.1-androidx","enabled":true,"outputFile":"app-release.apk","fullName":"release","baseName":"release"},"path":"app-release.apk","properties":{}}] \ No newline at end of file diff --git a/app/src/androidTest/java/com/king/base/app/ExampleInstrumentedTest.java b/app/src/androidTest/java/com/king/base/app/ExampleInstrumentedTest.java index 75e7022..b07d0b6 100644 --- a/app/src/androidTest/java/com/king/base/app/ExampleInstrumentedTest.java +++ b/app/src/androidTest/java/com/king/base/app/ExampleInstrumentedTest.java @@ -1,12 +1,13 @@ package com.king.base.app; import android.content.Context; -import android.support.test.InstrumentationRegistry; -import android.support.test.runner.AndroidJUnit4; import org.junit.Test; import org.junit.runner.RunWith; +import androidx.test.InstrumentationRegistry; +import androidx.test.runner.AndroidJUnit4; + import static org.junit.Assert.*; /** diff --git a/app/src/main/java/com/king/base/app/fragment/ListFragment.java b/app/src/main/java/com/king/base/app/fragment/ListFragment.java index 5c79e3e..744074a 100644 --- a/app/src/main/java/com/king/base/app/fragment/ListFragment.java +++ b/app/src/main/java/com/king/base/app/fragment/ListFragment.java @@ -3,27 +3,26 @@ import android.os.AsyncTask; import android.os.Bundle; import android.os.SystemClock; -import android.support.v4.widget.SwipeRefreshLayout; import android.view.View; import android.widget.AdapterView; import android.widget.ListView; import com.king.base.BaseFragment; -import com.king.base.adapter.HolderRecyclerAdapter; import com.king.base.app.R; import com.king.base.app.adapter.ListAdapter; -import com.king.view.superswiperefreshlayout.SuperSwipeRefreshLayout; import java.util.ArrayList; import java.util.List; +import androidx.swiperefreshlayout.widget.SwipeRefreshLayout; + /** * @author Jenly Jenly */ public class ListFragment extends BaseFragment{ - private SuperSwipeRefreshLayout ssrl; + private SwipeRefreshLayout srl; private ListView listView; @@ -43,7 +42,7 @@ public static ListFragment newInstance() { @Override public void initUI() { - ssrl = findViewById(R.id.ssrl); + srl = findViewById(R.id.srl); listView = findViewById(R.id.listView); initListData(); @@ -51,15 +50,10 @@ public void initUI() { listView.setAdapter(adapter); - ssrl.setOnRefreshListener(new SuperSwipeRefreshLayout.OnRefreshListener() { + srl.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() { @Override - public void onRefresh(SuperSwipeRefreshLayout.Direction direction) { - if(direction == SuperSwipeRefreshLayout.Direction.TOP){ - pullRefresh(); - }else{ - loadMoreRefresh(); - - } + public void onRefresh() { + pullRefresh(); } }); listView.setOnItemClickListener(new AdapterView.OnItemClickListener() { @@ -88,7 +82,7 @@ private void initListData(){ private void refreshView(){ adapter.notifyDataSetChanged(); - ssrl.setRefreshing(false); + srl.setRefreshing(false); } private void pullRefresh(){ diff --git a/app/src/main/java/com/king/base/app/fragment/RecyclerFragment.java b/app/src/main/java/com/king/base/app/fragment/RecyclerFragment.java index f3b8de9..18595ef 100644 --- a/app/src/main/java/com/king/base/app/fragment/RecyclerFragment.java +++ b/app/src/main/java/com/king/base/app/fragment/RecyclerFragment.java @@ -3,9 +3,6 @@ import android.os.AsyncTask; import android.os.Bundle; import android.os.SystemClock; -import android.support.v7.widget.DefaultItemAnimator; -import android.support.v7.widget.LinearLayoutManager; -import android.support.v7.widget.RecyclerView; import android.view.View; import com.king.base.BaseFragment; @@ -13,18 +10,22 @@ import com.king.base.adapter.divider.DividerItemDecoration; import com.king.base.app.R; import com.king.base.app.adapter.RecyclerViewAdapter; -import com.king.view.superswiperefreshlayout.SuperSwipeRefreshLayout; import java.util.ArrayList; import java.util.List; +import androidx.recyclerview.widget.DefaultItemAnimator; +import androidx.recyclerview.widget.LinearLayoutManager; +import androidx.recyclerview.widget.RecyclerView; +import androidx.swiperefreshlayout.widget.SwipeRefreshLayout; + /** * @author Jenly Jenly */ public class RecyclerFragment extends BaseFragment { - private SuperSwipeRefreshLayout ssrl; + private SwipeRefreshLayout srl; private RecyclerView recyclerView; @@ -43,27 +44,23 @@ public static RecyclerFragment newInstance() { @Override public void initUI() { - ssrl = findViewById(R.id.ssrl); + srl = findViewById(R.id.srl); recyclerView = findViewById(R.id.recyclerView); recyclerView.setItemAnimator(new DefaultItemAnimator()); recyclerView.addItemDecoration(new DividerItemDecoration(getContext(),DividerItemDecoration.VERTICAL)); initListData(); adapter = new RecyclerViewAdapter(getContext(),listData); - recyclerView.setLayoutManager(new LinearLayoutManager(getContext(), LinearLayoutManager.VERTICAL,false)); + recyclerView.setLayoutManager(new LinearLayoutManager(getContext())); recyclerView.setAdapter(adapter); - ssrl.setOnRefreshListener(new SuperSwipeRefreshLayout.OnRefreshListener() { + srl.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() { @Override - public void onRefresh(SuperSwipeRefreshLayout.Direction direction) { - if(direction == SuperSwipeRefreshLayout.Direction.TOP){ - pullRefresh(); - }else{ - loadMoreRefresh(); - - } + public void onRefresh() { + pullRefresh(); } }); + adapter.setOnItemClickListener(new HolderRecyclerAdapter.OnItemClickListener() { @Override public void onItemClick(View v, int position) { @@ -91,7 +88,7 @@ private void initListData(){ private void refreshView(){ adapter.notifyDataSetChanged(); - ssrl.setRefreshing(false); + srl.setRefreshing(false); } private void pullRefresh(){ diff --git a/app/src/main/res/layout/activity_main.xml b/app/src/main/res/layout/activity_main.xml index 3539c37..c6f7ac0 100644 --- a/app/src/main/res/layout/activity_main.xml +++ b/app/src/main/res/layout/activity_main.xml @@ -1,5 +1,5 @@ - - + diff --git a/app/src/main/res/layout/fragment_list.xml b/app/src/main/res/layout/fragment_list.xml index b95f994..3b85677 100644 --- a/app/src/main/res/layout/fragment_list.xml +++ b/app/src/main/res/layout/fragment_list.xml @@ -13,14 +13,13 @@ android:textSize="20sp" android:text="ListView" android:background="@color/colorPrimary"/> - + android:layout_height="match_parent"> - + diff --git a/app/src/main/res/layout/fragment_recycler.xml b/app/src/main/res/layout/fragment_recycler.xml index ba48572..3e2e3ee 100644 --- a/app/src/main/res/layout/fragment_recycler.xml +++ b/app/src/main/res/layout/fragment_recycler.xml @@ -13,14 +13,13 @@ android:textSize="20sp" android:text="RecyclerView" android:background="@color/colorPrimary"/> - - + - + diff --git a/base-adapter/build.gradle b/base-adapter/build.gradle index 9d51fd1..53371a4 100644 --- a/base-adapter/build.gradle +++ b/base-adapter/build.gradle @@ -11,7 +11,7 @@ android { versionCode app_version.versionCode versionName app_version.baseAdapter - testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" + testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" } buildTypes { diff --git a/base-adapter/src/androidTest/java/com/king/base/adapter/ExampleInstrumentedTest.java b/base-adapter/src/androidTest/java/com/king/base/adapter/ExampleInstrumentedTest.java index c11171e..e99fae6 100644 --- a/base-adapter/src/androidTest/java/com/king/base/adapter/ExampleInstrumentedTest.java +++ b/base-adapter/src/androidTest/java/com/king/base/adapter/ExampleInstrumentedTest.java @@ -1,12 +1,13 @@ package com.king.base.adapter; import android.content.Context; -import android.support.test.InstrumentationRegistry; -import android.support.test.runner.AndroidJUnit4; import org.junit.Test; import org.junit.runner.RunWith; +import androidx.test.InstrumentationRegistry; +import androidx.test.runner.AndroidJUnit4; + import static org.junit.Assert.*; /** diff --git a/base-adapter/src/main/java/com/king/base/adapter/AbstractAdapter.java b/base-adapter/src/main/java/com/king/base/adapter/AbstractAdapter.java index 82b9a46..821118c 100644 --- a/base-adapter/src/main/java/com/king/base/adapter/AbstractAdapter.java +++ b/base-adapter/src/main/java/com/king/base/adapter/AbstractAdapter.java @@ -21,12 +21,13 @@ import java.util.List; import android.content.Context; -import android.support.annotation.LayoutRes; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.BaseAdapter; +import androidx.annotation.LayoutRes; + /** * 抽象适配器(实现部分父类方法、免去一些通用的代码) * @author Jenly Jenly @@ -79,7 +80,7 @@ public LayoutInflater getLayoutInflater(){ return layoutInflater; } - public View inflate(@LayoutRes int layoutId,ViewGroup parent,boolean attachToRoot){ + public View inflate(@LayoutRes int layoutId, ViewGroup parent, boolean attachToRoot){ return layoutInflater.inflate(layoutId,parent,attachToRoot); } diff --git a/base-adapter/src/main/java/com/king/base/adapter/BaseAdapter.java b/base-adapter/src/main/java/com/king/base/adapter/BaseAdapter.java index de6c4ab..aa79823 100644 --- a/base-adapter/src/main/java/com/king/base/adapter/BaseAdapter.java +++ b/base-adapter/src/main/java/com/king/base/adapter/BaseAdapter.java @@ -1,7 +1,6 @@ package com.king.base.adapter; import android.content.Context; -import android.support.annotation.LayoutRes; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; @@ -14,6 +13,8 @@ import java.lang.reflect.Type; import java.util.List; +import androidx.annotation.LayoutRes; + /** * ListView通用适配器 * 在HolderRecyclerAdapter基础之上将H:ViewHolder实例化,通过ViewHolder子类根据控件的id得到对应控件,来进行相关的数据绑定操作 diff --git a/base-adapter/src/main/java/com/king/base/adapter/BaseRecyclerAdapter.java b/base-adapter/src/main/java/com/king/base/adapter/BaseRecyclerAdapter.java index dc054de..8d17335 100644 --- a/base-adapter/src/main/java/com/king/base/adapter/BaseRecyclerAdapter.java +++ b/base-adapter/src/main/java/com/king/base/adapter/BaseRecyclerAdapter.java @@ -1,7 +1,6 @@ package com.king.base.adapter; import android.content.Context; -import android.support.annotation.LayoutRes; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; @@ -14,6 +13,8 @@ import java.lang.reflect.Type; import java.util.List; +import androidx.annotation.LayoutRes; + /** * RecyclerView通用适配器 * 在HolderAdapter基础之上将H:ViewHolder实例化,通过ViewHolder子类根据控件的id得到对应控件,来进行相关的数据绑定操作 diff --git a/base-adapter/src/main/java/com/king/base/adapter/HolderRecyclerAdapter.java b/base-adapter/src/main/java/com/king/base/adapter/HolderRecyclerAdapter.java index 0aad70b..a917f4f 100644 --- a/base-adapter/src/main/java/com/king/base/adapter/HolderRecyclerAdapter.java +++ b/base-adapter/src/main/java/com/king/base/adapter/HolderRecyclerAdapter.java @@ -17,8 +17,6 @@ package com.king.base.adapter; import android.content.Context; -import android.support.annotation.LayoutRes; -import android.support.v7.widget.RecyclerView; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; @@ -28,6 +26,9 @@ import java.util.ArrayList; import java.util.List; +import androidx.annotation.LayoutRes; +import androidx.recyclerview.widget.RecyclerView; + /** * @author Jenly Jenly * @@ -127,7 +128,7 @@ public int getItemCount() { return listData==null ? 0:listData.size(); } - public View inflate(@LayoutRes int layoutId,ViewGroup parent,boolean attachToRoot){ + public View inflate(@LayoutRes int layoutId, ViewGroup parent, boolean attachToRoot){ return layoutInflater.inflate(layoutId,parent,attachToRoot); } diff --git a/base-adapter/src/main/java/com/king/base/adapter/ViewHolderRecyclerAdapter.java b/base-adapter/src/main/java/com/king/base/adapter/ViewHolderRecyclerAdapter.java index 8f39300..93d4021 100644 --- a/base-adapter/src/main/java/com/king/base/adapter/ViewHolderRecyclerAdapter.java +++ b/base-adapter/src/main/java/com/king/base/adapter/ViewHolderRecyclerAdapter.java @@ -17,12 +17,13 @@ package com.king.base.adapter; import android.content.Context; -import android.support.annotation.LayoutRes; import com.king.base.adapter.holder.ViewHolder; import java.util.List; +import androidx.annotation.LayoutRes; + /** * 通用适配器 * 在BaseRecyclerAdapter基础之上将H:ViewHolder具体化,通过通用的ViewHolder根据控件的id得到对应控件,来进行相关的数据绑定操作 @@ -32,7 +33,7 @@ public abstract class ViewHolderRecyclerAdapter extends BaseRecyclerAdapter{ - public ViewHolderRecyclerAdapter(Context context,@LayoutRes int layoutId) { + public ViewHolderRecyclerAdapter(Context context,@LayoutRes int layoutId) { super(context, layoutId); } diff --git a/base-adapter/src/main/java/com/king/base/adapter/ViewPagerAdapter.java b/base-adapter/src/main/java/com/king/base/adapter/ViewPagerAdapter.java index e4a356d..600fbf5 100644 --- a/base-adapter/src/main/java/com/king/base/adapter/ViewPagerAdapter.java +++ b/base-adapter/src/main/java/com/king/base/adapter/ViewPagerAdapter.java @@ -19,10 +19,11 @@ import java.util.List; import android.content.Context; -import android.support.v4.view.PagerAdapter; import android.view.View; import android.view.ViewGroup; +import androidx.viewpager.widget.PagerAdapter; + /** * ViewPager通用适配器 * @author Jenly Jenly diff --git a/base-adapter/src/main/java/com/king/base/adapter/ViewPagerFragmentAdapter.java b/base-adapter/src/main/java/com/king/base/adapter/ViewPagerFragmentAdapter.java index 52d4a7c..e92936a 100644 --- a/base-adapter/src/main/java/com/king/base/adapter/ViewPagerFragmentAdapter.java +++ b/base-adapter/src/main/java/com/king/base/adapter/ViewPagerFragmentAdapter.java @@ -16,17 +16,18 @@ */ package com.king.base.adapter; -import android.support.v4.app.Fragment; -import android.support.v4.app.FragmentManager; -import android.support.v4.app.FragmentPagerAdapter; import java.util.List; +import androidx.fragment.app.Fragment; +import androidx.fragment.app.FragmentManager; +import androidx.fragment.app.FragmentPagerAdapter; + /** * ViewPager通用Fragment适配器 * @author Jenly Jenly */ -public class ViewPagerFragmentAdapter extends FragmentPagerAdapter{ +public class ViewPagerFragmentAdapter extends FragmentPagerAdapter { private List listData; diff --git a/base-adapter/src/main/java/com/king/base/adapter/divider/DividerGridItemDecoration.java b/base-adapter/src/main/java/com/king/base/adapter/divider/DividerGridItemDecoration.java index fa90731..25b67eb 100644 --- a/base-adapter/src/main/java/com/king/base/adapter/divider/DividerGridItemDecoration.java +++ b/base-adapter/src/main/java/com/king/base/adapter/divider/DividerGridItemDecoration.java @@ -5,15 +5,16 @@ import android.graphics.Canvas; import android.graphics.Rect; import android.graphics.drawable.Drawable; -import android.support.annotation.DrawableRes; -import android.support.v4.content.ContextCompat; -import android.support.v7.widget.GridLayoutManager; -import android.support.v7.widget.RecyclerView; -import android.support.v7.widget.RecyclerView.LayoutManager; -import android.support.v7.widget.RecyclerView.State; -import android.support.v7.widget.StaggeredGridLayoutManager; import android.view.View; +import androidx.annotation.DrawableRes; +import androidx.core.content.ContextCompat; +import androidx.recyclerview.widget.GridLayoutManager; +import androidx.recyclerview.widget.RecyclerView; +import androidx.recyclerview.widget.RecyclerView.LayoutManager; +import androidx.recyclerview.widget.RecyclerView.State; +import androidx.recyclerview.widget.StaggeredGridLayoutManager; + /** * @author Jenly Jenly */ diff --git a/base-adapter/src/main/java/com/king/base/adapter/divider/DividerItemDecoration.java b/base-adapter/src/main/java/com/king/base/adapter/divider/DividerItemDecoration.java index b2a3fc9..9ce1dc1 100644 --- a/base-adapter/src/main/java/com/king/base/adapter/divider/DividerItemDecoration.java +++ b/base-adapter/src/main/java/com/king/base/adapter/divider/DividerItemDecoration.java @@ -6,14 +6,15 @@ import android.graphics.Canvas; import android.graphics.Rect; import android.graphics.drawable.Drawable; -import android.support.annotation.DrawableRes; -import android.support.annotation.NonNull; -import android.support.v4.content.ContextCompat; -import android.support.v4.view.ViewCompat; -import android.support.v7.widget.LinearLayoutManager; -import android.support.v7.widget.RecyclerView; import android.view.View; +import androidx.annotation.DrawableRes; +import androidx.annotation.NonNull; +import androidx.core.content.ContextCompat; +import androidx.core.view.ViewCompat; +import androidx.recyclerview.widget.LinearLayoutManager; +import androidx.recyclerview.widget.RecyclerView; + /** * @author Jenly */ diff --git a/base-adapter/src/main/java/com/king/base/adapter/holder/ViewHolder.java b/base-adapter/src/main/java/com/king/base/adapter/holder/ViewHolder.java index 156ac37..9d1d6a6 100644 --- a/base-adapter/src/main/java/com/king/base/adapter/holder/ViewHolder.java +++ b/base-adapter/src/main/java/com/king/base/adapter/holder/ViewHolder.java @@ -23,9 +23,6 @@ import android.graphics.Typeface; import android.graphics.drawable.Drawable; import android.os.Build; -import android.support.annotation.IdRes; -import android.support.annotation.StringRes; -import android.support.v7.widget.RecyclerView; import android.text.util.Linkify; import android.util.SparseArray; import android.view.View; @@ -41,6 +38,10 @@ import java.util.LinkedHashSet; import java.util.regex.Pattern; +import androidx.annotation.IdRes; +import androidx.annotation.StringRes; +import androidx.recyclerview.widget.RecyclerView; + /** * 通用的ViewHolder diff --git a/base-util/build.gradle b/base-util/build.gradle index ba1bca1..e96b96c 100644 --- a/base-util/build.gradle +++ b/base-util/build.gradle @@ -11,7 +11,7 @@ android { versionCode app_version.versionCode versionName app_version.baseUtil - testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" + testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" } buildTypes { diff --git a/base-util/src/androidTest/java/com/king/base/util/ExampleInstrumentedTest.java b/base-util/src/androidTest/java/com/king/base/util/ExampleInstrumentedTest.java index 8c32527..7d73699 100644 --- a/base-util/src/androidTest/java/com/king/base/util/ExampleInstrumentedTest.java +++ b/base-util/src/androidTest/java/com/king/base/util/ExampleInstrumentedTest.java @@ -1,12 +1,13 @@ package com.king.base.util; import android.content.Context; -import android.support.test.InstrumentationRegistry; -import android.support.test.runner.AndroidJUnit4; import org.junit.Test; import org.junit.runner.RunWith; +import androidx.test.InstrumentationRegistry; +import androidx.test.runner.AndroidJUnit4; + import static org.junit.Assert.*; /** diff --git a/base-util/src/main/java/com/king/base/util/SystemUtils.java b/base-util/src/main/java/com/king/base/util/SystemUtils.java index a45841c..74a8d5b 100644 --- a/base-util/src/main/java/com/king/base/util/SystemUtils.java +++ b/base-util/src/main/java/com/king/base/util/SystemUtils.java @@ -30,11 +30,6 @@ import android.os.Build; import android.provider.MediaStore; import android.provider.Settings; -import android.support.annotation.NonNull; -import android.support.v4.app.ActivityCompat; -import android.support.v4.app.Fragment; -import android.support.v4.content.ContextCompat; -import android.support.v4.content.FileProvider; import android.telephony.SmsManager; import android.telephony.TelephonyManager; import android.text.TextUtils; @@ -46,6 +41,12 @@ import java.util.List; import java.util.Locale; +import androidx.annotation.NonNull; +import androidx.core.app.ActivityCompat; +import androidx.core.content.ContextCompat; +import androidx.core.content.FileProvider; +import androidx.fragment.app.Fragment; + /** * @author Jenly Jenly */ diff --git a/base-util/src/main/java/com/king/base/util/UriUtils.java b/base-util/src/main/java/com/king/base/util/UriUtils.java index 8825c64..121433e 100644 --- a/base-util/src/main/java/com/king/base/util/UriUtils.java +++ b/base-util/src/main/java/com/king/base/util/UriUtils.java @@ -7,7 +7,8 @@ import android.os.Build; import android.provider.DocumentsContract; import android.provider.MediaStore; -import android.support.annotation.RequiresApi; + +import androidx.annotation.RequiresApi; /** * @author Jenly Jenly diff --git a/base/build.gradle b/base/build.gradle index 9a0d0af..fa44de3 100644 --- a/base/build.gradle +++ b/base/build.gradle @@ -11,7 +11,7 @@ android { versionCode app_version.versionCode versionName app_version.base - testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" + testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" } buildTypes { diff --git a/base/src/androidTest/java/com/king/base/ExampleInstrumentedTest.java b/base/src/androidTest/java/com/king/base/ExampleInstrumentedTest.java index 7e8a296..eeb89a9 100644 --- a/base/src/androidTest/java/com/king/base/ExampleInstrumentedTest.java +++ b/base/src/androidTest/java/com/king/base/ExampleInstrumentedTest.java @@ -1,12 +1,13 @@ package com.king.base; import android.content.Context; -import android.support.test.InstrumentationRegistry; -import android.support.test.runner.AndroidJUnit4; import org.junit.Test; import org.junit.runner.RunWith; +import androidx.test.InstrumentationRegistry; +import androidx.test.runner.AndroidJUnit4; + import static org.junit.Assert.*; /** diff --git a/base/src/main/java/com/king/base/BaseActivity.java b/base/src/main/java/com/king/base/BaseActivity.java index eeaae5e..f69d450 100644 --- a/base/src/main/java/com/king/base/BaseActivity.java +++ b/base/src/main/java/com/king/base/BaseActivity.java @@ -22,15 +22,6 @@ import android.content.DialogInterface; import android.content.Intent; import android.os.Bundle; -import android.support.annotation.IdRes; -import android.support.annotation.LayoutRes; -import android.support.annotation.Nullable; -import android.support.annotation.StringRes; -import android.support.annotation.StyleRes; -import android.support.v4.app.DialogFragment; -import android.support.v4.app.Fragment; -import android.support.v4.app.FragmentTransaction; -import android.support.v7.app.AppCompatActivity; import android.util.DisplayMetrics; import android.view.KeyEvent; import android.view.LayoutInflater; @@ -48,6 +39,16 @@ import com.king.base.util.SystemUtils; import com.king.base.util.ToastUtils; +import androidx.annotation.IdRes; +import androidx.annotation.LayoutRes; +import androidx.annotation.Nullable; +import androidx.annotation.StringRes; +import androidx.annotation.StyleRes; +import androidx.appcompat.app.AppCompatActivity; +import androidx.fragment.app.DialogFragment; +import androidx.fragment.app.Fragment; +import androidx.fragment.app.FragmentTransaction; + /** * @author Jenly */ @@ -161,7 +162,7 @@ protected void startActivityFinish(Class cls,int flags){ //----------------------------------- - public void replaceFragment(@IdRes int resId,Fragment fragment){ + public void replaceFragment(@IdRes int resId, Fragment fragment){ replaceFragment(resId,fragment,false); } @@ -176,7 +177,7 @@ public void replaceFragment(@IdRes int resId, Fragment fragment, boolean isBackS //----------------------------------- - protected void showToast(@StringRes int resId){ + protected void showToast(@StringRes int resId){ if(resId != Constants.NONE) ToastUtils.showToast(getContext(),resId); } diff --git a/base/src/main/java/com/king/base/BaseDialogFragment.java b/base/src/main/java/com/king/base/BaseDialogFragment.java index e34d144..8e34b8d 100644 --- a/base/src/main/java/com/king/base/BaseDialogFragment.java +++ b/base/src/main/java/com/king/base/BaseDialogFragment.java @@ -22,14 +22,6 @@ import android.graphics.Color; import android.graphics.drawable.ColorDrawable; import android.os.Bundle; -import android.support.annotation.IdRes; -import android.support.annotation.LayoutRes; -import android.support.annotation.Nullable; -import android.support.annotation.StringRes; -import android.support.v4.app.DialogFragment; -import android.support.v4.app.Fragment; -import android.support.v4.app.FragmentManager; -import android.support.v4.app.FragmentTransaction; import android.util.DisplayMetrics; import android.view.LayoutInflater; import android.view.View; @@ -45,6 +37,15 @@ import com.king.base.util.SystemUtils; import com.king.base.util.ToastUtils; +import androidx.annotation.IdRes; +import androidx.annotation.LayoutRes; +import androidx.annotation.Nullable; +import androidx.annotation.StringRes; +import androidx.fragment.app.DialogFragment; +import androidx.fragment.app.Fragment; +import androidx.fragment.app.FragmentManager; +import androidx.fragment.app.FragmentTransaction; + /** * @author Jenly */ @@ -193,7 +194,7 @@ public void replaceFragment(FragmentManager fragmentManager, @IdRes int resId, F //----------------------------------- - protected void showToast(@StringRes int resId){ + protected void showToast(@StringRes int resId){ if(resId != Constants.NONE) ToastUtils.showToast(context,resId); } diff --git a/base/src/main/java/com/king/base/BaseFragment.java b/base/src/main/java/com/king/base/BaseFragment.java index ddb325a..398f592 100644 --- a/base/src/main/java/com/king/base/BaseFragment.java +++ b/base/src/main/java/com/king/base/BaseFragment.java @@ -21,15 +21,6 @@ import android.content.DialogInterface; import android.content.Intent; import android.os.Bundle; -import android.support.annotation.IdRes; -import android.support.annotation.LayoutRes; -import android.support.annotation.Nullable; -import android.support.annotation.StringRes; -import android.support.annotation.StyleRes; -import android.support.v4.app.DialogFragment; -import android.support.v4.app.Fragment; -import android.support.v4.app.FragmentManager; -import android.support.v4.app.FragmentTransaction; import android.util.DisplayMetrics; import android.view.KeyEvent; import android.view.LayoutInflater; @@ -46,6 +37,16 @@ import com.king.base.util.SystemUtils; import com.king.base.util.ToastUtils; +import androidx.annotation.IdRes; +import androidx.annotation.LayoutRes; +import androidx.annotation.Nullable; +import androidx.annotation.StringRes; +import androidx.annotation.StyleRes; +import androidx.fragment.app.DialogFragment; +import androidx.fragment.app.Fragment; +import androidx.fragment.app.FragmentManager; +import androidx.fragment.app.FragmentTransaction; + /** * @author Jenly */ @@ -218,7 +219,7 @@ public void replaceFragment(FragmentManager fragmentManager, @IdRes int resId, F //----------------------------------- - protected void showToast(@StringRes int resId){ + protected void showToast(@StringRes int resId){ if(resId != Constants.NONE) ToastUtils.showToast(context,resId); } diff --git a/base/src/main/java/com/king/base/BaseProgressDialog.java b/base/src/main/java/com/king/base/BaseProgressDialog.java index 10e956e..6c976bc 100644 --- a/base/src/main/java/com/king/base/BaseProgressDialog.java +++ b/base/src/main/java/com/king/base/BaseProgressDialog.java @@ -18,11 +18,12 @@ import android.app.Dialog; import android.content.Context; import android.content.DialogInterface; -import android.support.annotation.NonNull; import android.view.Gravity; import android.view.View; import android.widget.ProgressBar; +import androidx.annotation.NonNull; + /** * @author Jenly */ diff --git a/base/src/main/java/com/king/base/ContentActivity.java b/base/src/main/java/com/king/base/ContentActivity.java index d1db957..957f364 100644 --- a/base/src/main/java/com/king/base/ContentActivity.java +++ b/base/src/main/java/com/king/base/ContentActivity.java @@ -18,12 +18,13 @@ import android.content.Intent; import android.os.Bundle; -import android.support.annotation.IdRes; -import android.support.annotation.Nullable; -import android.support.v4.app.Fragment; -import android.support.v7.app.AppCompatActivity; import android.view.View; +import androidx.annotation.IdRes; +import androidx.annotation.Nullable; +import androidx.appcompat.app.AppCompatActivity; +import androidx.fragment.app.Fragment; + /** * @author Jenly */ diff --git a/base/src/main/java/com/king/base/SplashActivity.java b/base/src/main/java/com/king/base/SplashActivity.java index e04bc97..0c16f3e 100644 --- a/base/src/main/java/com/king/base/SplashActivity.java +++ b/base/src/main/java/com/king/base/SplashActivity.java @@ -16,17 +16,19 @@ */ package com.king.base; -import android.support.annotation.LayoutRes; import android.view.View; import android.view.animation.Animation; import android.view.animation.AnimationUtils; +import androidx.annotation.LayoutRes; + /** * @author Jenly */ public abstract class SplashActivity extends BaseActivity { - public abstract @LayoutRes int getContentViewId(); + public abstract @LayoutRes + int getContentViewId(); public abstract Animation.AnimationListener getAnimationListener(); diff --git a/versions.gradle b/versions.gradle index 5a322bc..076ba6a 100644 --- a/versions.gradle +++ b/versions.gradle @@ -1,7 +1,7 @@ //App def app_version = [:] -app_version.versionCode = 11 -app_version.versionName = "3.2.1" +app_version.versionCode = 12 +app_version.versionName = "3.2.1-androidx" ext.app_version = app_version //build version @@ -17,33 +17,32 @@ ext.deps = [:] // App dependencies def versions = [:] //support -versions.supportLibrary = "28.0.0" +versions.supportLibrary = "1.0.0+" versions.constraintLayout = "1.1.3" //test -versions.junit = "4.12" -versions.runner = "1.0.2" -versions.espresso = "3.0.2" +versions.junit = "1.1.0" +versions.test = "1.2.0" +versions.runner = "1.2.0" +versions.espresso = "3.2.0" //support def support = [:] -support.design = "com.android.support:design:$versions.supportLibrary" -support.appcompat = "com.android.support:appcompat-v7:$versions.supportLibrary" -support.recyclerview = "com.android.support:recyclerview-v7:$versions.supportLibrary" -support.constraintlayout = "com.android.support.constraint:constraint-layout:$versions.constraintLayout" +support.design = "com.google.android.material:material:$versions.supportLibrary" +support.appcompat = "androidx.appcompat:appcompat:$versions.supportLibrary" +support.recyclerview = "androidx.recyclerview:recyclerview:$versions.supportLibrary" +support.constraintlayout = "androidx.constraintlayout:constraintlayout:$versions.constraintLayout" deps.support = support //test def test = [:] -test.junit = "junit:junit:$versions.junit" -test.runner = "com.android.support.test:runner:$versions.runner" -test.espresso = "com.android.support.test.espresso:espresso-core:$versions.espresso" +test.junit = "androidx.test.ext:junit:$versions.junit" +test.test = "androidx.test:core:$versions.test" +test.runner = "androidx.test:runner:$versions.runner" +test.espresso = "androidx.test.espresso:espresso-core:$versions.espresso" deps.test = test -//superswiperefreshlayout -deps.superswiperefreshlayout = "com.king.view:superswiperefreshlayout:1.1.0" - ext.deps = deps def addRepos(RepositoryHandler handler) {