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:
@@ -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)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user