mirror of
https://github.com/topjohnwu/Magisk.git
synced 2024-11-30 13:35:27 +00:00
Added progressbar indicating content loading on modules screen
This commit is contained in:
parent
6e14a727b1
commit
1920a52829
@ -85,6 +85,13 @@ class ModuleViewModel(
|
|||||||
private val itemsUpdatable = diffListOf<RepoItem.Update>()
|
private val itemsUpdatable = diffListOf<RepoItem.Update>()
|
||||||
private val itemsRemote = diffListOf<RepoItem.Remote>()
|
private val itemsRemote = diffListOf<RepoItem.Remote>()
|
||||||
|
|
||||||
|
var isRemoteLoading = false
|
||||||
|
@Bindable get
|
||||||
|
private set(value) {
|
||||||
|
field = value
|
||||||
|
notifyPropertyChanged(BR.remoteLoading)
|
||||||
|
}
|
||||||
|
|
||||||
val adapter = adapterOf<ComparableRvItem<*>>()
|
val adapter = adapterOf<ComparableRvItem<*>>()
|
||||||
val items = MergeObservableList<ComparableRvItem<*>>()
|
val items = MergeObservableList<ComparableRvItem<*>>()
|
||||||
.insertList(itemsCoreOnly)
|
.insertList(itemsCoreOnly)
|
||||||
@ -215,9 +222,13 @@ class ModuleViewModel(
|
|||||||
repoUpdater(refetch).andThen(loadRemoteDB(0))
|
repoUpdater(refetch).andThen(loadRemoteDB(0))
|
||||||
} else {
|
} else {
|
||||||
loadRemoteDB(itemsRemote.size)
|
loadRemoteDB(itemsRemote.size)
|
||||||
}.subscribeK(onError = Timber::e) {
|
}.observeOn(AndroidSchedulers.mainThread())
|
||||||
itemsRemote.addAll(it)
|
.doOnSubscribe { isRemoteLoading = true }
|
||||||
}
|
.doOnSuccess { isRemoteLoading = false }
|
||||||
|
.doOnError { isRemoteLoading = false }
|
||||||
|
.subscribeK(onError = Timber::e) {
|
||||||
|
itemsRemote.addAll(it)
|
||||||
|
}
|
||||||
|
|
||||||
refetch = false
|
refetch = false
|
||||||
}
|
}
|
||||||
|
@ -90,6 +90,28 @@
|
|||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
|
<FrameLayout
|
||||||
|
goneUnless="@{viewModel.remoteLoading}"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="4dp"
|
||||||
|
android:layout_gravity="bottom">
|
||||||
|
|
||||||
|
<FrameLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="16dp"
|
||||||
|
android:layout_gravity="center"
|
||||||
|
tools:ignore="UselessParent">
|
||||||
|
|
||||||
|
<ProgressBar
|
||||||
|
style="@style/WidgetFoundation.ProgressBar.Indeterminate"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:layout_gravity="center" />
|
||||||
|
|
||||||
|
</FrameLayout>
|
||||||
|
|
||||||
|
</FrameLayout>
|
||||||
|
|
||||||
</FrameLayout>
|
</FrameLayout>
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user