Add tooltips to accent picker
Add tooltips to the accent picker that align with the content description.
This commit is contained in:
parent
3f0331f1c9
commit
fefe2d244d
2 changed files with 20 additions and 15 deletions
|
@ -396,7 +396,7 @@ class PlaybackStateManager private constructor() {
|
||||||
logD("Removing item ${mUserQueue[index].name}.")
|
logD("Removing item ${mUserQueue[index].name}.")
|
||||||
|
|
||||||
if (index > mUserQueue.size || index < 0) {
|
if (index > mUserQueue.size || index < 0) {
|
||||||
logE("Index is out of bounds, did not remove queue item.")
|
logE("Index is out of bounds, did not remove user queue item.")
|
||||||
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -411,7 +411,7 @@ class PlaybackStateManager private constructor() {
|
||||||
*/
|
*/
|
||||||
fun moveUserQueueItems(from: Int, to: Int) {
|
fun moveUserQueueItems(from: Int, to: Int) {
|
||||||
if (from > mUserQueue.size || from < 0 || to > mUserQueue.size || to < 0) {
|
if (from > mUserQueue.size || from < 0 || to > mUserQueue.size || to < 0) {
|
||||||
logE("Indices were out of bounds, did not move queue item")
|
logE("Indices were out of bounds, did not move user queue item")
|
||||||
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -713,16 +713,18 @@ class PlaybackStateManager private constructor() {
|
||||||
* @param queueItems The list of [QueueItem]s to unpack.
|
* @param queueItems The list of [QueueItem]s to unpack.
|
||||||
*/
|
*/
|
||||||
private fun unpackQueue(queueItems: List<QueueItem>) {
|
private fun unpackQueue(queueItems: List<QueueItem>) {
|
||||||
|
// When unpacking, first traverse albums and then traverse album songs to reduce
|
||||||
|
// the amount of useless comparisons in large queues.
|
||||||
queueItems.forEach { item ->
|
queueItems.forEach { item ->
|
||||||
// Traverse albums and then album songs instead of just the songs, as its faster.
|
musicStore.albums.find { it.name == item.albumName }?.songs?.find {
|
||||||
musicStore.albums.find { it.name == item.albumName }
|
it.name == item.songName
|
||||||
?.songs?.find { it.name == item.songName }?.let {
|
}?.let {
|
||||||
if (item.isUserQueue) {
|
if (item.isUserQueue) {
|
||||||
mUserQueue.add(it)
|
mUserQueue.add(it)
|
||||||
} else {
|
} else {
|
||||||
mQueue.add(it)
|
mQueue.add(it)
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// When done, get a more accurate index to prevent issues with queue songs that were saved
|
// When done, get a more accurate index to prevent issues with queue songs that were saved
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
package org.oxycblt.auxio.settings.ui
|
package org.oxycblt.auxio.settings.ui
|
||||||
|
|
||||||
import android.view.ViewGroup
|
import android.view.ViewGroup
|
||||||
|
import androidx.appcompat.widget.TooltipCompat
|
||||||
import androidx.recyclerview.widget.RecyclerView
|
import androidx.recyclerview.widget.RecyclerView
|
||||||
import org.oxycblt.auxio.R
|
import org.oxycblt.auxio.R
|
||||||
import org.oxycblt.auxio.databinding.ItemAccentBinding
|
import org.oxycblt.auxio.databinding.ItemAccentBinding
|
||||||
|
@ -33,11 +34,7 @@ class AccentAdapter(
|
||||||
|
|
||||||
fun bind(accent: Accent) {
|
fun bind(accent: Accent) {
|
||||||
binding.accent.apply {
|
binding.accent.apply {
|
||||||
contentDescription = accent.getDetailedSummary(context)
|
contentDescription = context.getString(accent.name)
|
||||||
|
|
||||||
setOnClickListener {
|
|
||||||
doOnAccentConfirm(accent)
|
|
||||||
}
|
|
||||||
|
|
||||||
imageTintList = if (accent == Accent.get()) {
|
imageTintList = if (accent == Accent.get()) {
|
||||||
isEnabled = false
|
isEnabled = false
|
||||||
|
@ -50,6 +47,12 @@ class AccentAdapter(
|
||||||
}
|
}
|
||||||
|
|
||||||
backgroundTintList = accent.getStateList(context)
|
backgroundTintList = accent.getStateList(context)
|
||||||
|
|
||||||
|
TooltipCompat.setTooltipText(this, contentDescription)
|
||||||
|
|
||||||
|
setOnClickListener {
|
||||||
|
doOnAccentConfirm(accent)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue