ui: redefine activation meaning
Redefine the meaning of activation across the app to align with the SDK documentation. According to the documentation: - Activation -> A permanent kind of selection initiated by the user. This means playback states, item selection, etc. - Selection -> A transient kind of selection that can be added or removed without user input. This includes things such as playing indicators. Redefine usages of selection and activation across the app to align with this.
This commit is contained in:
parent
a4cc27d85e
commit
df6d80176d
25 changed files with 42 additions and 52 deletions
|
@ -197,7 +197,7 @@ private class AlbumSongViewHolder private constructor(private val binding: ItemA
|
|||
}
|
||||
|
||||
override fun updateIndicator(isActive: Boolean, isPlaying: Boolean) {
|
||||
binding.root.isActivated = isActive
|
||||
binding.root.isSelected = isActive
|
||||
binding.songTrackBg.isPlaying = isPlaying
|
||||
}
|
||||
|
||||
|
|
|
@ -165,7 +165,7 @@ private class ArtistAlbumViewHolder private constructor(private val binding: Ite
|
|||
}
|
||||
|
||||
override fun updateIndicator(isActive: Boolean, isPlaying: Boolean) {
|
||||
binding.root.isActivated = isActive
|
||||
binding.root.isSelected = isActive
|
||||
binding.parentImage.isPlaying = isPlaying
|
||||
}
|
||||
|
||||
|
@ -194,7 +194,7 @@ private class ArtistSongViewHolder private constructor(private val binding: Item
|
|||
}
|
||||
|
||||
override fun updateIndicator(isActive: Boolean, isPlaying: Boolean) {
|
||||
binding.root.isActivated = isActive
|
||||
binding.root.isSelected = isActive
|
||||
binding.songAlbumCover.isPlaying = isPlaying
|
||||
}
|
||||
|
||||
|
|
|
@ -115,8 +115,7 @@ constructor(context: Context, attrs: AttributeSet? = null, @AttrRes defStyleAttr
|
|||
|
||||
override fun setActivated(activated: Boolean) {
|
||||
super.setActivated(activated)
|
||||
invalidateAlpha()
|
||||
invalidatePlayingIndicator()
|
||||
invalidateSelectionIndicator()
|
||||
}
|
||||
|
||||
override fun setEnabled(enabled: Boolean) {
|
||||
|
@ -127,7 +126,8 @@ constructor(context: Context, attrs: AttributeSet? = null, @AttrRes defStyleAttr
|
|||
|
||||
override fun setSelected(selected: Boolean) {
|
||||
super.setSelected(selected)
|
||||
invalidateSelectionIndicator()
|
||||
invalidateAlpha()
|
||||
invalidatePlayingIndicator()
|
||||
}
|
||||
|
||||
var isPlaying: Boolean
|
||||
|
@ -137,11 +137,11 @@ constructor(context: Context, attrs: AttributeSet? = null, @AttrRes defStyleAttr
|
|||
}
|
||||
|
||||
private fun invalidateAlpha() {
|
||||
alpha = if (isActivated || isEnabled) 1f else 0.5f
|
||||
alpha = if (isSelected || isEnabled) 1f else 0.5f
|
||||
}
|
||||
|
||||
private fun invalidatePlayingIndicator() {
|
||||
if (isActivated) {
|
||||
if (isSelected) {
|
||||
customView?.alpha = 0f
|
||||
inner.alpha = 0f
|
||||
playingIndicator.alpha = 1f
|
||||
|
@ -153,7 +153,7 @@ constructor(context: Context, attrs: AttributeSet? = null, @AttrRes defStyleAttr
|
|||
}
|
||||
|
||||
private fun invalidateSelectionIndicator() {
|
||||
selectionIndicator.alpha = if (isSelected) 1f else 0f
|
||||
selectionIndicator.alpha = if (isActivated) 1f else 0f
|
||||
}
|
||||
|
||||
fun bind(song: Song) {
|
||||
|
|
|
@ -84,7 +84,7 @@ class PlaybackBarFragment : ViewBindingFragment<FragmentPlaybackBarBinding>() {
|
|||
ActionMode.REPEAT -> {
|
||||
binding.playbackSecondaryAction.apply {
|
||||
contentDescription = getString(R.string.desc_change_repeat)
|
||||
iconTint = context.getColorCompat(R.color.sel_accented)
|
||||
iconTint = context.getColorCompat(R.color.sel_activatable_icon)
|
||||
setOnClickListener { playbackModel.incrementRepeatMode() }
|
||||
collectImmediately(playbackModel.repeatMode, ::updateRepeat)
|
||||
}
|
||||
|
@ -93,7 +93,7 @@ class PlaybackBarFragment : ViewBindingFragment<FragmentPlaybackBarBinding>() {
|
|||
binding.playbackSecondaryAction.apply {
|
||||
setIconResource(R.drawable.sel_shuffle_state_24)
|
||||
contentDescription = getString(R.string.desc_shuffle)
|
||||
iconTint = context.getColorCompat(R.color.sel_accented)
|
||||
iconTint = context.getColorCompat(R.color.sel_activatable_icon)
|
||||
setOnClickListener { playbackModel.invertShuffled() }
|
||||
collectImmediately(playbackModel.isShuffled, ::updateShuffled)
|
||||
}
|
||||
|
|
|
@ -165,7 +165,7 @@ class QueueSongViewHolder private constructor(private val binding: ItemQueueSong
|
|||
}
|
||||
|
||||
override fun updateIndicator(isActive: Boolean, isPlaying: Boolean) {
|
||||
binding.interactBody.isActivated = isActive
|
||||
binding.interactBody.isSelected = isActive
|
||||
binding.songAlbumCover.isPlaying = isPlaying
|
||||
}
|
||||
|
||||
|
|
|
@ -70,7 +70,7 @@ constructor(context: Context, attrs: AttributeSet? = null, defStyleAttr: Int = 0
|
|||
// Sanity check 2: Ensure that this value is within the duration and will not crash
|
||||
// the app, and that the user is not currently seeking (which would cause the SeekBar
|
||||
// to jump around).
|
||||
if (from <= durationDs && !isActivated) {
|
||||
if (from <= durationDs && !isSelected) {
|
||||
binding.seekBarSlider.value = from.toFloat()
|
||||
|
||||
// We would want to keep this in the callback, but the callback only fires when
|
||||
|
@ -106,13 +106,13 @@ constructor(context: Context, attrs: AttributeSet? = null, defStyleAttr: Int = 0
|
|||
logD("Starting seek mode")
|
||||
// User has begun seeking, place the SeekBar into a "Suspended" mode in which no
|
||||
// position updates are sent and is indicated by the position value turning accented.
|
||||
isActivated = true
|
||||
isSelected = true
|
||||
}
|
||||
|
||||
override fun onStopTrackingTouch(slider: Slider) {
|
||||
logD("Confirming seek")
|
||||
// End of seek event, send off new value to callback.
|
||||
isActivated = false
|
||||
isSelected = false
|
||||
callback?.seekTo(slider.value.toLong())
|
||||
}
|
||||
|
||||
|
|
|
@ -47,7 +47,7 @@ class SongViewHolder private constructor(private val binding: ItemSongBinding) :
|
|||
}
|
||||
|
||||
override fun updateIndicator(isActive: Boolean, isPlaying: Boolean) {
|
||||
binding.root.isActivated = isActive
|
||||
binding.root.isSelected = isActive
|
||||
binding.songAlbumCover.isPlaying = isPlaying
|
||||
}
|
||||
|
||||
|
@ -80,7 +80,7 @@ class AlbumViewHolder private constructor(private val binding: ItemParentBinding
|
|||
}
|
||||
|
||||
override fun updateIndicator(isActive: Boolean, isPlaying: Boolean) {
|
||||
binding.root.isActivated = isActive
|
||||
binding.root.isSelected = isActive
|
||||
binding.parentImage.isPlaying = isPlaying
|
||||
}
|
||||
|
||||
|
@ -126,7 +126,7 @@ class ArtistViewHolder private constructor(private val binding: ItemParentBindin
|
|||
}
|
||||
|
||||
override fun updateIndicator(isActive: Boolean, isPlaying: Boolean) {
|
||||
binding.root.isActivated = isActive
|
||||
binding.root.isSelected = isActive
|
||||
binding.parentImage.isPlaying = isPlaying
|
||||
}
|
||||
|
||||
|
@ -165,7 +165,7 @@ class GenreViewHolder private constructor(private val binding: ItemParentBinding
|
|||
}
|
||||
|
||||
override fun updateIndicator(isActive: Boolean, isPlaying: Boolean) {
|
||||
binding.root.isActivated = isActive
|
||||
binding.root.isSelected = isActive
|
||||
binding.parentImage.isPlaying = isPlaying
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:color="?attr/colorPrimary" android:state_activated="true" />
|
||||
<item android:color="?android:attr/textColorPrimary" />
|
||||
</selector>
|
|
@ -1,5 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:color="?attr/colorPrimary" android:state_activated="true" />
|
||||
<item android:color="?android:attr/textColorSecondary" />
|
||||
</selector>
|
|
@ -1,5 +1,5 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:color="?attr/colorSecondaryContainer" android:alpha="0.32" android:state_selected="true" />
|
||||
<item android:color="?attr/colorSecondaryContainer" android:alpha="0.32" android:state_activated="true" />
|
||||
<item android:color="?attr/colorSurface" />
|
||||
</selector>
|
|
@ -1,6 +1,6 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:alpha="0.24" android:color="?attr/colorOnSurface" android:state_enabled="false" />
|
||||
<item android:color="?attr/colorPrimary" android:state_activated="true" />
|
||||
<item android:color="?attr/colorPrimary" android:state_selected="true" />
|
||||
<item android:color="?attr/colorControlNormal" />
|
||||
</selector>
|
|
@ -1,5 +1,5 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:color="?attr/colorPrimaryContainer" android:state_activated="true" />
|
||||
<item android:color="?attr/colorPrimaryContainer" android:state_selected="true" />
|
||||
<item android:color="?attr/colorOnSurfaceInverse" />
|
||||
</selector>
|
|
@ -1,5 +1,5 @@
|
|||
<?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/colorOnPrimaryContainer" android:state_selected="true" />
|
||||
<item android:color="?attr/colorSurfaceInverse" />
|
||||
</selector>
|
|
@ -1,6 +1,6 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:color="?attr/colorPrimary" android:state_activated="true" />
|
||||
<item android:color="?attr/colorPrimary" android:state_selected="true" />
|
||||
<item android:alpha="0.5" android:color="?android:attr/textColorPrimary" android:state_enabled="false" />
|
||||
<item android:color="?android:attr/textColorPrimary" />
|
||||
</selector>
|
|
@ -1,6 +1,6 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:color="?android:attr/textColorSecondary" android:state_activated="true" />
|
||||
<item android:color="?android:attr/textColorSecondary" android:state_selected="true" />
|
||||
<item android:alpha="0.5" android:color="?android:attr/textColorSecondary" android:state_enabled="false" />
|
||||
<item android:color="?android:attr/textColorSecondary" />
|
||||
</selector>
|
|
@ -1,5 +1,5 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:drawable="@color/sel_selectable_background" />
|
||||
<item android:drawable="@color/sel_activatable_background" />
|
||||
<item android:drawable="?attr/selectableItemBackground" />
|
||||
</layer-list>
|
|
@ -94,7 +94,7 @@
|
|||
android:layout_height="wrap_content"
|
||||
android:contentDescription="@string/desc_change_repeat"
|
||||
app:icon="@drawable/ic_repeat_off_24"
|
||||
app:iconTint="@color/sel_accented"
|
||||
app:iconTint="@color/sel_activatable_icon"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/playback_skip_prev"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="@+id/playback_skip_prev" />
|
||||
|
@ -143,11 +143,11 @@
|
|||
android:layout_height="wrap_content"
|
||||
android:contentDescription="@string/desc_shuffle"
|
||||
app:icon="@drawable/sel_shuffle_state_24"
|
||||
app:iconTint="@color/sel_accented"
|
||||
app:iconTint="@color/sel_activatable_icon"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/playback_skip_next"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="@+id/playback_skip_next"
|
||||
app:tint="@color/sel_accented" />
|
||||
app:tint="@color/sel_activatable_icon" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
|
|
|
@ -96,7 +96,7 @@
|
|||
android:layout_marginEnd="@dimen/spacing_huge"
|
||||
android:contentDescription="@string/desc_change_repeat"
|
||||
app:icon="@drawable/ic_repeat_off_24"
|
||||
app:iconTint="@color/sel_accented"
|
||||
app:iconTint="@color/sel_activatable_icon"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/playback_skip_prev"
|
||||
app:layout_constraintEnd_toStartOf="@+id/playback_skip_prev"
|
||||
app:layout_constraintHorizontal_chainStyle="packed"
|
||||
|
@ -147,11 +147,11 @@
|
|||
android:layout_marginStart="@dimen/spacing_huge"
|
||||
android:contentDescription="@string/desc_shuffle"
|
||||
app:icon="@drawable/sel_shuffle_state_24"
|
||||
app:iconTint="@color/sel_accented"
|
||||
app:iconTint="@color/sel_activatable_icon"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/playback_skip_next"
|
||||
app:layout_constraintStart_toEndOf="@+id/playback_skip_next"
|
||||
app:layout_constraintTop_toTopOf="@+id/playback_skip_next"
|
||||
app:tint="@color/sel_accented" />
|
||||
app:tint="@color/sel_activatable_icon" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
</org.oxycblt.auxio.playback.ui.ForcedLTRFrameLayout>
|
||||
|
|
|
@ -109,7 +109,7 @@
|
|||
android:layout_height="wrap_content"
|
||||
android:contentDescription="@string/desc_change_repeat"
|
||||
app:icon="@drawable/ic_repeat_off_24"
|
||||
app:iconTint="@color/sel_accented"
|
||||
app:iconTint="@color/sel_activatable_icon"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/playback_skip_prev"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="@+id/playback_skip_prev" />
|
||||
|
@ -158,11 +158,11 @@
|
|||
android:layout_height="wrap_content"
|
||||
android:contentDescription="@string/desc_shuffle"
|
||||
app:icon="@drawable/sel_shuffle_state_24"
|
||||
app:iconTint="@color/sel_accented"
|
||||
app:iconTint="@color/sel_activatable_icon"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/playback_skip_next"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="@+id/playback_skip_next"
|
||||
app:tint="@color/sel_accented" />
|
||||
app:tint="@color/sel_activatable_icon" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
|
|
|
@ -54,7 +54,7 @@
|
|||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="@dimen/spacing_small"
|
||||
android:textColor="@color/sel_accented_primary"
|
||||
android:textColor="@color/sel_selectable_text_primary"
|
||||
app:layout_constraintBottom_toTopOf="@+id/song_duration"
|
||||
app:layout_constraintEnd_toStartOf="@+id/song_menu"
|
||||
app:layout_constraintStart_toEndOf="@+id/song_track_bg"
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="@dimen/spacing_mid_medium"
|
||||
android:textColor="@color/sel_accented_primary"
|
||||
android:textColor="@color/sel_selectable_text_primary"
|
||||
app:layout_constraintBottom_toTopOf="@+id/parent_info"
|
||||
app:layout_constraintEnd_toStartOf="@+id/parent_menu"
|
||||
app:layout_constraintStart_toEndOf="@+id/parent_image"
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="@dimen/spacing_mid_medium"
|
||||
android:textColor="@color/sel_accented_primary"
|
||||
android:textColor="@color/sel_selectable_text_primary"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toEndOf="@+id/picker_image"
|
||||
|
|
|
@ -49,7 +49,7 @@
|
|||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="@dimen/spacing_mid_medium"
|
||||
android:textColor="@color/sel_toggleable_primary"
|
||||
android:textColor="@color/sel_selectable_text_primary"
|
||||
app:layout_constraintBottom_toTopOf="@+id/song_info"
|
||||
app:layout_constraintEnd_toStartOf="@+id/song_drag_handle"
|
||||
app:layout_constraintStart_toEndOf="@+id/song_album_cover"
|
||||
|
@ -63,7 +63,7 @@
|
|||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="@dimen/spacing_mid_medium"
|
||||
android:textColor="@color/sel_toggleable_secondary"
|
||||
android:textColor="@color/sel_selectable_text_secondary"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toStartOf="@+id/song_drag_handle"
|
||||
app:layout_constraintStart_toEndOf="@+id/song_album_cover"
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="@dimen/spacing_mid_medium"
|
||||
android:textColor="@color/sel_accented_primary"
|
||||
android:textColor="@color/sel_selectable_text_primary"
|
||||
app:layout_constraintBottom_toTopOf="@+id/song_info"
|
||||
app:layout_constraintEnd_toStartOf="@+id/song_menu"
|
||||
app:layout_constraintStart_toEndOf="@+id/song_album_cover"
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
android:layout_marginStart="@dimen/spacing_medium"
|
||||
android:layout_marginBottom="@dimen/spacing_tiny"
|
||||
android:textAppearance="@style/TextAppearance.Auxio.BodySmall"
|
||||
android:textColor="@color/sel_accented_secondary"
|
||||
android:textColor="@color/sel_selectable_text_secondary"
|
||||
tools:text="11:38" />
|
||||
|
||||
<TextView
|
||||
|
|
Loading…
Reference in a new issue