If there is no description/lyrics of the media, show the image

This commit is contained in:
antonio 2022-03-25 22:33:20 +01:00
parent cbacb417ab
commit ebcc7cb37f
4 changed files with 219 additions and 8 deletions

View file

@ -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);
}
}
});

View file

@ -0,0 +1,171 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="892dp"
android:height="500.74997dp"
android:viewportWidth="892"
android:viewportHeight="500.74997">
<path
android:pathData="M831.58,471.597a96.071,96.071 0,0 1,-4.488 26.557c-0.061,0.2 -0.128,0.396 -0.193,0.596L810.149,498.75c0.018,-0.179 0.036,-0.379 0.053,-0.596 1.117,-12.838 -5.263,-90.042 -12.961,-103.404C797.916,395.834 832.878,430.805 831.58,471.597Z"
android:fillColor="#f1f1f1"/>
<path
android:pathData="M830.323,498.154c-0.14,0.2 -0.286,0.399 -0.435,0.596h-12.565c0.095,-0.17 0.206,-0.369 0.334,-0.596 2.076,-3.746 8.219,-14.946 13.922,-26.557 6.126,-12.478 11.751,-25.428 11.277,-30.116C843.003,442.538 847.243,474.766 830.323,498.154Z"
android:fillColor="#f1f1f1"/>
<path
android:pathData="M46.35,478.584a71.351,71.351 0,0 0,3.333 19.724c0.045,0.148 0.095,0.294 0.144,0.442h12.439c-0.013,-0.133 -0.027,-0.281 -0.04,-0.442 -0.829,-9.535 3.909,-66.874 9.626,-76.797C71.352,422.315 45.386,448.288 46.35,478.584Z"
android:fillColor="#f1f1f1"/>
<path
android:pathData="M47.284,498.308c0.104,0.148 0.212,0.296 0.323,0.442h9.332c-0.071,-0.126 -0.153,-0.274 -0.248,-0.442 -1.542,-2.782 -6.104,-11.1 -10.34,-19.724 -4.55,-9.267 -8.727,-18.885 -8.376,-22.367C37.867,457.002 34.717,480.937 47.284,498.308Z"
android:fillColor="#f1f1f1"/>
<path
android:pathData="M654.047,351.25c-93.947,-39.814 -178.942,-38.301 -259,-14 -123.353,-21.543 -207.819,-18.21 -262,14v-100h521Z"
android:fillColor="#cbcbcb"/>
<path
android:pathData="M654.047,323.75c-86.552,-39.217 -173,-41.749 -260.75,0 -89.878,-25.878 -176.764,-25.607 -260.75,0v-304c89.294,-26.651 176.154,-26.01 260.75,0 89.361,-25.921 176.356,-26.743 260.75,0Z"
android:fillColor="#e5e5e5"/>
<path
android:pathData="M156.002,57.476 L153.091,50.024c1.141,-0.446 28.408,-10.987 68.424,-16.364 36.996,-4.972 92.116,-6.159 144.613,16.415l-3.16,7.35c-50.742,-21.818 -104.231,-20.669 -140.17,-15.865C183.681,46.791 156.275,57.37 156.002,57.476Z"
android:fillColor="#fff"/>
<path
android:pathData="M156.002,85.476 L153.091,78.024c1.141,-0.446 28.408,-10.987 68.424,-16.364 36.996,-4.972 92.116,-6.159 144.613,16.415l-3.16,7.35c-50.742,-21.818 -104.231,-20.67 -140.17,-15.865C183.681,74.791 156.275,85.37 156.002,85.476Z"
android:fillColor="#fff"/>
<path
android:pathData="M156.002,113.476 L153.091,106.024c1.141,-0.446 28.408,-10.987 68.424,-16.364 36.996,-4.972 92.116,-6.159 144.613,16.415l-3.16,7.35c-50.742,-21.818 -104.231,-20.67 -140.17,-15.865C183.681,102.791 156.275,113.37 156.002,113.476Z"
android:fillColor="#fff"/>
<path
android:pathData="M156.002,141.476 L153.091,134.024c1.141,-0.446 28.408,-10.987 68.424,-16.364 36.996,-4.971 92.116,-6.16 144.613,16.415l-3.16,7.35c-50.742,-21.818 -104.231,-20.67 -140.17,-15.865C183.681,130.791 156.275,141.37 156.002,141.476Z"
android:fillColor="#fff"/>
<path
android:pathData="M156.002,169.476 L153.091,162.024c1.141,-0.446 28.408,-10.987 68.424,-16.364 36.996,-4.972 92.116,-6.159 144.613,16.415l-3.16,7.35c-50.742,-21.819 -104.231,-20.67 -140.17,-15.865C183.681,158.791 156.275,169.37 156.002,169.476Z"
android:fillColor="#fff"/>
<path
android:pathData="M156.002,197.476 L153.091,190.024c1.141,-0.446 28.408,-10.987 68.424,-16.364 36.996,-4.971 92.116,-6.159 144.613,16.415l-3.16,7.35c-50.742,-21.819 -104.231,-20.669 -140.17,-15.865C183.681,186.791 156.275,197.37 156.002,197.476Z"
android:fillColor="#fff"/>
<path
android:pathData="M417.002,256.476 L414.091,249.024c1.141,-0.446 28.408,-10.987 68.424,-16.364 36.996,-4.971 92.116,-6.159 144.613,16.415l-3.16,7.35c-50.742,-21.819 -104.231,-20.669 -140.17,-15.865C444.681,245.791 417.275,256.37 417.002,256.476Z"
android:fillColor="#6c63ff"/>
<path
android:pathData="M414.547,202.739L414.547,49.809l2.807,-0.877c71.143,-22.223 141.942,-22.219 210.428,0.013l2.765,0.897L630.547,202.535l-5.412,-2.043c-71.27,-26.898 -140.26,-26.915 -205.055,-0.047ZM520.11,172.289q50.228,0 102.437,18.725L622.547,55.67c-65.114,-20.535 -132.377,-20.523 -200,0.033L422.547,190.828A266.356,266.356 0,0 1,520.11 172.289Z"
android:fillColor="#fff"/>
<path
android:pathData="M622.713,252.514l1.048,-25.451 35.946,-71.469a10.368,10.368 0,0 1,4.704 -4.677,10.49 10.49,0 0,1 8.104,-0.529 10.486,10.486 0,0 1,6.54 6.628,10.847 10.847,0 0,1 0.455,2.035A10.387,10.387 0,0 1,678.468 165.029L642.473,236.595Z"
android:fillColor="#6c63ff"/>
<path
android:pathData="M668.888,150.315l-39.02,77.58 -2.975,-1.496 37.739,-75.034A9.945,9.945 0,0 1,668.888 150.315Z"
android:fillColor="#3f3d56"/>
<path
android:pathData="M679.014,159.114l-37.532,74.623 -2.975,-1.496 38.939,-77.419a9.998,9.998 0,0 1,1.135 2.35A10.328,10.328 0,0 1,679.014 159.114Z"
android:fillColor="#3f3d56"/>
<path
android:pathData="M675.278,152.455l-39.451,78.438 -2.975,-1.496 39.5,-78.536a9.688,9.688 0,0 1,1.229 0.517A10.198,10.198 0,0 1,675.278 152.455Z"
android:fillColor="#3f3d56"/>
<path
android:pathData="M627.226,248.237l-3.97,3.197 0.333,-8.429C624.952,243.478 626.428,245.53 627.226,248.237Z"
android:fillColor="#3f3d56"/>
<path
android:pathData="M235.674,340.104 L230.922,325.688l5.063,-47.401a6.178,6.178 0,0 1,1.643 -3.595,6.251 6.251,0 0,1 4.409,-1.995 6.248,6.248 0,0 1,5.037 2.325,6.463 6.463,0 0,1 0.681,1.04 6.189,6.189 0,0 1,0.672 3.553l-5.07,47.465Z"
android:fillColor="#6c63ff"/>
<path
android:pathData="M239.999,273.418l-5.496,51.454 -1.973,-0.211 5.315,-49.765A5.926,5.926 0,0 1,239.999 273.418Z"
android:fillColor="#3f3d56"/>
<path
android:pathData="M247.492,276.202 L242.206,325.695l-1.973,-0.211 5.484,-51.347a5.957,5.957 0,0 1,1.126 1.073A6.153,6.153 0,0 1,247.492 276.202Z"
android:fillColor="#3f3d56"/>
<path
android:pathData="M244.012,273.272 L238.455,325.294l-1.973,-0.211 5.564,-52.088a5.773,5.773 0,0 1,0.794 0.031A6.077,6.077 0,0 1,244.012 273.272Z"
android:fillColor="#3f3d56"/>
<path
android:pathData="M237.295,336.772l-1.544,2.616 -1.582,-4.771C235.029,334.595 236.282,335.43 237.295,336.772Z"
android:fillColor="#3f3d56"/>
<path
android:pathData="M750.44,323.199a8.305,8.305 0,1 1,-14.42 -8.245q0.028,-0.049 0.056,-0.097a8.938,8.938 0,0 1,0.782 -1.11l-6.986,-49.796 -0.209,-1.492 -1.419,-10.161 -0.209,-1.465 0.773,0.036 13.536,0.619 3.63,0.164 0.455,9.27 2.574,52.115a8.294,8.294 0,0 1,1.437 10.161Z"
android:fillColor="#ffb8b8"/>
<path
android:pathData="M729.703,262.911l17.188,-1.576a3.393,3.393 0,0 0,3.06 -3.672l-3.184,-35.743a13.032,13.032 0,0 0,-25.961 2.318q0.033,0.369 0.087,0.736l5.154,35.059a3.388,3.388 0,0 0,3.346 2.894A2.402,2.402 0,0 0,729.703 262.911Z"
android:fillColor="#cbcbcb"/>
<path
android:pathData="M742.731,234.035a23.939,23.939 0,0 0,-8.805 -27.552c-6.481,-4.435 -15.351,-6.027 -24.902,5.344a118.912,118.912 0,0 0,-24.106 47.758l39.116,6.368S737.336,249.693 742.731,234.035Z"
android:fillColor="#cbcbcb"/>
<path
android:pathData="M679.466,490.206L668.313,490.206l-5.305,-43.017h16.46Z"
android:fillColor="#ffb8b8"/>
<path
android:pathData="M646.808,500.56L681.858,500.56L681.858,487.018L660.35,487.018a13.542,13.542 0,0 0,-13.542 13.542Z"
android:fillColor="#2f2e41"/>
<path
android:pathData="M771.156,480.478l-10.589,3.5 -18.539,-39.178 15.628,-5.166Z"
android:fillColor="#ffb8b8"/>
<path
android:pathData="M743.395,500.56l33.28,-11 -4.25,-12.858 -20.422,6.75a13.542,13.542 0,0 0,-8.608 17.108Z"
android:fillColor="#2f2e41"/>
<path
android:pathData="M718.176,172.861m-22.343,0a22.343,22.343 0,1 1,44.685 0a22.343,22.343 0,1 1,-44.685 0"
android:fillColor="#ffb8b8"/>
<path
android:pathData="M698.614,478.232l10.357,-68.358a3.184,3.184 0,0 1,6.242 -0.273l15.772,65.144A4.124,4.124 0,0 0,735.613 477.824l43.505,-6.992a4.094,4.094 0,0 0,3.268 -5.231L725.658,278.572a3.184,3.184 0,0 1,-0.055 -1.637l1.888,-8.187a4.079,4.079 0,0 0,-2.117 -4.561c-7.725,-3.942 -27.29,-12.136 -42.055,-3.16a4.14,4.14 0,0 0,-1.891 2.663L637.112,471.977A4.094,4.094 0,0 0,640.751 476.907l53.45,4.787q0.182,0.016 0.364,0.016a4.101,4.101 0,0 0,4.046 -3.48Z"
android:fillColor="#2f2e41"/>
<path
android:pathData="M732.991,157.076a16.902,16.902 0,0 1,-4.416 -3.839,5.731 5.731,0 0,1 -0.882,-5.549c1.129,-2.491 4.483,-3.275 7.083,-2.43s4.608,2.885 6.507,4.851c1.673,1.728 3.394,3.54 4.185,5.814s0.386,5.156 -1.588,6.536c-1.938,1.354 -4.723,0.8 -6.586,-0.654a16.8,16.8 0,0 1,-4.116 -5.704Z"
android:fillColor="#2f2e41"/>
<path
android:pathData="M740.559,150.71c0.124,-6.295 7.299,-10.81 13.497,-9.694s10.961,6.4 13.345,12.227c5.038,12.312 1.256,26.362 -3.598,38.752s-10.862,24.961 -10.153,38.246a39.958,39.958 0,0 0,23.21 33.658c-6.994,3.17 -15.354,-0.105 -21.231,-5.047 -13.052,-10.975 -18.09,-30.516 -11.972,-46.434 3.017,-7.851 8.335,-14.568 12.487,-21.883s7.198,-15.936 5.054,-24.069 -11.266,-14.718 -19.065,-11.571Z"
android:fillColor="#2f2e41"/>
<path
android:pathData="M716.836,182.776c1.948,-3.291 3.912,-7.612 0.353,-10.489a7.336,7.336 0,0 0,-5.504 -1.455c-4.014,0.484 -8.384,0.683 -12.27,-0.775a11.502,11.502 0,0 1,-6.672 -5.996c-2.001,-4.752 0.506,-10.527 4.698,-13.531a15.828,15.828 0,0 1,17.519 -0.31c5.431,-2.399 12.02,-1.332 16.954,1.97s8.31,8.59 10.144,14.236a27.478,27.478 0,0 1,0.84 15.114A22.462,22.462 0,0 1,728.965 196.895a8.089,8.089 0,0 1,-7.989 -1.183,15.027 15.027,0 0,1 -4.043,-5.926C716.192,187.297 715.797,184.534 716.836,182.776Z"
android:fillColor="#2f2e41"/>
<path
android:pathData="M650.556,202.712a9.573,9.573 0,0 1,0.217 1.492l39.077,22.544 9.498,-5.468 10.126,13.256 -15.874,11.315a7.277,7.277 0,0 1,-8.733 -0.213l-40.299,-31.79a9.552,9.552 0,1 1,5.982 -11.135Z"
android:fillColor="#ffb8b8"/>
<path
android:pathData="M691.157,227.816l12.63,16.369a4.094,4.094 0,0 0,6.186 0.339L724.27,229.677a11.371,11.371 0,1 0,-13.578 -18.244q-0.185,0.138 -0.365,0.283L692.396,221.743a4.094,4.094 0,0 0,-1.242 6.073Z"
android:fillColor="#cbcbcb"/>
<path
android:pathData="M208.552,488.809l12.123,-0.001l5.768,-46.761l-17.893,0.001l0.002,46.761z"
android:fillColor="#a0616a"/>
<path
android:pathData="M205.459,484.851l23.875,-0.001h0.001a15.216,15.216 0,0 1,15.215 15.215v0.494l-39.091,0.001Z"
android:fillColor="#2f2e41"/>
<path
android:pathData="M114.156,483.561l11.987,1.812l12.693,-45.374l-15.715,-2.674l-8.965,46.236z"
android:fillColor="#a0616a"/>
<path
android:pathData="M111.69,479.185l23.607,3.568 0.001,0a15.216,15.216 0,0 1,12.77 17.318l-0.074,0.489 -38.652,-5.842Z"
android:fillColor="#2f2e41"/>
<path
android:pathData="M151.535,257.07l13.461,3.527 -0.895,21.824 -0.111,39.734a7.963,7.963 0,1 1,-10.539 1.324l-4.136,-39.88Z"
android:fillColor="#a0616a"/>
<path
android:pathData="M149.192,232.073a10.988,10.988 0,0 1,6.793 -9.772,10.273 10.273,0 0,1 11.12,1.788 9.795,9.795 0,0 1,3.265 7.575c0.035,12.785 -2.851,31.42 -2.88,31.606l-0.046,0.296 -19.675,6.626Z"
android:fillColor="#cbcbcb"/>
<path
android:pathData="M184.372,268.364l30.094,-7.79 13.911,46.85 0.494,174.535 -23.013,-0.144 -9.62,-141.264L134.929,471.082l-24.722,-2.967 53.893,-139.924s-2.967,-24.722 6.428,-37.082l-1.978,-12.855Z"
android:fillColor="#2f2e41"/>
<path
android:pathData="M164.08,280.021a4.611,4.611 0,0 1,-0.984 -3.709l-13.727,-41.181a10.477,10.477 0,0 1,2.89 -11.058l5.959,-5.417 4.038,-16.153 23.21,5.673 -1.912,7.649 10.504,-1.909 22.125,49.277 -46.247,18.485 -2.278,0.036A4.61,4.61 0,0 1,164.08 280.021Z"
android:fillColor="#cbcbcb"/>
<path
android:pathData="M196.295,245.251l13.262,-4.215 10.909,18.923 21.145,33.641a7.963,7.963 0,1 1,-8.199 6.752L208.599,268.859Z"
android:fillColor="#a0616a"/>
<path
android:pathData="M180.953,225.376a10.987,10.987 0,0 1,0.518 -11.889,10.279 10.279,0 0,1 10.354,-4.433 9.795,9.795 0,0 1,6.808 4.657c6.864,10.786 14.385,28.078 14.46,28.251l0.119,0.275 -13.087,16.116Z"
android:fillColor="#cbcbcb"/>
<path
android:pathData="M179.429,181.056m-18.441,0a18.441,18.441 0,1 1,36.882 0a18.441,18.441 0,1 1,-36.882 0"
android:fillColor="#a0616a"/>
<path
android:pathData="M146.839,155.514m-17.764,0a17.764,17.764 0,1 1,35.527 0a17.764,17.764 0,1 1,-35.527 0"
android:fillColor="#2f2e41"/>
<path
android:pathData="M131.517,170.223a17.765,17.765 0,0 0,27.432 -9.327,17.765 17.765,0 1,1 -34.652,-7.285A17.758,17.758 0,0 0,131.517 170.223Z"
android:fillColor="#2f2e41"/>
<path
android:pathData="M201.62,170.243c-3.101,-5.552 -4.288,-7.871 -8.286,-11.247 -3.536,-2.986 -7.885,-3.863 -11.393,-1.033A21.008,21.008 0,1 0,194.617 177.246a21.183,21.183 0,0 0,-0.143 -2.375C197.523,174.442 198.571,170.671 201.62,170.243Z"
android:fillColor="#2f2e41"/>
<path
android:pathData="M382,500.75L1,500.75a1,1 0,0 1,0 -2L382,498.75a1,1 0,0 1,0 2Z"
android:fillColor="#cbcbcb"/>
<path
android:pathData="M891,500.75L510,500.75a1,1 0,0 1,0 -2h381a1,1 0,0 1,0 2Z"
android:fillColor="#cbcbcb"/>
<path
android:pathData="M392.297,19.75h2v303.038h-2z"
android:fillColor="#cbcbcb"/>
</vector>

View file

@ -1,12 +1,46 @@
<androidx.core.widget.NestedScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
android:layout_height="match_parent"
xmlns:app="http://schemas.android.com/apk/res-auto">
<TextView
android:id="@+id/now_playing_song_lyrics_text_view"
style="@style/BodyLarge"
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingStart="24dp"
android:paddingEnd="24dp" />
android:layout_height="match_parent">
<TextView
android:id="@+id/now_playing_song_lyrics_text_view"
style="@style/BodyLarge"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingStart="24dp"
android:paddingEnd="24dp"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"/>
<ImageView
android:id="@+id/empty_description_image_view"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:adjustViewBounds="true"
android:maxWidth="240dp"
android:maxHeight="240dp"
android:paddingTop="64dp"
android:scaleType="centerInside"
android:src="@drawable/ui_empty_description"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"/>
<TextView
android:id="@+id/title_empty_description_label"
style="@style/LabelMedium"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingTop="12dp"
android:text="@string/description_empty_title"
app:layout_constraintTop_toBottomOf="@+id/empty_description_image_view"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"/>
</androidx.constraintlayout.widget.ConstraintLayout>
</androidx.core.widget.NestedScrollView>

View file

@ -221,4 +221,5 @@
<string name="menu_sort_artist">Artist</string>
<string name="menu_sort_name">Name</string>
<string name="menu_sort_random">Random</string>
<string name="description_empty_title">No description available</string>
</resources>