diff --git a/app/src/main/java/com/topjohnwu/magisk/ui/module/ModuleViewModel.kt b/app/src/main/java/com/topjohnwu/magisk/ui/module/ModuleViewModel.kt index d952cf994..454492b50 100644 --- a/app/src/main/java/com/topjohnwu/magisk/ui/module/ModuleViewModel.kt +++ b/app/src/main/java/com/topjohnwu/magisk/ui/module/ModuleViewModel.kt @@ -85,6 +85,13 @@ class ModuleViewModel( private val itemsUpdatable = diffListOf() private val itemsRemote = diffListOf() + var isRemoteLoading = false + @Bindable get + private set(value) { + field = value + notifyPropertyChanged(BR.remoteLoading) + } + val adapter = adapterOf>() val items = MergeObservableList>() .insertList(itemsCoreOnly) @@ -215,9 +222,13 @@ class ModuleViewModel( repoUpdater(refetch).andThen(loadRemoteDB(0)) } else { loadRemoteDB(itemsRemote.size) - }.subscribeK(onError = Timber::e) { - itemsRemote.addAll(it) - } + }.observeOn(AndroidSchedulers.mainThread()) + .doOnSubscribe { isRemoteLoading = true } + .doOnSuccess { isRemoteLoading = false } + .doOnError { isRemoteLoading = false } + .subscribeK(onError = Timber::e) { + itemsRemote.addAll(it) + } refetch = false } diff --git a/app/src/main/res/layout/fragment_module_md2.xml b/app/src/main/res/layout/fragment_module_md2.xml index 5ec69f449..4baa39d40 100644 --- a/app/src/main/res/layout/fragment_module_md2.xml +++ b/app/src/main/res/layout/fragment_module_md2.xml @@ -90,6 +90,28 @@ + + + + + + + + + +