Skip to content

Commit 9a5b372

Browse files
committed
升级Kotlin、Paging3
1 parent 120c9fb commit 9a5b372

File tree

5 files changed

+10
-14
lines changed

5 files changed

+10
-14
lines changed

app/build.gradle

+5-5
Original file line numberDiff line numberDiff line change
@@ -54,19 +54,19 @@ dependencies {
5454
implementation"org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
5555
//Androidx
5656
implementation 'androidx.appcompat:appcompat:1.2.0'
57-
implementation 'androidx.constraintlayout:constraintlayout:2.0.1'
57+
implementation 'androidx.constraintlayout:constraintlayout:2.0.2'
5858
testImplementation 'junit:junit:4.13'
5959
androidTestImplementation 'androidx.test:runner:1.3.0'
6060
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
6161
implementation 'androidx.recyclerview:recyclerview:1.1.0'
6262
implementation 'com.google.android.material:material:1.2.1'
6363

6464
//协程
65-
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.3.7'
66-
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.3.7'
65+
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.3.9'
66+
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.3.9'
6767

6868
//Android KTX 是一组 Kotlin 扩展程序,属于 Android Jetpack 系列
69-
implementation 'androidx.core:core-ktx:1.3.1'
69+
implementation 'androidx.core:core-ktx:1.3.2'
7070
implementation 'androidx.lifecycle:lifecycle-runtime-ktx:2.2.0'
7171
implementation 'androidx.lifecycle:lifecycle-viewmodel-ktx:2.2.0'
7272
implementation 'androidx.lifecycle:lifecycle-livedata-ktx:2.2.0'
@@ -87,7 +87,7 @@ dependencies {
8787
implementation "androidx.navigation:navigation-ui-ktx:2.3.0"
8888

8989
//paging
90-
implementation "androidx.paging:paging-runtime:3.0.0-alpha06"
90+
implementation "androidx.paging:paging-runtime:3.0.0-alpha07"
9191

9292
//WorkManager
9393
implementation "androidx.work:work-runtime-ktx:2.4.0"

app/src/main/java/com/fmt/github/base/fragment/BasePagingVMFragment.kt

+1-5
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
package com.fmt.github.base.fragment
22

3-
import androidx.lifecycle.Observer
43
import androidx.paging.ExperimentalPagingApi
54
import androidx.paging.LoadState
65
import androidx.paging.PagingDataAdapter
@@ -38,16 +37,13 @@ abstract class BasePagingVMFragment<M : Any, VM : BaseLPagingViewModel<M>, VH :
3837
is LoadState.Error -> mSwipeRefreshLayout.isRefreshing = false
3938
}
4039
}
41-
mAdapter.addDataRefreshListener {
42-
mSwipeRefreshLayout.isRefreshing = false
43-
}
4440

4541
mViewModel = getViewModel() as VM
4642
afterViewCreated()
4743
}
4844

4945
override fun initData() {
50-
mViewModel.pagedList.observe(this, Observer {
46+
mViewModel.pagedList.observe(this, {
5147
mAdapter.submitData(lifecycle, it)
5248
})
5349
}

build.gradle

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
// Top-level build file where you can add configuration options common to all sub-projects/modules.
22
buildscript {
3-
ext.kotlin_version = '1.3.72'
3+
ext.kotlin_version = '1.4.10'
44
repositories {
55
google()
66
jcenter()
77

88
}
99
dependencies {
10-
classpath 'com.android.tools.build:gradle:3.4.2'
10+
classpath 'com.android.tools.build:gradle:4.0.2'
1111
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
1212
// NOTE: Do not place your application dependencies here; they belong
1313
// in the individual module build.gradle files
+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
#Mon Jul 15 21:18:50 CST 2019
1+
#Tue Oct 13 14:12:49 CST 2020
22
distributionBase=GRADLE_USER_HOME
33
distributionPath=wrapper/dists
44
zipStoreBase=GRADLE_USER_HOME
55
zipStorePath=wrapper/dists
6-
distributionUrl=https\://services.gradle.org/distributions/gradle-5.1.1-all.zip
6+
distributionUrl=https\://services.gradle.org/distributions/gradle-6.1.1-all.zip

image/function.png

228 KB
Loading

0 commit comments

Comments
 (0)