theme: re-add black theme on android 12
Re-add the black theme on Android 12. It still has use, unlike the other theme options made obsolete by dynamic colors.
This commit is contained in:
parent
4b7fa7415c
commit
6b355d6416
6 changed files with 23 additions and 10 deletions
|
@ -90,12 +90,16 @@ class MainActivity : AppCompatActivity() {
|
|||
}
|
||||
|
||||
private fun setupTheme() {
|
||||
// We only use Material You theming on Android 12 and above.
|
||||
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.S) {
|
||||
// Update the current accent and theme
|
||||
val settingsManager = SettingsManager.getInstance()
|
||||
AppCompatDelegate.setDefaultNightMode(settingsManager.theme)
|
||||
val settingsManager = SettingsManager.getInstance()
|
||||
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) {
|
||||
// Android 12, let dynamic colors be our accent and only enable the black theme option
|
||||
if (isNight && settingsManager.useBlackTheme) {
|
||||
setTheme(R.style.Theme_Auxio_Black)
|
||||
}
|
||||
} else {
|
||||
// Below android 12, load the accent and enable theme customization
|
||||
AppCompatDelegate.setDefaultNightMode(settingsManager.theme)
|
||||
val newAccent = Accent.set(settingsManager.accent)
|
||||
|
||||
// The black theme has a completely separate set of styles since style attributes cannot
|
||||
|
|
|
@ -145,8 +145,7 @@ class SettingsListFragment : PreferenceFragmentCompat() {
|
|||
}
|
||||
}
|
||||
|
||||
SettingsManager.KEY_SHOW_COVERS, SettingsManager.KEY_QUALITY_COVERS,
|
||||
SettingsManager.KEY_ROUND_COVERS -> {
|
||||
SettingsManager.KEY_SHOW_COVERS, SettingsManager.KEY_QUALITY_COVERS, -> {
|
||||
onPreferenceChangeListener = Preference.OnPreferenceChangeListener { _, _ ->
|
||||
Coil.imageLoader(requireContext()).apply {
|
||||
this.memoryCache?.clear()
|
||||
|
|
|
@ -32,7 +32,7 @@ fun Any.logD(obj: Any) {
|
|||
}
|
||||
|
||||
/**
|
||||
* Shortcut method for logging [msg] to the debug console., handles debug builds and anonymous objects
|
||||
* Shortcut method for logging [msg] to the debug console. Handles debug builds and anonymous objects
|
||||
*/
|
||||
fun Any.logD(msg: String) {
|
||||
if (BuildConfig.DEBUG) {
|
||||
|
@ -56,7 +56,11 @@ fun Any.logE(msg: String) {
|
|||
private fun Any.getName(): String = "Auxio.${this::class.simpleName ?: "Anonymous Object"}"
|
||||
|
||||
/**
|
||||
* Nothing to see here.
|
||||
* I know that this will not stop you, but consider what you are doing with your life, copycats.
|
||||
* Do you want to live a fulfilling existence on this planet? Or do you want to spend your life
|
||||
* taking work others did and making it objectively worse so you could arbitrage a fraction of a
|
||||
* penny on every AdMob impression you get. You could do so many great things if you simply had
|
||||
* the courage to come up with an idea of your own. Be better.
|
||||
*/
|
||||
private fun basedCopyleftNotice() {
|
||||
if (BuildConfig.APPLICATION_ID != "org.oxycblt.auxio" &&
|
||||
|
|
|
@ -142,3 +142,4 @@ val WindowInsets.systemBarsCompat: Rect get() {
|
|||
else -> Rect(0, 0, 0, 0)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,9 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<style name="Theme.Auxio.Black" parent="Theme.Auxio.App">
|
||||
<item name="colorSurface">@android:color/black</item>
|
||||
</style>
|
||||
|
||||
<style name="Theme.Auxio.Black.Red" parent="Theme.Auxio.Red">
|
||||
<item name="colorSurface">@android:color/black</item>
|
||||
</style>
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<PreferenceScreen xmlns:app="http://schemas.android.com/apk/res-auto">
|
||||
<PreferenceCategory
|
||||
app:isPreferenceVisible="@bool/enable_theme_settings"
|
||||
app:layout="@layout/item_header"
|
||||
app:title="@string/set_ui">
|
||||
|
||||
<org.oxycblt.auxio.settings.pref.IntListPreference
|
||||
app:defaultValue="@integer/theme_auto"
|
||||
app:isPreferenceVisible="@bool/enable_theme_settings"
|
||||
app:entries="@array/entires_theme"
|
||||
app:entryValues="@array/values_theme"
|
||||
app:icon="@drawable/ic_day"
|
||||
|
@ -15,6 +15,7 @@
|
|||
app:title="@string/set_theme" />
|
||||
|
||||
<Preference
|
||||
app:isPreferenceVisible="@bool/enable_theme_settings"
|
||||
app:icon="@drawable/ic_accent"
|
||||
app:key="auxio_accent"
|
||||
app:title="@string/set_accent" />
|
||||
|
|
Loading…
Reference in a new issue