Adding a progress spinner for first load of recents

This commit is contained in:
Jays2Kings 2021-04-12 23:32:43 -04:00
parent 2f09ac8cb5
commit 3529378aac
2 changed files with 10 additions and 1 deletions

View File

@ -181,10 +181,11 @@ class RecentsController(bundle: Bundle? = null) :
} }
presenter.onCreate() presenter.onCreate()
binding.swipeRefresh.isRefreshing = true
if (presenter.recentItems.isNotEmpty()) { if (presenter.recentItems.isNotEmpty()) {
adapter.updateDataSet(presenter.recentItems) adapter.updateDataSet(presenter.recentItems)
} else {
binding.frameLayout.alpha = 0f
} }
binding.downloadBottomSheet.dlBottomSheet.onCreate(this) binding.downloadBottomSheet.dlBottomSheet.onCreate(this)
@ -371,6 +372,8 @@ class RecentsController(bundle: Bundle? = null) :
shouldMoveToTop: Boolean = false shouldMoveToTop: Boolean = false
) { ) {
if (view == null) return if (view == null) return
binding.progress.isVisible = false
binding.frameLayout.alpha = 1f
binding.swipeRefresh.isRefreshing = LibraryUpdateService.isRunning() binding.swipeRefresh.isRefreshing = LibraryUpdateService.isRunning()
adapter.removeAllScrollableHeaders() adapter.removeAllScrollableHeaders()
adapter.updateItems(recents) adapter.updateItems(recents)

View File

@ -6,6 +6,12 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent"> android:layout_height="match_parent">
<ProgressBar
android:id="@+id/progress"
android:layout_width="75dp"
android:layout_height="75dp"
android:layout_gravity="center" />
<androidx.swiperefreshlayout.widget.SwipeRefreshLayout <androidx.swiperefreshlayout.widget.SwipeRefreshLayout
android:id="@+id/swipe_refresh" android:id="@+id/swipe_refresh"
android:layout_width="match_parent" android:layout_width="match_parent"