From c247e930c479d7914eba671a3ef625a49b634ab9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Holger=20Mu=CC=88ller?= Date: Mon, 21 Mar 2022 18:04:55 +0100 Subject: [PATCH] reworks requested by @ogarcia MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Holger Müller --- .../ultrasonic/fragment/PlayerFragment.kt | 64 ++++++++++--------- .../src/main/res/layout/player_media_info.xml | 2 +- ultrasonic/src/main/res/values/strings.xml | 3 +- 3 files changed, 35 insertions(+), 34 deletions(-) diff --git a/ultrasonic/src/main/kotlin/org/moire/ultrasonic/fragment/PlayerFragment.kt b/ultrasonic/src/main/kotlin/org/moire/ultrasonic/fragment/PlayerFragment.kt index 10825c16..da24a4b9 100644 --- a/ultrasonic/src/main/kotlin/org/moire/ultrasonic/fragment/PlayerFragment.kt +++ b/ultrasonic/src/main/kotlin/org/moire/ultrasonic/fragment/PlayerFragment.kt @@ -60,7 +60,6 @@ import kotlinx.coroutines.cancel import kotlinx.coroutines.launch import org.koin.android.ext.android.inject import org.koin.core.component.KoinComponent -import org.koin.core.component.get import org.moire.ultrasonic.R import org.moire.ultrasonic.adapters.BaseAdapter import org.moire.ultrasonic.adapters.TrackViewBinder @@ -141,7 +140,7 @@ class PlayerFragment : private lateinit var artistTextView: TextView private lateinit var albumTextView: TextView private lateinit var genreTextView: TextView - private lateinit var detailsTextView: TextView + private lateinit var bitrateFormatTextView: TextView private lateinit var albumArtImageView: ImageView private lateinit var playlistView: RecyclerView private lateinit var positionTextView: TextView @@ -180,7 +179,7 @@ class PlayerFragment : artistTextView = view.findViewById(R.id.current_playing_artist) albumTextView = view.findViewById(R.id.current_playing_album) genreTextView = view.findViewById(R.id.current_playing_genre) - detailsTextView = view.findViewById(R.id.current_file_details) + bitrateFormatTextView = view.findViewById(R.id.current_playing_bitrate_format) albumArtImageView = view.findViewById(R.id.current_playing_album_art_image) positionTextView = view.findViewById(R.id.current_playing_position) downloadTrackTextView = view.findViewById(R.id.current_playing_track) @@ -989,35 +988,38 @@ class PlayerFragment : if (currentSong!!.year != null && Settings.showNowPlayingDetails) albumTextView.append(String.format(Locale.ROOT, " (%d)", currentSong!!.year)) - genreTextView.text = currentSong!!.genre - genreTextView.visibility = - if (currentSong!!.genre != null && currentSong!!.genre!!.isNotBlank() && - Settings.showNowPlayingDetails - ) View.VISIBLE - else View.GONE + if (Settings.showNowPlayingDetails) { + genreTextView.text = currentSong!!.genre + genreTextView.visibility = + if (currentSong!!.genre != null && currentSong!!.genre!!.isNotBlank() + ) View.VISIBLE + else View.GONE - var bitRate: String? = null - if (currentSong!!.bitRate != null && currentSong!!.bitRate!! > 0) - bitRate = String.format( - Util.appContext().getString(R.string.song_details_kbps), currentSong!!.bitRate - ) - detailsTextView.text = - String.format( - Util.appContext().getString(R.string.song_details_all), - if (bitRate == null) "" - else String.format(Locale.ROOT, "%s ", bitRate), - if (TextUtils.isEmpty(currentSong!!.transcodedSuffix) || - currentSong!!.transcodedSuffix == currentSong!!.suffix || - currentSong!!.isVideo - ) currentSong!!.suffix - else String.format( - Locale.ROOT, "%s > %s", currentSong!!.suffix, - currentSong!!.transcodedSuffix + var bitRate: String? = null + if (currentSong!!.bitRate != null && currentSong!!.bitRate!! > 0) + bitRate = String.format( + Util.appContext().getString(R.string.song_details_kbps), + currentSong!!.bitRate ) - ) - detailsTextView.visibility = - if (Settings.showNowPlayingDetails) View.VISIBLE - else View.GONE + bitrateFormatTextView.text = + String.format( + Util.appContext().getString(R.string.song_details_all), + if (bitRate == null) "" + else String.format(Locale.ROOT, "%s ", bitRate), + if (TextUtils.isEmpty(currentSong!!.transcodedSuffix) || + currentSong!!.transcodedSuffix == currentSong!!.suffix || + currentSong!!.isVideo + ) currentSong!!.suffix + else String.format( + Locale.ROOT, "%s > %s", currentSong!!.suffix, + currentSong!!.transcodedSuffix + ) + ) + bitrateFormatTextView.visibility = View.VISIBLE + } else { + genreTextView.visibility = View.GONE + bitrateFormatTextView.visibility = View.GONE + } downloadTrackTextView.text = trackFormat downloadTotalDurationTextView.text = duration @@ -1030,7 +1032,7 @@ class PlayerFragment : artistTextView.text = null albumTextView.text = null genreTextView.text = null - detailsTextView.text = null + bitrateFormatTextView.text = null downloadTrackTextView.text = null downloadTotalDurationTextView.text = null imageLoaderProvider.getImageLoader() diff --git a/ultrasonic/src/main/res/layout/player_media_info.xml b/ultrasonic/src/main/res/layout/player_media_info.xml index 81bfaa3b..eae76952 100644 --- a/ultrasonic/src/main/res/layout/player_media_info.xml +++ b/ultrasonic/src/main/res/layout/player_media_info.xml @@ -88,7 +88,7 @@ a:textAppearance="?android:attr/textAppearanceSmall" /> Video Only download media on unmetered connections Download on Wi-Fi only - %1$s%2$s + %1$s%2$s %d kbps - %1$s  •  %2$d  •  %3$d kbps %4$s 0 B 0.00 GB 0 KB