accent: rename all light accents to deep accents

The way Material3 uses an initial light accent seeds is...odd. It more
closely resembles deep purple [darker on light mode, lighter on dark
mode] in behavior. Therefore we simply rename the light accents to
this. This does mess up translations a lot, but I'll fix it when I
update the rest of the translations.
This commit is contained in:
OxygenCobalt
2021-11-13 19:16:42 -07:00
parent c30c0d7fb3
commit f66dea9469
27 changed files with 265 additions and 256 deletions
@@ -20,75 +20,20 @@ package org.oxycblt.auxio.accent
import org.oxycblt.auxio.R
val ACCENT_PRIMARY_COLORS = arrayOf(
R.color.red_primary,
R.color.pink_primary,
R.color.purple_primary,
R.color.deep_purple_primary,
R.color.indigo_primary,
R.color.blue_primary,
R.color.light_blue_primary,
R.color.cyan_primary,
R.color.teal_primary,
R.color.green_primary,
R.color.light_green_primary,
R.color.lime_primary,
R.color.yellow_primary,
R.color.orange_primary,
R.color.brown_primary,
R.color.grey_primary,
)
val ACCENT_COUNT: Int get() = ACCENT_NAMES.size
val ACCENT_THEMES = arrayOf(
R.style.Theme_Auxio_Red,
R.style.Theme_Auxio_Pink,
R.style.Theme_Auxio_Purple,
R.style.Theme_Auxio_DeepPurple,
R.style.Theme_Auxio_Indigo,
R.style.Theme_Auxio_Blue,
R.style.Theme_Auxio_LightBlue,
R.style.Theme_Auxio_Cyan,
R.style.Theme_Auxio_Teal,
R.style.Theme_Auxio_Green,
R.style.Theme_Auxio_LightGreen,
R.style.Theme_Auxio_Lime,
R.style.Theme_Auxio_Yellow,
R.style.Theme_Auxio_Orange,
R.style.Theme_Auxio_Brown,
R.style.Theme_Auxio_Grey,
)
val ACCENT_BLACK_THEMES = arrayOf(
R.style.Theme_Auxio_Black_Red,
R.style.Theme_Auxio_Black_Pink,
R.style.Theme_Auxio_Black_Purple,
R.style.Theme_Auxio_Black_DeepPurple,
R.style.Theme_Auxio_Black_Indigo,
R.style.Theme_Auxio_Black_Blue,
R.style.Theme_Auxio_Black_LightBlue,
R.style.Theme_Auxio_Black_Cyan,
R.style.Theme_Auxio_Black_Teal,
R.style.Theme_Auxio_Black_Green,
R.style.Theme_Auxio_Black_LightGreen,
R.style.Theme_Auxio_Black_Lime,
R.style.Theme_Auxio_Black_Yellow,
R.style.Theme_Auxio_Black_Orange,
R.style.Theme_Auxio_Black_Brown,
R.style.Theme_Auxio_Black_Grey,
)
val ACCENT_NAMES = arrayOf(
private val ACCENT_NAMES = arrayOf(
R.string.clr_red,
R.string.clr_pink,
R.string.clr_purple,
R.string.clr_deep_purple,
R.string.clr_indigo,
R.string.clr_blue,
R.string.clr_light_blue,
R.string.clr_deep_blue,
R.string.clr_cyan,
R.string.clr_teal,
R.string.clr_green,
R.string.clr_light_green,
R.string.clr_deep_green,
R.string.clr_lime,
R.string.clr_yellow,
R.string.clr_orange,
@@ -96,8 +41,65 @@ val ACCENT_NAMES = arrayOf(
R.string.clr_grey,
)
private val ACCENT_THEMES = arrayOf(
R.style.Theme_Auxio_Red,
R.style.Theme_Auxio_Pink,
R.style.Theme_Auxio_Purple,
R.style.Theme_Auxio_DeepPurple,
R.style.Theme_Auxio_Indigo,
R.style.Theme_Auxio_Blue,
R.style.Theme_Auxio_DeepBlue,
R.style.Theme_Auxio_Cyan,
R.style.Theme_Auxio_Teal,
R.style.Theme_Auxio_Green,
R.style.Theme_Auxio_DeepGreen,
R.style.Theme_Auxio_Lime,
R.style.Theme_Auxio_Yellow,
R.style.Theme_Auxio_Orange,
R.style.Theme_Auxio_Brown,
R.style.Theme_Auxio_Grey,
)
private val ACCENT_BLACK_THEMES = arrayOf(
R.style.Theme_Auxio_Black_Red,
R.style.Theme_Auxio_Black_Pink,
R.style.Theme_Auxio_Black_Purple,
R.style.Theme_Auxio_Black_DeepPurple,
R.style.Theme_Auxio_Black_Indigo,
R.style.Theme_Auxio_Black_Blue,
R.style.Theme_Auxio_Black_DeepBlue,
R.style.Theme_Auxio_Black_Cyan,
R.style.Theme_Auxio_Black_Teal,
R.style.Theme_Auxio_Black_Green,
R.style.Theme_Auxio_Black_DeepGreen,
R.style.Theme_Auxio_Black_Lime,
R.style.Theme_Auxio_Black_Yellow,
R.style.Theme_Auxio_Black_Orange,
R.style.Theme_Auxio_Black_Brown,
R.style.Theme_Auxio_Black_Grey,
)
private val ACCENT_PRIMARY_COLORS = arrayOf(
R.color.red_primary,
R.color.pink_primary,
R.color.purple_primary,
R.color.deep_purple_primary,
R.color.indigo_primary,
R.color.blue_primary,
R.color.deep_blue_primary,
R.color.cyan_primary,
R.color.teal_primary,
R.color.green_primary,
R.color.deep_green_primary,
R.color.lime_primary,
R.color.yellow_primary,
R.color.orange_primary,
R.color.brown_primary,
R.color.grey_primary,
)
/**
* The data object for an accent.
* The data object for an accent. In the UI this is known as a "Color Scheme."
* @property name The name of this accent
* @property theme The theme resource for this accent
* @property blackTheme The black theme resource for this accent
@@ -40,7 +40,7 @@ class AccentAdapter(
) : RecyclerView.Adapter<AccentAdapter.ViewHolder>() {
private var selectedViewHolder: ViewHolder? = null
override fun getItemCount(): Int = ACCENT_PRIMARY_COLORS.size
override fun getItemCount(): Int = ACCENT_COUNT
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ViewHolder {
return ViewHolder(ItemAccentBinding.inflate(parent.context.inflater))
@@ -41,7 +41,11 @@ enum class LoopMode {
* @return The int constant for this mode
*/
fun toInt(): Int {
return CONST_NONE + ordinal
return when (this) {
NONE -> CONST_NONE
ALL -> CONST_ALL
TRACK -> CONST_TRACK
}
}
companion object {
@@ -104,7 +104,7 @@ class SearchFragment : Fragment() {
binding.searchEditText.apply {
addTextChangedListener { text ->
// Run the search with the updated text as the query
searchModel.doSearch(text?.toString() ?: "")
searchModel.search(text?.toString() ?: "")
}
// Auto-open the keyboard when this view is shown
@@ -36,6 +36,7 @@ import java.text.Normalizer
/**
* The [ViewModel] for the search functionality
* TODO: Implement fuzzy search?
* @author OxygenCobalt
*/
class SearchViewModel : ViewModel(), MusicStore.MusicCallback {
@@ -44,7 +45,7 @@ class SearchViewModel : ViewModel(), MusicStore.MusicCallback {
private var mFilterMode: DisplayMode? = null
private var mLastQuery = ""
/** Current search results from the last [doSearch] call. */
/** Current search results from the last [search] call. */
val searchResults: LiveData<List<BaseModel>> get() = mSearchResults
val isNavigating: Boolean get() = mIsNavigating
val filterMode: DisplayMode? get() = mFilterMode
@@ -61,7 +62,7 @@ class SearchViewModel : ViewModel(), MusicStore.MusicCallback {
* Use [query] to perform a search of the music library.
* Will push results to [searchResults].
*/
fun doSearch(query: String) {
fun search(query: String) {
val musicStore = MusicStore.maybeGetInstance()
mLastQuery = query
@@ -124,7 +125,7 @@ class SearchViewModel : ViewModel(), MusicStore.MusicCallback {
settingsManager.searchFilterMode = mFilterMode
doSearch(mLastQuery)
search(mLastQuery)
}
/**
@@ -183,7 +184,7 @@ class SearchViewModel : ViewModel(), MusicStore.MusicCallback {
// --- OVERRIDES ---
override fun onLoaded(musicStore: MusicStore) {
doSearch(mLastQuery)
search(mLastQuery)
}
override fun onCleared() {
@@ -21,7 +21,7 @@ package org.oxycblt.auxio.settings
import android.content.SharedPreferences
import androidx.appcompat.app.AppCompatDelegate
import androidx.core.content.edit
import org.oxycblt.auxio.accent.ACCENT_PRIMARY_COLORS
import org.oxycblt.auxio.accent.ACCENT_COUNT
import org.oxycblt.auxio.accent.Accent
import org.oxycblt.auxio.playback.state.PlaybackMode
@@ -70,8 +70,8 @@ fun handleAccentCompat(prefs: SharedPreferences): Accent {
}
// If there are still any issues with indices, just correct them so a crash doesnt occur.
if (accent > ACCENT_PRIMARY_COLORS.lastIndex) {
accent = ACCENT_PRIMARY_COLORS.lastIndex
if (accent >= ACCENT_COUNT) {
accent = ACCENT_COUNT - 1
}
// Move this to the [also legacy] ACCENT2 field. This makes it easier to convert in the
@@ -161,15 +161,21 @@ enum class SortMode(@IdRes val itemId: Int) {
* to storage, as it will be more efficent.
*/
fun toInt(): Int {
return ordinal + INT_ASCENDING
return when (this) {
ASCENDING -> CONST_ASCENDING
DESCENDING -> CONST_DESCENDING
ARTIST -> CONST_ARTIST
ALBUM -> CONST_ALBUM
YEAR -> CONST_YEAR
}
}
companion object {
private const val INT_ASCENDING = 0xA10C
private const val INT_DESCENDING = 0xA10D
private const val INT_ARTIST = 0xA10E
private const val INT_ALBUM = 0xA10F
private const val INT_YEAR = 0xA110
private const val CONST_ASCENDING = 0xA10C
private const val CONST_DESCENDING = 0xA10D
private const val CONST_ARTIST = 0xA10E
private const val CONST_ALBUM = 0xA10F
private const val CONST_YEAR = 0xA110
/**
* Returns a [SortMode] depending on the integer constant, use this when restoring
@@ -177,11 +183,11 @@ enum class SortMode(@IdRes val itemId: Int) {
*/
fun fromInt(value: Int): SortMode? {
return when (value) {
INT_ASCENDING -> ASCENDING
INT_DESCENDING -> DESCENDING
INT_ARTIST -> ARTIST
INT_ALBUM -> ALBUM
INT_YEAR -> YEAR
CONST_ASCENDING -> ASCENDING
CONST_DESCENDING -> DESCENDING
CONST_ARTIST -> ARTIST
CONST_ALBUM -> ALBUM
CONST_YEAR -> YEAR
else -> null
}
}