Commit 1920a528 authored by Viktor De Pasquale's avatar Viktor De Pasquale Committed by John Wu

Added progressbar indicating content loading on modules screen

parent 6e14a727
......@@ -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>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment