From 44f8160e21c736775c1a6b73a78c177cd829378f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jaime=20Garc=C3=ADa?= <55400857+jaime-grj@users.noreply.github.com> Date: Thu, 7 Aug 2025 02:38:17 +0200 Subject: [PATCH 1/6] fix: fixed incorrect album release date, hid release date TextView when there is no data --- .../tempo/subsonic/models/ItemDate.kt | 17 +++++++++++++---- .../tempo/ui/fragment/AlbumPageFragment.java | 9 ++++++--- 2 files changed, 19 insertions(+), 7 deletions(-) diff --git a/app/src/main/java/com/cappielloantonio/tempo/subsonic/models/ItemDate.kt b/app/src/main/java/com/cappielloantonio/tempo/subsonic/models/ItemDate.kt index e32e9842..3a77e93f 100644 --- a/app/src/main/java/com/cappielloantonio/tempo/subsonic/models/ItemDate.kt +++ b/app/src/main/java/com/cappielloantonio/tempo/subsonic/models/ItemDate.kt @@ -14,11 +14,20 @@ open class ItemDate : Parcelable { var month: Int? = null var day: Int? = null - fun getFormattedDate(): String { - val calendar = Calendar.getInstance() - val dateFormat = SimpleDateFormat("MMMM dd, yyyy", Locale.getDefault()) + fun getFormattedDate(): String? { + if (year == null && month == null && day == null) return null - calendar.set(year ?: 0, month ?: 0, day ?: 0) + val calendar = Calendar.getInstance() + val dateFormat = if (month == null && day == null) { + SimpleDateFormat("yyyy", Locale.getDefault()) + } else if (day == null) { + SimpleDateFormat("MMMM yyyy", Locale.getDefault()) + } + else{ + SimpleDateFormat("MMMM dd, yyyy", Locale.getDefault()) + } + + calendar.set(year ?: 0, month ?: 1, day ?: 1) // Default to 1 if day is null return dateFormat.format(calendar.time) } diff --git a/app/src/main/java/com/cappielloantonio/tempo/ui/fragment/AlbumPageFragment.java b/app/src/main/java/com/cappielloantonio/tempo/ui/fragment/AlbumPageFragment.java index f830888e..83bc8ece 100644 --- a/app/src/main/java/com/cappielloantonio/tempo/ui/fragment/AlbumPageFragment.java +++ b/app/src/main/java/com/cappielloantonio/tempo/ui/fragment/AlbumPageFragment.java @@ -149,13 +149,16 @@ public class AlbumPageFragment extends Fragment implements ClickCallback { bind.albumGenresTextview.setText(album.getGenre()); if (album.getReleaseDate() != null && album.getOriginalReleaseDate() != null) { - bind.albumReleaseYearsTextview.setVisibility(View.VISIBLE); + if (album.getReleaseDate().getFormattedDate() != null || album.getOriginalReleaseDate().getFormattedDate() != null) + bind.albumReleaseYearsTextview.setVisibility(View.VISIBLE); + else + bind.albumReleaseYearsTextview.setVisibility(View.GONE); - if (album.getReleaseDate() == null || album.getOriginalReleaseDate() == null) { + if (album.getReleaseDate().getFormattedDate() == null || album.getOriginalReleaseDate().getFormattedDate() == null) { bind.albumReleaseYearsTextview.setText(getString(R.string.album_page_release_date_label, album.getReleaseDate() != null ? album.getReleaseDate().getFormattedDate() : album.getOriginalReleaseDate().getFormattedDate())); } - if (album.getReleaseDate() != null && album.getOriginalReleaseDate() != null) { + if (album.getReleaseDate().getFormattedDate() != null && album.getOriginalReleaseDate().getFormattedDate() != null) { if (Objects.equals(album.getReleaseDate().getYear(), album.getOriginalReleaseDate().getYear()) && Objects.equals(album.getReleaseDate().getMonth(), album.getOriginalReleaseDate().getMonth()) && Objects.equals(album.getReleaseDate().getDay(), album.getOriginalReleaseDate().getDay())) { bind.albumReleaseYearsTextview.setText(getString(R.string.album_page_release_date_label, album.getReleaseDate().getFormattedDate())); } else { From 1f347209b5572b6fc685d26a68cdc68c465ce99c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jaime=20Garc=C3=ADa?= <55400857+jaime-grj@users.noreply.github.com> Date: Thu, 7 Aug 2025 02:46:57 +0200 Subject: [PATCH 2/6] fix: don't show empty genre TextView if album has no genre --- .../tempo/ui/fragment/AlbumPageFragment.java | 5 ++++- app/src/main/res/layout/fragment_album_page.xml | 4 +++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/com/cappielloantonio/tempo/ui/fragment/AlbumPageFragment.java b/app/src/main/java/com/cappielloantonio/tempo/ui/fragment/AlbumPageFragment.java index 83bc8ece..2d256443 100644 --- a/app/src/main/java/com/cappielloantonio/tempo/ui/fragment/AlbumPageFragment.java +++ b/app/src/main/java/com/cappielloantonio/tempo/ui/fragment/AlbumPageFragment.java @@ -146,7 +146,10 @@ public class AlbumPageFragment extends Fragment implements ClickCallback { bind.albumArtistLabel.setText(album.getArtist()); bind.albumReleaseYearLabel.setText(album.getYear() != 0 ? String.valueOf(album.getYear()) : ""); bind.albumSongCountDurationTextview.setText(getString(R.string.album_page_tracks_count_and_duration, album.getSongCount(), album.getDuration() != null ? album.getDuration() / 60 : 0)); - bind.albumGenresTextview.setText(album.getGenre()); + if (album.getGenre() != null && !album.getGenre().isEmpty()) { + bind.albumGenresTextview.setText(album.getGenre()); + bind.albumGenresTextview.setVisibility(View.VISIBLE); + } if (album.getReleaseDate() != null && album.getOriginalReleaseDate() != null) { if (album.getReleaseDate().getFormattedDate() != null || album.getOriginalReleaseDate().getFormattedDate() != null) diff --git a/app/src/main/res/layout/fragment_album_page.xml b/app/src/main/res/layout/fragment_album_page.xml index 0e58bf74..411d5c1c 100644 --- a/app/src/main/res/layout/fragment_album_page.xml +++ b/app/src/main/res/layout/fragment_album_page.xml @@ -126,9 +126,11 @@ android:layout_marginEnd="18dp" android:text="@string/label_placeholder" android:textAlignment="center" + android:visibility="gone" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toStartOf="parent" - app:layout_constraintTop_toTopOf="parent" /> + app:layout_constraintTop_toTopOf="parent" + tools:visibility="visible" /> Date: Thu, 7 Aug 2025 02:56:44 +0200 Subject: [PATCH 3/6] fix: don't show empty year TextView if album has no year --- .../cappielloantonio/tempo/ui/fragment/AlbumPageFragment.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/src/main/java/com/cappielloantonio/tempo/ui/fragment/AlbumPageFragment.java b/app/src/main/java/com/cappielloantonio/tempo/ui/fragment/AlbumPageFragment.java index 2d256443..31248768 100644 --- a/app/src/main/java/com/cappielloantonio/tempo/ui/fragment/AlbumPageFragment.java +++ b/app/src/main/java/com/cappielloantonio/tempo/ui/fragment/AlbumPageFragment.java @@ -144,7 +144,7 @@ public class AlbumPageFragment extends Fragment implements ClickCallback { bind.albumNameLabel.setText(album.getName()); bind.albumArtistLabel.setText(album.getArtist()); - bind.albumReleaseYearLabel.setText(album.getYear() != 0 ? String.valueOf(album.getYear()) : ""); + bind.albumReleaseYearLabel.setVisibility(album.getYear() != 0 ? View.VISIBLE : View.GONE); bind.albumSongCountDurationTextview.setText(getString(R.string.album_page_tracks_count_and_duration, album.getSongCount(), album.getDuration() != null ? album.getDuration() / 60 : 0)); if (album.getGenre() != null && !album.getGenre().isEmpty()) { bind.albumGenresTextview.setText(album.getGenre()); From d49d37d1fd3404134e2d7b3edbf90b1a94636ac1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jaime=20Garc=C3=ADa?= <55400857+jaime-grj@users.noreply.github.com> Date: Thu, 7 Aug 2025 03:06:01 +0200 Subject: [PATCH 4/6] chore: remove comment --- .../java/com/cappielloantonio/tempo/subsonic/models/ItemDate.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/src/main/java/com/cappielloantonio/tempo/subsonic/models/ItemDate.kt b/app/src/main/java/com/cappielloantonio/tempo/subsonic/models/ItemDate.kt index 3a77e93f..5de2fbc6 100644 --- a/app/src/main/java/com/cappielloantonio/tempo/subsonic/models/ItemDate.kt +++ b/app/src/main/java/com/cappielloantonio/tempo/subsonic/models/ItemDate.kt @@ -27,7 +27,7 @@ open class ItemDate : Parcelable { SimpleDateFormat("MMMM dd, yyyy", Locale.getDefault()) } - calendar.set(year ?: 0, month ?: 1, day ?: 1) // Default to 1 if day is null + calendar.set(year ?: 0, month ?: 1, day ?: 1) return dateFormat.format(calendar.time) } From 98db83f11add790c08c7ab03e4d9f1f0fdd17bdc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jaime=20Garc=C3=ADa?= <55400857+jaime-grj@users.noreply.github.com> Date: Thu, 7 Aug 2025 03:26:04 +0200 Subject: [PATCH 5/6] fix: set album year in AlbumPageFragment --- .../cappielloantonio/tempo/ui/fragment/AlbumPageFragment.java | 1 + 1 file changed, 1 insertion(+) diff --git a/app/src/main/java/com/cappielloantonio/tempo/ui/fragment/AlbumPageFragment.java b/app/src/main/java/com/cappielloantonio/tempo/ui/fragment/AlbumPageFragment.java index 31248768..8ea66d2f 100644 --- a/app/src/main/java/com/cappielloantonio/tempo/ui/fragment/AlbumPageFragment.java +++ b/app/src/main/java/com/cappielloantonio/tempo/ui/fragment/AlbumPageFragment.java @@ -144,6 +144,7 @@ public class AlbumPageFragment extends Fragment implements ClickCallback { bind.albumNameLabel.setText(album.getName()); bind.albumArtistLabel.setText(album.getArtist()); + bind.albumReleaseYearLabel.setText(album.getYear() != 0 ? String.valueOf(album.getYear()) : ""); bind.albumReleaseYearLabel.setVisibility(album.getYear() != 0 ? View.VISIBLE : View.GONE); bind.albumSongCountDurationTextview.setText(getString(R.string.album_page_tracks_count_and_duration, album.getSongCount(), album.getDuration() != null ? album.getDuration() / 60 : 0)); if (album.getGenre() != null && !album.getGenre().isEmpty()) { From e1aeccdd85fb446691ad64258671146913f5f6da Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jaime=20Garc=C3=ADa?= <55400857+jaime-grj@users.noreply.github.com> Date: Thu, 7 Aug 2025 04:18:25 +0200 Subject: [PATCH 6/6] fix: hide genre in AlbumPageFragment properly --- .../cappielloantonio/tempo/ui/fragment/AlbumPageFragment.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/app/src/main/java/com/cappielloantonio/tempo/ui/fragment/AlbumPageFragment.java b/app/src/main/java/com/cappielloantonio/tempo/ui/fragment/AlbumPageFragment.java index 8ea66d2f..dc02dcbe 100644 --- a/app/src/main/java/com/cappielloantonio/tempo/ui/fragment/AlbumPageFragment.java +++ b/app/src/main/java/com/cappielloantonio/tempo/ui/fragment/AlbumPageFragment.java @@ -151,6 +151,9 @@ public class AlbumPageFragment extends Fragment implements ClickCallback { bind.albumGenresTextview.setText(album.getGenre()); bind.albumGenresTextview.setVisibility(View.VISIBLE); } + else{ + bind.albumGenresTextview.setVisibility(View.GONE); + } if (album.getReleaseDate() != null && album.getOriginalReleaseDate() != null) { if (album.getReleaseDate().getFormattedDate() != null || album.getOriginalReleaseDate().getFormattedDate() != null)