ui: make default accent dynamic on api 31
Make the default accent the dynamic accent on API 31. This is to make Auxio's Material You support obvious to the user.
This commit is contained in:
@@ -81,8 +81,7 @@ fun handleAccentCompat(prefs: SharedPreferences): Accent {
|
||||
}
|
||||
}
|
||||
|
||||
// TODO: Default accent on android 12 should be dynamic colors
|
||||
return Accent.from(prefs.getInt(SettingsManager.KEY_ACCENT, 5))
|
||||
return Accent.from(prefs.getInt(SettingsManager.KEY_ACCENT, Accent.DEFAULT))
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -19,7 +19,7 @@ package org.oxycblt.auxio.ui.accent
|
||||
|
||||
import android.os.Build
|
||||
import org.oxycblt.auxio.R
|
||||
import org.oxycblt.auxio.util.logW
|
||||
import org.oxycblt.auxio.util.logEOrThrow
|
||||
|
||||
private val ACCENT_NAMES =
|
||||
intArrayOf(
|
||||
@@ -131,13 +131,20 @@ class Accent private constructor(val index: Int) {
|
||||
companion object {
|
||||
fun from(index: Int): Accent {
|
||||
if (index > (MAX - 1)) {
|
||||
logW("Account outside of bounds [idx: $index, max: $MAX]")
|
||||
logEOrThrow("Account outside of bounds [idx: $index, max: $MAX]")
|
||||
return Accent(5)
|
||||
}
|
||||
|
||||
return Accent(index)
|
||||
}
|
||||
|
||||
val DEFAULT =
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) {
|
||||
ACCENT_THEMES.lastIndex
|
||||
} else {
|
||||
5
|
||||
}
|
||||
|
||||
/**
|
||||
* The maximum amount of accents that are valid. This excludes the dynamic accent on
|
||||
* versions that do not support it.
|
||||
|
||||
@@ -1,13 +1,12 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:aapt="http://schemas.android.com/aapt"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:tint="?attr/colorControlNormal"
|
||||
android:viewportWidth="24"
|
||||
android:viewportHeight="24">
|
||||
<path
|
||||
android:fillColor="@android:color/white"
|
||||
android:pathData="M10,20h4L14,4h-4v16zM4,20h4v-8L4,12v8zM16,9v11h4L20,9h-4z" />
|
||||
</vector>
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:tint="?attr/colorControlNormal"
|
||||
android:viewportWidth="24"
|
||||
android:viewportHeight="24">
|
||||
<path
|
||||
android:fillColor="@android:color/white"
|
||||
android:pathData="M10,20h4L14,4h-4v16zM4,20h4v-8L4,12v8zM16,9v11h4L20,9h-4z" />
|
||||
</vector>
|
||||
|
||||
|
||||
@@ -2,10 +2,10 @@
|
||||
<androidx.core.widget.NestedScrollView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
style="@style/Widget.Auxio.Dialog.NestedScrollView"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
style="@style/Widget.Auxio.Dialog.NestedScrollView">
|
||||
android:orientation="vertical">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
@@ -37,11 +37,11 @@
|
||||
android:textColor="?android:attr/textColorSecondary" />
|
||||
|
||||
<TextView
|
||||
style="@style/Widget.Auxio.TextView.Header"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingStart="@dimen/spacing_mid_large"
|
||||
android:paddingEnd="@dimen/spacing_mid_large"
|
||||
style="@style/Widget.Auxio.TextView.Header"
|
||||
android:text="@string/set_dirs_mode" />
|
||||
|
||||
<com.google.android.material.divider.MaterialDivider
|
||||
@@ -53,28 +53,28 @@
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="@dimen/spacing_mid_large"
|
||||
android:layout_marginEnd="@dimen/spacing_mid_large"
|
||||
android:layout_marginTop="@dimen/spacing_medium"
|
||||
android:layout_marginEnd="@dimen/spacing_mid_large"
|
||||
android:gravity="center"
|
||||
app:singleSelection="true"
|
||||
app:checkedButton="@+id/dirs_mode_exclude"
|
||||
app:selectionRequired="true"
|
||||
app:checkedButton="@+id/dirs_mode_exclude">
|
||||
app:singleSelection="true">
|
||||
|
||||
<Button
|
||||
android:id="@+id/dirs_mode_exclude"
|
||||
style="@style/Widget.Auxio.Button.Secondary"
|
||||
android:layout_width="0dp"
|
||||
android:layout_weight="1"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/set_dirs_mode_exclude"
|
||||
style="@style/Widget.Auxio.Button.Secondary" />
|
||||
android:layout_weight="1"
|
||||
android:text="@string/set_dirs_mode_exclude" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/dirs_mode_include"
|
||||
style="@style/Widget.Auxio.Button.Secondary"
|
||||
android:layout_width="0dp"
|
||||
android:layout_weight="1"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/set_dirs_mode_include"
|
||||
style="@style/Widget.Auxio.Button.Secondary" />
|
||||
android:layout_weight="1"
|
||||
android:text="@string/set_dirs_mode_include" />
|
||||
|
||||
</com.google.android.material.button.MaterialButtonToggleGroup>
|
||||
|
||||
@@ -83,8 +83,8 @@
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="@dimen/spacing_mid_large"
|
||||
android:layout_marginEnd="@dimen/spacing_mid_large"
|
||||
android:layout_marginTop="@dimen/spacing_small"
|
||||
android:layout_marginEnd="@dimen/spacing_mid_large"
|
||||
tools:text="Mode description" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
@@ -2,9 +2,9 @@
|
||||
<androidx.core.widget.NestedScrollView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
style="@style/Widget.Auxio.Dialog.NestedScrollView"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
style="@style/Widget.Auxio.Dialog.NestedScrollView">
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:layout_width="match_parent"
|
||||
|
||||
@@ -6,9 +6,9 @@
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<androidx.core.widget.NestedScrollView
|
||||
style="@style/Widget.Auxio.Dialog.NestedScrollView"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
style="@style/Widget.Auxio.Dialog.NestedScrollView">
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/detail_container"
|
||||
@@ -17,9 +17,9 @@
|
||||
android:orientation="vertical"
|
||||
android:paddingStart="@dimen/spacing_mid_large"
|
||||
android:paddingEnd="@dimen/spacing_mid_large"
|
||||
android:showDividers="middle"
|
||||
android:visibility="gone"
|
||||
tools:visibility="visible"
|
||||
android:showDividers="middle">
|
||||
tools:visibility="visible">
|
||||
|
||||
<com.google.android.material.textfield.TextInputLayout
|
||||
android:layout_width="match_parent"
|
||||
@@ -69,8 +69,8 @@
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="@dimen/spacing_medium"
|
||||
app:expandedHintEnabled="false"
|
||||
android:hint="@string/lbl_size">
|
||||
android:hint="@string/lbl_size"
|
||||
app:expandedHintEnabled="false">
|
||||
|
||||
<org.oxycblt.auxio.detail.ReadOnlyTextInput
|
||||
android:id="@+id/detail_size"
|
||||
|
||||
@@ -34,7 +34,7 @@
|
||||
android:imeOptions="actionSearch|flagNoExtractUi"
|
||||
android:inputType="textFilter"
|
||||
android:paddingStart="@dimen/spacing_tiny"
|
||||
android:paddingEnd="0dp"/>
|
||||
android:paddingEnd="0dp" />
|
||||
|
||||
</com.google.android.material.textfield.TextInputLayout>
|
||||
|
||||
|
||||
@@ -10,10 +10,10 @@
|
||||
android:id="@+id/disc_item"
|
||||
style="@style/Widget.Auxio.Image.Small"
|
||||
android:scaleType="matrix"
|
||||
app:staticIcon="@drawable/ic_album"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:staticIcon="@drawable/ic_album"
|
||||
tools:ignore="ContentDescription" />
|
||||
|
||||
<TextView
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
|
||||
<style name="Widget.Auxio.Toolbar.Actions" parent="Widget.Auxio.Toolbar.Base">
|
||||
<item name="android:layout_marginEnd">@dimen/spacing_tiny_inv</item>
|
||||
</style>
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
|
||||
<style name="Widget.Auxio.Button.AppWidget.V31" parent="Widget.AppCompat.Button.Borderless">
|
||||
<item name="android:background">@drawable/ui_large_unbounded_ripple</item>
|
||||
</style>
|
||||
|
||||
Reference in New Issue
Block a user