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 itemsRemote = diffListOf<RepoItem.Remote>()
|
||||
|
||||
var isRemoteLoading = false
|
||||
@Bindable get
|
||||
private set(value) {
|
||||
field = value
|
||||
notifyPropertyChanged(BR.remoteLoading)
|
||||
}
|
||||
|
||||
val adapter = adapterOf<ComparableRvItem<*>>()
|
||||
val items = MergeObservableList<ComparableRvItem<*>>()
|
||||
.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
|
||||
}
|
||||
|
@ -90,6 +90,28 @@
|
||||
|
||||
</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>
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user