Simplify theme color application logic

This commit is contained in:
MM20
2021-12-13 17:34:13 +01:00
parent cb72b9180f
commit 9ebac9684b
13 changed files with 35 additions and 79 deletions
+2 -2
View File
@@ -37,7 +37,7 @@
android:requestLegacyExternalStorage="true"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/LauncherTheme.DefaultColors"
android:theme="@style/LauncherTheme"
android:usesCleartextTraffic="true"
tools:ignore="GoogleAppIndexingWarning">
@@ -51,7 +51,7 @@
android:parentActivityName=".ui.legacy.activity.LauncherActivity"
android:screenOrientation="portrait"
android:taskAffinity="de.mm20.launcher2.settings"
android:theme="@style/SettingsTheme.DefaultColors">
android:theme="@style/SettingsTheme">
<intent-filter>
<action android:name="android.intent.action.APPLICATION_PREFERENCES" />
<category android:name="android.intent.category.DEFAULT" />
@@ -3,26 +3,22 @@ package de.mm20.launcher2.activity
import android.content.Intent
import android.os.Bundle
import android.view.MenuItem
import android.view.View
import androidx.appcompat.app.AppCompatActivity
import androidx.fragment.app.Fragment
import de.mm20.launcher2.R
import de.mm20.launcher2.fragment.PreferencesCalendarFragment
import de.mm20.launcher2.fragment.PreferencesMainFragment
import de.mm20.launcher2.fragment.PreferencesServicesFragment
import de.mm20.launcher2.fragment.PreferencesWeatherFragment
import de.mm20.launcher2.preferences.ColorSchemes
import de.mm20.launcher2.preferences.LauncherPreferences
import de.mm20.launcher2.ui.legacy.activity.LauncherActivity
import de.mm20.launcher2.ui.legacy.helper.ThemeHelper
class SettingsActivity : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
when(LauncherPreferences.instance.colorScheme) {
ColorSchemes.BLACK -> setTheme(R.style.SettingsTheme_BlackWhiteColors)
else -> setTheme(R.style.SettingsTheme_DefaultColors)
}
ThemeHelper.applyTheme(theme)
if (savedInstanceState == null) {
val fragment = getStartFragment()
setupActionBar()