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:
parent
a0aaec98d0
commit
6e02929982
7 changed files with 97 additions and 54 deletions
|
@ -10,6 +10,7 @@
|
|||
- Added support for date values formatted as "YYYYMMDD"
|
||||
- Pressing the button will now clear the current selection before navigating back
|
||||
- Added support for non-standard `ARTISTS` tags
|
||||
- Reworked music folders dialog to be more coherent
|
||||
|
||||
#### What's Fixed
|
||||
- Fixed unreliable ReplayGain adjustment application in certain situations
|
||||
|
|
|
@ -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
|
||||
|
|
11
app/src/main/res/drawable/ic_add_24.xml
Normal file
11
app/src/main/res/drawable/ic_add_24.xml
Normal file
|
@ -0,0 +1,11 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportWidth="24"
|
||||
android:viewportHeight="24"
|
||||
android:tint="?attr/colorControlNormal">
|
||||
<path
|
||||
android:fillColor="@android:color/white"
|
||||
android:pathData="M11,19V13H5V11H11V5H13V11H19V13H13V19Z"/>
|
||||
</vector>
|
|
@ -4,60 +4,27 @@
|
|||
xmlns:tools="http://schemas.android.com/tools"
|
||||
style="@style/Widget.Auxio.Dialog.NestedScrollView"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical">
|
||||
|
||||
<LinearLayout
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical">
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<TextView
|
||||
style="@style/Widget.Auxio.TextView.Header"
|
||||
android:id="@+id/dirs_mode_header"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingStart="@dimen/spacing_large"
|
||||
android:paddingEnd="@dimen/spacing_large"
|
||||
android:text="@string/set_dirs_list" />
|
||||
|
||||
<com.google.android.material.divider.MaterialDivider
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" />
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/dirs_recycler"
|
||||
style="@style/Widget.Auxio.RecyclerView.Linear"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:layout_gravity="center"
|
||||
android:layout_weight="1"
|
||||
android:overScrollMode="never"
|
||||
tools:listitem="@layout/item_music_dir" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/dirs_empty"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingStart="@dimen/spacing_large"
|
||||
android:paddingTop="@dimen/spacing_medium"
|
||||
android:paddingEnd="@dimen/spacing_large"
|
||||
android:paddingBottom="@dimen/spacing_medium"
|
||||
android:text="@string/err_no_dirs"
|
||||
android:textAlignment="center"
|
||||
android:textAppearance="@style/TextAppearance.Auxio.LabelLarge"
|
||||
android:textColor="?android:attr/textColorSecondary"
|
||||
tools:visibility="gone" />
|
||||
|
||||
<TextView
|
||||
style="@style/Widget.Auxio.TextView.Header"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingStart="@dimen/spacing_large"
|
||||
android:paddingEnd="@dimen/spacing_large"
|
||||
android:text="@string/set_dirs_mode" />
|
||||
android:text="@string/set_dirs_mode"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<com.google.android.material.divider.MaterialDivider
|
||||
android:id="@+id/dirs_mode_header_divider"
|
||||
android:layout_width="match_parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/dirs_mode_header"
|
||||
android:layout_height="wrap_content" />
|
||||
|
||||
<com.google.android.material.button.MaterialButtonToggleGroup
|
||||
|
@ -68,19 +35,21 @@
|
|||
android:layout_marginTop="@dimen/spacing_medium"
|
||||
android:layout_marginEnd="@dimen/spacing_large"
|
||||
android:gravity="center"
|
||||
app:layout_constraintTop_toBottomOf="@+id/dirs_mode_header_divider"
|
||||
app:checkedButton="@+id/dirs_mode_exclude"
|
||||
app:selectionRequired="true"
|
||||
app:singleSelection="true">
|
||||
|
||||
<Button
|
||||
<com.google.android.material.button.MaterialButton
|
||||
android:id="@+id/dirs_mode_exclude"
|
||||
style="@style/Widget.Auxio.Button.Secondary"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
tools:icon="@drawable/ic_check_24"
|
||||
android:text="@string/set_dirs_mode_exclude" />
|
||||
|
||||
<Button
|
||||
<com.google.android.material.button.MaterialButton
|
||||
android:id="@+id/dirs_mode_include"
|
||||
style="@style/Widget.Auxio.Button.Secondary"
|
||||
android:layout_width="0dp"
|
||||
|
@ -98,9 +67,66 @@
|
|||
android:layout_marginTop="@dimen/spacing_small"
|
||||
android:layout_marginEnd="@dimen/spacing_large"
|
||||
android:textAlignment="viewStart"
|
||||
app:layout_constraintTop_toBottomOf="@+id/folder_mode_group"
|
||||
tools:text="Mode description" />
|
||||
|
||||
</LinearLayout>
|
||||
<TextView
|
||||
android:id="@+id/dirs_list_header"
|
||||
style="@style/Widget.Auxio.TextView.Header"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingStart="@dimen/spacing_large"
|
||||
android:paddingEnd="@dimen/spacing_large"
|
||||
android:text="@string/set_dirs_list"
|
||||
android:layout_marginTop="@dimen/spacing_medium"
|
||||
app:layout_constraintTop_toBottomOf="@+id/dirs_mode_desc"
|
||||
app:layout_constraintBottom_toTopOf="@+id/dirs_list_header_divider" />
|
||||
|
||||
<Button
|
||||
style="@style/Widget.Auxio.Button.Icon.Small"
|
||||
android:id="@+id/dirs_add"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
app:icon="@drawable/ic_add_24"
|
||||
android:contentDescription="@string/lbl_add"
|
||||
android:layout_marginEnd="@dimen/spacing_mid_large"
|
||||
app:layout_constraintBottom_toTopOf="@+id/dirs_list_header_divider"
|
||||
app:layout_constraintEnd_toEndOf="@+id/dirs_list_header" />
|
||||
|
||||
<com.google.android.material.divider.MaterialDivider
|
||||
android:id="@+id/dirs_list_header_divider"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
app:layout_constraintBottom_toTopOf="@+id/dirs_recycler"/>
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/dirs_recycler"
|
||||
style="@style/Widget.Auxio.RecyclerView.Linear"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:layout_gravity="center"
|
||||
android:layout_weight="1"
|
||||
android:clipToPadding="false"
|
||||
android:overScrollMode="never"
|
||||
android:paddingTop="@dimen/spacing_small"
|
||||
app:layout_constraintTop_toTopOf="@+id/dirs_list_header_divider"
|
||||
tools:listitem="@layout/item_music_dir" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/dirs_empty"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingStart="@dimen/spacing_large"
|
||||
android:paddingTop="@dimen/spacing_medium"
|
||||
android:paddingEnd="@dimen/spacing_large"
|
||||
android:paddingBottom="@dimen/spacing_medium"
|
||||
android:text="@string/err_no_dirs"
|
||||
android:textAlignment="center"
|
||||
android:textAppearance="@style/TextAppearance.Auxio.LabelLarge"
|
||||
android:textColor="?android:attr/textColorSecondary"
|
||||
app:layout_constraintTop_toTopOf="@+id/dirs_recycler"/>
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
|
||||
</androidx.core.widget.NestedScrollView>
|
|
@ -4,6 +4,8 @@
|
|||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingTop="@dimen/spacing_small"
|
||||
android:paddingBottom="@dimen/spacing_small"
|
||||
android:gravity="center"
|
||||
android:orientation="horizontal">
|
||||
|
||||
|
|
Loading…
Reference in a new issue