detail: update album song layout
Update the album song layout to be more alike to other songs. Recently I migrated the TextView in the album songs to use 48dp sizing, like the other song views. However, this resulted in a lot of empty space that felt off. Fix this by adding a light background to the track number, which fills the room it takes up a bit more. It also hopefully primes the track number to take an indicator once multi-select is added.
This commit is contained in:
@@ -19,6 +19,7 @@ package org.oxycblt.auxio.detail.recycler
|
||||
|
||||
import android.content.Context
|
||||
import androidx.core.view.isInvisible
|
||||
import androidx.core.view.isVisible
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import org.oxycblt.auxio.IntegerTable
|
||||
import org.oxycblt.auxio.R
|
||||
@@ -171,14 +172,14 @@ private class AlbumSongViewHolder private constructor(private val binding: ItemA
|
||||
isInvisible = false
|
||||
}
|
||||
|
||||
binding.songTrackPlaceholder.isInvisible = true
|
||||
binding.songTrackPlaceholder.isVisible = false
|
||||
} else {
|
||||
binding.songTrack.apply {
|
||||
textSafe = ""
|
||||
isInvisible = true
|
||||
}
|
||||
|
||||
binding.songTrackPlaceholder.isInvisible = false
|
||||
binding.songTrackPlaceholder.isVisible = true
|
||||
}
|
||||
|
||||
binding.songName.textSafe = item.resolvedName
|
||||
@@ -197,6 +198,7 @@ private class AlbumSongViewHolder private constructor(private val binding: ItemA
|
||||
binding.songName.isActivated = isHighlighted
|
||||
binding.songTrack.isActivated = isHighlighted
|
||||
binding.songTrackPlaceholder.isActivated = isHighlighted
|
||||
binding.songTrackBg.isActivated = isHighlighted
|
||||
}
|
||||
|
||||
companion object {
|
||||
|
||||
@@ -83,7 +83,7 @@ class PlaybackService :
|
||||
private lateinit var player: ExoPlayer
|
||||
private lateinit var mediaSession: MediaSessionCompat
|
||||
private lateinit var connector: PlaybackSessionConnector
|
||||
private val audioProcessor = ReplayGainAudioProcessor()
|
||||
private val replayGainProcessor = ReplayGainAudioProcessor()
|
||||
|
||||
// Notification components
|
||||
private lateinit var notification: PlaybackNotification
|
||||
@@ -247,7 +247,7 @@ class PlaybackService :
|
||||
if (info.isSelected) {
|
||||
for (i in 0 until info.trackGroup.length) {
|
||||
if (info.isTrackSelected(i)) {
|
||||
audioProcessor.applyReplayGain(info.trackGroup.getFormat(i).metadata)
|
||||
replayGainProcessor.applyReplayGain(info.trackGroup.getFormat(i).metadata)
|
||||
break
|
||||
}
|
||||
}
|
||||
@@ -359,8 +359,8 @@ class PlaybackService :
|
||||
handler,
|
||||
audioListener,
|
||||
AudioCapabilities.DEFAULT_AUDIO_CAPABILITIES,
|
||||
audioProcessor),
|
||||
LibflacAudioRenderer(handler, audioListener, audioProcessor))
|
||||
replayGainProcessor),
|
||||
LibflacAudioRenderer(handler, audioListener, replayGainProcessor))
|
||||
}
|
||||
|
||||
// Enable constant bitrate seeking so that certain MP3s/AACs are seekable
|
||||
|
||||
@@ -211,17 +211,17 @@ class ReplayGainAudioProcessor : BaseAudioProcessor() {
|
||||
}
|
||||
} else {
|
||||
for (i in position until limit step 2) {
|
||||
val sample = inputBuffer.getLeShort(i)
|
||||
var sample = inputBuffer.getLeShort(i)
|
||||
// Clamp the values to the minimum and maximum values possible for the
|
||||
// encoding. This prevents issues where samples amplified beyond 1 << 16
|
||||
// will end up becoming truncated during the conversion to a short,
|
||||
// resulting in popping.
|
||||
val targetSample =
|
||||
sample =
|
||||
(sample * volume)
|
||||
.toInt()
|
||||
.clamp(Short.MIN_VALUE.toInt(), Short.MAX_VALUE.toInt())
|
||||
.toShort()
|
||||
buffer.putLeShort(targetSample)
|
||||
buffer.putLeShort(sample)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:color="?attr/colorOnPrimaryContainer"
|
||||
android:state_activated="true" />
|
||||
<item android:color="?attr/colorOnSurfaceVariant" />
|
||||
</selector>
|
||||
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:alpha="0.64" android:color="?attr/colorPrimaryContainer"
|
||||
android:state_activated="true" />
|
||||
<item android:alpha="0.32" android:color="?attr/colorSurfaceVariant" />
|
||||
</selector>
|
||||
@@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="rectangle">
|
||||
<solid android:color="@color/sel_track_bg" />
|
||||
</shape>
|
||||
@@ -5,6 +5,20 @@
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
style="@style/Widget.Auxio.ItemLayout">
|
||||
|
||||
<!--
|
||||
We don't want to show an album cover, but we still want the spacing of this song
|
||||
to be alike to other songs. So, add a pastel-ish background to each track number
|
||||
view. The way we do this is odd, but it's designed this way-->
|
||||
|
||||
<org.oxycblt.auxio.coil.RoundableImageView
|
||||
android:id="@+id/song_track_bg"
|
||||
style="@style/Widget.Auxio.Image.Small"
|
||||
android:src="@drawable/ui_track_bg"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/song_track"
|
||||
app:layout_constraintEnd_toEndOf="@+id/song_track"
|
||||
app:layout_constraintStart_toStartOf="@+id/song_track"
|
||||
app:layout_constraintTop_toTopOf="@+id/song_track"/>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/song_track_placeholder"
|
||||
style="@style/Widget.Auxio.Image.Small"
|
||||
@@ -12,26 +26,27 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:contentDescription="@string/def_track"
|
||||
android:src="@drawable/ic_song"
|
||||
android:visibility="invisible"
|
||||
android:visibility="gone"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/song_track"
|
||||
app:layout_constraintEnd_toEndOf="@+id/song_track"
|
||||
app:layout_constraintStart_toStartOf="@+id/song_track"
|
||||
app:layout_constraintTop_toTopOf="@+id/song_track"
|
||||
app:tint="@color/sel_accented"
|
||||
app:tint="@color/sel_on_track_bg"
|
||||
tools:text="1" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/song_track"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_width="@dimen/size_btn_small"
|
||||
android:layout_height="@dimen/size_btn_small"
|
||||
android:gravity="center"
|
||||
android:maxLines="1"
|
||||
android:minWidth="@dimen/size_btn_small"
|
||||
android:minHeight="@dimen/size_btn_small"
|
||||
app:autoSizeTextType="uniform"
|
||||
app:autoSizeMinTextSize="@dimen/text_size_track_number_min"
|
||||
app:autoSizeMaxTextSize="@dimen/text_size_track_number_max"
|
||||
app:autoSizeStepGranularity="@dimen/text_size_track_number_step"
|
||||
android:textAlignment="center"
|
||||
android:textAppearance="@style/TextAppearance.Auxio.BodyLarge"
|
||||
android:textColor="@color/sel_accented_secondary"
|
||||
android:textSize="@dimen/text_size_track_number"
|
||||
android:textColor="@color/sel_on_track_bg"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toStartOf="@+id/song_name"
|
||||
app:layout_constraintHorizontal_bias="0.5"
|
||||
|
||||
@@ -26,7 +26,9 @@
|
||||
|
||||
<dimen name="text_size_ext_label_larger">16sp</dimen>
|
||||
<dimen name="text_size_ext_title_mid_large">18sp</dimen>
|
||||
<dimen name="text_size_track_number">22sp</dimen>
|
||||
<dimen name="text_size_track_number_min">12sp</dimen>
|
||||
<dimen name="text_size_track_number_max">20sp</dimen>
|
||||
<dimen name="text_size_track_number_step">2sp</dimen>
|
||||
|
||||
<!-- Misc -->
|
||||
<dimen name="elevation_small">2dp</dimen>
|
||||
|
||||
Reference in New Issue
Block a user