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 {
|
||||
applicationId "org.oxycblt.auxio"
|
||||
versionName "1.3.3"
|
||||
versionCode 5
|
||||
|
||||
minSdkVersion 21
|
||||
targetSdkVersion 30
|
||||
versionCode 5
|
||||
versionName "1.3.3"
|
||||
|
||||
buildFeatures {
|
||||
dataBinding true
|
||||
|
|
|
@ -107,7 +107,9 @@ class BlacklistDialog : LifecycleDialog() {
|
|||
blacklistModel.loadDatabasePaths()
|
||||
}
|
||||
|
||||
private fun addDocTreePath(uri: Uri) {
|
||||
private fun addDocTreePath(uri: Uri?) {
|
||||
uri ?: return
|
||||
|
||||
val path = parseDocTreePath(uri)
|
||||
|
||||
if (path != null) {
|
||||
|
@ -126,10 +128,8 @@ class BlacklistDialog : LifecycleDialog() {
|
|||
// Turn it into a semi-usable path
|
||||
val typeAndPath = DocumentsContract.getTreeDocumentId(docUri).split(":")
|
||||
|
||||
// We only support the main drive since that's all we can get from MediaColumns.DATA.
|
||||
// We also check if this directory actually has multiple parts, if it isn't, then its
|
||||
// the root directory and it shouldn't be supported.
|
||||
if (typeAndPath[0] == "primary" && typeAndPath.size == 2) {
|
||||
// Only the main drive is supported, since thats all we can get from MediaColumns.DATA
|
||||
if (typeAndPath[0] == "primary") {
|
||||
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
|
||||
* doesn't seem to set the view from onCreateView correctly.
|
||||
*/
|
||||
abstract class LifecycleDialog() : DialogFragment() {
|
||||
abstract class LifecycleDialog : DialogFragment() {
|
||||
override fun onCreateDialog(savedInstanceState: Bundle?): Dialog {
|
||||
return MaterialAlertDialogBuilder(requireActivity(), theme).create()
|
||||
}
|
||||
|
|
|
@ -3,11 +3,11 @@
|
|||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools">
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@color/background"
|
||||
android:paddingBottom="@dimen/padding_small"
|
||||
android:orientation="vertical"
|
||||
android:theme="@style/Theme.Neutral">
|
||||
|
||||
<TextView
|
||||
|
@ -26,32 +26,38 @@
|
|||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/accent_recycler"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_height="0dp"
|
||||
android:layout_weight="1"
|
||||
android:foregroundGravity="center"
|
||||
android:overScrollMode="never"
|
||||
app:layoutManager="org.oxycblt.auxio.settings.accent.AutoGridLayoutManager"
|
||||
app:layout_constraintBottom_toTopOf="@+id/accent_cancel"
|
||||
app:layout_constraintTop_toBottomOf="@+id/accent_header"
|
||||
tools:spanCount="6"
|
||||
tools:itemCount="18"
|
||||
tools:listitem="@layout/item_accent" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/accent_cancel"
|
||||
style="@style/Widget.Button.Dialog"
|
||||
android:layout_marginTop="@dimen/margin_small"
|
||||
android:layout_marginEnd="@dimen/margin_small"
|
||||
android:text="@android:string/cancel"
|
||||
app:layout_constraintEnd_toStartOf="@+id/accent_confirm"
|
||||
app:layout_constraintTop_toBottomOf="@+id/accent_recycler" />
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="end"
|
||||
android:padding="@dimen/padding_small">
|
||||
|
||||
<Button
|
||||
android:id="@+id/accent_confirm"
|
||||
style="@style/Widget.Button.Dialog"
|
||||
android:layout_marginEnd="@dimen/margin_small"
|
||||
android:text="@android:string/ok"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/accent_cancel"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="@+id/accent_cancel" />
|
||||
<Button
|
||||
android:id="@+id/accent_cancel"
|
||||
style="@style/Widget.Button.Dialog"
|
||||
android:layout_marginEnd="@dimen/margin_small"
|
||||
android:text="@android:string/cancel"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toStartOf="@+id/accent_confirm" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
<Button
|
||||
android:id="@+id/accent_confirm"
|
||||
style="@style/Widget.Button.Dialog"
|
||||
android:text="@android:string/ok"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/accent_cancel"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="@+id/accent_cancel" />
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
</layout>
|
|
@ -3,52 +3,52 @@
|
|||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools">
|
||||
|
||||
<androidx.core.widget.NestedScrollView
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@color/background"
|
||||
android:orientation="vertical"
|
||||
android:theme="@style/Theme.Neutral">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/blacklist_header"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:fontFamily="@font/inter_exbold"
|
||||
android:padding="@dimen/padding_medium"
|
||||
android:text="@string/setting_content_blacklist"
|
||||
android:textAlignment="viewStart"
|
||||
android:textColor="?attr/colorPrimary"
|
||||
android:textSize="@dimen/text_size_toolbar_header" />
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/blacklist_recycler"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:layout_gravity="center"
|
||||
android:layout_weight="1"
|
||||
android:overScrollMode="never"
|
||||
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
|
||||
tools:itemCount="1"
|
||||
tools:listitem="@layout/item_blacklist_entry" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/blacklist_empty_text"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:fontFamily="@font/inter_semibold"
|
||||
android:padding="@dimen/padding_medium"
|
||||
android:text="@string/label_no_dirs"
|
||||
android:textAlignment="center"
|
||||
android:textAppearance="?android:attr/textAppearanceLarge"
|
||||
android:textColor="?android:attr/textColorSecondary" />
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@color/background"
|
||||
android:orientation="vertical"
|
||||
android:paddingBottom="@dimen/padding_small"
|
||||
android:theme="@style/Theme.Neutral">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/blacklist_header"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:fontFamily="@font/inter_exbold"
|
||||
android:padding="@dimen/padding_medium"
|
||||
android:text="@string/setting_content_blacklist"
|
||||
android:textAlignment="viewStart"
|
||||
android:textColor="?attr/colorPrimary"
|
||||
android:textSize="@dimen/text_size_toolbar_header"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/blacklist_recycler"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:overScrollMode="never"
|
||||
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
|
||||
app:layout_constraintTop_toBottomOf="@+id/blacklist_header"
|
||||
tools:itemCount="1"
|
||||
tools:listitem="@layout/item_blacklist_entry" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/blacklist_empty_text"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:fontFamily="@font/inter_semibold"
|
||||
android:padding="@dimen/padding_medium"
|
||||
android:text="@string/label_no_dirs"
|
||||
android:textAlignment="center"
|
||||
android:textAppearance="?android:attr/textAppearanceLarge"
|
||||
android:textColor="?android:attr/textColorSecondary"
|
||||
app:layout_constraintTop_toBottomOf="@+id/blacklist_recycler" />
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="bottom"
|
||||
android:padding="@dimen/padding_small">
|
||||
|
||||
<Button
|
||||
android:id="@+id/blacklist_cancel"
|
||||
|
@ -61,7 +61,6 @@
|
|||
<Button
|
||||
android:id="@+id/blacklist_confirm"
|
||||
style="@style/Widget.Button.Dialog"
|
||||
android:layout_marginEnd="@dimen/margin_small"
|
||||
android:text="@string/label_save"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/blacklist_cancel"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
|
@ -70,13 +69,12 @@
|
|||
<Button
|
||||
android:id="@+id/blacklist_add"
|
||||
style="@style/Widget.Button.Dialog"
|
||||
android:layout_marginStart="@dimen/margin_small"
|
||||
android:layout_marginTop="@dimen/margin_small"
|
||||
android:text="@string/label_add"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/blacklist_empty_text" />
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent" />
|
||||
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
</androidx.core.widget.NestedScrollView>
|
||||
|
||||
</LinearLayout>
|
||||
</layout>
|
|
@ -104,7 +104,6 @@
|
|||
<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_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 -->
|
||||
<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_no_perms">Auxio needs permission to read your music library</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">That directory is not supported</string>
|
||||
<string name="error_bad_dir">This directory is not supported</string>
|
||||
|
||||
<!-- Hint Namespace | EditText Hints -->
|
||||
<string name="hint_search_library">Search your library…</string>
|
||||
|
|
|
@ -18,4 +18,4 @@ android.useAndroidX=true
|
|||
# Automatically convert third-party libraries to use AndroidX
|
||||
android.enableJetifier=true
|
||||
# Kotlin code style for this project: "official" or "obsolete":
|
||||
kotlin.code.style=official
|
||||
kotlin.code.style=official
|
||||
|
|
Loading…
Reference in a new issue