mirror of
https://github.com/antebudimir/tempus.git
synced 2026-01-02 02:13:33 +00:00
Added a progress indicator on item loading
This commit is contained in:
parent
24e94039bb
commit
301142b2c6
2 changed files with 31 additions and 16 deletions
|
|
@ -121,7 +121,8 @@ public class DownloadFragment extends Fragment implements ClickCallback {
|
||||||
downloadHorizontalAdapter = new DownloadHorizontalAdapter(this);
|
downloadHorizontalAdapter = new DownloadHorizontalAdapter(this);
|
||||||
bind.downloadedTracksRecyclerView.setAdapter(downloadHorizontalAdapter);
|
bind.downloadedTracksRecyclerView.setAdapter(downloadHorizontalAdapter);
|
||||||
downloadViewModel.getDownloadedTracks(getViewLifecycleOwner()).observe(getViewLifecycleOwner(), songs -> {
|
downloadViewModel.getDownloadedTracks(getViewLifecycleOwner()).observe(getViewLifecycleOwner(), songs -> {
|
||||||
if (songs == null || songs.isEmpty()) {
|
if (songs != null) {
|
||||||
|
if (songs.isEmpty()) {
|
||||||
if (bind != null) {
|
if (bind != null) {
|
||||||
bind.emptyDownloadLayout.setVisibility(View.VISIBLE);
|
bind.emptyDownloadLayout.setVisibility(View.VISIBLE);
|
||||||
bind.fragmentDownloadNestedScrollView.setVisibility(View.GONE);
|
bind.fragmentDownloadNestedScrollView.setVisibility(View.GONE);
|
||||||
|
|
@ -136,11 +137,15 @@ public class DownloadFragment extends Fragment implements ClickCallback {
|
||||||
|
|
||||||
bind.downloadDownloadedTracksPlaceholder.placeholder.setVisibility(View.GONE);
|
bind.downloadDownloadedTracksPlaceholder.placeholder.setVisibility(View.GONE);
|
||||||
bind.downloadDownloadedTracksSector.setVisibility(View.VISIBLE);
|
bind.downloadDownloadedTracksSector.setVisibility(View.VISIBLE);
|
||||||
|
|
||||||
bind.downloadedTracksRecyclerView.setLayoutManager(new LinearLayoutManager(requireContext()));
|
bind.downloadedTracksRecyclerView.setLayoutManager(new LinearLayoutManager(requireContext()));
|
||||||
|
|
||||||
downloadHorizontalAdapter.setItems(songs);
|
downloadHorizontalAdapter.setItems(songs);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (bind != null) bind.loadingProgressBar.setVisibility(View.GONE);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -39,6 +39,15 @@
|
||||||
</com.google.android.material.appbar.MaterialToolbar>
|
</com.google.android.material.appbar.MaterialToolbar>
|
||||||
</com.google.android.material.appbar.AppBarLayout>
|
</com.google.android.material.appbar.AppBarLayout>
|
||||||
|
|
||||||
|
<ProgressBar
|
||||||
|
android:id="@+id/loading_progress_bar"
|
||||||
|
style="@style/Widget.AppCompat.ProgressBar.Horizontal"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_gravity="center"
|
||||||
|
android:indeterminate="true"
|
||||||
|
android:minWidth="128dp" />
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:id="@+id/empty_download_layout"
|
android:id="@+id/empty_download_layout"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
|
|
@ -79,6 +88,7 @@
|
||||||
android:id="@+id/fragment_download_nested_scroll_view"
|
android:id="@+id/fragment_download_nested_scroll_view"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
|
android:visibility="gone"
|
||||||
app:layout_behavior="@string/appbar_scrolling_view_behavior">
|
app:layout_behavior="@string/appbar_scrolling_view_behavior">
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue