feat: implemented customizable home, allowing users to toggle visibility of elements and change their order

This commit is contained in:
CappielloAntonio 2024-03-23 21:33:11 +01:00
parent 309eca0764
commit 0e97eab744
12 changed files with 507 additions and 0 deletions

View file

@ -0,0 +1,23 @@
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="24dp"
android:layout_marginTop="12dp"
android:layout_marginEnd="24dp"
android:layout_marginBottom="4dp"
android:text="@string/home_rearrangement_dialog_subtitle" />
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/home_sector_item_recycler_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:clipToPadding="false"
android:nestedScrollingEnabled="false"
android:paddingHorizontal="18dp" />
</LinearLayout>

View file

@ -787,6 +787,14 @@
android:id="@+id/shares_placeholder"
layout="@layout/item_placeholder_horizontal"
android:visibility="gone" />
<Button
android:id="@+id/home_sector_rearrangement_button"
style="@style/Widget.Material3.Button.TextButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:text="@string/home_option_reorganize"/>
</LinearLayout>
</androidx.core.widget.NestedScrollView>

View file

@ -0,0 +1,26 @@
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?attr/selectableItemBackground"
android:clipChildren="false"
android:orientation="horizontal">
<CheckBox
android:id="@+id/home_sector_title_check_box"
android:layout_width="0dp"
android:layout_height="wrap_content"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"/>
<ImageView
android:id="@+id/home_sector_rearranger_image_view"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/ic_drag_handle"
app:layout_constraintBottom_toBottomOf="@+id/home_sector_title_check_box"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="@+id/home_sector_title_check_box" />
</androidx.constraintlayout.widget.ConstraintLayout>

View file

@ -87,6 +87,11 @@
<string name="filter_title_expanded">Filter Genres</string>
<string name="genre_catalogue_title">Genre Catalogue</string>
<string name="genre_catalogue_title_expanded">Browse Genres</string>
<string name="home_rearrangement_dialog_negative_button">Cancel</string>
<string name="home_rearrangement_dialog_neutral_button">Reset</string>
<string name="home_rearrangement_dialog_positive_button">Save</string>
<string name="home_rearrangement_dialog_title">Rearrange home</string>
<string name="home_rearrangement_dialog_subtitle">Please note that in order for the changes made to take effect, it is necessary to restart the application.</string>
<string name="home_subtitle_best_of">Top songs of your favorite artists</string>
<string name="home_subtitle_made_for_you">Start mix from a song you liked</string>
<string name="home_subtitle_new_internet_radio_station">Add a new radio</string>
@ -121,6 +126,7 @@
<string name="home_title_starred_tracks">★ Starred tracks</string>
<string name="home_title_starred_tracks_see_all_button">See all</string>
<string name="home_title_top_songs">Your top songs</string>
<string name="home_option_reorganize">Reorganize</string>
<string name="label_dot_separator" translatable="false"></string>
<string name="label_placeholder" translatable="false">--</string>
<string name="library_title_album">Albums</string>