androidx
Zhanty 5 years ago
parent e926991c60
commit 897c9ad332
  1. 349
      config/repository.gradle
  2. 51
      lib_base/build.gradle
  3. 7
      lib_base/src/main/java/com/android/base/adapter/ItemHelper.java
  4. 3
      lib_base/src/main/java/com/android/base/adapter/list/BaseListAdapter.java
  5. 7
      lib_base/src/main/java/com/android/base/adapter/pager/ViewPageFragmentAdapter.java
  6. 10
      lib_base/src/main/java/com/android/base/adapter/pager/ViewPageInfo.java
  7. 13
      lib_base/src/main/java/com/android/base/adapter/pager/ViewPageStateFragmentAdapter.java
  8. 5
      lib_base/src/main/java/com/android/base/adapter/pager/ViewPagerAdapter.java
  9. 3
      lib_base/src/main/java/com/android/base/adapter/pager/recycler/RecyclingPagerAdapter.java
  10. 12
      lib_base/src/main/java/com/android/base/app/BaseKit.java
  11. 10
      lib_base/src/main/java/com/android/base/app/aac/AutoClearedValue.kt
  12. 4
      lib_base/src/main/java/com/android/base/app/aac/AutoDisposeLiveData.kt
  13. 4
      lib_base/src/main/java/com/android/base/app/aac/ResourceLiveData.kt
  14. 52
      lib_base/src/main/java/com/android/base/app/aac/SingleLiveData.java
  15. 15
      lib_base/src/main/java/com/android/base/app/aac/SingleLiveEvent.java
  16. 5
      lib_base/src/main/java/com/android/base/app/activity/ActivityDelegate.java
  17. 3
      lib_base/src/main/java/com/android/base/app/activity/ActivityDelegateOwner.java
  18. 7
      lib_base/src/main/java/com/android/base/app/activity/ActivityDelegates.java
  19. 8
      lib_base/src/main/java/com/android/base/app/activity/BackHandlerHelper.java
  20. 8
      lib_base/src/main/java/com/android/base/app/activity/BaseActivity.java
  21. 7
      lib_base/src/main/java/com/android/base/app/dagger/ViewModelFactory.java
  22. 3
      lib_base/src/main/java/com/android/base/app/dagger/ViewModelKey.java
  23. 3
      lib_base/src/main/java/com/android/base/app/dagger/ViewModelModule.java
  24. 12
      lib_base/src/main/java/com/android/base/app/fragment/BaseDialogFragment.java
  25. 12
      lib_base/src/main/java/com/android/base/app/fragment/BaseFragment.java
  26. 7
      lib_base/src/main/java/com/android/base/app/fragment/BaseListFragment.java
  27. 2
      lib_base/src/main/java/com/android/base/app/fragment/BaseListV2Fragment.kt
  28. 5
      lib_base/src/main/java/com/android/base/app/fragment/BaseStateDialogFragment.java
  29. 5
      lib_base/src/main/java/com/android/base/app/fragment/BaseStateFragment.java
  30. 7
      lib_base/src/main/java/com/android/base/app/fragment/FragmentDelegate.java
  31. 3
      lib_base/src/main/java/com/android/base/app/fragment/FragmentDelegateOwner.java
  32. 9
      lib_base/src/main/java/com/android/base/app/fragment/FragmentDelegates.java
  33. 2
      lib_base/src/main/java/com/android/base/app/fragment/FragmentInfo.java
  34. 10
      lib_base/src/main/java/com/android/base/app/fragment/Fragments.kt
  35. 7
      lib_base/src/main/java/com/android/base/app/fragment/LazyDelegate.java
  36. 3
      lib_base/src/main/java/com/android/base/app/fragment/RefreshableStateLayoutImpl.java
  37. 7
      lib_base/src/main/java/com/android/base/app/fragment/TabManager.java
  38. 2
      lib_base/src/main/java/com/android/base/app/mvp/AbstractPresenter.kt
  39. 2
      lib_base/src/main/java/com/android/base/app/mvp/PresenterBinder.kt
  40. 1
      lib_base/src/main/java/com/android/base/app/mvp/RxPresenter.kt
  41. 5
      lib_base/src/main/java/com/android/base/app/mvvm/ArchViewModel.kt
  42. 2
      lib_base/src/main/java/com/android/base/app/mvvm/ViewModelEx.kt
  43. 3
      lib_base/src/main/java/com/android/base/app/ui/LoadingView.java
  44. 3
      lib_base/src/main/java/com/android/base/app/ui/RefreshViewFactory.java
  45. 5
      lib_base/src/main/java/com/android/base/app/ui/StateLayoutConfig.java
  46. 3
      lib_base/src/main/java/com/android/base/app/ui/SwipeRefreshView.java
  47. 4
      lib_base/src/main/java/com/android/base/data/Resource.java
  48. 7
      lib_base/src/main/java/com/android/base/imageloader/GlideImageLoader.java
  49. 11
      lib_base/src/main/java/com/android/base/imageloader/ImageLoader.java
  50. 4
      lib_base/src/main/java/com/android/base/imageloader/ProgressGlideModule.java
  51. 2
      lib_base/src/main/java/com/android/base/imageloader/ProgressInfo.java
  52. 4
      lib_base/src/main/java/com/android/base/imageloader/ProgressManager.java
  53. 2
      lib_base/src/main/java/com/android/base/imageloader/ProgressResponseBody.java
  54. 3
      lib_base/src/main/java/com/android/base/interfaces/OnItemClickListener.java
  55. 11
      lib_base/src/main/java/com/android/base/interfaces/adapter/DrawerListenerAdapter.java
  56. 3
      lib_base/src/main/java/com/android/base/interfaces/adapter/OnPageChangeListenerAdapter.java
  57. 3
      lib_base/src/main/java/com/android/base/interfaces/adapter/OnTabSelectedListenerAdapter.java
  58. 3
      lib_base/src/main/java/com/android/base/interfaces/adapter/TransitionListenerAdapter.java
  59. 5
      lib_base/src/main/java/com/android/base/kotlin/AttrStyleEx.kt
  60. 6
      lib_base/src/main/java/com/android/base/kotlin/ContextEx.kt
  61. 8
      lib_base/src/main/java/com/android/base/kotlin/FragmentEx.kt
  62. 2
      lib_base/src/main/java/com/android/base/kotlin/LiveDataEx.kt
  63. 6
      lib_base/src/main/java/com/android/base/kotlin/MenuEx.kt
  64. 2
      lib_base/src/main/java/com/android/base/kotlin/TextViewEx.kt
  65. 11
      lib_base/src/main/java/com/android/base/kotlin/ViewEx.kt
  66. 6
      lib_base/src/main/java/com/android/base/permission/AutoPermissionFragment.java
  67. 13
      lib_base/src/main/java/com/android/base/permission/AutoPermissionRequester.java
  68. 3
      lib_base/src/main/java/com/android/base/permission/DefaultPermissionUIProvider.java
  69. 6
      lib_base/src/main/java/com/android/base/permission/EasyPermissions.java
  70. 3
      lib_base/src/main/java/com/android/base/permission/IPermissionUIProvider.java
  71. 5
      lib_base/src/main/java/com/android/base/permission/PermissionUtils.java
  72. 4
      lib_base/src/main/java/com/android/base/rx/AutoDispose.kt
  73. 5
      lib_base/src/main/java/com/android/base/rx/FlowableRetryDelay.java
  74. 5
      lib_base/src/main/java/com/android/base/rx/ObservableRetryDelay.java
  75. 2
      lib_base/src/main/java/com/android/base/rx/RxBus.java
  76. 7
      lib_base/src/main/java/com/android/base/utils/android/ActFragWrapper.java
  77. 2
      lib_base/src/main/java/com/android/base/utils/android/DevicesUtils.java
  78. 2
      lib_base/src/main/java/com/android/base/utils/android/DirectoryUtils.java
  79. 9
      lib_base/src/main/java/com/android/base/utils/android/ResourceUtils.java
  80. 3
      lib_base/src/main/java/com/android/base/utils/android/TintUtils.java
  81. 3
      lib_base/src/main/java/com/android/base/utils/android/VideoUtils.java
  82. 7
      lib_base/src/main/java/com/android/base/utils/android/ViewUtils.java
  83. 3
      lib_base/src/main/java/com/android/base/utils/android/WebViewUtils.java
  84. 5
      lib_base/src/main/java/com/android/base/utils/android/WindowUtils.java
  85. 8
      lib_base/src/main/java/com/android/base/utils/android/XAppUtils.java
  86. 3
      lib_base/src/main/java/com/android/base/utils/android/XIntentUtils.java
  87. 9
      lib_base/src/main/java/com/android/base/utils/android/anim/ActivityAnimUtils.java
  88. 2
      lib_base/src/main/java/com/android/base/utils/android/compat/SystemBarCompat.java
  89. 3
      lib_base/src/main/java/com/android/base/utils/android/text/HtmlBuilder.java
  90. 1
      lib_base/src/main/java/com/android/base/utils/android/text/RoundedBackgroundSpan.java
  91. 5
      lib_base/src/main/java/com/android/base/widget/MultiStateView.java
  92. 5
      lib_base/src/main/java/com/android/base/widget/ScrollChildSwipeRefreshLayout.java
  93. 3
      lib_base/src/main/java/com/android/base/widget/SimpleLayout.java
  94. 2
      lib_base/src/main/java/com/android/base/widget/SimpleMultiStateView.java
  95. 7
      lib_base/src/main/java/com/android/base/widget/StateActionProcessor.java
  96. 3
      lib_base/src/main/java/com/android/base/widget/StateProcessor.java
  97. 53
      lib_base/src/main/java/com/android/base/widget/pulltozoom/NestedScrollView.java
  98. 2
      lib_base/src/main/java/com/android/base/widget/pulltozoom/PullToZoomScrollView.java
  99. 3
      lib_base/src/main/java/com/android/base/widget/ratio/RatioImageView.java
  100. 2
      lib_base/src/main/java/com/android/base/widget/ratio/RatioLayout.java
  101. Some files were not shown because too many files have changed in this diff Show More

@ -1,349 +0,0 @@
class Repository {
Map<String, String> androidLibraries
Map<String, String> kotlinLibraries
Map<String, String> thirdLibraries
Map<String, String> uiLibraries
Map<String, String> debugLibraries
Map<String, String> testLibraries
}
ext {
newRepository = this.&innerNewRepository
}
static Repository innerNewRepository() {
def androidLibrariesVersion = "28.0.0"
def android_plugin_version = '3.1.4'
def androidLibraries = [
//https://developer.android.com/topic/libraries/support-library/features.html
androidCompatV4 : "com.android.support:support-v4:${androidLibrariesVersion}",//v4 all
androidCompatV7 : "com.android.support:appcompat-v7:${androidLibrariesVersion}",
androidCompatV13 : "com.android.support:support-v13:${androidLibrariesVersion}",
androidDesign : "com.android.support:design:${androidLibrariesVersion}",
androidPrecent : "com.android.support:percent:${androidLibrariesVersion}",
androidAnnotations : "com.android.support:support-annotations:${androidLibrariesVersion}",
androidCard : "com.android.support:cardview-v7:${androidLibrariesVersion}",
androidRecyclerView : "com.android.support:recyclerview-v7:${androidLibrariesVersion}",
transition : "com.android.support:transition:${androidLibrariesVersion}",
androidExif : "com.android.support:exifinterface:${androidLibrariesVersion}",
gridlayout : "com.android.support:gridlayout-v7:${androidLibrariesVersion}",
dynamicAnimation : "com.android.support:support-dynamic-animation:${androidLibrariesVersion}",
constraintLayout : 'com.android.support.constraint:constraint-layout:1.1.3',
multiDex : "com.android.support:multidex:1.0.2",
dataBinding : "com.android.databinding:compiler:${android_plugin_version}",
//lifecycle
lifecycle : "android.arch.lifecycle:runtime:1.1.1",//not necessary if you are using lifecycle:extensions or lifecycle:common-java8
lifecycleAPT : "android.arch.lifecycle:compiler:1.1.1",// not needed if you are using the DefaultLifecycleObserver from common-java8 artifact.
lifecycleJava8 : "android.arch.lifecycle:common-java8:1.1.1",
//LiveData, and ViewModel
lifecycleExtensions : "android.arch.lifecycle:extensions:1.1.1",//For LiveData, and ViewModel
liveDataReactiveStreams: "android.arch.lifecycle:reactivestreams:1.1.1",//To use LiveData with ReactiveStreams API
//room
room : "android.arch.persistence.room:runtime:1.0.0",
roomApt : "android.arch.persistence.room:compiler:1.0.0",
roomRxJava2 : "android.arch.persistence.room:rxjava2:1.0.0",
roomGuava : "android.arch.persistence.room:guava:1.1.0-beta3",
//paging
paging : "android.arch.paging:runtime:1.0.0",
//https://github.com/google/flexbox-layout/
flexbox : 'com.google.android:flexbox:1.0.0',
]
def anko_version = '0.10.7'
def kotlin_version = '1.3.41'
def kotlinLibraries = [
//Kotlin
kotlinStdlib : "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version",
kotlinReflect : "org.jetbrains.kotlin:kotlin-reflect:$kotlin_version",
kotlinCoroutines : 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.1.0',//
kotlinAndroidCoroutines : "org.jetbrains.kotlinx:kotlinx-coroutines-android:1.1.0",
//https://github.com/JakeWharton/retrofit2-kotlin-coroutines-adapter
retrofitKotlinAdapter : 'com.jakewharton.retrofit:retrofit2-kotlin-coroutines-experimental-adapter:1.0.0',
//https://github.com/android/android-ktxandroid_ktx: A set of Kotlin extensions for Android app development
//https://android.github.io/android-ktx/core-ktx/index.html
androidKTX : 'androidx.core:core-ktx:1.0.0',
//https://github.com/ReactiveX/RxKotlin
rxKotlin : 'io.reactivex.rxjava2:rxkotlin:2.2.0',
//https://github.com/enbandari/KotlinTuples
tuples : "com.bennyhuo.kotlin:kotlin-tuples:1.0",
//https://github.com/enbandari/ObjectPropertyDelegate
objectPropertyDelegate : "com.bennyhuo.kotlin:opd:1.0-rc-2",
//https://github.com/enbandari/KotlinDeepCopy
deepCopyReflect : "com.bennyhuo.kotlin:deepcopy-reflect:1.0",
deepCopy : "com.bennyhuo.kotlin:deepcopy-annotations:1.1.0",
deepCopyApt : "com.bennyhuo.kotlin:deepcopy-compiler:1.1.0",
//https://github.com/enbandari/ReleasableVar
releasableVar : "com.bennyhuo.kotlin:releasable-nonnull-vars:1.1.0",
//kotlin functional, https://arrow-kt.io/
arrowCore : "io.arrow-kt:arrow-core:0.8.2",
//============================================================================
//Anko
//============================================================================
// Anko https://github.com/Kotlin/anko
ankoAll : "org.jetbrains.anko:anko:${anko_version}",
ankoCommons : "org.jetbrains.anko:anko-commons:$anko_version",// Anko Commons
ankoCommonsV4 : "org.jetbrains.anko:anko-support-v4-commons:$anko_version",
ankoCommonsV7 : "org.jetbrains.anko:anko-appcompat-v7-commons:$anko_version",
ankoSQLite : "org.jetbrains.anko:anko-sqlite:$anko_version", // Anko SQLite
// Anko Layouts , sdk15, sdk19, sdk21, sdk23 are also available, sdk
ankoLayoutSDK : "org.jetbrains.anko:anko-sdk27:$anko_version",
ankoLayoutCompatV7 : "org.jetbrains.anko:anko-appcompat-v7:$anko_version",
ankoLayoutCompatV4 : "org.jetbrains.anko:anko-support-v4:$anko_version",
ankoLayoutDesign : "org.jetbrains.anko:anko-design:$anko_version",
ankoLayoutRecyclerView : "org.jetbrains.anko:anko-recyclerview-v7:$anko_version",
ankoLayoutCardView : "org.jetbrains.anko:anko-cardview-v7:$anko_version",
ankoLayoutGridLayout : "org.jetbrains.anko:anko-gridlayout-v7:$anko_version",
ankoLayoutPercent : "org.jetbrains.anko:anko-percent:$anko_version",
ankoCoroutines : "org.jetbrains.anko:anko-coroutines:$anko_version", //anko Coroutines
ankoLayoutCoroutine : "org.jetbrains.anko:anko-sdk25-coroutines:$anko_version", //Anko Layouts Coroutine listeners
ankoLayoutCompatV7Coroutine: "org.jetbrains.anko:anko-appcompat-v7-coroutines:$anko_version",
ankoDesignCoroutine : "org.jetbrains.anko:anko-design-coroutines:$anko_version",
ankoRecyclerViewCoroutines : "org.jetbrains.anko:anko-recyclerview-v7-coroutines:$anko_version"
]
def rxBindingVersion = '2.1.1'
def autoDisposeVersion = '1.0.0-RC3'
def retrofitVersion = '2.5.0'
def daggerVersion = "2.17"
def thirdLibraries = [
//============================================================================
//RxJava
//============================================================================
//https://github.com/ReactiveX/RxJava
rxJava : "io.reactivex.rxjava2:rxjava:2.2.9",
//https://github.com/ReactiveX/RxAndroid
rxAndroid : 'io.reactivex.rxjava2:rxandroid:2.1.1',
//https://github.com/JakeWharton/RxBinding
rxBinding : "com.jakewharton.rxbinding2:rxbinding:$rxBindingVersion",
rxBindingV4 : "com.jakewharton.rxbinding2:rxbinding-support-v4:$rxBindingVersion",
rxBindingCompat : "com.jakewharton.rxbinding2:rxbinding-appcompat-v7:$rxBindingVersion",
rxBindingDesign : "com.jakewharton.rxbinding2:rxbinding-design:$rxBindingVersion",
rxBindingRecyclerView : "com.jakewharton.rxbinding2:rxbinding-recyclerview-v7:$rxBindingVersion",
//https://github.com/uber/AutoDispose
autoDispose : "com.uber.autodispose:autodispose:$autoDisposeVersion",
autoDisposeLifecycleJDK8 : "com.uber.autodispose:autodispose-lifecycle-jdk8:$autoDisposeVersion",
autoDisposeLifecycleArchcomponents: "com.uber.autodispose:autodispose-android-archcomponents:$autoDisposeVersion",
//https://github.com/uber/RxDogTag
rxDogTag : "com.uber.rxdogtag:rxdogtag:0.1.0",
//RxReplay https://github.com/JakeWharton/RxRelay
rxReplay : 'com.jakewharton.rxrelay2:rxrelay:2.0.0',
//============================================================================
//OkHttp&Retrofit&Gson&Glide
//============================================================================
//https://github.com/square/okhttp & https://github.com/square/retrofit
okHttp : "com.squareup.okhttp3:okhttp:3.12.0",
okHttpLogging : "com.squareup.okhttp3:logging-interceptor:3.12.0",
retrofit : "com.squareup.retrofit2:retrofit:${retrofitVersion}",
retrofitConverterGson : "com.squareup.retrofit2:converter-gson:${retrofitVersion}",
retrofitRxJavaCallAdapter : "com.squareup.retrofit2:adapter-rxjava:${retrofitVersion}",
retrofitRxJava2CallAdapter : "com.squareup.retrofit2:adapter-rxjava2:${retrofitVersion}",
////https://github.com/google/gson/blob/master/UserGuide.md#TOC-Overview
gson : "com.google.code.gson:gson:2.8.5",
//https://github.com/bumptech/glide
glide : "com.github.bumptech.glide:glide:4.8.0",
glideApt : 'com.github.bumptech.glide:compiler:4.8.0',
glideOkHttp : 'com.github.bumptech.glide:okhttp3-integration:4.8.0',
//============================================================================
//DI
//============================================================================
//https://github.com/google/dagger
dagger2 : "com.google.dagger:dagger:$daggerVersion",
dagger2Android : "com.google.dagger:dagger-android:$daggerVersion",
dagger2AndroidSupport : "com.google.dagger:dagger-android-support:$daggerVersion",
dagger2Apt : "com.google.dagger:dagger-compiler:$daggerVersion",
dagger2AndroidApt : "com.google.dagger:dagger-android-processor:$daggerVersion",
jsr305 : 'com.google.code.findbugs:jsr305:2.0.1',
//============================================================================
//ARouter
//============================================================================
//https://github.com/alibaba/ARouterapt arouter apt dagger
arouter : 'com.alibaba:arouter-api:1.4.1',
arouterAnnotation : 'com.alibaba:arouter-compiler:1.2.2',
//============================================================================
//AOP
//============================================================================
/*aspectJrt*/
aspectj : 'org.aspectj:aspectjrt:1.8.9', //https://eclipse.org/aspectj/
//============================================================================
//Utils
//============================================================================
//kv存储https://github.com/tencent/mmkvhttps://mp.weixin.qq.com/s/kTr1GVDCAhs5K7Hq3322FA
mmkv : 'com.tencent:mmkv:1.0.17',
//https://github.com/dmstocking/support-optional
supportOptional : 'com.github.dmstocking:support-optional:1.2',
//https://github.com/JakeWharton/timber
timber : "com.jakewharton.timber:timber:4.5.1",
//https://github.com/jOOQ/jOOR
jOOR : "org.jooq:joor-java-6:0.9.7",
//https://github.com/Blankj/AndroidUtilCode
utilcode : 'com.blankj:utilcode:1.23.7',
//https://github.com/yanzhenjie/AndPermission
andPermission : 'com.yanzhenjie.permission:support:2.0.1',
//image compressionhttps://github.com/Sunzxyong/Tiny
tiny : 'com.zxy.android:tiny:1.1.0',
//zip4j
zip4j : 'net.lingala.zip4j:zip4j:1.3.2',
//JobSchedulerhttps://github.com/evernote/android-job
androidJob : 'com.evernote:android-job:1.2.0',
//VideoCache/https://github.com/danikula/AndroidVideoCache
videoCache : 'com.danikula:videocache:2.7.0',
//https://github.com/promeG/TinyPinyin
tinypinyin : 'com.github.promeg:tinypinyin:2.0.3',
//https://github.com/Tencent/VasDolly
vasDolly : 'com.leon.channel:helper:2.0.3',
//Android P https://github.com/tiann/FreeReflection
freeReflection : 'me.weishu:free_reflection:1.2.0'
]
def debugLibraries = [
//https://github.com/square/leakcanary
debugLeakCanary : "com.squareup.leakcanary:leakcanary-android:1.6.3",
debugLeakCanaryFragment: "com.squareup.leakcanary:leakcanary-support-fragment:1.6.3",
releaseLeakCanary : "com.squareup.leakcanary:leakcanary-android-no-op:1.6.3",
//https://github.com/markzhai/AndroidPerformanceMonitor
//http://blog.zhaiyifan.cn/2016/01/16/BlockCanaryTransparentPerformanceMonitor/
debugBlockCanary : "com.github.markzhai:blockcanary-android:1.4.0",
releaseBlockCanary : "com.github.markzhai:blockcanary-no-op:1.4.0",
//http://facebook.github.io/stetho/
stetho : 'com.facebook.stetho:stetho:1.4.2',
stethoOkhttp3 : 'com.facebook.stetho:stetho-okhttp3:1.4.2',
//https://github.com/eleme/UETool ui调试工具
ueTool : 'me.ele:uetool:1.2.1',
//https://github.com/Kyson/AndroidGodEye
godeyeCore : 'cn.hikyson.godeye:godeye-core:2.1.1',
godeyeMonitor : 'cn.hikyson.godeye:godeye-monitor:2.1.1',
godeyeToolbox : 'cn.hikyson.godeye:godeye-toolbox:2.1.1',
]
def uiLibraries = [
//qmuihttps://qmuiteam.com/
qmui : 'com.qmuiteam:qmui:1.1.3',
//https://github.com/GcsSloop/rclayout
rclayout : 'com.gcssloop.widget:rclayout:1.6.0',
/*adapter*/
//https://github.com/drakeet/MultiType
multiType : 'me.drakeet.multitype:multitype:3.4.4',
multiTypeKotlin : 'me.drakeet.multitype:multitype-kotlin:3.4.4',
// https://github.com/Ztiany/WrapperAdapter
wrapperAdapter : 'com.github.Ztiany:WrapperAdapter:3.0.7',
/*image view about*/
//https://github.com/chrisbanes/PhotoView
photoView : 'com.github.chrisbanes:PhotoView:2.1.3',
rotatePhotoView :'com.chensl.rotatephotoview:rotatephotoview:1.0.5',
//https://github.com/davemorrissey/subsampling-scale-image-view
subsamplingScaleImageView: 'com.davemorrissey.labs:subsampling-scale-image-view:3.10.0',
//https://github.com/hdodenhof/CircleImageView
circleImageView : 'de.hdodenhof:circleimageview:2.1.0',
//https://github.com/vinc3m1/RoundedImageView
roundedImageView : 'com.makeramen:roundedimageview:2.3.0',
//https://github.com/Piasy/BigImageViewer
bigImageViewer : 'com.github.piasy:BigImageViewer:1.5.0',
//https://github.com/Piasy/BigImageViewer
bigImageViewerGlideLoader: 'com.github.piasy:GlideImageLoader:1.5.0',
//https://github.com/iielse/ImageWatcher仿
imageWatcher : 'com.github.iielse:ImageWatcher:1.1.1',
//https://github.com/stfalcon-studio/StfalconImageViewer
stfalconImageviewer : 'com.github.stfalcon:stfalcon-imageviewer:0.1.0',
//https://github.com/gjiazhe/ScrollParallaxImageView
scrollparallaximageview : 'com.gjiazhe:scrollparallaximageview:1.0',
/*view pager about*/
//https://github.com/HuanHaiLiuXin/CoolViewPager
coolviewpager : 'com.huanhailiuxin.view:coolviewpager:1.0.0',
//https://github.com/geftimov/android-viewpager-transformers
viewpagerTransformers : 'com.eftimoff:android-viewpager-transformers:1.0.1@aar',
//https://github.com/ogaclejapan/SmartTabLayout
smartTab : 'com.ogaclejapan.smarttablayout:library:1.6.1@aar',
/*camera*/
//https://github.com/Fotoapparat/Fotoapparat
fotoapparat : 'io.fotoapparat:fotoapparat:2.5.0',
//https://github.com/CameraKit/camerakit-android
cameraKit : 'com.camerakit:camerakit:1.0.0-beta3.10',
//need kotlin and kotlinx-coroutines-android
camerakitJpegkit : 'com.camerakit:jpegkit:0.1.0',
//https://github.com/natario1/CameraView
cameraView : 'com.otaliastudios:cameraview:1.3.1',
//picker about
//https://github.com/wdullaer/MaterialDateTimePicker
materialTimePicker : 'com.wdullaer:materialdatetimepicker:3.6.4',
//https://github.com/gzu-liyujiang/AndroidPicker
androidWheelPicker : "com.github.gzu-liyujiang.AndroidPicker:WheelPicker:1.5.6",
//https://github.com/zyyoona7/WheelPicker, it don't support setting max or min date.
wheelWiewPicker : "com.github.zyyoona7:wheelview:1.0.5",
/*text view*/
//https://github.com/chenBingX/SuperTextView
superTextView : 'com.github.chenBingX:SuperTextView:v3.1.4',
//https://github.com/iwgang/CountdownView
countdownView : 'com.github.iwgang:countdownview:2.1.3',
/*shape, tag*/
//https://github.com/florent37/ShapeOfView, need android x
shapeOfView : 'com.github.florent37:shapeofview:1.4.5',
//https://github.com/whilu/AndroidTagView
androidtagView : 'co.lujun:androidtagview:1.0.6',
//https://github.com/duanhong169/DrawableToolbox
drawableToolbox : "com.github.duanhong169:drawabletoolbox:1.0.5",
/*recycler view about*/
//https://github.com/GcsSloop/pager-layoutmanager
pagerlayoutmanager : 'com.gcssloop.recyclerview:pagerlayoutmanager:2.3.2@aar',
//https://github.com/alibaba/vlayout
vlayout : 'com.alibaba.android:vlayout:1.0.4@aar',
//https://github.com/DingMouRen/LayoutManagerGroup
layoutManagerGroup : 'com.github.DingMouRen:LayoutManagerGroup:f68c9712e5',
//https://github.com/lsjwzh/RecyclerViewPager
recyclerViewPager : 'com.github.lsjwzh.RecyclerViewPager:lib:v1.1.2',
//system ui managerhttps://github.com/DreaminginCodeZH/SystemUiHelper
systemUiHelper : 'me.zhanghai.android.systemuihelper:library:1.0.0',
//soft input methodhttps://github.com/yshrsmz/KeyboardVisibilityEvent
keyboardvisibilityevent : 'net.yslibrary.keyboardvisibilityevent:keyboardvisibilityevent:2.0.0',
]
def testLibraries = [
junit : "junit:junit:4.12",
mockito: "org.mockito:mockito-core:1.10.19"
]
def repository = new Repository()
repository.androidLibraries = androidLibraries
repository.kotlinLibraries = kotlinLibraries
repository.thirdLibraries = thirdLibraries
repository.debugLibraries = debugLibraries
repository.uiLibraries = uiLibraries
repository.testLibraries = testLibraries
return repository
}

@ -41,30 +41,8 @@ android {
targetCompatibility JavaVersion.VERSION_1_8 targetCompatibility JavaVersion.VERSION_1_8
} }
sourceSets {
main {
java.srcDirs += "src/github/java"
res.srcDirs += "src/github/res"
}
}
project.afterEvaluate {
Task assembleReleaseTask = project.tasks.findByPath("assembleRelease")
if (assembleReleaseTask != null) {
assembleReleaseTask.doLast {
File infile = project.file("build/outputs/aar/")
File outfile = project.file("./release")
project.copy {
from infile
into outfile
}
}
}
}
} }
dependencies { dependencies {
api fileTree(dir: 'libs', include: ['*.jar']) api fileTree(dir: 'libs', include: ['*.jar'])
@ -72,18 +50,27 @@ dependencies {
testImplementation testLibraries.junit testImplementation testLibraries.junit
//AndroidSupport //AndroidSupport
api androidLibraries.androidCompatV4 api androidLibraries.supportV4
api androidLibraries.androidCompatV7 api androidLibraries.appcompat
api androidLibraries.androidRecyclerView api androidLibraries.recyclerview
api androidLibraries.androidDesign api androidLibraries.material
api androidLibraries.androidPrecent api androidLibraries.percentLayout
api androidLibraries.constraintLayout api androidLibraries.constraintLayout
api androidLibraries.annotation
//AAC //AAC
api androidLibraries.lifecycle api androidLibraries. archRuntime
api androidLibraries.lifecycleJava8 api androidLibraries. archCommon
api androidLibraries.lifecycleExtensions api androidLibraries. lifecycleCommon
api androidLibraries.liveDataReactiveStreams api androidLibraries. lifecycleCommonJava8
api androidLibraries. lifecycleRuntimeKtx
api androidLibraries. lifecycleLiveDataCore
api androidLibraries. lifecycleLiveData
api androidLibraries. lifecycleLiveKtx
api androidLibraries. lifecycleViewModel
api androidLibraries. lifecycleViewModelKtx
api androidLibraries. lifecycleExtensions
api androidLibraries. lifecycleReactiveStreams
//Kotlin //Kotlin
api kotlinLibraries.kotlinStdlib api kotlinLibraries.kotlinStdlib
@ -126,4 +113,4 @@ dependencies {
api thirdLibraries.jOOR api thirdLibraries.jOOR
api thirdLibraries.supportOptional api thirdLibraries.supportOptional
} }

@ -1,12 +1,13 @@
package com.android.base.adapter; package com.android.base.adapter;
import android.support.annotation.IdRes;
import android.support.annotation.NonNull;
import android.support.annotation.StringRes;
import android.util.SparseArray; import android.util.SparseArray;
import android.view.View; import android.view.View;
import android.widget.TextView; import android.widget.TextView;
import androidx.annotation.IdRes;
import androidx.annotation.NonNull;
import androidx.annotation.StringRes;
/** /**
* @author Ztiany * @author Ztiany

@ -1,7 +1,6 @@
package com.android.base.adapter.list; package com.android.base.adapter.list;
import android.content.Context; import android.content.Context;
import android.support.annotation.NonNull;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
@ -12,6 +11,8 @@ import com.android.base.adapter.DataManager;
import java.util.List; import java.util.List;
import androidx.annotation.NonNull;
/** /**
* absListView通用的Adapter,注意只有setDataSource才能替换原有数据源的引用 * absListView通用的Adapter,注意只有setDataSource才能替换原有数据源的引用
* *

@ -1,13 +1,14 @@
package com.android.base.adapter.pager; package com.android.base.adapter.pager;
import android.content.Context; import android.content.Context;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentManager;
import androidx.fragment.app.FragmentPagerAdapter;
@SuppressWarnings("unused") @SuppressWarnings("unused")
public class ViewPageFragmentAdapter extends FragmentPagerAdapter { public class ViewPageFragmentAdapter extends FragmentPagerAdapter {

@ -1,13 +1,15 @@
package com.android.base.adapter.pager; package com.android.base.adapter.pager;
import android.os.Bundle; import android.os.Bundle;
import android.support.v4.app.Fragment;
import androidx.fragment.app.Fragment;
@SuppressWarnings("all") @SuppressWarnings("all")
public class ViewPageInfo { public class ViewPageInfo {
public final Class<? extends Fragment> clazz; public final Class<? extends Fragment> clazz;
public final Bundle args; public final Bundle args;
public final String title; public final String title;
public ViewPageInfo(String title, Class<? extends Fragment> clazz, Bundle args) { public ViewPageInfo(String title, Class<? extends Fragment> clazz, Bundle args) {
this.title = title; this.title = title;

@ -1,13 +1,16 @@
package com.android.base.adapter.pager; package com.android.base.adapter.pager;
import android.content.Context; import android.content.Context;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager; import org.jetbrains.annotations.NotNull;
import android.support.v4.app.FragmentStatePagerAdapter;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentManager;
import androidx.fragment.app.FragmentStatePagerAdapter;
public class ViewPageStateFragmentAdapter extends FragmentStatePagerAdapter { public class ViewPageStateFragmentAdapter extends FragmentStatePagerAdapter {
private final List<ViewPageInfo> mTabs; private final List<ViewPageInfo> mTabs;
@ -29,6 +32,7 @@ public class ViewPageStateFragmentAdapter extends FragmentStatePagerAdapter {
return mTabs.size(); return mTabs.size();
} }
@NotNull
@Override @Override
public Fragment getItem(int position) { public Fragment getItem(int position) {
ViewPageInfo viewPageInfo = mTabs.get(position); ViewPageInfo viewPageInfo = mTabs.get(position);
@ -44,5 +48,4 @@ public class ViewPageStateFragmentAdapter extends FragmentStatePagerAdapter {
return mTabs; return mTabs;
} }
}
}

@ -1,7 +1,5 @@
package com.android.base.adapter.pager; package com.android.base.adapter.pager;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
@ -11,6 +9,9 @@ import com.android.base.utils.common.Checker;
import java.util.List; import java.util.List;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
/** /**
* 如果使用可缩放的 View 作为 pager可能不适合使用此Adapter * 如果使用可缩放的 View 作为 pager可能不适合使用此Adapter
* *

@ -1,10 +1,11 @@
package com.android.base.adapter.pager.recycler; package com.android.base.adapter.pager.recycler;
import android.support.v4.view.PagerAdapter;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
import android.widget.AdapterView; import android.widget.AdapterView;
import androidx.viewpager.widget.PagerAdapter;
/** /**
* A {@link PagerAdapter} which behaves like an {@link android.widget.Adapter} with view types and view recycling. * A {@link PagerAdapter} which behaves like an {@link android.widget.Adapter} with view types and view recycling.
* *

@ -4,12 +4,6 @@ import android.app.Activity;
import android.app.Application; import android.app.Application;
import android.content.Context; import android.content.Context;
import android.os.Bundle; import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.annotation.UiThread;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentActivity;
import android.support.v4.app.FragmentManager;
import com.android.base.app.dagger.Injectable; import com.android.base.app.dagger.Injectable;
import com.android.base.app.fragment.FragmentConfig; import com.android.base.app.fragment.FragmentConfig;
@ -22,6 +16,12 @@ import com.android.base.receiver.NetworkState;
import com.blankj.utilcode.util.ActivityUtils; import com.blankj.utilcode.util.ActivityUtils;
import com.blankj.utilcode.util.AppUtils; import com.blankj.utilcode.util.AppUtils;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.annotation.UiThread;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentActivity;
import androidx.fragment.app.FragmentManager;
import dagger.android.AndroidInjection; import dagger.android.AndroidInjection;
import dagger.android.support.AndroidSupportInjection; import dagger.android.support.AndroidSupportInjection;
import io.reactivex.Flowable; import io.reactivex.Flowable;

@ -16,11 +16,11 @@
package com.android.base.app.aac package com.android.base.app.aac
import android.arch.lifecycle.DefaultLifecycleObserver import androidx.fragment.app.Fragment
import android.arch.lifecycle.Lifecycle import androidx.fragment.app.FragmentActivity
import android.arch.lifecycle.LifecycleOwner import androidx.lifecycle.DefaultLifecycleObserver
import android.support.v4.app.Fragment import androidx.lifecycle.Lifecycle
import android.support.v4.app.FragmentActivity import androidx.lifecycle.LifecycleOwner
import kotlin.properties.ReadWriteProperty import kotlin.properties.ReadWriteProperty
import kotlin.reflect.KProperty import kotlin.reflect.KProperty

@ -1,7 +1,7 @@
package com.android.base.app.aac package com.android.base.app.aac
import android.arch.lifecycle.LiveData import androidx.lifecycle.LiveData
import android.arch.lifecycle.MutableLiveData import androidx.lifecycle.MutableLiveData
import com.android.base.data.Resource import com.android.base.data.Resource
import com.android.base.rx.subscribeIgnoreError import com.android.base.rx.subscribeIgnoreError
import com.github.dmstocking.optional.java.util.Optional import com.github.dmstocking.optional.java.util.Optional

@ -1,7 +1,7 @@
package com.android.base.app.aac package com.android.base.app.aac
import android.arch.lifecycle.LiveData import androidx.lifecycle.LiveData
import android.arch.lifecycle.MutableLiveData import androidx.lifecycle.MutableLiveData
import com.android.base.data.Resource import com.android.base.data.Resource
import com.android.base.rx.subscribeIgnoreError import com.android.base.rx.subscribeIgnoreError
import com.github.dmstocking.optional.java.util.Optional import com.github.dmstocking.optional.java.util.Optional

@ -1,48 +1,50 @@
package com.android.base.app.aac; package com.android.base.app.aac;
import android.arch.lifecycle.LifecycleOwner;
import android.arch.lifecycle.MediatorLiveData;
import android.arch.lifecycle.Observer;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import java.lang.ref.WeakReference; import java.lang.ref.WeakReference;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.ListIterator; import java.util.ListIterator;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.lifecycle.LifecycleOwner;
import androidx.lifecycle.MediatorLiveData;
import androidx.lifecycle.Observer;
import timber.log.Timber; import timber.log.Timber;
public class SingleLiveData<T> extends MediatorLiveData<T> { public class SingleLiveData<T> extends MediatorLiveData<T> {
private int mVersion = 0; private int mVersion = 0;
private final List<WeakReference<ObserverWrapper<T>>> mWrapperObserverList = new ArrayList<>(); private final List<WeakReference<ObserverWrapper<? super T>>> mWrapperObserverList = new ArrayList<>();
@Override @Override
public void observe(@NonNull LifecycleOwner owner, @NonNull Observer<T> observer) { public void setValue(T value) {
super.observe(owner, getOrNewObserver(observer, mVersion)); mVersion++;
super.setValue(value);
} }
@Override @Override
public void observeForever(@NonNull Observer<T> observer) { public void observe(@NonNull LifecycleOwner owner, @NonNull Observer<? super T> observer) {
super.observeForever(getOrNewObserver(observer, mVersion)); super.observe(owner, getOrNewObserver(observer, mVersion));
} }
@Override @Override
public void setValue(T value) { public void observeForever(@NonNull Observer<? super T> observer) {
mVersion++; super.observeForever(getOrNewObserver(observer, mVersion));
super.setValue(value);
} }
@Override @Override
public void removeObserver(@NonNull Observer<T> observer) { @SuppressWarnings("unchecked")
public void removeObserver(@NonNull Observer<? super T> observer) {
if (observer instanceof ObserverWrapper) { if (observer instanceof ObserverWrapper) {
super.removeObserver(observer); super.removeObserver(observer);
removeWrapper((ObserverWrapper) observer); removeWrapper((ObserverWrapper) observer);
Timber.d("removeObserver() called with: observer = wrapper = [" + observer + "]"); Timber.d("removeObserver() called with: observer = wrapper = [" + observer + "]");
} else { } else {
ObserverWrapper<T> wrapper = findWrapper(observer); ObserverWrapper<? super T> wrapper = findWrapper(observer);
Timber.d("removeObserver() called with: observer = [" + observer + "], wrapper = [" + wrapper + "]"); Timber.d("removeObserver() called with: observer = [" + observer + "], wrapper = [" + wrapper + "]");
super.removeObserver(wrapper); super.removeObserver(wrapper);
removeWrapper(wrapper); removeWrapper(wrapper);
@ -50,10 +52,10 @@ public class SingleLiveData<T> extends MediatorLiveData<T> {
} }
private void removeWrapper(ObserverWrapper observer) { private void removeWrapper(ObserverWrapper observer) {
ListIterator<WeakReference<ObserverWrapper<T>>> iterator = mWrapperObserverList.listIterator(); ListIterator<WeakReference<ObserverWrapper<? super T>>> iterator = mWrapperObserverList.listIterator();
while (iterator.hasNext()) { while (iterator.hasNext()) {
WeakReference<ObserverWrapper<T>> next = iterator.next(); WeakReference<ObserverWrapper<? super T>> next = iterator.next();
ObserverWrapper<T> item = next.get(); ObserverWrapper<? super T> item = next.get();
if (item == observer) { if (item == observer) {
iterator.remove(); iterator.remove();
break; break;
@ -61,14 +63,14 @@ public class SingleLiveData<T> extends MediatorLiveData<T> {
} }
} }
private ObserverWrapper<T> findWrapper(Observer<T> observer) { private ObserverWrapper<? super T> findWrapper(Observer<? super T> observer) {
ListIterator<WeakReference<ObserverWrapper<T>>> iterator = mWrapperObserverList.listIterator(); ListIterator<WeakReference<ObserverWrapper<? super T>>> iterator = mWrapperObserverList.listIterator();
ObserverWrapper<T> target = null; ObserverWrapper<? super T> target = null;
while (iterator.hasNext()) { while (iterator.hasNext()) {
WeakReference<ObserverWrapper<T>> next = iterator.next(); WeakReference<ObserverWrapper<? super T>> next = iterator.next();
ObserverWrapper<T> item = next.get(); ObserverWrapper<? super T> item = next.get();
if (item == null) { if (item == null) {
iterator.remove(); iterator.remove();
} else if (item.mOrigin == observer) { } else if (item.mOrigin == observer) {
@ -79,8 +81,8 @@ public class SingleLiveData<T> extends MediatorLiveData<T> {
return target; return target;
} }
private Observer<T> getOrNewObserver(@NonNull Observer<T> observer, int observerVersion) { private Observer<? super T> getOrNewObserver(@NonNull Observer<? super T> observer, int observerVersion) {
ObserverWrapper<T> wrapper = findWrapper(observer); ObserverWrapper<? super T> wrapper = findWrapper(observer);
if (wrapper == null) { if (wrapper == null) {
wrapper = new ObserverWrapper<>(observerVersion, observer); wrapper = new ObserverWrapper<>(observerVersion, observer);

@ -1,15 +1,16 @@
package com.android.base.app.aac; package com.android.base.app.aac;
import android.arch.lifecycle.LifecycleOwner;
import android.arch.lifecycle.MutableLiveData;
import android.arch.lifecycle.Observer;
import android.support.annotation.MainThread;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.util.Log; import android.util.Log;
import java.util.concurrent.atomic.AtomicBoolean; 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 * A lifecycle-aware observable that sends only new updates after subscription, used for events like
@ -30,7 +31,7 @@ public class SingleLiveEvent<T> extends MutableLiveData<T> {
private final AtomicBoolean mPending = new AtomicBoolean(false); private final AtomicBoolean mPending = new AtomicBoolean(false);
@MainThread @MainThread
public void observe(@NonNull LifecycleOwner owner, @NonNull final Observer<T> observer) { public void observe(@NonNull LifecycleOwner owner, @NonNull final Observer<? super T> observer) {
if (hasActiveObservers()) { if (hasActiveObservers()) {
Log.w(TAG, "Multiple observers registered but only one will be notified of changes."); Log.w(TAG, "Multiple observers registered but only one will be notified of changes.");

@ -3,8 +3,9 @@ package com.android.base.app.activity;
import android.app.Activity; import android.app.Activity;
import android.content.Intent; import android.content.Intent;
import android.os.Bundle; import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable; import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
/** /**

@ -1,9 +1,10 @@
package com.android.base.app.activity; package com.android.base.app.activity;
import android.support.annotation.UiThread;
import com.github.dmstocking.optional.java.util.function.Predicate; import com.github.dmstocking.optional.java.util.function.Predicate;
import androidx.annotation.UiThread;
@UiThread @UiThread
@SuppressWarnings("unused") @SuppressWarnings("unused")
public interface ActivityDelegateOwner { public interface ActivityDelegateOwner {

@ -2,15 +2,16 @@ package com.android.base.app.activity;
import android.content.Intent; import android.content.Intent;
import android.os.Bundle; import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.annotation.UiThread;
import android.support.v7.app.AppCompatActivity;
import com.github.dmstocking.optional.java.util.function.Predicate; import com.github.dmstocking.optional.java.util.function.Predicate;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import androidx.annotation.Nullable;
import androidx.annotation.UiThread;
import androidx.appcompat.app.AppCompatActivity;
/** /**
* @author Ztiany * @author Ztiany
* Email: 1169654504@qq.com * Email: 1169654504@qq.com

@ -1,11 +1,11 @@
package com.android.base.app.activity; package com.android.base.app.activity;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentActivity;
import android.support.v4.app.FragmentManager;
import java.util.List; import java.util.List;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentActivity;
import androidx.fragment.app.FragmentManager;
/** /**
* <pre> * <pre>
* 1.Fragment需要自己处理BackPress事件如果不处理就交给子Fragment处理都不处理则由Activity处理 * 1.Fragment需要自己处理BackPress事件如果不处理就交给子Fragment处理都不处理则由Activity处理

@ -2,15 +2,15 @@ package com.android.base.app.activity;
import android.content.Intent; import android.content.Intent;
import android.os.Bundle; import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.annotation.UiThread;
import android.support.v7.app.AppCompatActivity;
import android.view.View; import android.view.View;
import com.android.base.utils.android.compat.AndroidVersion; import com.android.base.utils.android.compat.AndroidVersion;
import com.github.dmstocking.optional.java.util.function.Predicate; import com.github.dmstocking.optional.java.util.function.Predicate;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.annotation.UiThread;
import androidx.appcompat.app.AppCompatActivity;
import timber.log.Timber; import timber.log.Timber;
/** /**

@ -1,14 +1,15 @@
package com.android.base.app.dagger; package com.android.base.app.dagger;
import android.arch.lifecycle.ViewModel;
import android.arch.lifecycle.ViewModelProvider;
import android.support.annotation.NonNull;
import java.util.Map; import java.util.Map;
import javax.inject.Inject; import javax.inject.Inject;
import javax.inject.Provider; import javax.inject.Provider;
import androidx.annotation.NonNull;
import androidx.lifecycle.ViewModel;
import androidx.lifecycle.ViewModelProvider;
/** /**
* @author Ztiany * @author Ztiany
* Email: ztiany3@gmail.com * Email: ztiany3@gmail.com

@ -1,7 +1,7 @@
package com.android.base.app.dagger; package com.android.base.app.dagger;
import android.arch.lifecycle.ViewModel;
import androidx.lifecycle.ViewModel;
import dagger.MapKey; import dagger.MapKey;
import kotlin.annotation.AnnotationTarget; import kotlin.annotation.AnnotationTarget;
import kotlin.annotation.MustBeDocumented; import kotlin.annotation.MustBeDocumented;
@ -15,4 +15,5 @@ import kotlin.annotation.Target;
public @interface ViewModelKey { public @interface ViewModelKey {
Class<? extends ViewModel> value(); Class<? extends ViewModel> value();
} }

@ -1,7 +1,6 @@
package com.android.base.app.dagger; package com.android.base.app.dagger;
import android.arch.lifecycle.ViewModelProvider; import androidx.lifecycle.ViewModelProvider;
import dagger.Binds; import dagger.Binds;
import dagger.Module; import dagger.Module;

@ -3,11 +3,6 @@ package com.android.base.app.fragment;
import android.content.Context; import android.content.Context;
import android.content.Intent; import android.content.Intent;
import android.os.Bundle; import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.annotation.StringRes;
import android.support.annotation.UiThread;
import android.support.v7.app.AppCompatDialogFragment;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
@ -18,6 +13,11 @@ import com.android.base.app.activity.OnBackPressListener;
import com.android.base.app.ui.LoadingView; import com.android.base.app.ui.LoadingView;
import com.github.dmstocking.optional.java.util.function.Predicate; import com.github.dmstocking.optional.java.util.function.Predicate;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.annotation.StringRes;
import androidx.annotation.UiThread;
import androidx.appcompat.app.AppCompatDialogFragment;
import timber.log.Timber; import timber.log.Timber;
/** /**
@ -108,7 +108,7 @@ public class BaseDialogFragment extends AppCompatDialogFragment implements Loadi
} }
/** /**
* View is prepared, If {@link android.support.v4.app.Fragment#onCreateView(LayoutInflater, ViewGroup, Bundle)} return same layout, it will be called once * View is prepared, If {@link androidx.fragment.app.Fragment#onCreateView(LayoutInflater, ViewGroup, Bundle)} return same layout, it will be called once
* *
* @param view view of fragment * @param view view of fragment
*/ */

@ -3,11 +3,6 @@ package com.android.base.app.fragment;
import android.content.Context; import android.content.Context;
import android.content.Intent; import android.content.Intent;
import android.os.Bundle; import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.annotation.StringRes;
import android.support.annotation.UiThread;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
@ -19,6 +14,11 @@ import com.android.base.app.activity.OnBackPressListener;
import com.android.base.app.ui.LoadingView; import com.android.base.app.ui.LoadingView;
import com.github.dmstocking.optional.java.util.function.Predicate; import com.github.dmstocking.optional.java.util.function.Predicate;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.annotation.StringRes;
import androidx.annotation.UiThread;
import androidx.fragment.app.Fragment;
import timber.log.Timber; import timber.log.Timber;
/** /**
@ -119,7 +119,7 @@ public class BaseFragment extends Fragment implements LoadingView, OnBackPressLi
} }
/** /**
* View is prepared, If {@link android.support.v4.app.Fragment#onCreateView(LayoutInflater, ViewGroup, Bundle)} return same layout, it will be called once * View is prepared, If {@link androidx.fragment.app.Fragment#onCreateView(LayoutInflater, ViewGroup, Bundle)} return same layout, it will be called once
* *
* @param view view of fragment * @param view view of fragment
*/ */

@ -1,9 +1,6 @@
package com.android.base.app.fragment; package com.android.base.app.fragment;
import android.os.Bundle; import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.v7.widget.RecyclerView;
import com.android.base.adapter.DataManager; import com.android.base.adapter.DataManager;
import com.android.base.app.ui.AutoPageNumber; import com.android.base.app.ui.AutoPageNumber;
@ -15,6 +12,10 @@ import com.ztiany.loadmore.adapter.WrapperAdapter;
import java.util.List; import java.util.List;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.recyclerview.widget.RecyclerView;
/** /**
* 通用的RecyclerView列表界面支持下拉刷新和加载更多 * 通用的RecyclerView列表界面支持下拉刷新和加载更多
* *

@ -8,7 +8,7 @@ import com.android.base.app.ui.RefreshListLayout
import com.android.base.app.ui.StateLayoutConfig import com.android.base.app.ui.StateLayoutConfig
/** /**
* 区别于 [BaseListFragment] 只能支持 RecyclerView[BaseListFragment] 采用包装 [android.support.v7.widget.RecyclerView.Adapter] 的方式 * 区别于 [BaseListFragment] 只能支持 RecyclerView[BaseListFragment] 采用包装 [androidx.recyclerview.widget.RecyclerView.Adapter] 的方式
* 在底部添加 load more view item来实现加载更多BaseListV2Fragment 没有采用此种方式所以你使用的刷新视图应该是支持这下来刷新和加载更多功能的 * 在底部添加 load more view item来实现加载更多BaseListV2Fragment 没有采用此种方式所以你使用的刷新视图应该是支持这下来刷新和加载更多功能的
* *
* 在调用BaseListV2Fragment [onActivityCreated] 之前你应该设置好 [dataManager] * 在调用BaseListV2Fragment [onActivityCreated] 之前你应该设置好 [dataManager]

@ -1,14 +1,15 @@
package com.android.base.app.fragment; package com.android.base.app.fragment;
import android.os.Bundle; import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.view.View; import android.view.View;
import com.android.base.app.ui.RefreshStateLayout; import com.android.base.app.ui.RefreshStateLayout;
import com.android.base.app.ui.RefreshView; import com.android.base.app.ui.RefreshView;
import com.android.base.app.ui.StateLayoutConfig; import com.android.base.app.ui.StateLayoutConfig;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
/** /**
* @author Ztiany * @author Ztiany
* date : 2016-03-19 23:09 * date : 2016-03-19 23:09

@ -1,14 +1,15 @@
package com.android.base.app.fragment; package com.android.base.app.fragment;
import android.os.Bundle; import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.view.View; import android.view.View;
import com.android.base.app.ui.RefreshStateLayout; import com.android.base.app.ui.RefreshStateLayout;
import com.android.base.app.ui.RefreshView; import com.android.base.app.ui.RefreshView;
import com.android.base.app.ui.StateLayoutConfig; import com.android.base.app.ui.StateLayoutConfig;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
/** /**
* <pre> * <pre>
* 1: 支持显示{CONTENTLOADINGERROREMPTY}四种布局支持下拉刷新 * 1: 支持显示{CONTENTLOADINGERROREMPTY}四种布局支持下拉刷新

@ -3,11 +3,12 @@ package com.android.base.app.fragment;
import android.content.Context; import android.content.Context;
import android.content.Intent; import android.content.Intent;
import android.os.Bundle; import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.view.View; import android.view.View;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;
public interface FragmentDelegate<T extends Fragment> { public interface FragmentDelegate<T extends Fragment> {
/** /**

@ -1,9 +1,10 @@
package com.android.base.app.fragment; package com.android.base.app.fragment;
import android.support.annotation.UiThread;
import com.github.dmstocking.optional.java.util.function.Predicate; import com.github.dmstocking.optional.java.util.function.Predicate;
import androidx.annotation.UiThread;
@UiThread @UiThread
public interface FragmentDelegateOwner { public interface FragmentDelegateOwner {

@ -3,10 +3,6 @@ package com.android.base.app.fragment;
import android.content.Context; import android.content.Context;
import android.content.Intent; import android.content.Intent;
import android.os.Bundle; import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.annotation.UiThread;
import android.support.v4.app.Fragment;
import android.view.View; import android.view.View;
import com.github.dmstocking.optional.java.util.function.Predicate; import com.github.dmstocking.optional.java.util.function.Predicate;
@ -14,6 +10,11 @@ import com.github.dmstocking.optional.java.util.function.Predicate;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.annotation.UiThread;
import androidx.fragment.app.Fragment;
@UiThread @UiThread
final class FragmentDelegates implements FragmentDelegate<Fragment>, FragmentDelegateOwner { final class FragmentDelegates implements FragmentDelegate<Fragment>, FragmentDelegateOwner {

@ -2,7 +2,7 @@ package com.android.base.app.fragment;
import android.content.Context; import android.content.Context;
import android.os.Bundle; import android.os.Bundle;
import android.support.v4.app.Fragment; import androidx.fragment.app.Fragment;
import java.lang.ref.WeakReference; import java.lang.ref.WeakReference;

@ -3,12 +3,12 @@
package com.android.base.app.fragment package com.android.base.app.fragment
import android.support.annotation.NonNull
import android.support.v4.app.Fragment
import android.support.v4.app.FragmentActivity
import android.support.v4.app.FragmentManager
import android.support.v4.app.FragmentTransaction
import android.view.View import android.view.View
import androidx.annotation.NonNull
import androidx.fragment.app.Fragment
import androidx.fragment.app.FragmentActivity
import androidx.fragment.app.FragmentManager
import androidx.fragment.app.FragmentTransaction
import com.android.base.app.activity.ActivityDelegate import com.android.base.app.activity.ActivityDelegate
import com.android.base.app.activity.ActivityDelegateOwner import com.android.base.app.activity.ActivityDelegateOwner
import com.android.base.app.activity.ActivityStatus import com.android.base.app.activity.ActivityStatus

@ -1,11 +1,12 @@
package com.android.base.app.fragment; package com.android.base.app.fragment;
import android.os.Bundle; import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.view.View; import android.view.View;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;
/** /**
* <pre> * <pre>
* 在ViewPager中实现懒加载的Fragment * 在ViewPager中实现懒加载的Fragment

@ -1,7 +1,6 @@
package com.android.base.app.fragment; package com.android.base.app.fragment;
import android.graphics.drawable.Drawable; import android.graphics.drawable.Drawable;
import android.support.annotation.DrawableRes;
import android.view.View; import android.view.View;
import com.android.base.app.ui.OnRetryActionListener; import com.android.base.app.ui.OnRetryActionListener;
@ -12,6 +11,8 @@ import com.android.base.app.ui.StateLayout;
import com.android.base.app.ui.StateLayoutConfig; import com.android.base.app.ui.StateLayoutConfig;
import com.android.base.widget.StateProcessor; import com.android.base.widget.StateProcessor;
import androidx.annotation.DrawableRes;
import static com.android.base.app.ui.CommonId.REFRESH_ID; import static com.android.base.app.ui.CommonId.REFRESH_ID;
import static com.android.base.app.ui.CommonId.STATE_ID; import static com.android.base.app.ui.CommonId.STATE_ID;

@ -2,14 +2,15 @@ package com.android.base.app.fragment;
import android.content.Context; import android.content.Context;
import android.os.Bundle; import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentTransaction;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collections; import java.util.Collections;
import java.util.List; import java.util.List;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentManager;
import androidx.fragment.app.FragmentTransaction;
public abstract class TabManager { public abstract class TabManager {
@SuppressWarnings("WeakerAccess") public static final int ATTACH_DETACH = 1; @SuppressWarnings("WeakerAccess") public static final int ATTACH_DETACH = 1;

@ -1,6 +1,6 @@
package com.android.base.app.mvp package com.android.base.app.mvp
import android.support.annotation.CallSuper import androidx.annotation.CallSuper
import java.lang.ref.WeakReference import java.lang.ref.WeakReference
abstract class AbstractPresenter<V : IBaseView> : IPresenter<V> { abstract class AbstractPresenter<V : IBaseView> : IPresenter<V> {

@ -1,7 +1,7 @@
package com.android.base.app.mvp package com.android.base.app.mvp
import android.os.Bundle import android.os.Bundle
import android.support.v4.app.Fragment import androidx.fragment.app.Fragment
import android.view.View import android.view.View
import com.android.base.app.fragment.FragmentDelegate import com.android.base.app.fragment.FragmentDelegate
import com.android.base.app.fragment.FragmentDelegateOwner import com.android.base.app.fragment.FragmentDelegateOwner

@ -1,6 +1,7 @@
package com.android.base.app.mvp package com.android.base.app.mvp
import android.support.annotation.CallSuper import android.support.annotation.CallSuper
import androidx.annotation.CallSuper
import com.android.base.rx.AutoDisposeLifecycleScopeProviderEx import com.android.base.rx.AutoDisposeLifecycleScopeProviderEx
import com.uber.autodispose.lifecycle.CorrespondingEventsFunction import com.uber.autodispose.lifecycle.CorrespondingEventsFunction
import com.uber.autodispose.lifecycle.LifecycleEndedException import com.uber.autodispose.lifecycle.LifecycleEndedException

@ -1,7 +1,8 @@
package com.android.base.app.mvvm package com.android.base.app.mvvm
import android.arch.lifecycle.ViewModel
import android.support.annotation.CallSuper import androidx.annotation.CallSuper
import androidx.lifecycle.ViewModel
import com.android.base.rx.AutoDisposeLifecycleScopeProviderEx import com.android.base.rx.AutoDisposeLifecycleScopeProviderEx
import com.uber.autodispose.lifecycle.CorrespondingEventsFunction import com.uber.autodispose.lifecycle.CorrespondingEventsFunction
import com.uber.autodispose.lifecycle.LifecycleEndedException import com.uber.autodispose.lifecycle.LifecycleEndedException

@ -3,7 +3,7 @@ package com.android.base.app.mvvm
import android.arch.lifecycle.ViewModel import android.arch.lifecycle.ViewModel
import android.arch.lifecycle.ViewModelProvider import android.arch.lifecycle.ViewModelProvider
import android.arch.lifecycle.ViewModelProviders import android.arch.lifecycle.ViewModelProviders
import android.support.v4.app.Fragment import androidx.fragment.app.Fragment
import android.support.v4.app.FragmentActivity import android.support.v4.app.FragmentActivity
inline fun <reified VM : ViewModel> Fragment.getViewModel(factory: ViewModelProvider.Factory? = null): VM { inline fun <reified VM : ViewModel> Fragment.getViewModel(factory: ViewModelProvider.Factory? = null): VM {

@ -1,6 +1,7 @@
package com.android.base.app.ui; package com.android.base.app.ui;
import android.support.annotation.StringRes;
import androidx.annotation.StringRes;
/** /**
* 显示通用的 LoadingDialog Message * 显示通用的 LoadingDialog Message

@ -1,8 +1,9 @@
package com.android.base.app.ui; package com.android.base.app.ui;
import android.support.v4.widget.SwipeRefreshLayout;
import android.view.View; import android.view.View;
import androidx.swiperefreshlayout.widget.SwipeRefreshLayout;
/** /**
* RefreshView Factory * RefreshView Factory
* *

@ -1,14 +1,15 @@
package com.android.base.app.ui; package com.android.base.app.ui;
import android.graphics.drawable.Drawable; import android.graphics.drawable.Drawable;
import android.support.annotation.DrawableRes;
import android.support.annotation.IntDef;
import com.android.base.widget.StateProcessor; import com.android.base.widget.StateProcessor;
import java.lang.annotation.Retention; import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy; import java.lang.annotation.RetentionPolicy;
import androidx.annotation.DrawableRes;
import androidx.annotation.IntDef;
/** /**
* @author Ztiany * @author Ztiany
* Email: 1169654504@qq.com * Email: 1169654504@qq.com

@ -1,6 +1,7 @@
package com.android.base.app.ui; package com.android.base.app.ui;
import android.support.v4.widget.SwipeRefreshLayout;
import androidx.swiperefreshlayout.widget.SwipeRefreshLayout;
class SwipeRefreshView implements RefreshView { class SwipeRefreshView implements RefreshView {

@ -1,8 +1,8 @@
package com.android.base.data; package com.android.base.data;
import android.support.annotation.NonNull; import androidx.annotation.NonNull;
import android.support.annotation.Nullable; import androidx.annotation.Nullable;
/** /**

@ -3,9 +3,6 @@ package com.android.base.imageloader;
import android.content.Context; import android.content.Context;
import android.graphics.Bitmap; import android.graphics.Bitmap;
import android.graphics.drawable.Drawable; import android.graphics.drawable.Drawable;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.view.View; import android.view.View;
import android.widget.ImageView; import android.widget.ImageView;
@ -21,6 +18,10 @@ import com.bumptech.glide.request.transition.Transition;
import java.util.concurrent.ExecutionException; import java.util.concurrent.ExecutionException;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;
class GlideImageLoader implements ImageLoader { class GlideImageLoader implements ImageLoader {
private boolean canFragmentLoadImage(Fragment fragment) { private boolean canFragmentLoadImage(Fragment fragment) {

@ -3,14 +3,15 @@ package com.android.base.imageloader;
import android.content.Context; import android.content.Context;
import android.graphics.Bitmap; import android.graphics.Bitmap;
import android.graphics.drawable.Drawable; import android.graphics.drawable.Drawable;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.annotation.UiThread;
import android.support.annotation.WorkerThread;
import android.support.v4.app.Fragment;
import android.view.View; import android.view.View;
import android.widget.ImageView; import android.widget.ImageView;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.annotation.UiThread;
import androidx.annotation.WorkerThread;
import androidx.fragment.app.Fragment;
// @formatter:off // @formatter:off
public interface ImageLoader { public interface ImageLoader {

@ -1,8 +1,6 @@
package com.android.base.imageloader; package com.android.base.imageloader;
import android.content.Context; import android.content.Context;
import android.support.annotation.CallSuper;
import android.support.annotation.NonNull;
import com.bumptech.glide.Glide; import com.bumptech.glide.Glide;
import com.bumptech.glide.Registry; import com.bumptech.glide.Registry;
@ -12,6 +10,8 @@ import com.bumptech.glide.module.AppGlideModule;
import java.io.InputStream; import java.io.InputStream;
import androidx.annotation.CallSuper;
import androidx.annotation.NonNull;
import okhttp3.OkHttpClient; import okhttp3.OkHttpClient;
public class ProgressGlideModule extends AppGlideModule { public class ProgressGlideModule extends AppGlideModule {

@ -1,7 +1,7 @@
package com.android.base.imageloader; package com.android.base.imageloader;
import android.support.annotation.NonNull; import androidx.annotation.NonNull;
public class ProgressInfo { public class ProgressInfo {

@ -2,8 +2,6 @@ package com.android.base.imageloader;
import android.os.Handler; import android.os.Handler;
import android.os.Looper; import android.os.Looper;
import android.support.annotation.NonNull;
import android.support.annotation.UiThread;
import com.android.base.utils.common.Checker; import com.android.base.utils.common.Checker;
import com.android.base.utils.common.StringChecker; import com.android.base.utils.common.StringChecker;
@ -15,6 +13,8 @@ import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import androidx.annotation.NonNull;
import androidx.annotation.UiThread;
import okhttp3.Interceptor; import okhttp3.Interceptor;
import okhttp3.OkHttpClient; import okhttp3.OkHttpClient;
import okhttp3.Response; import okhttp3.Response;

@ -1,10 +1,10 @@
package com.android.base.imageloader; package com.android.base.imageloader;
import android.os.SystemClock; import android.os.SystemClock;
import android.support.annotation.NonNull;
import java.io.IOException; import java.io.IOException;
import androidx.annotation.NonNull;
import okhttp3.MediaType; import okhttp3.MediaType;
import okhttp3.ResponseBody; import okhttp3.ResponseBody;
import okio.Buffer; import okio.Buffer;

@ -1,8 +1,9 @@
package com.android.base.interfaces; package com.android.base.interfaces;
import android.support.annotation.NonNull;
import android.view.View; import android.view.View;
import androidx.annotation.NonNull;
public abstract class OnItemClickListener<T> implements View.OnClickListener { public abstract class OnItemClickListener<T> implements View.OnClickListener {

@ -1,21 +1,24 @@
package com.android.base.interfaces.adapter; package com.android.base.interfaces.adapter;
import android.support.v4.widget.DrawerLayout;
import android.view.View; import android.view.View;
import org.jetbrains.annotations.NotNull;
import androidx.drawerlayout.widget.DrawerLayout;
public interface DrawerListenerAdapter extends DrawerLayout.DrawerListener { public interface DrawerListenerAdapter extends DrawerLayout.DrawerListener {
@Override @Override
default void onDrawerSlide(View drawerView, float slideOffset) { default void onDrawerSlide(@NotNull View drawerView, float slideOffset) {
} }
@Override @Override
default void onDrawerOpened(View drawerView) { default void onDrawerOpened(@NotNull View drawerView) {
} }
@Override @Override
default void onDrawerClosed(View drawerView) { default void onDrawerClosed(@NotNull View drawerView) {
} }
@Override @Override

@ -1,6 +1,7 @@
package com.android.base.interfaces.adapter; package com.android.base.interfaces.adapter;
import android.support.v4.view.ViewPager;
import androidx.viewpager.widget.ViewPager;
/** /**
* @author Ztiany * @author Ztiany

@ -1,6 +1,7 @@
package com.android.base.interfaces.adapter; package com.android.base.interfaces.adapter;
import android.support.design.widget.TabLayout;
import com.google.android.material.tabs.TabLayout;
public interface OnTabSelectedListenerAdapter extends TabLayout.OnTabSelectedListener { public interface OnTabSelectedListenerAdapter extends TabLayout.OnTabSelectedListener {

@ -1,9 +1,10 @@
package com.android.base.interfaces.adapter; package com.android.base.interfaces.adapter;
import android.os.Build; import android.os.Build;
import android.support.annotation.RequiresApi;
import android.transition.Transition; import android.transition.Transition;
import androidx.annotation.RequiresApi;
@RequiresApi(api = Build.VERSION_CODES.KITKAT) @RequiresApi(api = Build.VERSION_CODES.KITKAT)
public interface TransitionListenerAdapter extends Transition.TransitionListener { public interface TransitionListenerAdapter extends Transition.TransitionListener {

@ -3,11 +3,12 @@ package com.android.base.kotlin
import android.content.Context import android.content.Context
import android.content.ContextWrapper import android.content.ContextWrapper
import android.content.res.TypedArray import android.content.res.TypedArray
import android.support.annotation.AttrRes
import android.support.annotation.StyleRes
import android.util.TypedValue import android.util.TypedValue
import android.view.ContextThemeWrapper import android.view.ContextThemeWrapper
import android.view.View import android.view.View
import androidx.annotation.AttrRes
import androidx.annotation.StyleRes
/** 属性相关扩展:https://github.com/Kotlin/anko/issues/16*/ /** 属性相关扩展:https://github.com/Kotlin/anko/issues/16*/
val View.contextThemeWrapper: ContextThemeWrapper val View.contextThemeWrapper: ContextThemeWrapper

@ -2,9 +2,9 @@ package com.android.base.kotlin
import android.content.Context import android.content.Context
import android.graphics.drawable.Drawable import android.graphics.drawable.Drawable
import android.support.annotation.ColorRes import androidx.annotation.ColorRes
import android.support.annotation.DrawableRes import androidx.annotation.DrawableRes
import android.support.v4.content.ContextCompat import androidx.core.content.ContextCompat
fun Context.colorFromId(@ColorRes id: Int): Int { fun Context.colorFromId(@ColorRes id: Int): Int {
return ContextCompat.getColor(this, id) return ContextCompat.getColor(this, id)

@ -1,10 +1,10 @@
package com.android.base.kotlin package com.android.base.kotlin
import android.graphics.drawable.Drawable import android.graphics.drawable.Drawable
import android.support.annotation.ColorRes import androidx.annotation.ColorRes
import android.support.annotation.DrawableRes import androidx.annotation.DrawableRes
import android.support.v4.app.Fragment import androidx.core.content.ContextCompat
import android.support.v4.content.ContextCompat import androidx.fragment.app.Fragment
fun Fragment.colorFromId(@ColorRes colorRes: Int): Int { fun Fragment.colorFromId(@ColorRes colorRes: Int): Int {

@ -1,6 +1,6 @@
package com.android.base.kotlin package com.android.base.kotlin
import android.arch.lifecycle.MutableLiveData import androidx.lifecycle.MutableLiveData
fun <T> MutableLiveData<T>.init(t: T): MutableLiveData<T> { fun <T> MutableLiveData<T>.init(t: T): MutableLiveData<T> {
this.postValue(t) this.postValue(t)

@ -1,18 +1,18 @@
package com.android.base.kotlin package com.android.base.kotlin
import android.support.v7.widget.PopupMenu
import android.view.Menu import android.view.Menu
import android.view.MenuItem import android.view.MenuItem
import androidx.appcompat.widget.PopupMenu
fun PopupMenu.setMenus(items: Array<String>): PopupMenu { fun PopupMenu.setMenus(items: Array<String>): PopupMenu {
for (i in 0 until items.size) { for (i in items.indices) {
menu.add(Menu.NONE, i, i, items[i]) menu.add(Menu.NONE, i, i, items[i])
} }
return this return this
} }
fun PopupMenu.setMenus(items: Array<String>, ids: IntArray): PopupMenu { fun PopupMenu.setMenus(items: Array<String>, ids: IntArray): PopupMenu {
for (i in 0 until items.size) { for (i in items.indices) {
menu.add(Menu.NONE, ids[i], i, items[i]) menu.add(Menu.NONE, ids[i], i, items[i])
} }
return this return this

@ -1,12 +1,12 @@
package com.android.base.kotlin package com.android.base.kotlin
import android.graphics.drawable.Drawable import android.graphics.drawable.Drawable
import android.support.annotation.DrawableRes
import android.text.Editable import android.text.Editable
import android.text.TextWatcher import android.text.TextWatcher
import android.widget.Button import android.widget.Button
import android.widget.EditText import android.widget.EditText
import android.widget.TextView import android.widget.TextView
import androidx.annotation.DrawableRes
import com.android.base.interfaces.adapter.TextWatcherAdapter import com.android.base.interfaces.adapter.TextWatcherAdapter
inline fun TextView.textWatcher(init: KTextWatcher.() -> Unit) = addTextChangedListener(KTextWatcher().apply(init)) inline fun TextView.textWatcher(init: KTextWatcher.() -> Unit) = addTextChangedListener(KTextWatcher().apply(init))

@ -1,17 +1,18 @@
package com.android.base.kotlin package com.android.base.kotlin
import android.graphics.drawable.Drawable import android.graphics.drawable.Drawable
import android.support.annotation.ColorRes
import android.support.annotation.DrawableRes import androidx.fragment.app.Fragment
import android.support.v4.content.ContextCompat
import android.support.v4.view.ViewCompat
import android.support.v4.widget.NestedScrollView
import android.view.View import android.view.View
import android.view.View.FOCUS_DOWN import android.view.View.FOCUS_DOWN
import android.view.View.FOCUS_UP import android.view.View.FOCUS_UP
import android.view.ViewGroup import android.view.ViewGroup
import android.view.ViewTreeObserver import android.view.ViewTreeObserver
import android.widget.ScrollView import android.widget.ScrollView
import androidx.annotation.*
import androidx.core.content.ContextCompat
import androidx.core.view.ViewCompat
import androidx.core.widget.NestedScrollView
import com.android.base.rx.subscribeIgnoreError import com.android.base.rx.subscribeIgnoreError
import com.android.base.utils.android.ViewUtils import com.android.base.utils.android.ViewUtils
import com.android.base.utils.android.compat.AndroidVersion.atLeast import com.android.base.utils.android.compat.AndroidVersion.atLeast

@ -3,10 +3,10 @@ package com.android.base.permission;
import android.content.Intent; import android.content.Intent;
import android.os.Bundle; import android.os.Bundle;
import android.os.Handler; import android.os.Handler;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;
import timber.log.Timber; import timber.log.Timber;
/** /**

@ -1,17 +1,18 @@
package com.android.base.permission; package com.android.base.permission;
import android.arch.lifecycle.DefaultLifecycleObserver;
import android.arch.lifecycle.LifecycleOwner;
import android.content.Intent; import android.content.Intent;
import android.support.annotation.NonNull;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentActivity;
import android.support.v4.app.FragmentManager;
import com.android.base.utils.android.ActFragWrapper; import com.android.base.utils.android.ActFragWrapper;
import java.util.Arrays; import java.util.Arrays;
import androidx.annotation.NonNull;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentActivity;
import androidx.fragment.app.FragmentManager;
import androidx.lifecycle.DefaultLifecycleObserver;
import androidx.lifecycle.LifecycleOwner;
import timber.log.Timber; import timber.log.Timber;
import static com.android.base.permission.PermissionCode.PERMISSION_REQUESTER_CODE; import static com.android.base.permission.PermissionCode.PERMISSION_REQUESTER_CODE;

@ -3,13 +3,14 @@ package com.android.base.permission;
import android.content.Context; import android.content.Context;
import android.content.DialogInterface; import android.content.DialogInterface;
import android.graphics.Color; import android.graphics.Color;
import android.support.v7.app.AlertDialog;
import com.android.base.R; import com.android.base.R;
import com.blankj.utilcode.util.ToastUtils; import com.blankj.utilcode.util.ToastUtils;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
import androidx.appcompat.app.AlertDialog;
import static com.android.base.permission.PermissionUtils.createPermissionAskAgainText; import static com.android.base.permission.PermissionUtils.createPermissionAskAgainText;
import static com.android.base.permission.PermissionUtils.createPermissionDeniedTip; import static com.android.base.permission.PermissionUtils.createPermissionDeniedTip;
import static com.android.base.permission.PermissionUtils.createPermissionRationaleText; import static com.android.base.permission.PermissionUtils.createPermissionRationaleText;

@ -23,14 +23,14 @@ import android.content.pm.PackageManager;
import android.net.Uri; import android.net.Uri;
import android.os.Build; import android.os.Build;
import android.provider.Settings; import android.provider.Settings;
import android.support.v4.app.ActivityCompat;
import android.support.v4.app.Fragment;
import android.support.v4.content.ContextCompat;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.List; import java.util.List;
import androidx.core.app.ActivityCompat;
import androidx.core.content.ContextCompat;
import androidx.fragment.app.Fragment;
import timber.log.Timber; import timber.log.Timber;
/** /**

@ -2,7 +2,8 @@ package com.android.base.permission;
import android.content.Context; import android.content.Context;
import android.content.DialogInterface; import android.content.DialogInterface;
import android.support.annotation.NonNull;
import androidx.annotation.NonNull;
public interface IPermissionUIProvider { public interface IPermissionUIProvider {

@ -1,8 +1,6 @@
package com.android.base.permission; package com.android.base.permission;
import android.content.Context; import android.content.Context;
import android.support.annotation.ColorInt;
import android.support.annotation.NonNull;
import android.text.SpannableStringBuilder; import android.text.SpannableStringBuilder;
import android.text.Spanned; import android.text.Spanned;
import android.text.style.ForegroundColorSpan; import android.text.style.ForegroundColorSpan;
@ -13,6 +11,9 @@ import com.blankj.utilcode.util.AppUtils;
import java.util.Arrays; import java.util.Arrays;
import java.util.List; import java.util.List;
import androidx.annotation.ColorInt;
import androidx.annotation.NonNull;
/** /**
* @author Ztiany * @author Ztiany
* Email: ztiany3@gmail.com * Email: ztiany3@gmail.com

@ -2,8 +2,8 @@
package com.android.base.rx package com.android.base.rx
import android.arch.lifecycle.Lifecycle import androidx.lifecycle.Lifecycle
import android.arch.lifecycle.LifecycleOwner import androidx.lifecycle.LifecycleOwner
import com.uber.autodispose.* import com.uber.autodispose.*
import com.uber.autodispose.AutoDispose.autoDisposable import com.uber.autodispose.AutoDispose.autoDisposable
import com.uber.autodispose.android.lifecycle.AndroidLifecycleScopeProvider import com.uber.autodispose.android.lifecycle.AndroidLifecycleScopeProvider

@ -1,12 +1,12 @@
package com.android.base.rx; package com.android.base.rx;
import android.support.annotation.Nullable;
import org.reactivestreams.Publisher; import org.reactivestreams.Publisher;
import java.util.Date; import java.util.Date;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
import androidx.annotation.Nullable;
import io.reactivex.Flowable; import io.reactivex.Flowable;
import io.reactivex.functions.Function; import io.reactivex.functions.Function;
import timber.log.Timber; import timber.log.Timber;
@ -15,8 +15,7 @@ public class FlowableRetryDelay implements Function<Flowable<Throwable>, Publish
private final int mMaxRetries; private final int mMaxRetries;
private final long mRetryDelayMillis; private final long mRetryDelayMillis;
@Nullable @Nullable private RetryChecker mRetryChecker;
private RetryChecker mRetryChecker;
private int mRetryCount = 0; private int mRetryCount = 0;
@SuppressWarnings("unused") @SuppressWarnings("unused")

@ -1,10 +1,10 @@
package com.android.base.rx; package com.android.base.rx;
import android.support.annotation.Nullable;
import java.util.Date; import java.util.Date;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
import androidx.annotation.Nullable;
import io.reactivex.Observable; import io.reactivex.Observable;
import io.reactivex.ObservableSource; import io.reactivex.ObservableSource;
import io.reactivex.functions.Function; import io.reactivex.functions.Function;
@ -14,8 +14,7 @@ public class ObservableRetryDelay implements Function<Observable<Throwable>, Obs
private final int mMaxRetries; private final int mMaxRetries;
private final long mRetryDelayMillis; private final long mRetryDelayMillis;
@Nullable @Nullable private RetryChecker mRetryChecker;
private RetryChecker mRetryChecker;
private int mRetryCount = 0; private int mRetryCount = 0;
@SuppressWarnings("unused") @SuppressWarnings("unused")

@ -1,9 +1,9 @@
package com.android.base.rx; package com.android.base.rx;
import android.support.annotation.NonNull;
import java.util.UUID; import java.util.UUID;
import androidx.annotation.NonNull;
import io.reactivex.Flowable; import io.reactivex.Flowable;
import io.reactivex.processors.PublishProcessor; import io.reactivex.processors.PublishProcessor;

@ -5,9 +5,10 @@ import android.app.Service;
import android.content.Context; import android.content.Context;
import android.content.Intent; import android.content.Intent;
import android.os.Bundle; import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment; import androidx.annotation.Nullable;
import android.support.v4.app.FragmentActivity; import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentActivity;
/** /**
* 包含了Activity和Fragment的相关操作 * 包含了Activity和Fragment的相关操作

@ -3,7 +3,6 @@ package com.android.base.utils.android;
import android.Manifest; import android.Manifest;
import android.annotation.SuppressLint; import android.annotation.SuppressLint;
import android.os.Build; import android.os.Build;
import android.support.annotation.RequiresPermission;
import android.util.Log; import android.util.Log;
import com.android.base.utils.android.compat.AndroidVersion; import com.android.base.utils.android.compat.AndroidVersion;
@ -12,6 +11,7 @@ import java.text.SimpleDateFormat;
import java.util.Date; import java.util.Date;
import java.util.UUID; import java.util.UUID;
import androidx.annotation.RequiresPermission;
import timber.log.Timber; import timber.log.Timber;
public class DevicesUtils { public class DevicesUtils {

@ -1,12 +1,12 @@
package com.android.base.utils.android; package com.android.base.utils.android;
import android.os.Environment; import android.os.Environment;
import android.support.annotation.NonNull;
import com.android.base.utils.BaseUtils; import com.android.base.utils.BaseUtils;
import java.io.File; import java.io.File;
import androidx.annotation.NonNull;
import timber.log.Timber; import timber.log.Timber;
public class DirectoryUtils { public class DirectoryUtils {

@ -4,13 +4,14 @@ import android.content.Context;
import android.content.res.TypedArray; import android.content.res.TypedArray;
import android.graphics.drawable.Drawable; import android.graphics.drawable.Drawable;
import android.net.Uri; import android.net.Uri;
import android.support.annotation.ArrayRes;
import android.support.annotation.AttrRes;
import android.support.annotation.NonNull;
import android.support.annotation.StringRes;
import com.android.base.utils.BaseUtils; import com.android.base.utils.BaseUtils;
import androidx.annotation.ArrayRes;
import androidx.annotation.AttrRes;
import androidx.annotation.NonNull;
import androidx.annotation.StringRes;
public class ResourceUtils { public class ResourceUtils {

@ -7,7 +7,8 @@ import android.graphics.Paint;
import android.graphics.PorterDuff; import android.graphics.PorterDuff;
import android.graphics.PorterDuffColorFilter; import android.graphics.PorterDuffColorFilter;
import android.graphics.drawable.Drawable; import android.graphics.drawable.Drawable;
import android.support.v4.graphics.drawable.DrawableCompat;
import androidx.core.graphics.drawable.DrawableCompat;
/** /**
* usage: * usage:

@ -4,7 +4,8 @@ import android.content.Context;
import android.graphics.Bitmap; import android.graphics.Bitmap;
import android.media.MediaMetadataRetriever; import android.media.MediaMetadataRetriever;
import android.net.Uri; import android.net.Uri;
import android.support.annotation.WorkerThread;
import androidx.annotation.WorkerThread;
public class VideoUtils { public class VideoUtils {

@ -6,14 +6,15 @@ import android.graphics.Canvas;
import android.graphics.Picture; import android.graphics.Picture;
import android.graphics.drawable.Drawable; import android.graphics.drawable.Drawable;
import android.os.Build; import android.os.Build;
import android.support.annotation.IdRes;
import android.support.annotation.Nullable;
import android.support.v4.app.FragmentActivity;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
import android.webkit.WebView; import android.webkit.WebView;
import android.widget.TextView; import android.widget.TextView;
import androidx.annotation.IdRes;
import androidx.annotation.Nullable;
import androidx.fragment.app.FragmentActivity;
public class ViewUtils { public class ViewUtils {
private ViewUtils() { private ViewUtils() {

@ -2,7 +2,6 @@ package com.android.base.utils.android;
import android.content.Context; import android.content.Context;
import android.os.Build; import android.os.Build;
import android.support.annotation.RequiresApi;
import android.util.Log; import android.util.Log;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
@ -10,6 +9,8 @@ import android.webkit.CookieManager;
import android.webkit.CookieSyncManager; import android.webkit.CookieSyncManager;
import android.webkit.WebView; import android.webkit.WebView;
import androidx.annotation.RequiresApi;
/** /**
* <pre> * <pre>
* 关于内存泄漏最好的方式还是开启独立的进程 * 关于内存泄漏最好的方式还是开启独立的进程

@ -5,8 +5,6 @@ import android.app.KeyguardManager;
import android.content.Context; import android.content.Context;
import android.content.res.Configuration; import android.content.res.Configuration;
import android.graphics.Bitmap; import android.graphics.Bitmap;
import android.support.v7.app.ActionBar;
import android.support.v7.app.AppCompatActivity;
import android.util.DisplayMetrics; import android.util.DisplayMetrics;
import android.view.Surface; import android.view.Surface;
import android.view.View; import android.view.View;
@ -16,6 +14,9 @@ import android.view.WindowManager;
import com.android.base.utils.BaseUtils; import com.android.base.utils.BaseUtils;
import com.android.base.utils.android.compat.SystemBarCompat; import com.android.base.utils.android.compat.SystemBarCompat;
import androidx.appcompat.app.ActionBar;
import androidx.appcompat.app.AppCompatActivity;
/** /**
* 窗口工具箱 * 窗口工具箱
*/ */

@ -7,10 +7,6 @@ import android.content.pm.PackageManager;
import android.content.pm.ResolveInfo; import android.content.pm.ResolveInfo;
import android.net.Uri; import android.net.Uri;
import android.os.Build; import android.os.Build;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.annotation.RequiresApi;
import android.support.v4.content.FileProvider;
import android.webkit.MimeTypeMap; import android.webkit.MimeTypeMap;
import com.android.base.utils.common.FileUtils; import com.android.base.utils.common.FileUtils;
@ -19,6 +15,10 @@ import com.android.base.utils.common.StringChecker;
import java.io.File; import java.io.File;
import java.util.List; import java.util.List;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.annotation.RequiresApi;
import androidx.core.content.FileProvider;
import timber.log.Timber; import timber.log.Timber;
/** /**

@ -9,7 +9,6 @@ import android.net.Uri;
import android.provider.CalendarContract; import android.provider.CalendarContract;
import android.provider.MediaStore; import android.provider.MediaStore;
import android.provider.Settings; import android.provider.Settings;
import android.support.annotation.Nullable;
import android.text.TextUtils; import android.text.TextUtils;
import android.util.Log; import android.util.Log;
@ -18,6 +17,8 @@ import java.util.Arrays;
import java.util.Calendar; import java.util.Calendar;
import java.util.List; import java.util.List;
import androidx.annotation.Nullable;
import static android.content.ContentValues.TAG; import static android.content.ContentValues.TAG;
/** /**

@ -3,10 +3,6 @@ package com.android.base.utils.android.anim;
import android.app.Activity; import android.app.Activity;
import android.app.ActivityOptions; import android.app.ActivityOptions;
import android.content.Intent; import android.content.Intent;
import android.support.annotation.AnimRes;
import android.support.v4.app.ActivityCompat;
import android.support.v4.app.ActivityOptionsCompat;
import android.support.v7.app.AppCompatActivity;
import android.transition.Explode; import android.transition.Explode;
import android.transition.Fade; import android.transition.Fade;
import android.transition.Slide; import android.transition.Slide;
@ -15,6 +11,11 @@ import android.view.Window;
import com.android.base.utils.android.compat.AndroidVersion; import com.android.base.utils.android.compat.AndroidVersion;
import androidx.annotation.AnimRes;
import androidx.appcompat.app.AppCompatActivity;
import androidx.core.app.ActivityCompat;
import androidx.core.app.ActivityOptionsCompat;
public class ActivityAnimUtils { public class ActivityAnimUtils {
private ActivityAnimUtils() { private ActivityAnimUtils() {

@ -8,7 +8,6 @@ import android.content.res.Resources;
import android.graphics.Color; import android.graphics.Color;
import android.graphics.Point; import android.graphics.Point;
import android.os.Build; import android.os.Build;
import android.support.annotation.ColorInt;
import android.util.DisplayMetrics; import android.util.DisplayMetrics;
import android.util.TypedValue; import android.util.TypedValue;
import android.view.Display; import android.view.Display;
@ -24,6 +23,7 @@ import android.widget.FrameLayout;
import com.android.base.R; import com.android.base.R;
import androidx.annotation.ColorInt;
import timber.log.Timber; import timber.log.Timber;
/** /**

@ -17,7 +17,6 @@
package com.android.base.utils.android.text; package com.android.base.utils.android.text;
import android.os.Build; import android.os.Build;
import android.support.annotation.RequiresApi;
import android.text.Html; import android.text.Html;
import android.text.Spanned; import android.text.Spanned;
import android.widget.TextView; import android.widget.TextView;
@ -25,6 +24,8 @@ import android.widget.TextView;
import java.util.Iterator; import java.util.Iterator;
import java.util.LinkedList; import java.util.LinkedList;
import androidx.annotation.RequiresApi;
/** /**
* <p>Build a valid HTML string for a {@link TextView}.</p> * <p>Build a valid HTML string for a {@link TextView}.</p>
* *

@ -3,7 +3,6 @@ package com.android.base.utils.android.text;
import android.graphics.Canvas; import android.graphics.Canvas;
import android.graphics.Paint; import android.graphics.Paint;
import android.graphics.RectF; import android.graphics.RectF;
import android.support.annotation.NonNull;
import android.text.style.ReplacementSpan; import android.text.style.ReplacementSpan;
/** /**

@ -2,8 +2,6 @@ package com.android.base.widget;
import android.content.Context; import android.content.Context;
import android.content.res.TypedArray; import android.content.res.TypedArray;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.util.AttributeSet; import android.util.AttributeSet;
import android.util.SparseArray; import android.util.SparseArray;
import android.view.LayoutInflater; import android.view.LayoutInflater;
@ -16,6 +14,9 @@ import com.android.base.R;
import com.android.base.app.ui.StateLayoutConfig; import com.android.base.app.ui.StateLayoutConfig;
import com.android.base.app.ui.StateLayoutConfig.ViewState; import com.android.base.app.ui.StateLayoutConfig.ViewState;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import static com.android.base.app.ui.StateLayoutConfig.CONTENT; import static com.android.base.app.ui.StateLayoutConfig.CONTENT;
import static com.android.base.app.ui.StateLayoutConfig.EMPTY; import static com.android.base.app.ui.StateLayoutConfig.EMPTY;
import static com.android.base.app.ui.StateLayoutConfig.ERROR; import static com.android.base.app.ui.StateLayoutConfig.ERROR;

@ -3,13 +3,14 @@ package com.android.base.widget;
import android.content.Context; import android.content.Context;
import android.content.res.TypedArray; import android.content.res.TypedArray;
import android.graphics.Color; import android.graphics.Color;
import android.support.v4.view.ViewCompat;
import android.support.v4.widget.SwipeRefreshLayout;
import android.util.AttributeSet; import android.util.AttributeSet;
import android.view.View; import android.view.View;
import com.android.base.R; import com.android.base.R;
import androidx.core.view.ViewCompat;
import androidx.swiperefreshlayout.widget.SwipeRefreshLayout;
/** /**
* Extends {@link SwipeRefreshLayout} to support non-direct descendant scrolling views. * Extends {@link SwipeRefreshLayout} to support non-direct descendant scrolling views.

@ -2,11 +2,12 @@ package com.android.base.widget;
import android.content.Context; import android.content.Context;
import android.os.Build; import android.os.Build;
import android.support.annotation.RequiresApi;
import android.util.AttributeSet; import android.util.AttributeSet;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
import androidx.annotation.RequiresApi;
/** /**
* a SimpleLayout look like FrameLayout * a SimpleLayout look like FrameLayout
*/ */

@ -2,7 +2,6 @@ package com.android.base.widget;
import android.content.Context; import android.content.Context;
import android.content.res.TypedArray; import android.content.res.TypedArray;
import android.support.annotation.NonNull;
import android.util.AttributeSet; import android.util.AttributeSet;
import android.view.View; import android.view.View;
@ -11,6 +10,7 @@ import com.android.base.app.ui.StateLayout;
import com.android.base.app.ui.StateLayoutConfig; import com.android.base.app.ui.StateLayoutConfig;
import com.android.base.utils.common.StringChecker; import com.android.base.utils.common.StringChecker;
import androidx.annotation.NonNull;
import timber.log.Timber; import timber.log.Timber;
import static com.android.base.app.ui.StateLayoutConfig.CONTENT; import static com.android.base.app.ui.StateLayoutConfig.CONTENT;

@ -2,9 +2,6 @@ package com.android.base.widget;
import android.content.res.TypedArray; import android.content.res.TypedArray;
import android.graphics.drawable.Drawable; import android.graphics.drawable.Drawable;
import android.support.annotation.DrawableRes;
import android.support.annotation.NonNull;
import android.support.v4.content.ContextCompat;
import android.text.TextUtils; import android.text.TextUtils;
import android.view.Gravity; import android.view.Gravity;
import android.view.View; import android.view.View;
@ -17,6 +14,10 @@ import com.android.base.app.ui.CommonId;
import com.android.base.app.ui.OnRetryActionListener; import com.android.base.app.ui.OnRetryActionListener;
import com.android.base.app.ui.StateLayoutConfig; import com.android.base.app.ui.StateLayoutConfig;
import androidx.annotation.DrawableRes;
import androidx.annotation.NonNull;
import androidx.core.content.ContextCompat;
import static com.android.base.app.ui.StateLayoutConfig.EMPTY; import static com.android.base.app.ui.StateLayoutConfig.EMPTY;
import static com.android.base.app.ui.StateLayoutConfig.ERROR; import static com.android.base.app.ui.StateLayoutConfig.ERROR;
import static com.android.base.app.ui.StateLayoutConfig.NET_ERROR; import static com.android.base.app.ui.StateLayoutConfig.NET_ERROR;

@ -1,11 +1,12 @@
package com.android.base.widget; package com.android.base.widget;
import android.content.res.TypedArray; import android.content.res.TypedArray;
import android.support.annotation.NonNull;
import android.view.View; import android.view.View;
import com.android.base.app.ui.StateLayoutConfig; import com.android.base.app.ui.StateLayoutConfig;
import androidx.annotation.NonNull;
/** /**
* @author Ztiany * @author Ztiany
* Email: ztiany3@gmail.com * Email: ztiany3@gmail.com

@ -7,21 +7,6 @@ import android.graphics.Rect;
import android.os.Bundle; import android.os.Bundle;
import android.os.Parcel; import android.os.Parcel;
import android.os.Parcelable; import android.os.Parcelable;
import android.support.v4.view.AccessibilityDelegateCompat;
import android.support.v4.view.InputDeviceCompat;
import android.support.v4.view.MotionEventCompat;
import android.support.v4.view.NestedScrollingChild;
import android.support.v4.view.NestedScrollingChildHelper;
import android.support.v4.view.NestedScrollingParent;
import android.support.v4.view.NestedScrollingParentHelper;
import android.support.v4.view.ScrollingView;
import android.support.v4.view.VelocityTrackerCompat;
import android.support.v4.view.ViewCompat;
import android.support.v4.view.accessibility.AccessibilityEventCompat;
import android.support.v4.view.accessibility.AccessibilityNodeInfoCompat;
import android.support.v4.view.accessibility.AccessibilityRecordCompat;
import android.support.v4.widget.EdgeEffectCompat;
import android.support.v4.widget.ScrollerCompat;
import android.util.AttributeSet; import android.util.AttributeSet;
import android.util.Log; import android.util.Log;
import android.util.TypedValue; import android.util.TypedValue;
@ -40,6 +25,22 @@ import android.widget.ScrollView;
import java.util.List; import java.util.List;
import androidx.core.view.AccessibilityDelegateCompat;
import androidx.core.view.InputDeviceCompat;
import androidx.core.view.MotionEventCompat;
import androidx.core.view.NestedScrollingChild;
import androidx.core.view.NestedScrollingChildHelper;
import androidx.core.view.NestedScrollingParent;
import androidx.core.view.NestedScrollingParentHelper;
import androidx.core.view.ScrollingView;
import androidx.core.view.VelocityTrackerCompat;
import androidx.core.view.ViewCompat;
import androidx.core.view.accessibility.AccessibilityEventCompat;
import androidx.core.view.accessibility.AccessibilityNodeInfoCompat;
import androidx.core.view.accessibility.AccessibilityRecordCompat;
import androidx.core.widget.EdgeEffectCompat;
import androidx.core.widget.ScrollerCompat;
class NestedScrollView extends FrameLayout implements NestedScrollingParent, NestedScrollingChild, ScrollingView { class NestedScrollView extends FrameLayout implements NestedScrollingParent, NestedScrollingChild, ScrollingView {
static final int ANIMATED_SCROLL_GAP = 250; static final int ANIMATED_SCROLL_GAP = 250;
@ -589,10 +590,10 @@ class NestedScrollView extends FrameLayout implements NestedScrollingParent, Nes
*/ */
/* /*
* Shortcut the most recurring case: the subscribeUser is in the dragging * Shortcut the most recurring case: the subscribeUser is in the dragging
* state and he is moving his finger. We want to intercept this * state and he is moving his finger. We want to intercept this
* motion. * motion.
*/ */
final int action = ev.getAction(); final int action = ev.getAction();
if ((action == MotionEvent.ACTION_MOVE) && (mIsBeingDragged)) { if ((action == MotionEvent.ACTION_MOVE) && (mIsBeingDragged)) {
return true; return true;
@ -606,9 +607,9 @@ class NestedScrollView extends FrameLayout implements NestedScrollingParent, Nes
*/ */
/* /*
* Locally do absolute value. mLastMotionY is set to the y value * Locally do absolute value. mLastMotionY is set to the y value
* of the down event. * of the down event.
*/ */
final int activePointerId = mActivePointerId; final int activePointerId = mActivePointerId;
if (activePointerId == INVALID_POINTER) { if (activePointerId == INVALID_POINTER) {
// If we don't have a valid id, the touch down wasn't on content. // If we don't have a valid id, the touch down wasn't on content.
@ -661,7 +662,7 @@ class NestedScrollView extends FrameLayout implements NestedScrollingParent, Nes
* otherwise don't. mScroller.isFinished should be false when * otherwise don't. mScroller.isFinished should be false when
* being flinged. We need to call computeScrollOffset() first so that * being flinged. We need to call computeScrollOffset() first so that
* isFinished() is correct. * isFinished() is correct.
*/ */
mScroller.computeScrollOffset(); mScroller.computeScrollOffset();
mIsBeingDragged = !mScroller.isFinished(); mIsBeingDragged = !mScroller.isFinished();
startNestedScroll(ViewCompat.SCROLL_AXIS_VERTICAL); startNestedScroll(ViewCompat.SCROLL_AXIS_VERTICAL);
@ -685,9 +686,9 @@ class NestedScrollView extends FrameLayout implements NestedScrollingParent, Nes
} }
/* /*
* The only time we want to intercept motion events is if we are in the * The only time we want to intercept motion events is if we are in the
* drag mode. * drag mode.
*/ */
return mIsBeingDragged; return mIsBeingDragged;
} }

@ -13,6 +13,7 @@ import android.view.animation.DecelerateInterpolator;
import com.android.base.R; import com.android.base.R;
/** /**
* <pre> * <pre>
* {@code * {@code
@ -127,6 +128,7 @@ public class PullToZoomScrollView extends NestedScrollView {
return mContainerView != null && mZoomView != null; return mContainerView != null && mZoomView != null;
} }
@Override @Override
protected boolean overScrollByCompat(int deltaX, int deltaY, protected boolean overScrollByCompat(int deltaX, int deltaY,
int scrollX, int scrollY, int scrollX, int scrollY,

@ -1,9 +1,10 @@
package com.android.base.widget.ratio; package com.android.base.widget.ratio;
import android.content.Context; import android.content.Context;
import android.support.v7.widget.AppCompatImageView;
import android.util.AttributeSet; import android.util.AttributeSet;
import androidx.appcompat.widget.AppCompatImageView;
public class RatioImageView extends AppCompatImageView { public class RatioImageView extends AppCompatImageView {

@ -11,7 +11,7 @@ import com.android.base.R;
public class RatioLayout extends FrameLayout { public class RatioLayout extends FrameLayout {
// 宽和高的比例 // 宽和高的比例
private float ratio = 0.0f; private float ratio;
public RatioLayout(Context context) { public RatioLayout(Context context) {
this(context, null); this(context, null);

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save