From ebcc7cb37f5e6f28e0609b4e6b4da332cced9428 Mon Sep 17 00:00:00 2001 From: antonio Date: Fri, 25 Mar 2022 22:33:20 +0100 Subject: [PATCH] If there is no description/lyrics of the media, show the image --- .../ui/fragment/PlayerLyricsFragment.java | 7 +- .../res/drawable/ui_empty_description.xml | 171 ++++++++++++++++++ .../layout/inner_fragment_player_lyrics.xml | 48 ++++- app/src/main/res/values/strings.xml | 1 + 4 files changed, 219 insertions(+), 8 deletions(-) create mode 100644 app/src/main/res/drawable/ui_empty_description.xml diff --git a/app/src/main/java/com/cappielloantonio/play/ui/fragment/PlayerLyricsFragment.java b/app/src/main/java/com/cappielloantonio/play/ui/fragment/PlayerLyricsFragment.java index 95800d89..6709ad5a 100644 --- a/app/src/main/java/com/cappielloantonio/play/ui/fragment/PlayerLyricsFragment.java +++ b/app/src/main/java/com/cappielloantonio/play/ui/fragment/PlayerLyricsFragment.java @@ -47,9 +47,14 @@ public class PlayerLyricsFragment extends Fragment { playerBottomSheetViewModel.getLiveLyrics().observe(requireActivity(), lyrics -> { if (bind != null) { if (lyrics == null || lyrics.trim().equals("")) { - bind.nowPlayingSongLyricsTextView.setText(R.string.player_song_lyrics_none_available_label); + bind.nowPlayingSongLyricsTextView.setVisibility(View.GONE); + bind.emptyDescriptionImageView.setVisibility(View.VISIBLE); + bind.titleEmptyDescriptionLabel.setVisibility(View.VISIBLE); } else { bind.nowPlayingSongLyricsTextView.setText(MusicUtil.getReadableString(lyrics)); + bind.nowPlayingSongLyricsTextView.setVisibility(View.VISIBLE); + bind.emptyDescriptionImageView.setVisibility(View.GONE); + bind.titleEmptyDescriptionLabel.setVisibility(View.GONE); } } }); diff --git a/app/src/main/res/drawable/ui_empty_description.xml b/app/src/main/res/drawable/ui_empty_description.xml new file mode 100644 index 00000000..f96d0632 --- /dev/null +++ b/app/src/main/res/drawable/ui_empty_description.xml @@ -0,0 +1,171 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/app/src/main/res/layout/inner_fragment_player_lyrics.xml b/app/src/main/res/layout/inner_fragment_player_lyrics.xml index 1f6cad9c..d9d6ccf7 100644 --- a/app/src/main/res/layout/inner_fragment_player_lyrics.xml +++ b/app/src/main/res/layout/inner_fragment_player_lyrics.xml @@ -1,12 +1,46 @@ + android:layout_height="match_parent" + xmlns:app="http://schemas.android.com/apk/res-auto"> - + android:layout_height="match_parent"> + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index deb099db..9f7edafa 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -221,4 +221,5 @@ Artist Name Random + No description available \ No newline at end of file