Improve dialog layouts
Improve the dialog layouts so that only the recyclerview scrolls when it cannot fit instead of the entire layout being forced to scroll.
This commit is contained in:
parent
076d2b3d7e
commit
53ec1aa8a5
8 changed files with 85 additions and 82 deletions
|
@ -9,10 +9,11 @@ android {
|
||||||
|
|
||||||
defaultConfig {
|
defaultConfig {
|
||||||
applicationId "org.oxycblt.auxio"
|
applicationId "org.oxycblt.auxio"
|
||||||
|
versionName "1.3.3"
|
||||||
|
versionCode 5
|
||||||
|
|
||||||
minSdkVersion 21
|
minSdkVersion 21
|
||||||
targetSdkVersion 30
|
targetSdkVersion 30
|
||||||
versionCode 5
|
|
||||||
versionName "1.3.3"
|
|
||||||
|
|
||||||
buildFeatures {
|
buildFeatures {
|
||||||
dataBinding true
|
dataBinding true
|
||||||
|
|
|
@ -107,7 +107,9 @@ class BlacklistDialog : LifecycleDialog() {
|
||||||
blacklistModel.loadDatabasePaths()
|
blacklistModel.loadDatabasePaths()
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun addDocTreePath(uri: Uri) {
|
private fun addDocTreePath(uri: Uri?) {
|
||||||
|
uri ?: return
|
||||||
|
|
||||||
val path = parseDocTreePath(uri)
|
val path = parseDocTreePath(uri)
|
||||||
|
|
||||||
if (path != null) {
|
if (path != null) {
|
||||||
|
@ -126,10 +128,8 @@ class BlacklistDialog : LifecycleDialog() {
|
||||||
// Turn it into a semi-usable path
|
// Turn it into a semi-usable path
|
||||||
val typeAndPath = DocumentsContract.getTreeDocumentId(docUri).split(":")
|
val typeAndPath = DocumentsContract.getTreeDocumentId(docUri).split(":")
|
||||||
|
|
||||||
// We only support the main drive since that's all we can get from MediaColumns.DATA.
|
// Only the main drive is supported, since thats all we can get from MediaColumns.DATA
|
||||||
// We also check if this directory actually has multiple parts, if it isn't, then its
|
if (typeAndPath[0] == "primary") {
|
||||||
// the root directory and it shouldn't be supported.
|
|
||||||
if (typeAndPath[0] == "primary" && typeAndPath.size == 2) {
|
|
||||||
return getRootPath() + "/" + typeAndPath.last()
|
return getRootPath() + "/" + typeAndPath.last()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -11,7 +11,7 @@ import com.google.android.material.dialog.MaterialAlertDialogBuilder
|
||||||
* [DialogFragment] that replicates the Fragment lifecycle in regards to [AlertDialog], which
|
* [DialogFragment] that replicates the Fragment lifecycle in regards to [AlertDialog], which
|
||||||
* doesn't seem to set the view from onCreateView correctly.
|
* doesn't seem to set the view from onCreateView correctly.
|
||||||
*/
|
*/
|
||||||
abstract class LifecycleDialog() : DialogFragment() {
|
abstract class LifecycleDialog : DialogFragment() {
|
||||||
override fun onCreateDialog(savedInstanceState: Bundle?): Dialog {
|
override fun onCreateDialog(savedInstanceState: Bundle?): Dialog {
|
||||||
return MaterialAlertDialogBuilder(requireActivity(), theme).create()
|
return MaterialAlertDialogBuilder(requireActivity(), theme).create()
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,11 +3,11 @@
|
||||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
xmlns:tools="http://schemas.android.com/tools">
|
xmlns:tools="http://schemas.android.com/tools">
|
||||||
|
|
||||||
<androidx.constraintlayout.widget.ConstraintLayout
|
<LinearLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="wrap_content"
|
||||||
android:background="@color/background"
|
android:background="@color/background"
|
||||||
android:paddingBottom="@dimen/padding_small"
|
android:orientation="vertical"
|
||||||
android:theme="@style/Theme.Neutral">
|
android:theme="@style/Theme.Neutral">
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
|
@ -26,32 +26,38 @@
|
||||||
<androidx.recyclerview.widget.RecyclerView
|
<androidx.recyclerview.widget.RecyclerView
|
||||||
android:id="@+id/accent_recycler"
|
android:id="@+id/accent_recycler"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="0dp"
|
||||||
|
android:layout_weight="1"
|
||||||
android:foregroundGravity="center"
|
android:foregroundGravity="center"
|
||||||
android:overScrollMode="never"
|
android:overScrollMode="never"
|
||||||
app:layoutManager="org.oxycblt.auxio.settings.accent.AutoGridLayoutManager"
|
app:layoutManager="org.oxycblt.auxio.settings.accent.AutoGridLayoutManager"
|
||||||
|
app:layout_constraintBottom_toTopOf="@+id/accent_cancel"
|
||||||
app:layout_constraintTop_toBottomOf="@+id/accent_header"
|
app:layout_constraintTop_toBottomOf="@+id/accent_header"
|
||||||
tools:spanCount="6"
|
|
||||||
tools:itemCount="18"
|
tools:itemCount="18"
|
||||||
tools:listitem="@layout/item_accent" />
|
tools:listitem="@layout/item_accent" />
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:gravity="end"
|
||||||
|
android:padding="@dimen/padding_small">
|
||||||
|
|
||||||
<Button
|
<Button
|
||||||
android:id="@+id/accent_cancel"
|
android:id="@+id/accent_cancel"
|
||||||
style="@style/Widget.Button.Dialog"
|
style="@style/Widget.Button.Dialog"
|
||||||
android:layout_marginTop="@dimen/margin_small"
|
|
||||||
android:layout_marginEnd="@dimen/margin_small"
|
android:layout_marginEnd="@dimen/margin_small"
|
||||||
android:text="@android:string/cancel"
|
android:text="@android:string/cancel"
|
||||||
app:layout_constraintEnd_toStartOf="@+id/accent_confirm"
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
app:layout_constraintTop_toBottomOf="@+id/accent_recycler" />
|
app:layout_constraintEnd_toStartOf="@+id/accent_confirm" />
|
||||||
|
|
||||||
<Button
|
<Button
|
||||||
android:id="@+id/accent_confirm"
|
android:id="@+id/accent_confirm"
|
||||||
style="@style/Widget.Button.Dialog"
|
style="@style/Widget.Button.Dialog"
|
||||||
android:layout_marginEnd="@dimen/margin_small"
|
|
||||||
android:text="@android:string/ok"
|
android:text="@android:string/ok"
|
||||||
app:layout_constraintBottom_toBottomOf="@+id/accent_cancel"
|
app:layout_constraintBottom_toBottomOf="@+id/accent_cancel"
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
app:layout_constraintTop_toTopOf="@+id/accent_cancel" />
|
app:layout_constraintTop_toTopOf="@+id/accent_cancel" />
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
</LinearLayout>
|
||||||
</layout>
|
</layout>
|
|
@ -3,16 +3,12 @@
|
||||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
xmlns:tools="http://schemas.android.com/tools">
|
xmlns:tools="http://schemas.android.com/tools">
|
||||||
|
|
||||||
<androidx.core.widget.NestedScrollView
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="match_parent">
|
|
||||||
|
|
||||||
<androidx.constraintlayout.widget.ConstraintLayout
|
<LinearLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="wrap_content"
|
||||||
android:background="@color/background"
|
android:background="@color/background"
|
||||||
android:orientation="vertical"
|
android:orientation="vertical"
|
||||||
android:paddingBottom="@dimen/padding_small"
|
|
||||||
android:theme="@style/Theme.Neutral">
|
android:theme="@style/Theme.Neutral">
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
|
@ -24,17 +20,16 @@
|
||||||
android:text="@string/setting_content_blacklist"
|
android:text="@string/setting_content_blacklist"
|
||||||
android:textAlignment="viewStart"
|
android:textAlignment="viewStart"
|
||||||
android:textColor="?attr/colorPrimary"
|
android:textColor="?attr/colorPrimary"
|
||||||
android:textSize="@dimen/text_size_toolbar_header"
|
android:textSize="@dimen/text_size_toolbar_header" />
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
|
||||||
app:layout_constraintTop_toTopOf="parent" />
|
|
||||||
|
|
||||||
<androidx.recyclerview.widget.RecyclerView
|
<androidx.recyclerview.widget.RecyclerView
|
||||||
android:id="@+id/blacklist_recycler"
|
android:id="@+id/blacklist_recycler"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="0dp"
|
||||||
|
android:layout_gravity="center"
|
||||||
|
android:layout_weight="1"
|
||||||
android:overScrollMode="never"
|
android:overScrollMode="never"
|
||||||
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
|
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
|
||||||
app:layout_constraintTop_toBottomOf="@+id/blacklist_header"
|
|
||||||
tools:itemCount="1"
|
tools:itemCount="1"
|
||||||
tools:listitem="@layout/item_blacklist_entry" />
|
tools:listitem="@layout/item_blacklist_entry" />
|
||||||
|
|
||||||
|
@ -47,8 +42,13 @@
|
||||||
android:text="@string/label_no_dirs"
|
android:text="@string/label_no_dirs"
|
||||||
android:textAlignment="center"
|
android:textAlignment="center"
|
||||||
android:textAppearance="?android:attr/textAppearanceLarge"
|
android:textAppearance="?android:attr/textAppearanceLarge"
|
||||||
android:textColor="?android:attr/textColorSecondary"
|
android:textColor="?android:attr/textColorSecondary" />
|
||||||
app:layout_constraintTop_toBottomOf="@+id/blacklist_recycler" />
|
|
||||||
|
<androidx.constraintlayout.widget.ConstraintLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_gravity="bottom"
|
||||||
|
android:padding="@dimen/padding_small">
|
||||||
|
|
||||||
<Button
|
<Button
|
||||||
android:id="@+id/blacklist_cancel"
|
android:id="@+id/blacklist_cancel"
|
||||||
|
@ -61,7 +61,6 @@
|
||||||
<Button
|
<Button
|
||||||
android:id="@+id/blacklist_confirm"
|
android:id="@+id/blacklist_confirm"
|
||||||
style="@style/Widget.Button.Dialog"
|
style="@style/Widget.Button.Dialog"
|
||||||
android:layout_marginEnd="@dimen/margin_small"
|
|
||||||
android:text="@string/label_save"
|
android:text="@string/label_save"
|
||||||
app:layout_constraintBottom_toBottomOf="@+id/blacklist_cancel"
|
app:layout_constraintBottom_toBottomOf="@+id/blacklist_cancel"
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
@ -70,13 +69,12 @@
|
||||||
<Button
|
<Button
|
||||||
android:id="@+id/blacklist_add"
|
android:id="@+id/blacklist_add"
|
||||||
style="@style/Widget.Button.Dialog"
|
style="@style/Widget.Button.Dialog"
|
||||||
android:layout_marginStart="@dimen/margin_small"
|
|
||||||
android:layout_marginTop="@dimen/margin_small"
|
|
||||||
android:text="@string/label_add"
|
android:text="@string/label_add"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
app:layout_constraintTop_toBottomOf="@+id/blacklist_empty_text" />
|
app:layout_constraintStart_toStartOf="parent" />
|
||||||
|
|
||||||
|
|
||||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
</androidx.core.widget.NestedScrollView>
|
|
||||||
|
</LinearLayout>
|
||||||
</layout>
|
</layout>
|
|
@ -104,7 +104,6 @@
|
||||||
<string name="error_load_failed">Laden die Musik fehlgeschlagen</string>
|
<string name="error_load_failed">Laden die Musik fehlgeschlagen</string>
|
||||||
<string name="error_no_perms">Auxio braucht Berechtigung, zu lesen deine Musikbibliothek</string>
|
<string name="error_no_perms">Auxio braucht Berechtigung, zu lesen deine Musikbibliothek</string>
|
||||||
<string name="error_no_browser">Link könnte nicht geöffnet werden</string>
|
<string name="error_no_browser">Link könnte nicht geöffnet werden</string>
|
||||||
<string name="error_brick_dir">Das Stammverzeichnis kann nicht ausgeschlossen sein</string>
|
|
||||||
|
|
||||||
<!-- Hint Namespace | EditText Hints -->
|
<!-- Hint Namespace | EditText Hints -->
|
||||||
<string name="hint_search_library">Durchsuche deine Musikbibliothek…</string>
|
<string name="hint_search_library">Durchsuche deine Musikbibliothek…</string>
|
||||||
|
|
|
@ -105,8 +105,7 @@
|
||||||
<string name="error_load_failed">Music loading failed</string>
|
<string name="error_load_failed">Music loading failed</string>
|
||||||
<string name="error_no_perms">Auxio needs permission to read your music library</string>
|
<string name="error_no_perms">Auxio needs permission to read your music library</string>
|
||||||
<string name="error_no_browser">Could not open link</string>
|
<string name="error_no_browser">Could not open link</string>
|
||||||
<string name="error_brick_dir">The root folder cannot be excluded</string>
|
<string name="error_bad_dir">This directory is not supported</string>
|
||||||
<string name="error_bad_dir">That directory is not supported</string>
|
|
||||||
|
|
||||||
<!-- Hint Namespace | EditText Hints -->
|
<!-- Hint Namespace | EditText Hints -->
|
||||||
<string name="hint_search_library">Search your library…</string>
|
<string name="hint_search_library">Search your library…</string>
|
||||||
|
|
Loading…
Reference in a new issue