From 58d540b9394d23e2f88469f074befadc7573dd57 Mon Sep 17 00:00:00 2001 From: CappielloAntonio Date: Sun, 24 Mar 2024 00:45:19 +0100 Subject: [PATCH] feat: as an option show the item's rating and whether it is marked as a favorite --- .../ui/adapter/SongHorizontalAdapter.java | 7 ++-- .../tempo/util/MusicUtil.java | 15 +++++++++ .../tempo/util/Preferences.kt | 6 ++++ app/src/main/res/drawable/ic_favorite.xml | 2 +- .../main/res/layout/item_horizontal_track.xml | 32 ++++++++++++++++--- app/src/main/res/values-de/strings.xml | 2 +- app/src/main/res/values-fr/strings.xml | 2 +- app/src/main/res/values-ko/strings.xml | 2 +- app/src/main/res/values-pt/strings.xml | 2 +- app/src/main/res/values-zh/strings.xml | 2 +- app/src/main/res/values/strings.xml | 6 ++-- app/src/main/res/xml/global_preferences.xml | 6 ++++ 12 files changed, 70 insertions(+), 14 deletions(-) diff --git a/app/src/main/java/com/cappielloantonio/tempo/ui/adapter/SongHorizontalAdapter.java b/app/src/main/java/com/cappielloantonio/tempo/ui/adapter/SongHorizontalAdapter.java index 37a075b3..2893ffe8 100644 --- a/app/src/main/java/com/cappielloantonio/tempo/ui/adapter/SongHorizontalAdapter.java +++ b/app/src/main/java/com/cappielloantonio/tempo/ui/adapter/SongHorizontalAdapter.java @@ -17,6 +17,7 @@ import com.cappielloantonio.tempo.subsonic.models.Child; import com.cappielloantonio.tempo.util.Constants; import com.cappielloantonio.tempo.util.DownloadUtil; import com.cappielloantonio.tempo.util.MusicUtil; +import com.cappielloantonio.tempo.util.Preferences; import java.util.ArrayList; import java.util.Collections; @@ -59,11 +60,13 @@ public class SongHorizontalAdapter extends RecyclerView.Adapter?) { App.getInstance().preferences.edit().putString(HOME_SECTOR_LIST, Gson().toJson(extension)).apply() } + + @JvmStatic + fun showItemRating(): Boolean { + return App.getInstance().preferences.getBoolean(RATING_PER_ITEM, false) + } } \ No newline at end of file diff --git a/app/src/main/res/drawable/ic_favorite.xml b/app/src/main/res/drawable/ic_favorite.xml index 7d395976..753a4220 100644 --- a/app/src/main/res/drawable/ic_favorite.xml +++ b/app/src/main/res/drawable/ic_favorite.xml @@ -4,6 +4,6 @@ android:viewportWidth="24" android:viewportHeight="24"> diff --git a/app/src/main/res/layout/item_horizontal_track.xml b/app/src/main/res/layout/item_horizontal_track.xml index 72a1c22a..10d96ded 100644 --- a/app/src/main/res/layout/item_horizontal_track.xml +++ b/app/src/main/res/layout/item_horizontal_track.xml @@ -1,5 +1,6 @@ @@ -73,10 +74,32 @@ android:singleLine="true" android:text="@string/label_placeholder" app:layout_constraintBottom_toBottomOf="@+id/song_cover_image_view" - app:layout_constraintEnd_toStartOf="@+id/search_result_download_indicator_image_view" + app:layout_constraintEnd_toStartOf="@+id/rating_indicator_image_view" app:layout_constraintStart_toEndOf="@+id/cover_image_separator" app:layout_constraintTop_toBottomOf="@+id/search_result_song_title_text_view" /> + + + + + + app:layout_constraintStart_toEndOf="@+id/rating_indicator_image_view" + app:layout_constraintTop_toTopOf="@+id/song_cover_image_view" + tools:visibility="visible"> Lieblingslieder %1$s\'s Top Tracks Jahr %1$d - %1$s • %2$s %3$s + %1$s • %2$s %3$s %4$s Abbrechen Weiter Weiter und Herunterladen diff --git a/app/src/main/res/values-fr/strings.xml b/app/src/main/res/values-fr/strings.xml index d6659fa5..91d778d0 100644 --- a/app/src/main/res/values-fr/strings.xml +++ b/app/src/main/res/values-fr/strings.xml @@ -328,7 +328,7 @@ Titres favoris Les meilleurs titres de %1$s Année %1$d - %1$s • %2$s %3$s + %1$s • %2$s %3$s %4$s Annuler Continuer Continuer et télécharger diff --git a/app/src/main/res/values-ko/strings.xml b/app/src/main/res/values-ko/strings.xml index 679f333a..c01de5e9 100644 --- a/app/src/main/res/values-ko/strings.xml +++ b/app/src/main/res/values-ko/strings.xml @@ -331,7 +331,7 @@ 즐겨찾기한 트랙 %1$s\의 top tracks 년도 %1$d - %1$s • %2$s %3$s + %1$s • %2$s %3$s %4$s 취소 계속 계속해서 다운로드 diff --git a/app/src/main/res/values-pt/strings.xml b/app/src/main/res/values-pt/strings.xml index 12f04a31..ee78697b 100644 --- a/app/src/main/res/values-pt/strings.xml +++ b/app/src/main/res/values-pt/strings.xml @@ -330,7 +330,7 @@ Músicas favoritas Músicas preferidas de %1$s Ano %1$d - %1$s • %2$s %3$s + %1$s • %2$s %3$s %4$s Cancelar Continuar Continuar e baixar diff --git a/app/src/main/res/values-zh/strings.xml b/app/src/main/res/values-zh/strings.xml index 96ebda39..ce6cb55b 100644 --- a/app/src/main/res/values-zh/strings.xml +++ b/app/src/main/res/values-zh/strings.xml @@ -327,7 +327,7 @@ 已收藏的曲目 %1$s 的热门曲目 年份 %1$d - %1$s • %2$s %3$s + %1$s • %2$s %3$s %4$s 取消 继续 继续并下载 diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 49bd1423..1b56360c 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -271,7 +271,9 @@ Show podcast If enabled, show the podcast section. Restart the app for it to take full effect. Show audio quality - The bitrate and audio format will be shown for each audio track + The bitrate and audio format will be shown for each audio track. + Show item rating + If enabled, the item\'s rating and whether it is marked as a favorite will be displayed. Sync timer If enabled, the user will have the ability to save their play queue and will have the ability to load state when opening the application. Sync play queue for this user @@ -343,7 +345,7 @@ Starred tracks %1$s\'s top tracks Year %1$d - %1$s • %2$s %3$s + %1$s • %2$s %3$s %4$s Cancel Continue Continue and download diff --git a/app/src/main/res/xml/global_preferences.xml b/app/src/main/res/xml/global_preferences.xml index 40077d99..e4141cc7 100644 --- a/app/src/main/res/xml/global_preferences.xml +++ b/app/src/main/res/xml/global_preferences.xml @@ -57,6 +57,12 @@ android:summary="@string/settings_audio_quality_summary" android:key="audio_quality_per_item" /> + +