music: reorganize music folders dialog
Reorganize the music folders dialog to be more visually straightforward than prior, primarily by grouping the folder elements into the same visual region. Resolves #318.
This commit is contained in:
@@ -218,7 +218,9 @@ class Task(context: Context, private val raw: Song.Raw) {
|
||||
// Album artist
|
||||
textFrames["TXXX:musicbrainz album artist id"]?.let { raw.albumArtistMusicBrainzIds = it }
|
||||
(textFrames["TXXX:albumartists"] ?: textFrames["TPE2"])?.let { raw.albumArtistNames = it }
|
||||
(textFrames["TXXX:albumartists_sort"] ?: textFrames["TSO2"])?.let { raw.albumArtistSortNames = it }
|
||||
(textFrames["TXXX:albumartists_sort"] ?: textFrames["TSO2"])?.let {
|
||||
raw.albumArtistSortNames = it
|
||||
}
|
||||
|
||||
// Genre
|
||||
textFrames["TCON"]?.let { raw.genreNames = it }
|
||||
|
||||
@@ -26,6 +26,7 @@ import android.view.LayoutInflater
|
||||
import androidx.activity.result.ActivityResultLauncher
|
||||
import androidx.activity.result.contract.ActivityResultContracts
|
||||
import androidx.appcompat.app.AlertDialog
|
||||
import androidx.core.view.ViewCompat
|
||||
import androidx.core.view.isVisible
|
||||
import org.oxycblt.auxio.BuildConfig
|
||||
import org.oxycblt.auxio.R
|
||||
@@ -50,10 +51,8 @@ class MusicDirsDialog :
|
||||
DialogMusicDirsBinding.inflate(inflater)
|
||||
|
||||
override fun onConfigDialog(builder: AlertDialog.Builder) {
|
||||
// Don't set the click listener here, we do some custom magic in onCreateView instead.
|
||||
builder
|
||||
.setTitle(R.string.set_dirs)
|
||||
.setNeutralButton(R.string.lbl_add, null)
|
||||
.setNegativeButton(R.string.lbl_cancel, null)
|
||||
.setPositiveButton(R.string.lbl_save) { _, _ ->
|
||||
val settings = MusicSettings.from(requireContext())
|
||||
@@ -74,13 +73,9 @@ class MusicDirsDialog :
|
||||
registerForActivityResult(
|
||||
ActivityResultContracts.OpenDocumentTree(), ::addDocumentTreeUriToDirs)
|
||||
|
||||
// Now that the dialog exists, we get the view manually when the dialog is shown
|
||||
// and override its click listener so that the dialog does not auto-dismiss when we
|
||||
// click the "Add"/"Save" buttons. This prevents the dialog from disappearing in the former
|
||||
// and the app from crashing in the latter.
|
||||
requireDialog().setOnShowListener {
|
||||
val dialog = it as AlertDialog
|
||||
dialog.getButton(AlertDialog.BUTTON_NEUTRAL)?.setOnClickListener {
|
||||
binding.dirsAdd.apply {
|
||||
ViewCompat.setTooltipText(this, contentDescription)
|
||||
setOnClickListener {
|
||||
logD("Opening launcher")
|
||||
val launcher =
|
||||
requireNotNull(openDocumentTreeLauncher) {
|
||||
@@ -182,8 +177,12 @@ class MusicDirsDialog :
|
||||
private fun updateMode() {
|
||||
val binding = requireBinding()
|
||||
if (isUiModeInclude(binding)) {
|
||||
binding.dirsModeExclude.icon = null
|
||||
binding.dirsModeInclude.setIconResource(R.drawable.ic_check_24)
|
||||
binding.dirsModeDesc.setText(R.string.set_dirs_mode_include_desc)
|
||||
} else {
|
||||
binding.dirsModeExclude.setIconResource(R.drawable.ic_check_24)
|
||||
binding.dirsModeInclude.icon = null
|
||||
binding.dirsModeDesc.setText(R.string.set_dirs_mode_exclude_desc)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
package org.oxycblt.auxio.util
|
||||
|
||||
import android.app.PendingIntent
|
||||
import android.content.ActivityNotFoundException
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import android.content.res.ColorStateList
|
||||
@@ -26,6 +27,7 @@ import android.os.Build
|
||||
import android.util.TypedValue
|
||||
import android.view.LayoutInflater
|
||||
import android.widget.Toast
|
||||
import androidx.activity.result.ActivityResultLauncher
|
||||
import androidx.annotation.AttrRes
|
||||
import androidx.annotation.ColorRes
|
||||
import androidx.annotation.DimenRes
|
||||
|
||||
Reference in New Issue
Block a user