fix: download tab performance

This commit is contained in:
pca006132 2025-10-31 20:16:01 +08:00
parent 9930537486
commit 7f66124614
2 changed files with 69 additions and 83 deletions

View file

@ -117,14 +117,12 @@ public class DownloadFragment extends Fragment implements ClickCallback {
if (songs.isEmpty()) { 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.downloadDownloadedSector.setVisibility(View.GONE); bind.downloadDownloadedSector.setVisibility(View.GONE);
bind.downloadedGroupByImageView.setVisibility(View.GONE); bind.downloadedGroupByImageView.setVisibility(View.GONE);
} }
} else { } else {
if (bind != null) { if (bind != null) {
bind.emptyDownloadLayout.setVisibility(View.GONE); bind.emptyDownloadLayout.setVisibility(View.GONE);
bind.fragmentDownloadNestedScrollView.setVisibility(View.VISIBLE);
bind.downloadDownloadedSector.setVisibility(View.VISIBLE); bind.downloadDownloadedSector.setVisibility(View.VISIBLE);
bind.downloadedGroupByImageView.setVisibility(View.VISIBLE); bind.downloadedGroupByImageView.setVisibility(View.VISIBLE);

View file

@ -1,9 +1,10 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<androidx.coordinatorlayout.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android" <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent"> android:layout_height="match_parent"
android:orientation="vertical">
<fragment <fragment
android:id="@+id/toolbar_fragment" android:id="@+id/toolbar_fragment"
@ -26,6 +27,7 @@
android:layout_height="match_parent" android:layout_height="match_parent"
android:gravity="center" android:gravity="center"
android:orientation="vertical" android:orientation="vertical"
android:paddingBottom="@dimen/global_padding_bottom"
android:visibility="gone"> android:visibility="gone">
<ImageView <ImageView
@ -57,92 +59,78 @@
android:text="@string/download_info_empty_subtitle" /> android:text="@string/download_info_empty_subtitle" />
</LinearLayout> </LinearLayout>
<androidx.core.widget.NestedScrollView <androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/fragment_download_nested_scroll_view" android:id="@+id/download_downloaded_sector"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="wrap_content"
android:paddingHorizontal="16dp"
android:visibility="gone" android:visibility="gone"
app:layout_behavior="@string/appbar_scrolling_view_behavior"> tools:visibility="visible">
<androidx.constraintlayout.widget.ConstraintLayout <TextView
android:id="@+id/download_downloaded_sector" android:id="@+id/downloaded_text_view_refreshable"
style="@style/TitleLarge"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:text="@string/download_title_section"
app:layout_constraintEnd_toStartOf="@+id/downloaded_refresh_image_view"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/shuffle_downloaded_text_view_clickable"
style="@style/TitleMedium"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:paddingHorizontal="16dp" android:text="@string/download_shuffle_all_subtitle"
android:paddingTop="16dp" app:layout_constraintEnd_toEndOf="parent"
android:paddingBottom="@dimen/global_padding_bottom" app:layout_constraintStart_toStartOf="parent"
android:visibility="gone" app:layout_constraintTop_toBottomOf="@+id/downloaded_text_view_refreshable" />
tools:visibility="visible">
<TextView <ImageView
android:id="@+id/downloaded_text_view_refreshable" android:id="@+id/downloaded_refresh_image_view"
style="@style/TitleLarge" android:layout_width="24dp"
android:layout_width="0dp" android:layout_height="24dp"
android:layout_height="wrap_content" android:layout_marginStart="12dp"
android:text="@string/download_title_section" android:layout_marginEnd="12dp"
app:layout_constraintEnd_toStartOf="@+id/downloaded_refresh_image_view" android:background="@drawable/ic_refresh"
app:layout_constraintStart_toStartOf="parent" android:contentDescription="@string/download_refresh_button_content_description"
app:layout_constraintTop_toTopOf="parent" /> app:layout_constraintBottom_toBottomOf="@+id/downloaded_text_view_refreshable"
app:layout_constraintEnd_toStartOf="@id/downloaded_go_back_image_view"
app:layout_constraintStart_toEndOf="@id/downloaded_text_view_refreshable"
app:layout_constraintTop_toTopOf="@+id/downloaded_text_view_refreshable" />
<TextView <ImageView
android:id="@+id/shuffle_downloaded_text_view_clickable" android:id="@+id/downloaded_go_back_image_view"
style="@style/TitleMedium" android:layout_width="24dp"
android:layout_width="match_parent" android:layout_height="24dp"
android:layout_height="wrap_content" android:layout_gravity="center"
android:text="@string/download_shuffle_all_subtitle" android:layout_marginHorizontal="12dp"
app:layout_constraintEnd_toEndOf="parent" android:background="@drawable/ic_arrow_back"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintBottom_toBottomOf="@+id/downloaded_text_view_refreshable"
app:layout_constraintTop_toBottomOf="@+id/downloaded_text_view_refreshable"/> app:layout_constraintEnd_toStartOf="@id/downloaded_group_by_image_view"
app:layout_constraintStart_toEndOf="@id/downloaded_refresh_image_view"
app:layout_constraintTop_toTopOf="@+id/downloaded_text_view_refreshable" />
<ImageView <ImageView
android:id="@+id/downloaded_refresh_image_view" android:id="@+id/downloaded_group_by_image_view"
android:layout_width="24dp" android:layout_width="24dp"
android:layout_height="24dp" android:layout_height="24dp"
android:layout_marginStart="12dp" android:layout_gravity="center"
android:layout_marginEnd="12dp" android:background="@drawable/ic_filter_list"
android:background="@drawable/ic_refresh" app:layout_constraintBottom_toBottomOf="@+id/downloaded_text_view_refreshable"
android:contentDescription="@string/download_refresh_button_content_description" app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintBottom_toBottomOf="@+id/downloaded_text_view_refreshable" app:layout_constraintTop_toTopOf="@+id/downloaded_text_view_refreshable" />
app:layout_constraintEnd_toStartOf="@id/downloaded_go_back_image_view" </androidx.constraintlayout.widget.ConstraintLayout>
app:layout_constraintStart_toEndOf="@id/downloaded_text_view_refreshable"
app:layout_constraintTop_toTopOf="@+id/downloaded_text_view_refreshable" />
<ImageView <androidx.recyclerview.widget.RecyclerView
android:id="@+id/downloaded_go_back_image_view" android:id="@+id/downloaded_recycler_view"
android:layout_width="24dp" android:layout_width="match_parent"
android:layout_height="24dp" android:layout_height="wrap_content"
android:layout_marginHorizontal="12dp" android:clipToPadding="false"
android:layout_gravity="center" android:nestedScrollingEnabled="false"
android:background="@drawable/ic_arrow_back" android:paddingHorizontal="12dp"
app:layout_constraintBottom_toBottomOf="@+id/downloaded_text_view_refreshable" android:paddingTop="12dp"
app:layout_constraintEnd_toStartOf="@id/downloaded_group_by_image_view" android:paddingBottom="@dimen/global_padding_bottom" />
app:layout_constraintStart_toEndOf="@id/downloaded_refresh_image_view" </LinearLayout>
app:layout_constraintTop_toTopOf="@+id/downloaded_text_view_refreshable" />
<ImageView
android:id="@+id/downloaded_group_by_image_view"
android:layout_width="24dp"
android:layout_height="24dp"
android:layout_gravity="center"
android:background="@drawable/ic_filter_list"
app:layout_constraintBottom_toBottomOf="@+id/downloaded_text_view_refreshable"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="@+id/downloaded_text_view_refreshable" />
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/downloaded_recycler_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:clipToPadding="false"
android:nestedScrollingEnabled="false"
android:paddingTop="12dp"
android:paddingBottom="8dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/shuffle_downloaded_text_view_clickable" />
</androidx.constraintlayout.widget.ConstraintLayout>
</androidx.core.widget.NestedScrollView>
</androidx.coordinatorlayout.widget.CoordinatorLayout>