瀏覽代碼

| 升级BRV

drake 5 年之前
父節點
當前提交
acc99e86c3
共有 3 個文件被更改,包括 4 次插入10 次删除
  1. 1 1
      README.md
  2. 1 1
      build.gradle
  3. 2 8
      net/src/main/java/com/drake/net/scope/PageCoroutineScope.kt

+ 1 - 1
README.md

@@ -79,7 +79,7 @@ implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.3.0'
 // 支持自动下拉刷新和缺省页的, 可选
 implementation 'com.github.liangjingkanji:BRV:1.2.1'
 
-implementation 'com.github.liangjingkanji:Net:2.0.7'
+implementation 'com.github.liangjingkanji:Net:2.0.8'
 ```
 
 

+ 1 - 1
build.gradle

@@ -4,7 +4,7 @@ buildscript {
 
     ext {
         kotlin_version = '1.3.61'
-        brv_version = '1.2.1'
+        brv_version = '1.2.3'
         coroutine_version = '1.3.0'
         glide_version = '4.9.0'
     }

+ 2 - 8
net/src/main/java/com/drake/net/scope/PageCoroutineScope.kt

@@ -21,10 +21,6 @@ class PageCoroutineScope(
 
     val index get() = page.index
 
-    private var load
-        get() = page.getTag(R.id.load) as? Boolean ?: false
-        set(value) = page.setTag(R.id.load, value)
-
     init {
         page.addOnAttachStateChangeListener(object : View.OnAttachStateChangeListener {
             override fun onViewAttachedToWindow(v: View) {
@@ -54,7 +50,7 @@ class PageCoroutineScope(
     override fun catch(e: Throwable) {
         super.catch(e)
 
-        if (cacheSucceed || load) {
+        if (cacheSucceed) {
             finish(false)
         } else {
             page.showError()
@@ -65,12 +61,11 @@ class PageCoroutineScope(
         super.finally(e)
         if (e == null && auto) {
             page.showContent()
-            load = true
         }
     }
 
     override fun handleError(e: Throwable) {
-        if (cacheSucceed || load) {
+        if (cacheSucceed) {
             NetConfig.onError(e)
         } else {
             NetConfig.onStateError(e, page)
@@ -106,7 +101,6 @@ class PageCoroutineScope(
      */
     fun showContent() {
         page.showContent()
-        load = true
         autoOff()
     }