all: reformat

This commit is contained in:
Alexander Capehart
2026-02-08 17:25:29 -07:00
parent a44ec09193
commit 3603822d64
3 changed files with 20 additions and 27 deletions
@@ -546,11 +546,8 @@ constructor(context: Context, attrs: AttributeSet? = null, @AttrRes defStyleAttr
* Since the error drawable must also share a view with an image, any kind of transform or tint
* must occur within a custom dialog, which is implemented here.
*/
private class StyledDrawable(
context: Context,
inner: Drawable,
@Px val iconSize: Int?,
) : Drawable() {
private class StyledDrawable(context: Context, inner: Drawable, @Px val iconSize: Int?) :
Drawable() {
// Never tint a shared drawable instance. These icons are also used elsewhere (e.g. the
// About screen), and tinting without mutation can leak the modified tint state across
// views in inconsistent ways depending on drawable caching/inflation order.
@@ -22,7 +22,6 @@ import android.os.Bundle
import android.view.LayoutInflater
import androidx.core.view.updatePadding
import androidx.recyclerview.widget.RecyclerView
import org.oxycblt.auxio.R
import org.oxycblt.auxio.databinding.DialogSortBinding
import org.oxycblt.auxio.list.ClickableListListener
import org.oxycblt.auxio.list.adapter.UpdateInstructions
@@ -30,8 +29,7 @@ import org.oxycblt.auxio.ui.ViewBindingBottomSheetDialogFragment
import org.oxycblt.auxio.util.systemBarInsetsCompat
abstract class SortDialog :
ViewBindingBottomSheetDialogFragment<DialogSortBinding>(),
ClickableListListener<Sort.Mode> {
ViewBindingBottomSheetDialogFragment<DialogSortBinding>(), ClickableListListener<Sort.Mode> {
private val modeAdapter = SortModeAdapter(@Suppress("LeakingThis") this)
abstract fun getInitialSort(): Sort?
@@ -56,12 +54,8 @@ abstract class SortDialog :
applyChosenSort(requireNotNull(getCurrentSort()))
dismiss()
}
binding.sortDirectionAsc.setOnClickListener {
updateDirection(Sort.Direction.ASCENDING)
}
binding.sortDirectionDsc.setOnClickListener {
updateDirection(Sort.Direction.DESCENDING)
}
binding.sortDirectionAsc.setOnClickListener { updateDirection(Sort.Direction.ASCENDING) }
binding.sortDirectionDsc.setOnClickListener { updateDirection(Sort.Direction.DESCENDING) }
// --- STATE SETUP ---
modeAdapter.update(getModeChoices(), UpdateInstructions.Diff)
@@ -95,7 +89,9 @@ abstract class SortDialog :
val binding = requireBinding()
val initial = getInitialSort()
val mode = modeAdapter.currentMode ?: return null
val direction = if (binding.sortDirectionAsc.isChecked) Sort.Direction.ASCENDING else Sort.Direction.DESCENDING
val direction =
if (binding.sortDirectionAsc.isChecked) Sort.Direction.ASCENDING
else Sort.Direction.DESCENDING
return Sort(mode, direction)
}
}
@@ -89,18 +89,8 @@ class ExportPlaylistDialog : ViewBindingMaterialDialogFragment<DialogPlaylistExp
findNavController().navigateUp()
}
binding.exportRelativePaths.setOnClickListener {
// Enforce "selection required" behavior even if the config value doesn't change.
val current = pickerModel.currentExportConfig.value
updateExportConfig(current.copy(absolute = false))
pickerModel.setExportConfig(current.copy(absolute = false))
}
binding.exportAbsolutePaths.setOnClickListener {
// Enforce "selection required" behavior even if the config value doesn't change.
val current = pickerModel.currentExportConfig.value
updateExportConfig(current.copy(absolute = true))
pickerModel.setExportConfig(current.copy(absolute = true))
}
binding.exportRelativePaths.setOnClickListener { updatePathStyle(absolute = false) }
binding.exportAbsolutePaths.setOnClickListener { updatePathStyle(absolute = true) }
binding.exportWindowsPaths.setOnClickListener { _ ->
val current = pickerModel.currentExportConfig.value
@@ -141,6 +131,16 @@ class ExportPlaylistDialog : ViewBindingMaterialDialogFragment<DialogPlaylistExp
}
}
private fun updatePathStyle(absolute: Boolean) {
// Keep the UI in a valid state even if the config doesn't change (no emission).
val current = pickerModel.currentExportConfig.value
val updated = current.copy(absolute = absolute)
updateExportConfig(updated)
if (updated != current) {
pickerModel.setExportConfig(updated)
}
}
private fun updateExportConfig(config: ExportConfig) {
val binding = requireBinding()
binding.exportRelativePaths.isChecked = !config.absolute