mirror of
https://github.com/ultrasonic/ultrasonic
synced 2025-02-19 13:10:54 +01:00
implemented @tzugen way to show the song details
Signed-off-by: Holger Müller <github@euhm.de>
This commit is contained in:
parent
cc5f29ca98
commit
2f5704548c
@ -138,8 +138,9 @@ class PlayerFragment :
|
|||||||
private lateinit var playlistFlipper: ViewFlipper
|
private lateinit var playlistFlipper: ViewFlipper
|
||||||
private lateinit var emptyTextView: TextView
|
private lateinit var emptyTextView: TextView
|
||||||
private lateinit var songTitleTextView: TextView
|
private lateinit var songTitleTextView: TextView
|
||||||
private lateinit var albumTextView: TextView
|
|
||||||
private lateinit var artistTextView: TextView
|
private lateinit var artistTextView: TextView
|
||||||
|
private lateinit var albumTextView: TextView
|
||||||
|
private lateinit var genreTextView: TextView
|
||||||
private lateinit var detailsTextView: TextView
|
private lateinit var detailsTextView: TextView
|
||||||
private lateinit var albumArtImageView: ImageView
|
private lateinit var albumArtImageView: ImageView
|
||||||
private lateinit var playlistView: RecyclerView
|
private lateinit var playlistView: RecyclerView
|
||||||
@ -176,9 +177,10 @@ class PlayerFragment :
|
|||||||
playlistFlipper = view.findViewById(R.id.current_playing_playlist_flipper)
|
playlistFlipper = view.findViewById(R.id.current_playing_playlist_flipper)
|
||||||
emptyTextView = view.findViewById(R.id.playlist_empty)
|
emptyTextView = view.findViewById(R.id.playlist_empty)
|
||||||
songTitleTextView = view.findViewById(R.id.current_playing_song)
|
songTitleTextView = view.findViewById(R.id.current_playing_song)
|
||||||
albumTextView = view.findViewById(R.id.current_playing_album)
|
|
||||||
artistTextView = view.findViewById(R.id.current_playing_artist)
|
artistTextView = view.findViewById(R.id.current_playing_artist)
|
||||||
detailsTextView = view.findViewById(R.id.current_playing_details)
|
albumTextView = view.findViewById(R.id.current_playing_album)
|
||||||
|
genreTextView = view.findViewById(R.id.current_playing_genre)
|
||||||
|
detailsTextView = view.findViewById(R.id.current_file_details)
|
||||||
albumArtImageView = view.findViewById(R.id.current_playing_album_art_image)
|
albumArtImageView = view.findViewById(R.id.current_playing_album_art_image)
|
||||||
positionTextView = view.findViewById(R.id.current_playing_position)
|
positionTextView = view.findViewById(R.id.current_playing_position)
|
||||||
downloadTrackTextView = view.findViewById(R.id.current_playing_track)
|
downloadTrackTextView = view.findViewById(R.id.current_playing_track)
|
||||||
@ -982,30 +984,40 @@ class PlayerFragment :
|
|||||||
if (currentPlaying != null) {
|
if (currentPlaying != null) {
|
||||||
currentSong = currentPlaying!!.song
|
currentSong = currentPlaying!!.song
|
||||||
songTitleTextView.text = currentSong!!.title
|
songTitleTextView.text = currentSong!!.title
|
||||||
albumTextView.text = currentSong!!.album
|
|
||||||
artistTextView.text = currentSong!!.artist
|
artistTextView.text = currentSong!!.artist
|
||||||
|
albumTextView.text = currentSong!!.album
|
||||||
|
if (currentSong!!.year != null && Settings.showNowPlayingDetails)
|
||||||
|
albumTextView.append(String.format(Locale.ROOT, " (%d)", currentSong!!.year))
|
||||||
|
|
||||||
val fileFormat: String? =
|
genreTextView.text = currentSong!!.genre
|
||||||
if (TextUtils.isEmpty(currentSong!!.transcodedSuffix) ||
|
genreTextView.visibility =
|
||||||
currentSong!!.transcodedSuffix == currentSong!!.suffix ||
|
if (currentSong!!.genre != null && currentSong!!.genre!!.isNotBlank() &&
|
||||||
currentSong!!.isVideo
|
Settings.showNowPlayingDetails
|
||||||
|
) 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
|
||||||
)
|
)
|
||||||
currentSong!!.suffix
|
detailsTextView.text =
|
||||||
else
|
String.format(
|
||||||
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,
|
Locale.ROOT, "%s > %s", currentSong!!.suffix,
|
||||||
currentSong!!.transcodedSuffix
|
currentSong!!.transcodedSuffix
|
||||||
)
|
)
|
||||||
val details: String = String.format(
|
)
|
||||||
Util.appContext().getString(R.string.song_details_nowplaying),
|
|
||||||
currentSong!!.genre, currentSong!!.year, currentSong!!.bitRate, fileFormat
|
|
||||||
)
|
|
||||||
detailsTextView.text = details
|
|
||||||
detailsTextView.visibility =
|
detailsTextView.visibility =
|
||||||
if (Settings.showNowPlayingDetails)
|
if (Settings.showNowPlayingDetails) View.VISIBLE
|
||||||
View.VISIBLE
|
else View.GONE
|
||||||
else
|
|
||||||
View.GONE
|
|
||||||
|
|
||||||
downloadTrackTextView.text = trackFormat
|
downloadTrackTextView.text = trackFormat
|
||||||
downloadTotalDurationTextView.text = duration
|
downloadTotalDurationTextView.text = duration
|
||||||
@ -1015,8 +1027,9 @@ class PlayerFragment :
|
|||||||
} else {
|
} else {
|
||||||
currentSong = null
|
currentSong = null
|
||||||
songTitleTextView.text = null
|
songTitleTextView.text = null
|
||||||
albumTextView.text = null
|
|
||||||
artistTextView.text = null
|
artistTextView.text = null
|
||||||
|
albumTextView.text = null
|
||||||
|
genreTextView.text = null
|
||||||
detailsTextView.text = null
|
detailsTextView.text = null
|
||||||
downloadTrackTextView.text = null
|
downloadTrackTextView.text = null
|
||||||
downloadTotalDurationTextView.text = null
|
downloadTotalDurationTextView.text = null
|
||||||
|
@ -9,7 +9,6 @@
|
|||||||
a:layout_marginEnd="12dp" >
|
a:layout_marginEnd="12dp" >
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
a:id="@+id/current_playing"
|
|
||||||
a:layout_width="wrap_content"
|
a:layout_width="wrap_content"
|
||||||
a:layout_height="wrap_content"
|
a:layout_height="wrap_content"
|
||||||
a:layout_alignParentLeft="true"
|
a:layout_alignParentLeft="true"
|
||||||
@ -48,6 +47,16 @@
|
|||||||
a:textAppearance="?android:attr/textAppearanceSmall"
|
a:textAppearance="?android:attr/textAppearanceSmall"
|
||||||
tools:text="Album" />
|
tools:text="Album" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
a:id="@+id/current_playing_genre"
|
||||||
|
a:layout_width="wrap_content"
|
||||||
|
a:layout_height="wrap_content"
|
||||||
|
a:ellipsize="start"
|
||||||
|
a:gravity="right"
|
||||||
|
a:singleLine="true"
|
||||||
|
a:textAppearance="?android:attr/textAppearanceSmall"
|
||||||
|
tools:text="Genre" />
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
@ -56,7 +65,8 @@
|
|||||||
a:layout_alignParentRight="true"
|
a:layout_alignParentRight="true"
|
||||||
a:layout_centerVertical="true"
|
a:layout_centerVertical="true"
|
||||||
a:gravity="right"
|
a:gravity="right"
|
||||||
a:orientation="vertical">
|
a:orientation="vertical"
|
||||||
|
tools:ignore="RelativeOverlap">
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
a:id="@+id/current_playing_track"
|
a:id="@+id/current_playing_track"
|
||||||
@ -77,17 +87,16 @@
|
|||||||
a:text="@string/util.no_time"
|
a:text="@string/util.no_time"
|
||||||
a:textAppearance="?android:attr/textAppearanceSmall" />
|
a:textAppearance="?android:attr/textAppearanceSmall" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
a:id="@+id/current_file_details"
|
||||||
|
a:layout_width="wrap_content"
|
||||||
|
a:layout_height="wrap_content"
|
||||||
|
a:ellipsize="start"
|
||||||
|
a:gravity="right"
|
||||||
|
a:singleLine="true"
|
||||||
|
a:textAppearance="?android:attr/textAppearanceSmall"
|
||||||
|
tools:text="Details" />
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
<TextView
|
|
||||||
a:id="@+id/current_playing_details"
|
|
||||||
a:layout_width="fill_parent"
|
|
||||||
a:layout_height="wrap_content"
|
|
||||||
a:layout_below="@id/current_playing"
|
|
||||||
a:ellipsize="start"
|
|
||||||
a:gravity="center_horizontal"
|
|
||||||
a:singleLine="true"
|
|
||||||
a:textAppearance="?android:attr/textAppearanceSmall"
|
|
||||||
tools:text="Details" />
|
|
||||||
|
|
||||||
</RelativeLayout>
|
</RelativeLayout>
|
Loading…
x
Reference in New Issue
Block a user