diff --git a/app/build.gradle b/app/build.gradle index 4c371cbb..ed4eed5b 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -8,7 +8,6 @@ android { targetSdkVersion rootProject.ext.android.targetSdkVersion versionCode rootProject.ext.android.versionCode versionName rootProject.ext.android.versionName - testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" } buildTypes { release { @@ -39,6 +38,6 @@ dependencies { implementation project(':mvvmhabit') // implementation rootProject.ext.dependencies.MVVMHabit //内存泄漏测试 - debugImplementation 'com.squareup.leakcanary:leakcanary-android:1.6.2' - debugImplementation 'com.squareup.leakcanary:leakcanary-support-fragment:1.6.2' + debugImplementation 'com.squareup.leakcanary:leakcanary-android:1.6.3' + debugImplementation 'com.squareup.leakcanary:leakcanary-support-fragment:1.6.3' } diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index f717cdda..70c160aa 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -1,9 +1,9 @@ + package="com.goldze.mvvmhabit"> - + @@ -11,13 +11,14 @@ + android:name=".app.AppApplication" + android:allowBackup="true" + android:icon="@mipmap/ic_launcher" + android:label="@string/app_name" + android:networkSecurityConfig="@xml/network_security_config" + android:roundIcon="@mipmap/ic_launcher_round" + android:supportsRtl="true" + android:theme="@style/AppTheme"> diff --git a/app/src/main/java/com/goldze/mvvmhabit/app/AppViewModelFactory.java b/app/src/main/java/com/goldze/mvvmhabit/app/AppViewModelFactory.java index 01cdf05f..e59ed8fb 100644 --- a/app/src/main/java/com/goldze/mvvmhabit/app/AppViewModelFactory.java +++ b/app/src/main/java/com/goldze/mvvmhabit/app/AppViewModelFactory.java @@ -2,15 +2,16 @@ import android.annotation.SuppressLint; import android.app.Application; -import android.arch.lifecycle.ViewModel; -import android.arch.lifecycle.ViewModelProvider; -import android.support.annotation.NonNull; -import android.support.annotation.VisibleForTesting; import com.goldze.mvvmhabit.data.DemoRepository; import com.goldze.mvvmhabit.ui.login.LoginViewModel; import com.goldze.mvvmhabit.ui.network.NetWorkViewModel; +import androidx.annotation.NonNull; +import androidx.annotation.VisibleForTesting; +import androidx.lifecycle.ViewModel; +import androidx.lifecycle.ViewModelProvider; + /** * Created by goldze on 2019/3/26. */ diff --git a/app/src/main/java/com/goldze/mvvmhabit/binding/twinklingrefreshlayout/ViewAdapter.java b/app/src/main/java/com/goldze/mvvmhabit/binding/twinklingrefreshlayout/ViewAdapter.java index 1351122c..fa28a221 100644 --- a/app/src/main/java/com/goldze/mvvmhabit/binding/twinklingrefreshlayout/ViewAdapter.java +++ b/app/src/main/java/com/goldze/mvvmhabit/binding/twinklingrefreshlayout/ViewAdapter.java @@ -1,11 +1,9 @@ package com.goldze.mvvmhabit.binding.twinklingrefreshlayout; - -import android.databinding.BindingAdapter; - import com.lcodecore.tkrefreshlayout.RefreshListenerAdapter; import com.lcodecore.tkrefreshlayout.TwinklingRefreshLayout; +import androidx.databinding.BindingAdapter; import me.goldze.mvvmhabit.binding.command.BindingCommand; diff --git a/app/src/main/java/com/goldze/mvvmhabit/data/DemoRepository.java b/app/src/main/java/com/goldze/mvvmhabit/data/DemoRepository.java index 98d6970b..b0f25a8d 100644 --- a/app/src/main/java/com/goldze/mvvmhabit/data/DemoRepository.java +++ b/app/src/main/java/com/goldze/mvvmhabit/data/DemoRepository.java @@ -1,12 +1,11 @@ package com.goldze.mvvmhabit.data; -import android.support.annotation.NonNull; -import android.support.annotation.VisibleForTesting; - import com.goldze.mvvmhabit.data.source.HttpDataSource; import com.goldze.mvvmhabit.data.source.LocalDataSource; import com.goldze.mvvmhabit.entity.DemoEntity; +import androidx.annotation.NonNull; +import androidx.annotation.VisibleForTesting; import io.reactivex.Observable; import me.goldze.mvvmhabit.base.BaseModel; import me.goldze.mvvmhabit.http.BaseResponse; diff --git a/app/src/main/java/com/goldze/mvvmhabit/data/source/local/LocalDataSourceImpl.java b/app/src/main/java/com/goldze/mvvmhabit/data/source/local/LocalDataSourceImpl.java index a306b78c..2037e1ef 100644 --- a/app/src/main/java/com/goldze/mvvmhabit/data/source/local/LocalDataSourceImpl.java +++ b/app/src/main/java/com/goldze/mvvmhabit/data/source/local/LocalDataSourceImpl.java @@ -1,7 +1,6 @@ package com.goldze.mvvmhabit.data.source.local; import com.goldze.mvvmhabit.data.source.LocalDataSource; -import com.goldze.mvvmhabit.data.source.http.service.DemoApiService; import me.goldze.mvvmhabit.utils.SPUtils; diff --git a/app/src/main/java/com/goldze/mvvmhabit/entity/FormEntity.java b/app/src/main/java/com/goldze/mvvmhabit/entity/FormEntity.java index 7ac53432..70a9fb21 100644 --- a/app/src/main/java/com/goldze/mvvmhabit/entity/FormEntity.java +++ b/app/src/main/java/com/goldze/mvvmhabit/entity/FormEntity.java @@ -1,9 +1,10 @@ package com.goldze.mvvmhabit.entity; -import android.databinding.BaseObservable; import android.os.Parcel; import android.os.Parcelable; +import androidx.databinding.BaseObservable; + /** * Created by goldze on 2017/7/17. */ diff --git a/app/src/main/java/com/goldze/mvvmhabit/ui/base/adapter/BaseFragmentPagerAdapter.java b/app/src/main/java/com/goldze/mvvmhabit/ui/base/adapter/BaseFragmentPagerAdapter.java index 132e074d..2ee0da05 100644 --- a/app/src/main/java/com/goldze/mvvmhabit/ui/base/adapter/BaseFragmentPagerAdapter.java +++ b/app/src/main/java/com/goldze/mvvmhabit/ui/base/adapter/BaseFragmentPagerAdapter.java @@ -1,11 +1,11 @@ package com.goldze.mvvmhabit.ui.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; + /** * Created by goldze on 2017/7/17. * FragmentPager适配器 diff --git a/app/src/main/java/com/goldze/mvvmhabit/ui/base/fragment/BasePagerFragment.java b/app/src/main/java/com/goldze/mvvmhabit/ui/base/fragment/BasePagerFragment.java index beac1847..ee4a631d 100644 --- a/app/src/main/java/com/goldze/mvvmhabit/ui/base/fragment/BasePagerFragment.java +++ b/app/src/main/java/com/goldze/mvvmhabit/ui/base/fragment/BasePagerFragment.java @@ -1,20 +1,19 @@ package com.goldze.mvvmhabit.ui.base.fragment; - import android.os.Bundle; -import android.support.annotation.Nullable; -import android.support.design.widget.TabLayout; -import android.support.v4.app.Fragment; import android.view.LayoutInflater; import android.view.ViewGroup; -import com.goldze.mvvmhabit.R; import com.goldze.mvvmhabit.BR; +import com.goldze.mvvmhabit.R; import com.goldze.mvvmhabit.databinding.FragmentBasePagerBinding; import com.goldze.mvvmhabit.ui.base.adapter.BaseFragmentPagerAdapter; +import com.google.android.material.tabs.TabLayout; import java.util.List; +import androidx.annotation.Nullable; +import androidx.fragment.app.Fragment; import me.goldze.mvvmhabit.base.BaseFragment; import me.goldze.mvvmhabit.base.BaseViewModel; diff --git a/app/src/main/java/com/goldze/mvvmhabit/ui/base/viewmodel/ToolbarViewModel.java b/app/src/main/java/com/goldze/mvvmhabit/ui/base/viewmodel/ToolbarViewModel.java index a9c02f68..681be4e5 100644 --- a/app/src/main/java/com/goldze/mvvmhabit/ui/base/viewmodel/ToolbarViewModel.java +++ b/app/src/main/java/com/goldze/mvvmhabit/ui/base/viewmodel/ToolbarViewModel.java @@ -1,11 +1,11 @@ package com.goldze.mvvmhabit.ui.base.viewmodel; import android.app.Application; -import android.databinding.ObservableField; -import android.databinding.ObservableInt; -import android.support.annotation.NonNull; import android.view.View; +import androidx.annotation.NonNull; +import androidx.databinding.ObservableField; +import androidx.databinding.ObservableInt; import me.goldze.mvvmhabit.base.BaseModel; import me.goldze.mvvmhabit.base.BaseViewModel; import me.goldze.mvvmhabit.binding.command.BindingAction; diff --git a/app/src/main/java/com/goldze/mvvmhabit/ui/form/FormFragment.java b/app/src/main/java/com/goldze/mvvmhabit/ui/form/FormFragment.java index 8de8b15d..f1be9df1 100644 --- a/app/src/main/java/com/goldze/mvvmhabit/ui/form/FormFragment.java +++ b/app/src/main/java/com/goldze/mvvmhabit/ui/form/FormFragment.java @@ -1,11 +1,7 @@ package com.goldze.mvvmhabit.ui.form; import android.app.DatePickerDialog; -import android.arch.lifecycle.Observer; -import android.databinding.Observable; import android.os.Bundle; -import android.support.annotation.Nullable; -import android.support.v7.app.AppCompatActivity; import android.view.LayoutInflater; import android.view.ViewGroup; import android.widget.DatePicker; @@ -17,6 +13,10 @@ import java.util.Calendar; +import androidx.annotation.Nullable; +import androidx.appcompat.app.AppCompatActivity; +import androidx.databinding.Observable; +import androidx.lifecycle.Observer; import me.goldze.mvvmhabit.base.BaseFragment; import me.goldze.mvvmhabit.utils.MaterialDialogUtils; diff --git a/app/src/main/java/com/goldze/mvvmhabit/ui/form/FormViewModel.java b/app/src/main/java/com/goldze/mvvmhabit/ui/form/FormViewModel.java index 0f22bcaa..326d9270 100644 --- a/app/src/main/java/com/goldze/mvvmhabit/ui/form/FormViewModel.java +++ b/app/src/main/java/com/goldze/mvvmhabit/ui/form/FormViewModel.java @@ -1,8 +1,6 @@ package com.goldze.mvvmhabit.ui.form; import android.app.Application; -import android.databinding.ObservableBoolean; -import android.support.annotation.NonNull; import android.text.TextUtils; import android.view.View; @@ -14,6 +12,8 @@ import java.util.ArrayList; import java.util.List; +import androidx.annotation.NonNull; +import androidx.databinding.ObservableBoolean; import me.goldze.mvvmhabit.binding.command.BindingAction; import me.goldze.mvvmhabit.binding.command.BindingCommand; import me.goldze.mvvmhabit.binding.command.BindingConsumer; diff --git a/app/src/main/java/com/goldze/mvvmhabit/ui/login/LoginActivity.java b/app/src/main/java/com/goldze/mvvmhabit/ui/login/LoginActivity.java index 79d96bec..47b68009 100644 --- a/app/src/main/java/com/goldze/mvvmhabit/ui/login/LoginActivity.java +++ b/app/src/main/java/com/goldze/mvvmhabit/ui/login/LoginActivity.java @@ -1,9 +1,6 @@ package com.goldze.mvvmhabit.ui.login; -import android.arch.lifecycle.Observer; -import android.arch.lifecycle.ViewModelProviders; import android.os.Bundle; -import android.support.annotation.Nullable; import android.text.method.HideReturnsTransformationMethod; import android.text.method.PasswordTransformationMethod; @@ -12,6 +9,9 @@ import com.goldze.mvvmhabit.app.AppViewModelFactory; import com.goldze.mvvmhabit.databinding.ActivityLoginBinding; +import androidx.annotation.Nullable; +import androidx.lifecycle.Observer; +import androidx.lifecycle.ViewModelProviders; import me.goldze.mvvmhabit.base.BaseActivity; /** diff --git a/app/src/main/java/com/goldze/mvvmhabit/ui/login/LoginViewModel.java b/app/src/main/java/com/goldze/mvvmhabit/ui/login/LoginViewModel.java index 8b80d2a7..a377c6fc 100644 --- a/app/src/main/java/com/goldze/mvvmhabit/ui/login/LoginViewModel.java +++ b/app/src/main/java/com/goldze/mvvmhabit/ui/login/LoginViewModel.java @@ -1,15 +1,15 @@ package com.goldze.mvvmhabit.ui.login; import android.app.Application; -import android.databinding.ObservableField; -import android.databinding.ObservableInt; -import android.support.annotation.NonNull; import android.text.TextUtils; import android.view.View; import com.goldze.mvvmhabit.data.DemoRepository; import com.goldze.mvvmhabit.ui.main.DemoActivity; +import androidx.annotation.NonNull; +import androidx.databinding.ObservableField; +import androidx.databinding.ObservableInt; import io.reactivex.disposables.Disposable; import io.reactivex.functions.Consumer; import me.goldze.mvvmhabit.base.BaseViewModel; diff --git a/app/src/main/java/com/goldze/mvvmhabit/ui/main/DemoActivity.java b/app/src/main/java/com/goldze/mvvmhabit/ui/main/DemoActivity.java index 68dc0dbb..41a38328 100644 --- a/app/src/main/java/com/goldze/mvvmhabit/ui/main/DemoActivity.java +++ b/app/src/main/java/com/goldze/mvvmhabit/ui/main/DemoActivity.java @@ -2,23 +2,20 @@ import android.Manifest; import android.app.ProgressDialog; -import android.arch.lifecycle.Observer; -import android.content.Context; import android.content.pm.ActivityInfo; -import android.databinding.Observable; import android.os.Bundle; -import android.support.annotation.Nullable; import com.goldze.mvvmhabit.BR; import com.goldze.mvvmhabit.R; import com.goldze.mvvmhabit.databinding.ActivityDemoBinding; import com.tbruyelle.rxpermissions2.RxPermissions; +import androidx.annotation.Nullable; +import androidx.lifecycle.Observer; import io.reactivex.functions.Consumer; import me.goldze.mvvmhabit.base.BaseActivity; import me.goldze.mvvmhabit.http.DownLoadManager; import me.goldze.mvvmhabit.http.download.ProgressCallBack; -import me.goldze.mvvmhabit.utils.KLog; import me.goldze.mvvmhabit.utils.ToastUtils; import okhttp3.ResponseBody; diff --git a/app/src/main/java/com/goldze/mvvmhabit/ui/main/DemoViewModel.java b/app/src/main/java/com/goldze/mvvmhabit/ui/main/DemoViewModel.java index 8e102bb7..7983c86f 100644 --- a/app/src/main/java/com/goldze/mvvmhabit/ui/main/DemoViewModel.java +++ b/app/src/main/java/com/goldze/mvvmhabit/ui/main/DemoViewModel.java @@ -1,10 +1,7 @@ package com.goldze.mvvmhabit.ui.main; import android.app.Application; -import android.arch.lifecycle.MutableLiveData; -import android.databinding.ObservableBoolean; import android.os.Bundle; -import android.support.annotation.NonNull; import com.goldze.mvvmhabit.entity.FormEntity; import com.goldze.mvvmhabit.ui.form.FormFragment; @@ -14,6 +11,7 @@ import com.goldze.mvvmhabit.ui.viewpager.activity.ViewPagerActivity; import com.goldze.mvvmhabit.ui.vp_frg.ViewPagerGroupFragment; +import androidx.annotation.NonNull; import me.goldze.mvvmhabit.base.BaseViewModel; import me.goldze.mvvmhabit.binding.command.BindingAction; import me.goldze.mvvmhabit.binding.command.BindingCommand; @@ -112,7 +110,7 @@ public void call() { public BindingCommand fileDownLoadClick = new BindingCommand(new BindingAction() { @Override public void call() { - loadUrlEvent.setValue("http://gdown.baidu.com/data/wisegame/a2cd8828b227b9f9/neihanduanzi_692.apk"); + loadUrlEvent.setValue("http://gdown.baidu.com/data/wisegame/dc8a46540c7960a2/baidushoujizhushou_16798087.apk"); } }); } diff --git a/app/src/main/java/com/goldze/mvvmhabit/ui/network/NetWorkFragment.java b/app/src/main/java/com/goldze/mvvmhabit/ui/network/NetWorkFragment.java index f4ec0dd8..28cad3f6 100644 --- a/app/src/main/java/com/goldze/mvvmhabit/ui/network/NetWorkFragment.java +++ b/app/src/main/java/com/goldze/mvvmhabit/ui/network/NetWorkFragment.java @@ -1,11 +1,7 @@ package com.goldze.mvvmhabit.ui.network; -import android.arch.lifecycle.Observer; -import android.arch.lifecycle.ViewModelProviders; import android.content.pm.ActivityInfo; import android.os.Bundle; -import android.support.annotation.NonNull; -import android.support.annotation.Nullable; import android.view.LayoutInflater; import android.view.ViewGroup; @@ -16,6 +12,10 @@ import com.goldze.mvvmhabit.app.AppViewModelFactory; import com.goldze.mvvmhabit.databinding.FragmentNetworkBinding; +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; +import androidx.lifecycle.Observer; +import androidx.lifecycle.ViewModelProviders; import me.goldze.mvvmhabit.base.BaseFragment; import me.goldze.mvvmhabit.utils.MaterialDialogUtils; import me.goldze.mvvmhabit.utils.ToastUtils; @@ -52,9 +52,6 @@ public NetWorkViewModel initViewModel() { @Override public void initData() { - //给RecyclerView添加Adpter,请使用自定义的Adapter继承BindingRecyclerViewAdapter,重写onBindBinding方法,里面有你要的Item对应的binding对象。 - // Adapter属于View层的东西, 不建议定义到ViewModel中绑定,以免内存泄漏 - binding.setAdapter(new BindingRecyclerViewAdapter()); //请求网络数据 viewModel.requestNetWork(); } diff --git a/app/src/main/java/com/goldze/mvvmhabit/ui/network/NetWorkItemViewModel.java b/app/src/main/java/com/goldze/mvvmhabit/ui/network/NetWorkItemViewModel.java index 02928165..140b05e3 100644 --- a/app/src/main/java/com/goldze/mvvmhabit/ui/network/NetWorkItemViewModel.java +++ b/app/src/main/java/com/goldze/mvvmhabit/ui/network/NetWorkItemViewModel.java @@ -1,15 +1,15 @@ package com.goldze.mvvmhabit.ui.network; -import android.databinding.ObservableField; import android.graphics.drawable.Drawable; import android.os.Bundle; -import android.support.annotation.NonNull; -import android.support.v4.content.ContextCompat; import com.goldze.mvvmhabit.R; import com.goldze.mvvmhabit.entity.DemoEntity; import com.goldze.mvvmhabit.ui.network.detail.DetailFragment; +import androidx.annotation.NonNull; +import androidx.core.content.ContextCompat; +import androidx.databinding.ObservableField; import me.goldze.mvvmhabit.base.ItemViewModel; import me.goldze.mvvmhabit.binding.command.BindingAction; import me.goldze.mvvmhabit.binding.command.BindingCommand; diff --git a/app/src/main/java/com/goldze/mvvmhabit/ui/network/NetWorkViewModel.java b/app/src/main/java/com/goldze/mvvmhabit/ui/network/NetWorkViewModel.java index 1e4ae632..99de1c95 100644 --- a/app/src/main/java/com/goldze/mvvmhabit/ui/network/NetWorkViewModel.java +++ b/app/src/main/java/com/goldze/mvvmhabit/ui/network/NetWorkViewModel.java @@ -1,15 +1,15 @@ package com.goldze.mvvmhabit.ui.network; import android.app.Application; -import android.databinding.ObservableArrayList; -import android.databinding.ObservableList; -import android.support.annotation.NonNull; import com.goldze.mvvmhabit.BR; import com.goldze.mvvmhabit.R; import com.goldze.mvvmhabit.data.DemoRepository; import com.goldze.mvvmhabit.entity.DemoEntity; +import androidx.annotation.NonNull; +import androidx.databinding.ObservableArrayList; +import androidx.databinding.ObservableList; import io.reactivex.disposables.Disposable; import io.reactivex.functions.Action; import io.reactivex.functions.Consumer; diff --git a/app/src/main/java/com/goldze/mvvmhabit/ui/network/detail/DetailViewModel.java b/app/src/main/java/com/goldze/mvvmhabit/ui/network/detail/DetailViewModel.java index 9faf3b22..6dfda5af 100644 --- a/app/src/main/java/com/goldze/mvvmhabit/ui/network/detail/DetailViewModel.java +++ b/app/src/main/java/com/goldze/mvvmhabit/ui/network/detail/DetailViewModel.java @@ -1,11 +1,11 @@ package com.goldze.mvvmhabit.ui.network.detail; import android.app.Application; -import android.databinding.ObservableField; -import android.support.annotation.NonNull; import com.goldze.mvvmhabit.entity.DemoEntity; +import androidx.annotation.NonNull; +import androidx.databinding.ObservableField; import me.goldze.mvvmhabit.base.BaseViewModel; /** diff --git a/app/src/main/java/com/goldze/mvvmhabit/ui/rv_multi/MultiRecycleHeadViewModel.java b/app/src/main/java/com/goldze/mvvmhabit/ui/rv_multi/MultiRecycleHeadViewModel.java index 72b5b705..60543869 100644 --- a/app/src/main/java/com/goldze/mvvmhabit/ui/rv_multi/MultiRecycleHeadViewModel.java +++ b/app/src/main/java/com/goldze/mvvmhabit/ui/rv_multi/MultiRecycleHeadViewModel.java @@ -1,7 +1,6 @@ package com.goldze.mvvmhabit.ui.rv_multi; -import android.support.annotation.NonNull; - +import androidx.annotation.NonNull; import me.goldze.mvvmhabit.base.BaseViewModel; import me.goldze.mvvmhabit.base.MultiItemViewModel; import me.goldze.mvvmhabit.binding.command.BindingAction; diff --git a/app/src/main/java/com/goldze/mvvmhabit/ui/rv_multi/MultiRecycleLeftItemViewModel.java b/app/src/main/java/com/goldze/mvvmhabit/ui/rv_multi/MultiRecycleLeftItemViewModel.java index fb13a855..5ac9e4aa 100644 --- a/app/src/main/java/com/goldze/mvvmhabit/ui/rv_multi/MultiRecycleLeftItemViewModel.java +++ b/app/src/main/java/com/goldze/mvvmhabit/ui/rv_multi/MultiRecycleLeftItemViewModel.java @@ -1,8 +1,7 @@ package com.goldze.mvvmhabit.ui.rv_multi; -import android.databinding.ObservableField; -import android.support.annotation.NonNull; - +import androidx.annotation.NonNull; +import androidx.databinding.ObservableField; import me.goldze.mvvmhabit.base.MultiItemViewModel; import me.goldze.mvvmhabit.binding.command.BindingAction; diff --git a/app/src/main/java/com/goldze/mvvmhabit/ui/rv_multi/MultiRecycleRightItemViewModel.java b/app/src/main/java/com/goldze/mvvmhabit/ui/rv_multi/MultiRecycleRightItemViewModel.java index 4a373f61..66008771 100644 --- a/app/src/main/java/com/goldze/mvvmhabit/ui/rv_multi/MultiRecycleRightItemViewModel.java +++ b/app/src/main/java/com/goldze/mvvmhabit/ui/rv_multi/MultiRecycleRightItemViewModel.java @@ -1,8 +1,7 @@ package com.goldze.mvvmhabit.ui.rv_multi; -import android.databinding.ObservableField; -import android.support.annotation.NonNull; - +import androidx.annotation.NonNull; +import androidx.databinding.ObservableField; import me.goldze.mvvmhabit.base.MultiItemViewModel; import me.goldze.mvvmhabit.binding.command.BindingAction; diff --git a/app/src/main/java/com/goldze/mvvmhabit/ui/rv_multi/MultiRecycleViewFragment.java b/app/src/main/java/com/goldze/mvvmhabit/ui/rv_multi/MultiRecycleViewFragment.java index 09bbc572..87955e6f 100644 --- a/app/src/main/java/com/goldze/mvvmhabit/ui/rv_multi/MultiRecycleViewFragment.java +++ b/app/src/main/java/com/goldze/mvvmhabit/ui/rv_multi/MultiRecycleViewFragment.java @@ -1,7 +1,6 @@ package com.goldze.mvvmhabit.ui.rv_multi; import android.os.Bundle; -import android.support.annotation.Nullable; import android.view.LayoutInflater; import android.view.ViewGroup; @@ -9,6 +8,7 @@ import com.goldze.mvvmhabit.R; import com.goldze.mvvmhabit.databinding.FragmentMultiRvBinding; +import androidx.annotation.Nullable; import me.goldze.mvvmhabit.base.BaseFragment; import me.tatarka.bindingcollectionadapter2.BindingRecyclerViewAdapter; @@ -32,8 +32,5 @@ public int initVariableId() { @Override public void initData() { super.initData(); - //给RecyclerView添加Adpter,请使用自定义的Adapter继承BindingRecyclerViewAdapter,重写onBindBinding方法,里面有你要的Item对应的binding对象。 - // Adapter属于View层的东西, 不建议定义到ViewModel中绑定,以免内存泄漏 - binding.setAdapter(new BindingRecyclerViewAdapter()); } } diff --git a/app/src/main/java/com/goldze/mvvmhabit/ui/rv_multi/MultiRecycleViewModel.java b/app/src/main/java/com/goldze/mvvmhabit/ui/rv_multi/MultiRecycleViewModel.java index a59bbb3e..92e690c2 100644 --- a/app/src/main/java/com/goldze/mvvmhabit/ui/rv_multi/MultiRecycleViewModel.java +++ b/app/src/main/java/com/goldze/mvvmhabit/ui/rv_multi/MultiRecycleViewModel.java @@ -1,16 +1,15 @@ package com.goldze.mvvmhabit.ui.rv_multi; import android.app.Application; -import android.databinding.ObservableArrayList; -import android.databinding.ObservableList; -import android.support.annotation.NonNull; import com.goldze.mvvmhabit.BR; import com.goldze.mvvmhabit.R; +import androidx.annotation.NonNull; +import androidx.databinding.ObservableArrayList; +import androidx.databinding.ObservableList; import me.goldze.mvvmhabit.base.BaseViewModel; import me.goldze.mvvmhabit.base.MultiItemViewModel; -import me.tatarka.bindingcollectionadapter2.BindingRecyclerViewAdapter; import me.tatarka.bindingcollectionadapter2.ItemBinding; import me.tatarka.bindingcollectionadapter2.OnItemBind; diff --git a/app/src/main/java/com/goldze/mvvmhabit/ui/tab_bar/activity/TabBarActivity.java b/app/src/main/java/com/goldze/mvvmhabit/ui/tab_bar/activity/TabBarActivity.java index 76271458..c64e93e0 100644 --- a/app/src/main/java/com/goldze/mvvmhabit/ui/tab_bar/activity/TabBarActivity.java +++ b/app/src/main/java/com/goldze/mvvmhabit/ui/tab_bar/activity/TabBarActivity.java @@ -1,9 +1,6 @@ package com.goldze.mvvmhabit.ui.tab_bar.activity; import android.os.Bundle; -import android.support.v4.app.Fragment; -import android.support.v4.app.FragmentTransaction; -import android.support.v4.content.ContextCompat; import com.goldze.mvvmhabit.BR; import com.goldze.mvvmhabit.R; @@ -16,6 +13,9 @@ import java.util.ArrayList; import java.util.List; +import androidx.core.content.ContextCompat; +import androidx.fragment.app.Fragment; +import androidx.fragment.app.FragmentTransaction; import me.goldze.mvvmhabit.base.BaseActivity; import me.goldze.mvvmhabit.base.BaseViewModel; import me.majiajie.pagerbottomtabstrip.NavigationController; diff --git a/app/src/main/java/com/goldze/mvvmhabit/ui/tab_bar/fragment/TabBar1Fragment.java b/app/src/main/java/com/goldze/mvvmhabit/ui/tab_bar/fragment/TabBar1Fragment.java index 1d279dda..7f053dc6 100644 --- a/app/src/main/java/com/goldze/mvvmhabit/ui/tab_bar/fragment/TabBar1Fragment.java +++ b/app/src/main/java/com/goldze/mvvmhabit/ui/tab_bar/fragment/TabBar1Fragment.java @@ -1,13 +1,13 @@ package com.goldze.mvvmhabit.ui.tab_bar.fragment; import android.os.Bundle; -import android.support.annotation.Nullable; import android.view.LayoutInflater; import android.view.ViewGroup; import com.goldze.mvvmhabit.BR; import com.goldze.mvvmhabit.R; +import androidx.annotation.Nullable; import me.goldze.mvvmhabit.base.BaseFragment; /** diff --git a/app/src/main/java/com/goldze/mvvmhabit/ui/tab_bar/fragment/TabBar2Fragment.java b/app/src/main/java/com/goldze/mvvmhabit/ui/tab_bar/fragment/TabBar2Fragment.java index d94d97a9..681a319d 100644 --- a/app/src/main/java/com/goldze/mvvmhabit/ui/tab_bar/fragment/TabBar2Fragment.java +++ b/app/src/main/java/com/goldze/mvvmhabit/ui/tab_bar/fragment/TabBar2Fragment.java @@ -1,13 +1,13 @@ package com.goldze.mvvmhabit.ui.tab_bar.fragment; import android.os.Bundle; -import android.support.annotation.Nullable; import android.view.LayoutInflater; import android.view.ViewGroup; import com.goldze.mvvmhabit.BR; import com.goldze.mvvmhabit.R; +import androidx.annotation.Nullable; import me.goldze.mvvmhabit.base.BaseFragment; /** diff --git a/app/src/main/java/com/goldze/mvvmhabit/ui/tab_bar/fragment/TabBar3Fragment.java b/app/src/main/java/com/goldze/mvvmhabit/ui/tab_bar/fragment/TabBar3Fragment.java index 83b44077..4636e4f7 100644 --- a/app/src/main/java/com/goldze/mvvmhabit/ui/tab_bar/fragment/TabBar3Fragment.java +++ b/app/src/main/java/com/goldze/mvvmhabit/ui/tab_bar/fragment/TabBar3Fragment.java @@ -1,13 +1,13 @@ package com.goldze.mvvmhabit.ui.tab_bar.fragment; import android.os.Bundle; -import android.support.annotation.Nullable; import android.view.LayoutInflater; import android.view.ViewGroup; import com.goldze.mvvmhabit.BR; import com.goldze.mvvmhabit.R; +import androidx.annotation.Nullable; import me.goldze.mvvmhabit.base.BaseFragment; /** diff --git a/app/src/main/java/com/goldze/mvvmhabit/ui/tab_bar/fragment/TabBar4Fragment.java b/app/src/main/java/com/goldze/mvvmhabit/ui/tab_bar/fragment/TabBar4Fragment.java index e4835eba..67889c57 100644 --- a/app/src/main/java/com/goldze/mvvmhabit/ui/tab_bar/fragment/TabBar4Fragment.java +++ b/app/src/main/java/com/goldze/mvvmhabit/ui/tab_bar/fragment/TabBar4Fragment.java @@ -1,13 +1,13 @@ package com.goldze.mvvmhabit.ui.tab_bar.fragment; import android.os.Bundle; -import android.support.annotation.Nullable; import android.view.LayoutInflater; import android.view.ViewGroup; import com.goldze.mvvmhabit.BR; import com.goldze.mvvmhabit.R; +import androidx.annotation.Nullable; import me.goldze.mvvmhabit.base.BaseFragment; /** diff --git a/app/src/main/java/com/goldze/mvvmhabit/ui/viewpager/activity/ViewPagerActivity.java b/app/src/main/java/com/goldze/mvvmhabit/ui/viewpager/activity/ViewPagerActivity.java index 3d4d5466..0d31775b 100644 --- a/app/src/main/java/com/goldze/mvvmhabit/ui/viewpager/activity/ViewPagerActivity.java +++ b/app/src/main/java/com/goldze/mvvmhabit/ui/viewpager/activity/ViewPagerActivity.java @@ -1,16 +1,16 @@ package com.goldze.mvvmhabit.ui.viewpager.activity; -import android.arch.lifecycle.Observer; import android.os.Bundle; -import android.support.annotation.Nullable; -import android.support.design.widget.TabLayout; import com.goldze.mvvmhabit.BR; import com.goldze.mvvmhabit.R; import com.goldze.mvvmhabit.databinding.FragmentViewpagerBinding; import com.goldze.mvvmhabit.ui.viewpager.adapter.ViewPagerBindingAdapter; import com.goldze.mvvmhabit.ui.viewpager.vm.ViewPagerViewModel; +import com.google.android.material.tabs.TabLayout; +import androidx.annotation.Nullable; +import androidx.lifecycle.Observer; import me.goldze.mvvmhabit.base.BaseActivity; import me.goldze.mvvmhabit.utils.ToastUtils; diff --git a/app/src/main/java/com/goldze/mvvmhabit/ui/viewpager/adapter/ViewPagerBindingAdapter.java b/app/src/main/java/com/goldze/mvvmhabit/ui/viewpager/adapter/ViewPagerBindingAdapter.java index a2b9970c..b492992f 100644 --- a/app/src/main/java/com/goldze/mvvmhabit/ui/viewpager/adapter/ViewPagerBindingAdapter.java +++ b/app/src/main/java/com/goldze/mvvmhabit/ui/viewpager/adapter/ViewPagerBindingAdapter.java @@ -1,11 +1,11 @@ package com.goldze.mvvmhabit.ui.viewpager.adapter; -import android.databinding.ViewDataBinding; import android.view.ViewGroup; import com.goldze.mvvmhabit.databinding.ItemViewpagerBinding; import com.goldze.mvvmhabit.ui.viewpager.vm.ViewPagerItemViewModel; +import androidx.databinding.ViewDataBinding; import me.tatarka.bindingcollectionadapter2.BindingViewPagerAdapter; /** diff --git a/app/src/main/java/com/goldze/mvvmhabit/ui/viewpager/vm/ViewPagerItemViewModel.java b/app/src/main/java/com/goldze/mvvmhabit/ui/viewpager/vm/ViewPagerItemViewModel.java index 1d175ecb..349e48ba 100644 --- a/app/src/main/java/com/goldze/mvvmhabit/ui/viewpager/vm/ViewPagerItemViewModel.java +++ b/app/src/main/java/com/goldze/mvvmhabit/ui/viewpager/vm/ViewPagerItemViewModel.java @@ -1,7 +1,6 @@ package com.goldze.mvvmhabit.ui.viewpager.vm; -import android.support.annotation.NonNull; - +import androidx.annotation.NonNull; import me.goldze.mvvmhabit.base.ItemViewModel; import me.goldze.mvvmhabit.binding.command.BindingAction; import me.goldze.mvvmhabit.binding.command.BindingCommand; diff --git a/app/src/main/java/com/goldze/mvvmhabit/ui/viewpager/vm/ViewPagerViewModel.java b/app/src/main/java/com/goldze/mvvmhabit/ui/viewpager/vm/ViewPagerViewModel.java index 3a50393f..168a916b 100644 --- a/app/src/main/java/com/goldze/mvvmhabit/ui/viewpager/vm/ViewPagerViewModel.java +++ b/app/src/main/java/com/goldze/mvvmhabit/ui/viewpager/vm/ViewPagerViewModel.java @@ -1,14 +1,13 @@ package com.goldze.mvvmhabit.ui.viewpager.vm; import android.app.Application; -import android.databinding.ObservableArrayList; -import android.databinding.ObservableList; -import android.support.annotation.NonNull; import com.goldze.mvvmhabit.BR; import com.goldze.mvvmhabit.R; -import com.goldze.mvvmhabit.ui.viewpager.adapter.ViewPagerBindingAdapter; +import androidx.annotation.NonNull; +import androidx.databinding.ObservableArrayList; +import androidx.databinding.ObservableList; import me.goldze.mvvmhabit.base.BaseViewModel; import me.goldze.mvvmhabit.binding.command.BindingCommand; import me.goldze.mvvmhabit.binding.command.BindingConsumer; diff --git a/app/src/main/java/com/goldze/mvvmhabit/ui/vp_frg/ViewPagerGroupFragment.java b/app/src/main/java/com/goldze/mvvmhabit/ui/vp_frg/ViewPagerGroupFragment.java index bb2783e1..56c2315e 100644 --- a/app/src/main/java/com/goldze/mvvmhabit/ui/vp_frg/ViewPagerGroupFragment.java +++ b/app/src/main/java/com/goldze/mvvmhabit/ui/vp_frg/ViewPagerGroupFragment.java @@ -1,8 +1,5 @@ package com.goldze.mvvmhabit.ui.vp_frg; -import android.support.v4.app.Fragment; - - import com.goldze.mvvmhabit.ui.base.fragment.BasePagerFragment; import com.goldze.mvvmhabit.ui.tab_bar.fragment.TabBar1Fragment; import com.goldze.mvvmhabit.ui.tab_bar.fragment.TabBar2Fragment; @@ -12,6 +9,8 @@ import java.util.ArrayList; import java.util.List; +import androidx.fragment.app.Fragment; + /** * Create Author:goldze * Create Date:2019/01/25 diff --git a/app/src/main/java/com/goldze/mvvmhabit/utils/HttpsUtils.java b/app/src/main/java/com/goldze/mvvmhabit/utils/HttpsUtils.java index ef769645..8c612946 100644 --- a/app/src/main/java/com/goldze/mvvmhabit/utils/HttpsUtils.java +++ b/app/src/main/java/com/goldze/mvvmhabit/utils/HttpsUtils.java @@ -35,9 +35,6 @@ import javax.net.ssl.TrustManagerFactory; import javax.net.ssl.X509TrustManager; -import me.goldze.mvvmhabit.utils.KLog; - - public class HttpsUtils { public static class SSLParams { diff --git a/app/src/main/res/layout/fragment_base_pager.xml b/app/src/main/res/layout/fragment_base_pager.xml index d23670cd..bd9f3fe7 100644 --- a/app/src/main/res/layout/fragment_base_pager.xml +++ b/app/src/main/res/layout/fragment_base_pager.xml @@ -18,7 +18,7 @@ android:background="@color/white" android:orientation="vertical"> - - - - - - - + @@ -26,10 +20,9 @@ android:layout_height="match_parent" android:orientation="vertical"> - - - - - - + @@ -35,10 +29,9 @@ binding:tr_head_height="80dp" binding:tr_wave_height="80dp"> - - + binding:tabGravity="fill" + binding:tabIndicatorColor="@color/colorPrimary" + binding:tabSelectedTextColor="@color/colorPrimary" + binding:tabTextColor="@android:color/black" /> - - - + diff --git a/app/src/main/res/xml/network_security_config.xml b/app/src/main/res/xml/network_security_config.xml new file mode 100644 index 00000000..2439f15c --- /dev/null +++ b/app/src/main/res/xml/network_security_config.xml @@ -0,0 +1,4 @@ + + + + diff --git a/build.gradle b/build.gradle index 506580cf..848cec1b 100644 --- a/build.gradle +++ b/build.gradle @@ -6,7 +6,7 @@ buildscript { jcenter() } dependencies { - classpath 'com.android.tools.build:gradle:3.3.3' + classpath 'com.android.tools.build:gradle:3.5.2' // classpath 'com.github.dcendents:android-maven-gradle-plugin:1.3' // classpath 'com.github.dcendents:android-maven-gradle-plugin:1.5' // classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.7.3' diff --git a/config.gradle b/config.gradle index 6c636f96..a6d320d9 100644 --- a/config.gradle +++ b/config.gradle @@ -11,19 +11,18 @@ ext { ] //version配置 versions = [ - "support-version": "28.0.0", + "support-version": "1.0.0", "junit-version" : "4.12", ] //support配置 support = [ - "constraint-layout" : "1.0.0-beta2", - 'support-v4' : "com.android.support:support-v4:${versions["support-version"]}", - 'appcompat-v7' : "com.android.support:appcompat-v7:${versions["support-version"]}", - 'recyclerview-v7' : "com.android.support:recyclerview-v7:${versions["support-version"]}", - 'support-v13' : "com.android.support:support-v13:${versions["support-version"]}", - 'support-fragment' : "com.android.support:support-fragment:${versions["support-version"]}", - 'design' : "com.android.support:design:${versions["support-version"]}", - 'animated-vector-drawable': "com.android.support:animated-vector-drawable:${versions["support-version"]}", + 'support-v4' : "androidx.legacy:legacy-support-v4:${versions["support-version"]}", + 'appcompat-v7' : "androidx.appcompat:appcompat:${versions["support-version"]}", + 'recyclerview-v7' : "androidx.recyclerview:recyclerview:${versions["support-version"]}", + 'support-v13' : "androidx.legacy:legacy-support-v13:${versions["support-version"]}", + 'support-fragment' : "androidx.fragment:fragment:${versions["support-version"]}", + 'design' : "com.google.android.material:material:${versions["support-version"]}", + 'animated-vector-drawable': "androidx.vectordrawable:vectordrawable-animated:${versions["support-version"]}", 'junit' : "junit:junit:${versions["junit-version"]}", ] //依赖第三方配置 @@ -44,19 +43,20 @@ ext { "converter-gson" : "com.squareup.retrofit2:converter-gson:2.4.0", "adapter-rxjava" : "com.squareup.retrofit2:adapter-rxjava2:2.4.0", //glide图片加载 - "glide" : "com.github.bumptech.glide:glide:4.8.0", - "glide-compiler" : "com.github.bumptech.glide:compiler:4.8.0", + "glide" : "com.github.bumptech.glide:glide:4.11.0", + "glide-compiler" : "com.github.bumptech.glide:compiler:4.11.0", //json解析 - "gson" : "com.google.code.gson:gson:2.8.5", + "gson" : "com.google.code.gson:gson:2.8.6", //material-dialogs - "material-dialogs-core" : "com.afollestad.material-dialogs:core:0.9.4.5", - "material-dialogs-commons" : "com.afollestad.material-dialogs:commons:0.9.4.5", + "material-dialogs-core" : "com.afollestad.material-dialogs:core:0.9.6.0", + "material-dialogs-commons" : "com.afollestad.material-dialogs:commons:0.9.6.0", //recyclerview的databinding套装 - "bindingcollectionadapter" : "me.tatarka.bindingcollectionadapter2:bindingcollectionadapter:2.2.0", - "bindingcollectionadapter-recyclerview": "me.tatarka.bindingcollectionadapter2:bindingcollectionadapter-recyclerview:2.2.0", + "bindingcollectionadapter" : "me.tatarka.bindingcollectionadapter2:bindingcollectionadapter:4.0.0", + "bindingcollectionadapter-recyclerview": "me.tatarka.bindingcollectionadapter2:bindingcollectionadapter-recyclerview:4.0.0", + "bindingcollectionadapter-viewpager2" : "me.tatarka.bindingcollectionadapter2:bindingcollectionadapter-viewpager2:4.0.0", //Google AAC - "lifecycle-extensions" : "android.arch.lifecycle:extensions:1.1.1", - "lifecycle-compiler" : "android.arch.lifecycle:compiler:1.1.1", + "lifecycle-extensions" : "androidx.lifecycle:lifecycle-extensions:2.0.0", + "lifecycle-compiler" : "androidx.lifecycle:lifecycle-compiler:2.0.0", //MVVMHabit "MVVMHabit" : "com.github.goldze:MVVMHabit:3.1.6", ] diff --git a/gradle.properties b/gradle.properties index f8dd8775..901c7f82 100644 --- a/gradle.properties +++ b/gradle.properties @@ -15,4 +15,7 @@ org.gradle.jvmargs=-Xmx1536m # This option should only be used with decoupled projects. More details, visit # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects # org.gradle.parallel=true -# android.databinding.enableV2=true \ No newline at end of file +# android.databinding.enableV2=true + +android.useAndroidX=true +android.enableJetifier=true \ No newline at end of file diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 6af21361..82c55c84 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.1-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.4-all.zip diff --git a/mvvmhabit/build.gradle b/mvvmhabit/build.gradle index 1a9ebfc3..430d5d0d 100644 --- a/mvvmhabit/build.gradle +++ b/mvvmhabit/build.gradle @@ -68,6 +68,9 @@ dependencies { api(rootProject.ext.dependencies["bindingcollectionadapter-recyclerview"]) { exclude group: 'com.android.support' } + api(rootProject.ext.dependencies["bindingcollectionadapter-viewpager2"]) { + exclude group: 'com.android.support' + } //Google LiveData和ViewModel组件 api rootProject.ext.dependencies["lifecycle-extensions"] annotationProcessor rootProject.ext.dependencies["lifecycle-compiler"] diff --git a/mvvmhabit/src/main/java/me/goldze/mvvmhabit/base/AppManager.java b/mvvmhabit/src/main/java/me/goldze/mvvmhabit/base/AppManager.java index 07f13c41..2d1eff59 100644 --- a/mvvmhabit/src/main/java/me/goldze/mvvmhabit/base/AppManager.java +++ b/mvvmhabit/src/main/java/me/goldze/mvvmhabit/base/AppManager.java @@ -1,10 +1,11 @@ package me.goldze.mvvmhabit.base; import android.app.Activity; -import android.support.v4.app.Fragment; import java.util.Stack; +import androidx.fragment.app.Fragment; + /** * Created by goldze on 2017/6/15. * activity堆栈式管理 diff --git a/mvvmhabit/src/main/java/me/goldze/mvvmhabit/base/BaseActivity.java b/mvvmhabit/src/main/java/me/goldze/mvvmhabit/base/BaseActivity.java index 554e2d88..2953b5d1 100644 --- a/mvvmhabit/src/main/java/me/goldze/mvvmhabit/base/BaseActivity.java +++ b/mvvmhabit/src/main/java/me/goldze/mvvmhabit/base/BaseActivity.java @@ -1,14 +1,7 @@ package me.goldze.mvvmhabit.base; -import android.arch.lifecycle.Observer; -import android.arch.lifecycle.ViewModel; -import android.arch.lifecycle.ViewModelProviders; import android.content.Intent; -import android.databinding.DataBindingUtil; -import android.databinding.ViewDataBinding; import android.os.Bundle; -import android.support.annotation.Nullable; -import android.support.v4.app.FragmentActivity; import com.afollestad.materialdialogs.MaterialDialog; import com.trello.rxlifecycle2.components.support.RxAppCompatActivity; @@ -17,6 +10,13 @@ import java.lang.reflect.Type; import java.util.Map; +import androidx.annotation.Nullable; +import androidx.databinding.DataBindingUtil; +import androidx.databinding.ViewDataBinding; +import androidx.fragment.app.FragmentActivity; +import androidx.lifecycle.Observer; +import androidx.lifecycle.ViewModel; +import androidx.lifecycle.ViewModelProviders; import me.goldze.mvvmhabit.base.BaseViewModel.ParameterField; import me.goldze.mvvmhabit.bus.Messenger; import me.goldze.mvvmhabit.utils.MaterialDialogUtils; diff --git a/mvvmhabit/src/main/java/me/goldze/mvvmhabit/base/BaseApplication.java b/mvvmhabit/src/main/java/me/goldze/mvvmhabit/base/BaseApplication.java index b9b12999..5899a9ab 100644 --- a/mvvmhabit/src/main/java/me/goldze/mvvmhabit/base/BaseApplication.java +++ b/mvvmhabit/src/main/java/me/goldze/mvvmhabit/base/BaseApplication.java @@ -3,8 +3,8 @@ import android.app.Activity; import android.app.Application; import android.os.Bundle; -import android.support.annotation.NonNull; +import androidx.annotation.NonNull; import me.goldze.mvvmhabit.utils.Utils; /** diff --git a/mvvmhabit/src/main/java/me/goldze/mvvmhabit/base/BaseFragment.java b/mvvmhabit/src/main/java/me/goldze/mvvmhabit/base/BaseFragment.java index 20a98253..ee34f831 100644 --- a/mvvmhabit/src/main/java/me/goldze/mvvmhabit/base/BaseFragment.java +++ b/mvvmhabit/src/main/java/me/goldze/mvvmhabit/base/BaseFragment.java @@ -1,14 +1,7 @@ package me.goldze.mvvmhabit.base; -import android.arch.lifecycle.Observer; -import android.arch.lifecycle.ViewModel; -import android.arch.lifecycle.ViewModelProviders; import android.content.Intent; -import android.databinding.DataBindingUtil; -import android.databinding.ViewDataBinding; import android.os.Bundle; -import android.support.annotation.Nullable; -import android.support.v4.app.Fragment; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; @@ -20,6 +13,13 @@ import java.lang.reflect.Type; import java.util.Map; +import androidx.annotation.Nullable; +import androidx.databinding.DataBindingUtil; +import androidx.databinding.ViewDataBinding; +import androidx.fragment.app.Fragment; +import androidx.lifecycle.Observer; +import androidx.lifecycle.ViewModel; +import androidx.lifecycle.ViewModelProviders; import me.goldze.mvvmhabit.base.BaseViewModel.ParameterField; import me.goldze.mvvmhabit.bus.Messenger; import me.goldze.mvvmhabit.utils.MaterialDialogUtils; diff --git a/mvvmhabit/src/main/java/me/goldze/mvvmhabit/base/BaseViewModel.java b/mvvmhabit/src/main/java/me/goldze/mvvmhabit/base/BaseViewModel.java index cb46eeda..8d4be18a 100644 --- a/mvvmhabit/src/main/java/me/goldze/mvvmhabit/base/BaseViewModel.java +++ b/mvvmhabit/src/main/java/me/goldze/mvvmhabit/base/BaseViewModel.java @@ -1,12 +1,7 @@ package me.goldze.mvvmhabit.base; import android.app.Application; -import android.arch.lifecycle.AndroidViewModel; -import android.arch.lifecycle.Lifecycle; -import android.arch.lifecycle.LifecycleOwner; -import android.arch.lifecycle.Observer; import android.os.Bundle; -import android.support.annotation.NonNull; import com.trello.rxlifecycle2.LifecycleProvider; @@ -14,6 +9,11 @@ import java.util.HashMap; import java.util.Map; +import androidx.annotation.NonNull; +import androidx.lifecycle.AndroidViewModel; +import androidx.lifecycle.Lifecycle; +import androidx.lifecycle.LifecycleOwner; +import androidx.lifecycle.Observer; import io.reactivex.disposables.CompositeDisposable; import io.reactivex.disposables.Disposable; import io.reactivex.functions.Consumer; diff --git a/mvvmhabit/src/main/java/me/goldze/mvvmhabit/base/ContainerActivity.java b/mvvmhabit/src/main/java/me/goldze/mvvmhabit/base/ContainerActivity.java index 7a136237..58127c79 100644 --- a/mvvmhabit/src/main/java/me/goldze/mvvmhabit/base/ContainerActivity.java +++ b/mvvmhabit/src/main/java/me/goldze/mvvmhabit/base/ContainerActivity.java @@ -2,23 +2,17 @@ import android.content.Intent; import android.os.Bundle; -import android.os.PersistableBundle; -import android.support.v4.app.Fragment; -import android.support.v4.app.FragmentManager; -import android.support.v4.app.FragmentTransaction; -import android.view.View; -import android.view.ViewGroup; import android.view.WindowManager; -import android.widget.LinearLayout; import com.trello.rxlifecycle2.components.support.RxAppCompatActivity; import java.lang.ref.WeakReference; +import androidx.fragment.app.Fragment; +import androidx.fragment.app.FragmentManager; +import androidx.fragment.app.FragmentTransaction; import me.goldze.mvvmhabit.R; -import static android.view.View.generateViewId; - /** * 盛装Fragment的一个容器(代理)Activity diff --git a/mvvmhabit/src/main/java/me/goldze/mvvmhabit/base/IBaseViewModel.java b/mvvmhabit/src/main/java/me/goldze/mvvmhabit/base/IBaseViewModel.java index 1f5382ba..0ad257dc 100644 --- a/mvvmhabit/src/main/java/me/goldze/mvvmhabit/base/IBaseViewModel.java +++ b/mvvmhabit/src/main/java/me/goldze/mvvmhabit/base/IBaseViewModel.java @@ -1,9 +1,10 @@ package me.goldze.mvvmhabit.base; -import android.arch.lifecycle.Lifecycle; -import android.arch.lifecycle.LifecycleObserver; -import android.arch.lifecycle.LifecycleOwner; -import android.arch.lifecycle.OnLifecycleEvent; + +import androidx.lifecycle.Lifecycle; +import androidx.lifecycle.LifecycleObserver; +import androidx.lifecycle.LifecycleOwner; +import androidx.lifecycle.OnLifecycleEvent; /** * Created by goldze on 2017/6/15. diff --git a/mvvmhabit/src/main/java/me/goldze/mvvmhabit/base/ItemViewModel.java b/mvvmhabit/src/main/java/me/goldze/mvvmhabit/base/ItemViewModel.java index 45ac04e0..8b673231 100644 --- a/mvvmhabit/src/main/java/me/goldze/mvvmhabit/base/ItemViewModel.java +++ b/mvvmhabit/src/main/java/me/goldze/mvvmhabit/base/ItemViewModel.java @@ -1,6 +1,7 @@ package me.goldze.mvvmhabit.base; -import android.support.annotation.NonNull; + +import androidx.annotation.NonNull; /** * ItemViewModel diff --git a/mvvmhabit/src/main/java/me/goldze/mvvmhabit/base/MultiItemViewModel.java b/mvvmhabit/src/main/java/me/goldze/mvvmhabit/base/MultiItemViewModel.java index 0e04d9a3..e300c520 100644 --- a/mvvmhabit/src/main/java/me/goldze/mvvmhabit/base/MultiItemViewModel.java +++ b/mvvmhabit/src/main/java/me/goldze/mvvmhabit/base/MultiItemViewModel.java @@ -1,6 +1,7 @@ package me.goldze.mvvmhabit.base; -import android.support.annotation.NonNull; + +import androidx.annotation.NonNull; /** * Create Author:goldze diff --git a/mvvmhabit/src/main/java/me/goldze/mvvmhabit/base/ViewModelFactory.java b/mvvmhabit/src/main/java/me/goldze/mvvmhabit/base/ViewModelFactory.java index 6d104cb7..86b26591 100644 --- a/mvvmhabit/src/main/java/me/goldze/mvvmhabit/base/ViewModelFactory.java +++ b/mvvmhabit/src/main/java/me/goldze/mvvmhabit/base/ViewModelFactory.java @@ -2,14 +2,13 @@ import android.annotation.SuppressLint; import android.app.Application; -import android.arch.lifecycle.ViewModel; -import android.arch.lifecycle.ViewModelProvider; -import android.arch.lifecycle.ViewModelProviders; -import android.support.v4.app.FragmentActivity; import java.lang.reflect.Constructor; import java.lang.reflect.InvocationTargetException; +import androidx.lifecycle.ViewModel; +import androidx.lifecycle.ViewModelProvider; + /** * Created by goldze on 2018/9/30. */ diff --git a/mvvmhabit/src/main/java/me/goldze/mvvmhabit/binding/command/BindingCommand.java b/mvvmhabit/src/main/java/me/goldze/mvvmhabit/binding/command/BindingCommand.java index 6a27b40d..4b6b1f81 100644 --- a/mvvmhabit/src/main/java/me/goldze/mvvmhabit/binding/command/BindingCommand.java +++ b/mvvmhabit/src/main/java/me/goldze/mvvmhabit/binding/command/BindingCommand.java @@ -1,8 +1,6 @@ package me.goldze.mvvmhabit.binding.command; -import io.reactivex.exceptions.Exceptions; - /** * About : kelin的ReplyCommand * 执行的命令回调, 用于ViewModel与xml之间的数据绑定 diff --git a/mvvmhabit/src/main/java/me/goldze/mvvmhabit/binding/command/BindingFunction.java b/mvvmhabit/src/main/java/me/goldze/mvvmhabit/binding/command/BindingFunction.java index 2d0cbe0b..34210115 100644 --- a/mvvmhabit/src/main/java/me/goldze/mvvmhabit/binding/command/BindingFunction.java +++ b/mvvmhabit/src/main/java/me/goldze/mvvmhabit/binding/command/BindingFunction.java @@ -1,7 +1,5 @@ package me.goldze.mvvmhabit.binding.command; -import me.goldze.mvvmhabit.R; - /** * Represents a function with zero arguments. * diff --git a/mvvmhabit/src/main/java/me/goldze/mvvmhabit/binding/command/ResponseCommand.java b/mvvmhabit/src/main/java/me/goldze/mvvmhabit/binding/command/ResponseCommand.java index 45522d2d..c02bb3ad 100644 --- a/mvvmhabit/src/main/java/me/goldze/mvvmhabit/binding/command/ResponseCommand.java +++ b/mvvmhabit/src/main/java/me/goldze/mvvmhabit/binding/command/ResponseCommand.java @@ -1,7 +1,5 @@ package me.goldze.mvvmhabit.binding.command; - -import io.reactivex.exceptions.Exceptions; import io.reactivex.functions.Function; /** diff --git a/mvvmhabit/src/main/java/me/goldze/mvvmhabit/binding/viewadapter/checkbox/ViewAdapter.java b/mvvmhabit/src/main/java/me/goldze/mvvmhabit/binding/viewadapter/checkbox/ViewAdapter.java index 1ffc3add..3305ef2c 100644 --- a/mvvmhabit/src/main/java/me/goldze/mvvmhabit/binding/viewadapter/checkbox/ViewAdapter.java +++ b/mvvmhabit/src/main/java/me/goldze/mvvmhabit/binding/viewadapter/checkbox/ViewAdapter.java @@ -1,9 +1,9 @@ package me.goldze.mvvmhabit.binding.viewadapter.checkbox; -import android.databinding.BindingAdapter; import android.widget.CheckBox; import android.widget.CompoundButton; +import androidx.databinding.BindingAdapter; import me.goldze.mvvmhabit.binding.command.BindingCommand; /** diff --git a/mvvmhabit/src/main/java/me/goldze/mvvmhabit/binding/viewadapter/edittext/ViewAdapter.java b/mvvmhabit/src/main/java/me/goldze/mvvmhabit/binding/viewadapter/edittext/ViewAdapter.java index 45861741..fdc742d4 100644 --- a/mvvmhabit/src/main/java/me/goldze/mvvmhabit/binding/viewadapter/edittext/ViewAdapter.java +++ b/mvvmhabit/src/main/java/me/goldze/mvvmhabit/binding/viewadapter/edittext/ViewAdapter.java @@ -1,12 +1,12 @@ package me.goldze.mvvmhabit.binding.viewadapter.edittext; import android.content.Context; -import android.databinding.BindingAdapter; import android.text.Editable; import android.text.TextWatcher; import android.view.inputmethod.InputMethodManager; import android.widget.EditText; +import androidx.databinding.BindingAdapter; import me.goldze.mvvmhabit.binding.command.BindingCommand; /** diff --git a/mvvmhabit/src/main/java/me/goldze/mvvmhabit/binding/viewadapter/image/ViewAdapter.java b/mvvmhabit/src/main/java/me/goldze/mvvmhabit/binding/viewadapter/image/ViewAdapter.java index 88202f82..5871393c 100644 --- a/mvvmhabit/src/main/java/me/goldze/mvvmhabit/binding/viewadapter/image/ViewAdapter.java +++ b/mvvmhabit/src/main/java/me/goldze/mvvmhabit/binding/viewadapter/image/ViewAdapter.java @@ -1,14 +1,12 @@ package me.goldze.mvvmhabit.binding.viewadapter.image; - -import android.databinding.BindingAdapter; import android.text.TextUtils; import android.widget.ImageView; import com.bumptech.glide.Glide; import com.bumptech.glide.request.RequestOptions; -import me.goldze.mvvmhabit.R; +import androidx.databinding.BindingAdapter; /** * Created by goldze on 2017/6/18. diff --git a/mvvmhabit/src/main/java/me/goldze/mvvmhabit/binding/viewadapter/listview/ViewAdapter.java b/mvvmhabit/src/main/java/me/goldze/mvvmhabit/binding/viewadapter/listview/ViewAdapter.java index aea8f0ac..d467e52d 100644 --- a/mvvmhabit/src/main/java/me/goldze/mvvmhabit/binding/viewadapter/listview/ViewAdapter.java +++ b/mvvmhabit/src/main/java/me/goldze/mvvmhabit/binding/viewadapter/listview/ViewAdapter.java @@ -1,6 +1,5 @@ package me.goldze.mvvmhabit.binding.viewadapter.listview; -import android.databinding.BindingAdapter; import android.view.View; import android.widget.AbsListView; import android.widget.AdapterView; @@ -8,6 +7,7 @@ import java.util.concurrent.TimeUnit; +import androidx.databinding.BindingAdapter; import io.reactivex.functions.Consumer; import io.reactivex.subjects.PublishSubject; import me.goldze.mvvmhabit.binding.command.BindingCommand; diff --git a/mvvmhabit/src/main/java/me/goldze/mvvmhabit/binding/viewadapter/mswitch/ViewAdapter.java b/mvvmhabit/src/main/java/me/goldze/mvvmhabit/binding/viewadapter/mswitch/ViewAdapter.java index 577f4adb..2e584824 100644 --- a/mvvmhabit/src/main/java/me/goldze/mvvmhabit/binding/viewadapter/mswitch/ViewAdapter.java +++ b/mvvmhabit/src/main/java/me/goldze/mvvmhabit/binding/viewadapter/mswitch/ViewAdapter.java @@ -1,15 +1,11 @@ package me.goldze.mvvmhabit.binding.viewadapter.mswitch; -import android.databinding.BindingAdapter; -import android.text.TextUtils; import android.widget.CompoundButton; import android.widget.Switch; +import androidx.databinding.BindingAdapter; import me.goldze.mvvmhabit.binding.command.BindingCommand; -import static android.R.attr.checked; -import static me.goldze.mvvmhabit.R.attr.switchState; - /** * Created by goldze on 2017/6/18. */ diff --git a/mvvmhabit/src/main/java/me/goldze/mvvmhabit/binding/viewadapter/radiogroup/ViewAdapter.java b/mvvmhabit/src/main/java/me/goldze/mvvmhabit/binding/viewadapter/radiogroup/ViewAdapter.java index 9792d8e7..fe0c38cb 100644 --- a/mvvmhabit/src/main/java/me/goldze/mvvmhabit/binding/viewadapter/radiogroup/ViewAdapter.java +++ b/mvvmhabit/src/main/java/me/goldze/mvvmhabit/binding/viewadapter/radiogroup/ViewAdapter.java @@ -1,12 +1,10 @@ package me.goldze.mvvmhabit.binding.viewadapter.radiogroup; -import android.databinding.BindingAdapter; -import android.support.annotation.IdRes; -import android.text.TextUtils; -import android.webkit.WebView; import android.widget.RadioButton; import android.widget.RadioGroup; +import androidx.annotation.IdRes; +import androidx.databinding.BindingAdapter; import me.goldze.mvvmhabit.binding.command.BindingCommand; /** diff --git a/mvvmhabit/src/main/java/me/goldze/mvvmhabit/binding/viewadapter/recyclerview/DividerLine.java b/mvvmhabit/src/main/java/me/goldze/mvvmhabit/binding/viewadapter/recyclerview/DividerLine.java index 894b0f8f..eb3fe0a7 100644 --- a/mvvmhabit/src/main/java/me/goldze/mvvmhabit/binding/viewadapter/recyclerview/DividerLine.java +++ b/mvvmhabit/src/main/java/me/goldze/mvvmhabit/binding/viewadapter/recyclerview/DividerLine.java @@ -5,9 +5,10 @@ import android.graphics.Canvas; import android.graphics.Rect; import android.graphics.drawable.Drawable; -import android.support.v7.widget.RecyclerView; import android.view.View; +import androidx.recyclerview.widget.RecyclerView; + /** * Created by goldze on 2017/6/16. */ diff --git a/mvvmhabit/src/main/java/me/goldze/mvvmhabit/binding/viewadapter/recyclerview/LayoutManagers.java b/mvvmhabit/src/main/java/me/goldze/mvvmhabit/binding/viewadapter/recyclerview/LayoutManagers.java new file mode 100644 index 00000000..6dc84272 --- /dev/null +++ b/mvvmhabit/src/main/java/me/goldze/mvvmhabit/binding/viewadapter/recyclerview/LayoutManagers.java @@ -0,0 +1,88 @@ +package me.goldze.mvvmhabit.binding.viewadapter.recyclerview; + +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; + +import androidx.annotation.IntDef; +import androidx.recyclerview.widget.GridLayoutManager; +import androidx.recyclerview.widget.LinearLayoutManager; +import androidx.recyclerview.widget.RecyclerView; +import androidx.recyclerview.widget.StaggeredGridLayoutManager; + +/** + * A collection of factories to create RecyclerView LayoutManagers so that you can easily set them + * in your layout. + */ +public class LayoutManagers { + protected LayoutManagers() { + } + + public interface LayoutManagerFactory { + RecyclerView.LayoutManager create(RecyclerView recyclerView); + } + + /** + * A {@link LinearLayoutManager}. + */ + public static LayoutManagerFactory linear() { + return new LayoutManagerFactory() { + @Override + public RecyclerView.LayoutManager create(RecyclerView recyclerView) { + return new LinearLayoutManager(recyclerView.getContext()); + } + }; + } + + /** + * A {@link LinearLayoutManager} with the given orientation and reverseLayout. + */ + public static LayoutManagerFactory linear(@Orientation final int orientation, final boolean reverseLayout) { + return new LayoutManagerFactory() { + @Override + public RecyclerView.LayoutManager create(RecyclerView recyclerView) { + return new LinearLayoutManager(recyclerView.getContext(), orientation, reverseLayout); + } + }; + } + + /** + * A {@link GridLayoutManager} with the given spanCount. + */ + public static LayoutManagerFactory grid(final int spanCount) { + return new LayoutManagerFactory() { + @Override + public RecyclerView.LayoutManager create(RecyclerView recyclerView) { + return new GridLayoutManager(recyclerView.getContext(), spanCount); + } + }; + } + + /** + * A {@link GridLayoutManager} with the given spanCount, orientation and reverseLayout. + **/ + public static LayoutManagerFactory grid(final int spanCount, @Orientation final int orientation, final boolean reverseLayout) { + return new LayoutManagerFactory() { + @Override + public RecyclerView.LayoutManager create(RecyclerView recyclerView) { + return new GridLayoutManager(recyclerView.getContext(), spanCount, orientation, reverseLayout); + } + }; + } + + /** + * A {@link StaggeredGridLayoutManager} with the given spanCount and orientation. + */ + public static LayoutManagerFactory staggeredGrid(final int spanCount, @Orientation final int orientation) { + return new LayoutManagerFactory() { + @Override + public RecyclerView.LayoutManager create(RecyclerView recyclerView) { + return new StaggeredGridLayoutManager(spanCount, orientation); + } + }; + } + + @IntDef({LinearLayoutManager.HORIZONTAL, LinearLayoutManager.VERTICAL}) + @Retention(RetentionPolicy.SOURCE) + public @interface Orientation { + } +} \ No newline at end of file diff --git a/mvvmhabit/src/main/java/me/goldze/mvvmhabit/binding/viewadapter/recyclerview/LineManagers.java b/mvvmhabit/src/main/java/me/goldze/mvvmhabit/binding/viewadapter/recyclerview/LineManagers.java index 5697c68d..a3f65e3d 100644 --- a/mvvmhabit/src/main/java/me/goldze/mvvmhabit/binding/viewadapter/recyclerview/LineManagers.java +++ b/mvvmhabit/src/main/java/me/goldze/mvvmhabit/binding/viewadapter/recyclerview/LineManagers.java @@ -1,6 +1,6 @@ package me.goldze.mvvmhabit.binding.viewadapter.recyclerview; -import android.support.v7.widget.RecyclerView; +import androidx.recyclerview.widget.RecyclerView; /** * Created by goldze on 2017/6/16. diff --git a/mvvmhabit/src/main/java/me/goldze/mvvmhabit/binding/viewadapter/recyclerview/ViewAdapter.java b/mvvmhabit/src/main/java/me/goldze/mvvmhabit/binding/viewadapter/recyclerview/ViewAdapter.java index 50d46ba3..604a90bc 100644 --- a/mvvmhabit/src/main/java/me/goldze/mvvmhabit/binding/viewadapter/recyclerview/ViewAdapter.java +++ b/mvvmhabit/src/main/java/me/goldze/mvvmhabit/binding/viewadapter/recyclerview/ViewAdapter.java @@ -1,11 +1,10 @@ package me.goldze.mvvmhabit.binding.viewadapter.recyclerview; -import android.databinding.BindingAdapter; -import android.support.v7.widget.LinearLayoutManager; -import android.support.v7.widget.RecyclerView; - import java.util.concurrent.TimeUnit; +import androidx.databinding.BindingAdapter; +import androidx.recyclerview.widget.LinearLayoutManager; +import androidx.recyclerview.widget.RecyclerView; import io.reactivex.functions.Consumer; import io.reactivex.subjects.PublishSubject; import me.goldze.mvvmhabit.binding.command.BindingCommand; @@ -20,6 +19,10 @@ public static void setLineManager(RecyclerView recyclerView, LineManagers.LineMa recyclerView.addItemDecoration(lineManagerFactory.create(recyclerView)); } + @BindingAdapter("layoutManager") + public static void setLayoutManager(RecyclerView recyclerView, LayoutManagers.LayoutManagerFactory layoutManagerFactory) { + recyclerView.setLayoutManager(layoutManagerFactory.create(recyclerView)); + } @BindingAdapter(value = {"onScrollChangeCommand", "onScrollStateChangedCommand"}, requireAll = false) public static void onScrollChangeCommand(final RecyclerView recyclerView, diff --git a/mvvmhabit/src/main/java/me/goldze/mvvmhabit/binding/viewadapter/scrollview/ViewAdapter.java b/mvvmhabit/src/main/java/me/goldze/mvvmhabit/binding/viewadapter/scrollview/ViewAdapter.java index 63f6978d..20b0ade0 100644 --- a/mvvmhabit/src/main/java/me/goldze/mvvmhabit/binding/viewadapter/scrollview/ViewAdapter.java +++ b/mvvmhabit/src/main/java/me/goldze/mvvmhabit/binding/viewadapter/scrollview/ViewAdapter.java @@ -1,10 +1,10 @@ package me.goldze.mvvmhabit.binding.viewadapter.scrollview; -import android.databinding.BindingAdapter; -import android.support.v4.widget.NestedScrollView; import android.view.ViewTreeObserver; import android.widget.ScrollView; +import androidx.core.widget.NestedScrollView; +import androidx.databinding.BindingAdapter; import me.goldze.mvvmhabit.binding.command.BindingCommand; /** diff --git a/mvvmhabit/src/main/java/me/goldze/mvvmhabit/binding/viewadapter/spinner/ViewAdapter.java b/mvvmhabit/src/main/java/me/goldze/mvvmhabit/binding/viewadapter/spinner/ViewAdapter.java index b1be3ede..34806180 100644 --- a/mvvmhabit/src/main/java/me/goldze/mvvmhabit/binding/viewadapter/spinner/ViewAdapter.java +++ b/mvvmhabit/src/main/java/me/goldze/mvvmhabit/binding/viewadapter/spinner/ViewAdapter.java @@ -1,16 +1,15 @@ package me.goldze.mvvmhabit.binding.viewadapter.spinner; -import android.databinding.BindingAdapter; import android.text.TextUtils; import android.view.View; import android.widget.AdapterView; import android.widget.ArrayAdapter; import android.widget.Spinner; -import android.widget.SpinnerAdapter; import java.util.ArrayList; import java.util.List; +import androidx.databinding.BindingAdapter; import me.goldze.mvvmhabit.binding.command.BindingCommand; /** diff --git a/mvvmhabit/src/main/java/me/goldze/mvvmhabit/binding/viewadapter/swiperefresh/ViewAdapter.java b/mvvmhabit/src/main/java/me/goldze/mvvmhabit/binding/viewadapter/swiperefresh/ViewAdapter.java index 13b6ff80..a6ece792 100644 --- a/mvvmhabit/src/main/java/me/goldze/mvvmhabit/binding/viewadapter/swiperefresh/ViewAdapter.java +++ b/mvvmhabit/src/main/java/me/goldze/mvvmhabit/binding/viewadapter/swiperefresh/ViewAdapter.java @@ -1,8 +1,7 @@ package me.goldze.mvvmhabit.binding.viewadapter.swiperefresh; -import android.databinding.BindingAdapter; -import android.support.v4.widget.SwipeRefreshLayout; - +import androidx.databinding.BindingAdapter; +import androidx.swiperefreshlayout.widget.SwipeRefreshLayout; import me.goldze.mvvmhabit.binding.command.BindingCommand; diff --git a/mvvmhabit/src/main/java/me/goldze/mvvmhabit/binding/viewadapter/view/ViewAdapter.java b/mvvmhabit/src/main/java/me/goldze/mvvmhabit/binding/viewadapter/view/ViewAdapter.java index 56cc9600..878083d3 100644 --- a/mvvmhabit/src/main/java/me/goldze/mvvmhabit/binding/viewadapter/view/ViewAdapter.java +++ b/mvvmhabit/src/main/java/me/goldze/mvvmhabit/binding/viewadapter/view/ViewAdapter.java @@ -1,12 +1,12 @@ package me.goldze.mvvmhabit.binding.viewadapter.view; -import android.databinding.BindingAdapter; import android.view.View; import com.jakewharton.rxbinding2.view.RxView; import java.util.concurrent.TimeUnit; +import androidx.databinding.BindingAdapter; import io.reactivex.functions.Consumer; import me.goldze.mvvmhabit.binding.command.BindingCommand; diff --git a/mvvmhabit/src/main/java/me/goldze/mvvmhabit/binding/viewadapter/viewgroup/IBindingItemViewModel.java b/mvvmhabit/src/main/java/me/goldze/mvvmhabit/binding/viewadapter/viewgroup/IBindingItemViewModel.java index 5489b226..98fe8353 100644 --- a/mvvmhabit/src/main/java/me/goldze/mvvmhabit/binding/viewadapter/viewgroup/IBindingItemViewModel.java +++ b/mvvmhabit/src/main/java/me/goldze/mvvmhabit/binding/viewadapter/viewgroup/IBindingItemViewModel.java @@ -1,11 +1,10 @@ package me.goldze.mvvmhabit.binding.viewadapter.viewgroup; +import androidx.databinding.ViewDataBinding; + /** * Created by goldze on 2017/6/15. */ - -import android.databinding.ViewDataBinding; - public interface IBindingItemViewModel { void injecDataBinding(V binding); } diff --git a/mvvmhabit/src/main/java/me/goldze/mvvmhabit/binding/viewadapter/viewgroup/ViewAdapter.java b/mvvmhabit/src/main/java/me/goldze/mvvmhabit/binding/viewadapter/viewgroup/ViewAdapter.java index 32d18833..847114e4 100644 --- a/mvvmhabit/src/main/java/me/goldze/mvvmhabit/binding/viewadapter/viewgroup/ViewAdapter.java +++ b/mvvmhabit/src/main/java/me/goldze/mvvmhabit/binding/viewadapter/viewgroup/ViewAdapter.java @@ -1,16 +1,14 @@ package me.goldze.mvvmhabit.binding.viewadapter.viewgroup; -import android.databinding.BindingAdapter; -import android.databinding.DataBindingUtil; -import android.databinding.ObservableList; -import android.databinding.ViewDataBinding; import android.view.LayoutInflater; import android.view.ViewGroup; +import androidx.databinding.BindingAdapter; +import androidx.databinding.DataBindingUtil; +import androidx.databinding.ObservableList; +import androidx.databinding.ViewDataBinding; import me.tatarka.bindingcollectionadapter2.ItemBinding; -import static me.goldze.mvvmhabit.R.attr.itemView; - /** * Created by goldze on 2017/6/18. */ diff --git a/mvvmhabit/src/main/java/me/goldze/mvvmhabit/binding/viewadapter/viewpager/ViewAdapter.java b/mvvmhabit/src/main/java/me/goldze/mvvmhabit/binding/viewadapter/viewpager/ViewAdapter.java index 2b290317..d3e9d54e 100644 --- a/mvvmhabit/src/main/java/me/goldze/mvvmhabit/binding/viewadapter/viewpager/ViewAdapter.java +++ b/mvvmhabit/src/main/java/me/goldze/mvvmhabit/binding/viewadapter/viewpager/ViewAdapter.java @@ -1,10 +1,7 @@ package me.goldze.mvvmhabit.binding.viewadapter.viewpager; -import android.databinding.BindingAdapter; -import android.support.v4.view.ViewPager; -import android.text.TextUtils; -import android.webkit.WebView; - +import androidx.databinding.BindingAdapter; +import androidx.viewpager.widget.ViewPager; import me.goldze.mvvmhabit.binding.command.BindingCommand; /** diff --git a/mvvmhabit/src/main/java/me/goldze/mvvmhabit/binding/viewadapter/webview/ViewAdapter.java b/mvvmhabit/src/main/java/me/goldze/mvvmhabit/binding/viewadapter/webview/ViewAdapter.java index cbabc54d..9ea65be4 100644 --- a/mvvmhabit/src/main/java/me/goldze/mvvmhabit/binding/viewadapter/webview/ViewAdapter.java +++ b/mvvmhabit/src/main/java/me/goldze/mvvmhabit/binding/viewadapter/webview/ViewAdapter.java @@ -1,9 +1,10 @@ package me.goldze.mvvmhabit.binding.viewadapter.webview; -import android.databinding.BindingAdapter; import android.text.TextUtils; import android.webkit.WebView; +import androidx.databinding.BindingAdapter; + /** * Created by goldze on 2017/6/18. */ diff --git a/mvvmhabit/src/main/java/me/goldze/mvvmhabit/bus/Messenger.java b/mvvmhabit/src/main/java/me/goldze/mvvmhabit/bus/Messenger.java index fd7f0d4e..1b1dcd36 100644 --- a/mvvmhabit/src/main/java/me/goldze/mvvmhabit/bus/Messenger.java +++ b/mvvmhabit/src/main/java/me/goldze/mvvmhabit/bus/Messenger.java @@ -1,6 +1,5 @@ package me.goldze.mvvmhabit.bus; - import java.lang.reflect.Type; import java.util.ArrayList; import java.util.Collection; diff --git a/mvvmhabit/src/main/java/me/goldze/mvvmhabit/bus/RxBus.java b/mvvmhabit/src/main/java/me/goldze/mvvmhabit/bus/RxBus.java index 43564d44..bd327758 100644 --- a/mvvmhabit/src/main/java/me/goldze/mvvmhabit/bus/RxBus.java +++ b/mvvmhabit/src/main/java/me/goldze/mvvmhabit/bus/RxBus.java @@ -1,6 +1,5 @@ package me.goldze.mvvmhabit.bus; - import java.util.Map; import java.util.concurrent.ConcurrentHashMap; diff --git a/mvvmhabit/src/main/java/me/goldze/mvvmhabit/bus/RxBusSubscriber.java b/mvvmhabit/src/main/java/me/goldze/mvvmhabit/bus/RxBusSubscriber.java index 936137b0..5748b531 100644 --- a/mvvmhabit/src/main/java/me/goldze/mvvmhabit/bus/RxBusSubscriber.java +++ b/mvvmhabit/src/main/java/me/goldze/mvvmhabit/bus/RxBusSubscriber.java @@ -1,6 +1,5 @@ package me.goldze.mvvmhabit.bus; - import io.reactivex.observers.DisposableObserver; /** diff --git a/mvvmhabit/src/main/java/me/goldze/mvvmhabit/bus/RxSubscriptions.java b/mvvmhabit/src/main/java/me/goldze/mvvmhabit/bus/RxSubscriptions.java index 89c297bc..41ebf5a1 100644 --- a/mvvmhabit/src/main/java/me/goldze/mvvmhabit/bus/RxSubscriptions.java +++ b/mvvmhabit/src/main/java/me/goldze/mvvmhabit/bus/RxSubscriptions.java @@ -1,7 +1,5 @@ package me.goldze.mvvmhabit.bus; -import org.reactivestreams.Subscription; - import io.reactivex.disposables.CompositeDisposable; import io.reactivex.disposables.Disposable; diff --git a/mvvmhabit/src/main/java/me/goldze/mvvmhabit/bus/event/SingleLiveEvent.java b/mvvmhabit/src/main/java/me/goldze/mvvmhabit/bus/event/SingleLiveEvent.java index 37c814fd..6f53309d 100644 --- a/mvvmhabit/src/main/java/me/goldze/mvvmhabit/bus/event/SingleLiveEvent.java +++ b/mvvmhabit/src/main/java/me/goldze/mvvmhabit/bus/event/SingleLiveEvent.java @@ -16,15 +16,17 @@ package me.goldze.mvvmhabit.bus.event; -import android.arch.lifecycle.LifecycleOwner; -import android.arch.lifecycle.MutableLiveData; -import android.arch.lifecycle.Observer; -import android.support.annotation.MainThread; -import android.support.annotation.Nullable; import android.util.Log; import java.util.concurrent.atomic.AtomicBoolean; +import androidx.annotation.MainThread; +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; +import androidx.lifecycle.LifecycleOwner; +import androidx.lifecycle.MutableLiveData; +import androidx.lifecycle.Observer; + /** * A lifecycle-aware observable that sends only new updates after subscription, used for events like * navigation and Snackbar messages. @@ -36,13 +38,12 @@ * Note that only one observer is going to be notified of changes. */ public class SingleLiveEvent extends MutableLiveData { - private static final String TAG = "SingleLiveEvent"; private final AtomicBoolean mPending = new AtomicBoolean(false); @MainThread - public void observe(LifecycleOwner owner, final Observer observer) { + public void observe(@NonNull LifecycleOwner owner, @NonNull final Observer observer) { if (hasActiveObservers()) { Log.w(TAG, "Multiple observers registered but only one will be notified of changes."); diff --git a/mvvmhabit/src/main/java/me/goldze/mvvmhabit/bus/event/SnackbarMessage.java b/mvvmhabit/src/main/java/me/goldze/mvvmhabit/bus/event/SnackbarMessage.java index 66a1df82..dd2b9752 100644 --- a/mvvmhabit/src/main/java/me/goldze/mvvmhabit/bus/event/SnackbarMessage.java +++ b/mvvmhabit/src/main/java/me/goldze/mvvmhabit/bus/event/SnackbarMessage.java @@ -16,10 +16,10 @@ package me.goldze.mvvmhabit.bus.event; -import android.arch.lifecycle.LifecycleOwner; -import android.arch.lifecycle.Observer; -import android.support.annotation.Nullable; -import android.support.annotation.StringRes; +import androidx.annotation.Nullable; +import androidx.annotation.StringRes; +import androidx.lifecycle.LifecycleOwner; +import androidx.lifecycle.Observer; /** * A SingleLiveEvent used for Snackbar messages. Like a {@link SingleLiveEvent} but also prevents diff --git a/mvvmhabit/src/main/java/me/goldze/mvvmhabit/crash/CaocConfig.java b/mvvmhabit/src/main/java/me/goldze/mvvmhabit/crash/CaocConfig.java index 5175bab4..fe2d23ea 100644 --- a/mvvmhabit/src/main/java/me/goldze/mvvmhabit/crash/CaocConfig.java +++ b/mvvmhabit/src/main/java/me/goldze/mvvmhabit/crash/CaocConfig.java @@ -17,16 +17,17 @@ package me.goldze.mvvmhabit.crash; import android.app.Activity; -import android.support.annotation.DrawableRes; -import android.support.annotation.IntDef; -import android.support.annotation.NonNull; -import android.support.annotation.Nullable; import java.io.Serializable; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.reflect.Modifier; +import androidx.annotation.DrawableRes; +import androidx.annotation.IntDef; +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; + public class CaocConfig implements Serializable { diff --git a/mvvmhabit/src/main/java/me/goldze/mvvmhabit/crash/CaocInitProvider.java b/mvvmhabit/src/main/java/me/goldze/mvvmhabit/crash/CaocInitProvider.java index b0cd50e5..27a4a937 100644 --- a/mvvmhabit/src/main/java/me/goldze/mvvmhabit/crash/CaocInitProvider.java +++ b/mvvmhabit/src/main/java/me/goldze/mvvmhabit/crash/CaocInitProvider.java @@ -20,8 +20,9 @@ import android.content.ContentValues; import android.database.Cursor; import android.net.Uri; -import android.support.annotation.NonNull; -import android.support.annotation.Nullable; + +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; public class CaocInitProvider extends ContentProvider { diff --git a/mvvmhabit/src/main/java/me/goldze/mvvmhabit/crash/CustomActivityOnCrash.java b/mvvmhabit/src/main/java/me/goldze/mvvmhabit/crash/CustomActivityOnCrash.java index c8dfb4d2..b081154a 100644 --- a/mvvmhabit/src/main/java/me/goldze/mvvmhabit/crash/CustomActivityOnCrash.java +++ b/mvvmhabit/src/main/java/me/goldze/mvvmhabit/crash/CustomActivityOnCrash.java @@ -27,9 +27,6 @@ import android.content.pm.ResolveInfo; import android.os.Build; import android.os.Bundle; -import android.support.annotation.NonNull; -import android.support.annotation.Nullable; -import android.support.annotation.RestrictTo; import android.util.Log; import java.io.PrintWriter; @@ -46,6 +43,10 @@ import java.util.zip.ZipEntry; import java.util.zip.ZipFile; +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; +import androidx.annotation.RestrictTo; + public final class CustomActivityOnCrash { diff --git a/mvvmhabit/src/main/java/me/goldze/mvvmhabit/crash/DefaultErrorActivity.java b/mvvmhabit/src/main/java/me/goldze/mvvmhabit/crash/DefaultErrorActivity.java index 1fbd7a56..240b6c1c 100644 --- a/mvvmhabit/src/main/java/me/goldze/mvvmhabit/crash/DefaultErrorActivity.java +++ b/mvvmhabit/src/main/java/me/goldze/mvvmhabit/crash/DefaultErrorActivity.java @@ -23,9 +23,6 @@ import android.content.DialogInterface; import android.content.res.TypedArray; import android.os.Bundle; -import android.support.annotation.Nullable; -import android.support.v4.content.res.ResourcesCompat; -import android.support.v7.app.AppCompatActivity; import android.util.TypedValue; import android.view.View; import android.widget.Button; @@ -33,6 +30,9 @@ import android.widget.TextView; import android.widget.Toast; +import androidx.annotation.Nullable; +import androidx.appcompat.app.AppCompatActivity; +import androidx.core.content.res.ResourcesCompat; import me.goldze.mvvmhabit.R; diff --git a/mvvmhabit/src/main/java/me/goldze/mvvmhabit/http/ApiDisposableObserver.java b/mvvmhabit/src/main/java/me/goldze/mvvmhabit/http/ApiDisposableObserver.java index ce2fbc00..26dbd076 100644 --- a/mvvmhabit/src/main/java/me/goldze/mvvmhabit/http/ApiDisposableObserver.java +++ b/mvvmhabit/src/main/java/me/goldze/mvvmhabit/http/ApiDisposableObserver.java @@ -1,6 +1,5 @@ package me.goldze.mvvmhabit.http; - import io.reactivex.observers.DisposableObserver; import me.goldze.mvvmhabit.base.AppManager; import me.goldze.mvvmhabit.utils.KLog; diff --git a/mvvmhabit/src/main/java/me/goldze/mvvmhabit/http/NetworkUtil.java b/mvvmhabit/src/main/java/me/goldze/mvvmhabit/http/NetworkUtil.java index 6b64313f..fb44a7f7 100644 --- a/mvvmhabit/src/main/java/me/goldze/mvvmhabit/http/NetworkUtil.java +++ b/mvvmhabit/src/main/java/me/goldze/mvvmhabit/http/NetworkUtil.java @@ -5,7 +5,6 @@ import android.net.NetworkInfo; import android.telephony.TelephonyManager; - import java.io.IOException; import java.net.HttpURLConnection; import java.net.InetAddress; diff --git a/mvvmhabit/src/main/java/me/goldze/mvvmhabit/http/download/ProgressCallBack.java b/mvvmhabit/src/main/java/me/goldze/mvvmhabit/http/download/ProgressCallBack.java index 12967cdd..e3aea755 100644 --- a/mvvmhabit/src/main/java/me/goldze/mvvmhabit/http/download/ProgressCallBack.java +++ b/mvvmhabit/src/main/java/me/goldze/mvvmhabit/http/download/ProgressCallBack.java @@ -60,7 +60,6 @@ public void saveFile(ResponseBody body) { fos.write(buf, 0, len); } fos.flush(); - unsubscribe(); //onCompleted(); } catch (FileNotFoundException e) { e.printStackTrace(); @@ -70,6 +69,7 @@ public void saveFile(ResponseBody body) { try { if (is != null) is.close(); if (fos != null) fos.close(); + unsubscribe(); } catch (IOException e) { Log.e("saveFile", e.getMessage()); } diff --git a/mvvmhabit/src/main/java/me/goldze/mvvmhabit/http/interceptor/CacheInterceptor.java b/mvvmhabit/src/main/java/me/goldze/mvvmhabit/http/interceptor/CacheInterceptor.java index 7484d0eb..5867077b 100644 --- a/mvvmhabit/src/main/java/me/goldze/mvvmhabit/http/interceptor/CacheInterceptor.java +++ b/mvvmhabit/src/main/java/me/goldze/mvvmhabit/http/interceptor/CacheInterceptor.java @@ -1,8 +1,6 @@ package me.goldze.mvvmhabit.http.interceptor; -import android.app.Activity; import android.content.Context; -import android.widget.Toast; import java.io.IOException; diff --git a/mvvmhabit/src/main/java/me/goldze/mvvmhabit/utils/ImageUtils.java b/mvvmhabit/src/main/java/me/goldze/mvvmhabit/utils/ImageUtils.java index a9e9594d..85b35a3a 100644 --- a/mvvmhabit/src/main/java/me/goldze/mvvmhabit/utils/ImageUtils.java +++ b/mvvmhabit/src/main/java/me/goldze/mvvmhabit/utils/ImageUtils.java @@ -28,8 +28,6 @@ import android.text.TextUtils; import android.util.DisplayMetrics; -import org.reactivestreams.Subscriber; - import java.io.BufferedInputStream; import java.io.BufferedOutputStream; import java.io.ByteArrayInputStream; diff --git a/mvvmhabit/src/main/java/me/goldze/mvvmhabit/utils/MaterialDialogUtils.java b/mvvmhabit/src/main/java/me/goldze/mvvmhabit/utils/MaterialDialogUtils.java index c3ab2dda..73e444e0 100644 --- a/mvvmhabit/src/main/java/me/goldze/mvvmhabit/utils/MaterialDialogUtils.java +++ b/mvvmhabit/src/main/java/me/goldze/mvvmhabit/utils/MaterialDialogUtils.java @@ -3,10 +3,8 @@ import android.content.Context; import android.content.DialogInterface; import android.graphics.Color; -import android.support.annotation.NonNull; import android.text.InputType; import android.text.TextUtils; -import android.util.TypedValue; import android.view.KeyEvent; import android.view.View; @@ -17,6 +15,7 @@ import java.util.List; +import androidx.annotation.NonNull; import me.goldze.mvvmhabit.R; diff --git a/mvvmhabit/src/main/java/me/goldze/mvvmhabit/utils/RegexUtils.java b/mvvmhabit/src/main/java/me/goldze/mvvmhabit/utils/RegexUtils.java index c6f0e3eb..2fdc4f02 100644 --- a/mvvmhabit/src/main/java/me/goldze/mvvmhabit/utils/RegexUtils.java +++ b/mvvmhabit/src/main/java/me/goldze/mvvmhabit/utils/RegexUtils.java @@ -1,6 +1,5 @@ package me.goldze.mvvmhabit.utils; -import android.support.v4.util.SimpleArrayMap; import java.util.ArrayList; import java.util.Collections; @@ -8,6 +7,7 @@ import java.util.regex.Matcher; import java.util.regex.Pattern; +import androidx.collection.SimpleArrayMap; import me.goldze.mvvmhabit.utils.constant.RegexConstants; /** diff --git a/mvvmhabit/src/main/java/me/goldze/mvvmhabit/utils/RxUtils.java b/mvvmhabit/src/main/java/me/goldze/mvvmhabit/utils/RxUtils.java index 30e5528b..19423b8b 100644 --- a/mvvmhabit/src/main/java/me/goldze/mvvmhabit/utils/RxUtils.java +++ b/mvvmhabit/src/main/java/me/goldze/mvvmhabit/utils/RxUtils.java @@ -1,11 +1,11 @@ package me.goldze.mvvmhabit.utils; import android.content.Context; -import android.support.v4.app.Fragment; import com.trello.rxlifecycle2.LifecycleProvider; import com.trello.rxlifecycle2.LifecycleTransformer; +import androidx.fragment.app.Fragment; import io.reactivex.Observable; import io.reactivex.ObservableSource; import io.reactivex.ObservableTransformer; diff --git a/mvvmhabit/src/main/java/me/goldze/mvvmhabit/utils/SPUtils.java b/mvvmhabit/src/main/java/me/goldze/mvvmhabit/utils/SPUtils.java index 2a88acf0..486aff49 100644 --- a/mvvmhabit/src/main/java/me/goldze/mvvmhabit/utils/SPUtils.java +++ b/mvvmhabit/src/main/java/me/goldze/mvvmhabit/utils/SPUtils.java @@ -2,13 +2,14 @@ import android.content.Context; import android.content.SharedPreferences; -import android.support.annotation.NonNull; import java.util.Collections; import java.util.HashMap; import java.util.Map; import java.util.Set; +import androidx.annotation.NonNull; + /** * Created by goldze on 2017/5/14. * SharedPreferences工具类 diff --git a/mvvmhabit/src/main/java/me/goldze/mvvmhabit/utils/ToastUtils.java b/mvvmhabit/src/main/java/me/goldze/mvvmhabit/utils/ToastUtils.java index a7097d5b..6ab540e2 100644 --- a/mvvmhabit/src/main/java/me/goldze/mvvmhabit/utils/ToastUtils.java +++ b/mvvmhabit/src/main/java/me/goldze/mvvmhabit/utils/ToastUtils.java @@ -1,12 +1,8 @@ package me.goldze.mvvmhabit.utils; + import android.content.Context; import android.os.Handler; import android.os.Looper; -import android.support.annotation.ColorInt; -import android.support.annotation.DrawableRes; -import android.support.annotation.LayoutRes; -import android.support.annotation.Nullable; -import android.support.annotation.StringRes; import android.text.SpannableString; import android.text.Spanned; import android.text.style.ForegroundColorSpan; @@ -17,6 +13,12 @@ import java.lang.ref.WeakReference; +import androidx.annotation.ColorInt; +import androidx.annotation.DrawableRes; +import androidx.annotation.LayoutRes; +import androidx.annotation.Nullable; +import androidx.annotation.StringRes; + /** * Created by goldze on 2017/5/14. * 吐司工具类 diff --git a/mvvmhabit/src/main/java/me/goldze/mvvmhabit/utils/Utils.java b/mvvmhabit/src/main/java/me/goldze/mvvmhabit/utils/Utils.java index affc9ecc..4d3996ad 100644 --- a/mvvmhabit/src/main/java/me/goldze/mvvmhabit/utils/Utils.java +++ b/mvvmhabit/src/main/java/me/goldze/mvvmhabit/utils/Utils.java @@ -2,7 +2,8 @@ import android.annotation.SuppressLint; import android.content.Context; -import android.support.annotation.NonNull; + +import androidx.annotation.NonNull; /** * Created by goldze on 2017/5/14. diff --git a/mvvmhabit/src/main/java/me/goldze/mvvmhabit/utils/compression/Luban.java b/mvvmhabit/src/main/java/me/goldze/mvvmhabit/utils/compression/Luban.java index a3d45487..548a43b8 100644 --- a/mvvmhabit/src/main/java/me/goldze/mvvmhabit/utils/compression/Luban.java +++ b/mvvmhabit/src/main/java/me/goldze/mvvmhabit/utils/compression/Luban.java @@ -5,7 +5,6 @@ import android.graphics.BitmapFactory; import android.graphics.Matrix; import android.media.ExifInterface; -import android.support.annotation.NonNull; import android.text.TextUtils; import android.util.Log; @@ -16,6 +15,7 @@ import java.util.ArrayList; import java.util.List; +import androidx.annotation.NonNull; import io.reactivex.Observable; import io.reactivex.android.schedulers.AndroidSchedulers; import io.reactivex.functions.Consumer; diff --git a/mvvmhabit/src/main/java/me/goldze/mvvmhabit/utils/compression/Preconditions.java b/mvvmhabit/src/main/java/me/goldze/mvvmhabit/utils/compression/Preconditions.java index ffec2c26..590dfde0 100644 --- a/mvvmhabit/src/main/java/me/goldze/mvvmhabit/utils/compression/Preconditions.java +++ b/mvvmhabit/src/main/java/me/goldze/mvvmhabit/utils/compression/Preconditions.java @@ -1,6 +1,6 @@ package me.goldze.mvvmhabit.utils.compression; -import android.support.annotation.Nullable; +import androidx.annotation.Nullable; final class Preconditions { diff --git a/mvvmhabit/src/main/java/me/goldze/mvvmhabit/utils/constant/MemoryConstants.java b/mvvmhabit/src/main/java/me/goldze/mvvmhabit/utils/constant/MemoryConstants.java index 699e0370..639efd6d 100644 --- a/mvvmhabit/src/main/java/me/goldze/mvvmhabit/utils/constant/MemoryConstants.java +++ b/mvvmhabit/src/main/java/me/goldze/mvvmhabit/utils/constant/MemoryConstants.java @@ -1,10 +1,10 @@ package me.goldze.mvvmhabit.utils.constant; -import android.support.annotation.IntDef; - import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; +import androidx.annotation.IntDef; + /** * Created by goldze on 2017/5/14. * 存储相关常量 diff --git a/mvvmhabit/src/main/java/me/goldze/mvvmhabit/utils/constant/TimeConstants.java b/mvvmhabit/src/main/java/me/goldze/mvvmhabit/utils/constant/TimeConstants.java index 669cb180..6b6ef534 100644 --- a/mvvmhabit/src/main/java/me/goldze/mvvmhabit/utils/constant/TimeConstants.java +++ b/mvvmhabit/src/main/java/me/goldze/mvvmhabit/utils/constant/TimeConstants.java @@ -1,10 +1,10 @@ package me.goldze.mvvmhabit.utils.constant; -import android.support.annotation.IntDef; - import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; +import androidx.annotation.IntDef; + /** * Created by goldze on 2017/5/14. * 时间相关常量