ui: improve misc ui elements

Make some minor UI tweaks across the app.
This commit is contained in:
OxygenCobalt
2021-09-11 20:54:36 -06:00
parent cafd7d8ca6
commit 744e4172f3
13 changed files with 86 additions and 42 deletions
@@ -88,7 +88,10 @@ class PlaybackFragment : Fragment(), SeekBar.OnSeekBarChangeListener {
// Make marquee of song title work
binding.playbackSong.isSelected = true
binding.playbackSeekBar.setOnSeekBarChangeListener(this)
binding.playbackSeekBar.apply {
setOnSeekBarChangeListener(this@PlaybackFragment)
isEnabled = true
}
// --- VIEWMODEL SETUP --
@@ -18,12 +18,38 @@
package org.oxycblt.auxio.settings
import android.util.TypedValue
import androidx.appcompat.app.AlertDialog
import androidx.appcompat.widget.AppCompatTextView
import androidx.core.content.res.ResourcesCompat
import androidx.core.view.updatePadding
import org.oxycblt.auxio.BuildConfig
import org.oxycblt.auxio.R
import org.oxycblt.auxio.ui.LifecycleDialog
import org.oxycblt.auxio.util.resolveAttr
class IntListPrefDialog(private val pref: IntListPreference) : LifecycleDialog() {
override fun onConfigDialog(builder: AlertDialog.Builder) {
builder.setTitle(pref.title)
// Don't set the title. Instead. Set a custom title view so that the padding actually
// works between the title and this dialog's contents. I can't believe I have to do this.
val titleView = AppCompatTextView(requireContext()).apply {
text = pref.title
typeface = ResourcesCompat.getFont(context, R.font.inter_bold)
setTextSize(
TypedValue.COMPLEX_UNIT_PX,
resources.getDimensionPixelSize(R.dimen.text_size_large).toFloat()
)
setTextColor(android.R.attr.textColorPrimary.resolveAttr(context))
// We have to make the bottom padding account for the ListView's immutable top padding,
// because Android's dialog code is a massive pile of broken spaghetti.
val padding = resources.getDimension(R.dimen.spacing_medium).toInt()
val paddingHack = resources.getDimension(R.dimen.spacing_small).toInt()
updatePadding(left = padding, top = padding, right = padding, bottom = paddingHack)
}
builder.setCustomTitle(titleView)
builder.setSingleChoiceItems(pref.entries, pref.getValueIndex()) { _, index ->
pref.setValueIndex(index)
@@ -35,6 +61,6 @@ class IntListPrefDialog(private val pref: IntListPreference) : LifecycleDialog()
}
companion object {
const val TAG = "TAG_INT_PREF_DIALOG"
const val TAG = BuildConfig.APPLICATION_ID + ".tag.INT_PREF"
}
}