Redo accents

Collapse amber and yellow into a single accent [Yellow], remove the neutral accent due to UI isuses, and darken light-mode accents across the board to be more visible.
This commit is contained in:
OxygenCobalt 2021-02-28 15:50:13 -07:00
parent abd5b3ca8d
commit 3f0331f1c9
No known key found for this signature in database
GPG key ID: 37DBE3621FE9AD47
15 changed files with 59 additions and 37 deletions

View file

@ -75,7 +75,7 @@ class SettingsListFragment : PreferenceFragmentCompat() {
}
}
SettingsManager.Keys.KEY_ACCENT -> {
SettingsManager.Keys.KEY_ACCENT_OLD -> {
onPreferenceClickListener = Preference.OnPreferenceClickListener {
showAccentDialog()
true

View file

@ -2,7 +2,9 @@ package org.oxycblt.auxio.settings
import android.content.Context
import android.content.SharedPreferences
import androidx.core.content.edit
import androidx.preference.PreferenceManager
import org.oxycblt.auxio.logD
import org.oxycblt.auxio.playback.state.PlaybackMode
import org.oxycblt.auxio.recycler.DisplayMode
import org.oxycblt.auxio.recycler.SortMode
@ -30,7 +32,21 @@ class SettingsManager private constructor(context: Context) :
/** The current accent. */
var accent: Accent
get() {
// Accent is stored as an index [to be efficient], so retrieve it when done.
if (sharedPrefs.contains(Keys.KEY_ACCENT_OLD)) {
logD("Migrating from old accent to new accent.")
val newAccent = handleAccentCompat(
sharedPrefs.getInt(Keys.KEY_ACCENT_OLD, 5)
)
// When converted, write them to the new accent pref and delete the old one.
sharedPrefs.edit {
putInt(Keys.KEY_ACCENT, newAccent)
remove(Keys.KEY_ACCENT_OLD)
apply()
}
}
return ACCENTS[sharedPrefs.getInt(Keys.KEY_ACCENT, 5)]
}
set(value) {
@ -171,10 +187,37 @@ class SettingsManager private constructor(context: Context) :
}
}
/** SharedPreferences keys. */
/**
* Convert the old accent format of <1.3.1 to the accent format of 1.3.2-Onwards,
* where many accents were changed or removed.
*/
private fun handleAccentCompat(oldAccent: Int): Int {
var newAccent = oldAccent
// Correct any accents over yellow to their correct positions
if (oldAccent > 12) {
newAccent--
}
// Correct neutral accents to the closest accent [Grey]
if (newAccent == 18) {
newAccent = 16
}
// If there are still any issues with indices, just correct them so a crash doesnt occur.
if (newAccent > ACCENTS.lastIndex) {
newAccent = ACCENTS.lastIndex
}
return newAccent
}
/**
* SharedPreferences keys.
*/
object Keys {
const val KEY_THEME = "KEY_THEME"
const val KEY_ACCENT = "KEY_ACCENT"
const val KEY_ACCENT = "KEY_ACCENT2"
const val KEY_EDGE_TO_EDGE = "KEY_EDGE"
const val KEY_LIBRARY_DISPLAY_MODE = "KEY_LIBRARY_DISPLAY_MODE"
const val KEY_SHOW_COVERS = "KEY_SHOW_COVERS"
@ -191,9 +234,13 @@ class SettingsManager private constructor(context: Context) :
const val KEY_LIBRARY_SORT_MODE = "KEY_LIBRARY_SORT_MODE"
const val KEY_SEARCH_FILTER_MODE = "KEY_SEARCH"
const val KEY_DEBUG_SAVE = "KEY_SAVE_STATE"
const val KEY_ACCENT_OLD = "KEY_ACCENT"
}
/** Values for some settings entries that cant be enums/ints.*/
/**
* Values for some settings entries that arent important enough to recieve an enum.
*/
object EntryValues {
const val THEME_AUTO = "AUTO"
const val THEME_LIGHT = "LIGHT"

View file

@ -30,13 +30,11 @@ val ACCENTS = arrayOf(
Accent(R.color.light_green, R.style.Theme_LightGreen, R.string.color_label_light_green),
Accent(R.color.lime, R.style.Theme_Lime, R.string.color_label_lime),
Accent(R.color.yellow, R.style.Theme_Yellow, R.string.color_label_yellow),
Accent(R.color.amber, R.style.Theme_Amber, R.string.color_label_amber),
Accent(R.color.orange, R.style.Theme_Orange, R.string.color_label_orange),
Accent(R.color.deep_orange, R.style.Theme_DeepOrange, R.string.color_label_deep_orange),
Accent(R.color.brown, R.style.Theme_Brown, R.string.color_label_brown),
Accent(R.color.grey, R.style.Theme_Gray, R.string.color_label_grey),
Accent(R.color.blue_grey, R.style.Theme_BlueGrey, R.string.color_label_blue_grey),
Accent(R.color.control_color, R.style.Theme_Neutral, R.string.color_label_neutral)
)
/**

View file

@ -2,7 +2,7 @@
<layout 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"
tools:context=".detail.GenreDetailFragment">
tools:context=".detail.DetailFragment">
<androidx.coordinatorlayout.widget.CoordinatorLayout
android:layout_width="match_parent"
@ -28,9 +28,7 @@
android:layout_height="match_parent"
android:layout_marginTop="?attr/actionBarSize"
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/genre_song_header"
tools:listitem="@layout/item_artist_header" />
</androidx.coordinatorlayout.widget.CoordinatorLayout>
</layout>

View file

@ -138,13 +138,11 @@
<string name="color_label_light_green">Hellgrün</string>
<string name="color_label_lime">Lindgrün</string>
<string name="color_label_yellow">Gelb</string>
<string name="color_label_amber">Bernsteingelb</string>
<string name="color_label_orange">Orange</string>
<string name="color_label_deep_orange">Tieforange</string>
<string name="color_label_brown">Braun</string>
<string name="color_label_grey">Grau</string>
<string name="color_label_blue_grey">Blaugrau</string>
<string name="color_label_neutral">Neutral</string>
<!-- Format Namespace | Value formatting/plurals -->
<string name="format_next_from">Nächsten von: %s</string>

View file

@ -89,12 +89,10 @@
<string name="color_label_light_green">Verde Claro</string>
<string name="color_label_lime">Verde Amarillo</string>
<string name="color_label_yellow">Amarillo</string>
<string name="color_label_amber">Ambar</string>
<string name="color_label_orange">Naranja</string>
<string name="color_label_brown">Marrón</string>
<string name="color_label_grey">Gris</string>
<string name="color_label_blue_grey">Azul Gris</string>
<string name="color_label_neutral">Neutro</string>
<!-- Format Namespace | Value formatting/plurals -->
<string name="format_songs_loaded">Canciones encontradas: %d</string>

View file

@ -88,12 +88,10 @@
<string name="color_label_light_green">Vert Clair</string>
<string name="color_label_lime">Vert Citron</string>
<string name="color_label_yellow">Jaune</string>
<string name="color_label_amber">Ambre</string>
<string name="color_label_orange">Orange</string>
<string name="color_label_brown">Brun</string>
<string name="color_label_grey">Gris</string>
<string name="color_label_blue_grey">Bleu Gris</string>
<string name="color_label_neutral">Neutre</string>
<!-- Format Namespace | Value formatting/plurals -->
<string name="format_songs_loaded">Titres chargés: %d</string>

View file

@ -91,7 +91,6 @@
<string name="color_label_brown">Barna</string>
<string name="color_label_grey">Szürke</string>
<string name="color_label_blue_grey">Kékszürke</string>
<string name="color_label_neutral">Semleges</string>
<!-- Format Namespace | Value formatting/plurals -->
<plurals name="format_song_count">

View file

@ -89,12 +89,10 @@
<string name="color_label_light_green">Verde Chiaro</string>
<string name="color_label_lime">Verde Giallo</string>
<string name="color_label_yellow">Giallo</string>
<string name="color_label_amber">Ambra</string>
<string name="color_label_orange">Arancio</string>
<string name="color_label_brown">Bruno</string>
<string name="color_label_grey">Grigio</string>
<string name="color_label_blue_grey">Azzurro Grigio</string>
<string name="color_label_neutral">Neutrale</string>
<!-- Format Namespace | Value formatting/plurals -->
<string name="format_songs_loaded">Brani caricate: %d</string>

View file

@ -23,8 +23,7 @@
<color name="green">#a5d6a7</color>
<color name="light_green">#c5e1a5</color>
<color name="lime">#e6ee9c</color>
<color name="yellow">#fff59d</color>
<color name="amber">#ffe082</color>
<color name="yellow">#ffe082</color>
<color name="orange">#ffcc80</color>
<color name="deep_orange">#ffab91</color>
<color name="brown">#bcaaa4</color>

View file

@ -95,7 +95,6 @@
<string name="color_label_brown">Bruin</string>
<string name="color_label_grey">Grijis</string>
<string name="color_label_blue_grey">Blauwgrijis</string>
<string name="color_label_neutral">Neutraal</string>
<!-- Format Namespace | Value formatting/plurals -->
<string name="format_songs_loaded">Nummers geladen: %d</string>

View file

@ -85,12 +85,10 @@
<string name="color_label_light_green">Jasnozielony</string>
<string name="color_label_lime">Żółtyzielony</string>
<string name="color_label_yellow">Żółty</string>
<string name="color_label_amber">Bursztynowy</string>
<string name="color_label_orange">Pomarańczowy</string>
<string name="color_label_brown">Brązowy</string>
<string name="color_label_grey">Szary</string>
<string name="color_label_blue_grey">Błękitszary</string>
<string name="color_label_neutral">Neutralny</string>
<!-- Format Namespace | Value formatting/plurals -->
<string name="format_songs_loaded">Utwory uruchamia się: %d</string>

View file

@ -22,12 +22,11 @@
<color name="teal">#009688</color>
<color name="green">#4caf50</color>
<color name="light_green">#8bc34a</color>
<color name="lime">#cddc39</color>
<color name="yellow">#f1ca00</color>
<color name="amber">#ffc107</color>
<color name="orange">#ff9800</color>
<color name="lime">#B7C534</color>
<color name="yellow">#E4AC00</color>
<color name="orange">#E68A01</color>
<color name="deep_orange">#ff5722</color>
<color name="brown">#795548</color>
<color name="grey">#9e9e9e</color>
<color name="grey">#808080</color>
<color name="blue_grey">#607d8b</color>
</resources>

View file

@ -141,13 +141,11 @@
<string name="color_label_light_green">Light Green</string>
<string name="color_label_lime">Lime</string>
<string name="color_label_yellow">Yellow</string>
<string name="color_label_amber">Amber</string>
<string name="color_label_orange">Orange</string>
<string name="color_label_deep_orange">Deep Orange</string>
<string name="color_label_brown">Brown</string>
<string name="color_label_grey">Grey</string>
<string name="color_label_blue_grey">Blue Grey</string>
<string name="color_label_neutral">Neutral</string>
<!-- Format Namespace | Value formatting/plurals -->
<string name="format_next_from">Next From: %s</string>

View file

@ -68,11 +68,6 @@
<item name="colorSecondary">@color/yellow</item>
</style>
<style name="Theme.Amber" parent="Theme.Base">
<item name="colorPrimary">@color/amber</item>
<item name="colorSecondary">@color/amber</item>
</style>
<style name="Theme.Orange" parent="Theme.Base">
<item name="colorPrimary">@color/orange</item>
<item name="colorSecondary">@color/orange</item>