Explorar o código

Fixed hiding swipe refresh progress

Vadik Sirekanyan %!s(int64=7) %!d(string=hai) anos
pai
achega
b88c966a48

+ 5 - 9
app/src/main/java/com/sirekanyan/knigopis/feature/MainActivity.kt

@@ -380,21 +380,17 @@ class MainActivity : BaseActivity(), Router {
             })
     }
 
-    private fun <T> Flowable<T>.showProgressBar(): Flowable<T> {
-        fun hideProgress() {
-            booksProgressBar.hide()
-            swipeRefresh.isRefreshing = false
-        }
-        return doOnSubscribe {
+    private fun <T> Flowable<T>.showProgressBar(): Flowable<T> =
+        doOnSubscribe {
             if (!swipeRefresh.isRefreshing) {
                 booksProgressBar.show()
             }
         }.doOnNext {
-            hideProgress()
+            booksProgressBar.hide()
         }.doFinally {
-            hideProgress()
+            booksProgressBar.hide()
+            swipeRefresh.isRefreshing = false
         }
-    }
 
     private fun handleError(
         th: Throwable,