|
|
@ -40,8 +40,7 @@ class ThemeConfigFragment : PreferenceFragmentCompat(), SharedPreferences.OnShar |
|
|
|
sharedPreferences ?: return |
|
|
|
sharedPreferences ?: return |
|
|
|
when (key) { |
|
|
|
when (key) { |
|
|
|
"transparentStatusBar" -> { |
|
|
|
"transparentStatusBar" -> { |
|
|
|
postEvent(Bus.RECREATE, "") |
|
|
|
recreateActivities() |
|
|
|
Handler().postDelayed({ activity?.recreate() }, 100) |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
"colorPrimary", "colorAccent", "colorBackground" -> { |
|
|
|
"colorPrimary", "colorAccent", "colorBackground" -> { |
|
|
|
if (backgroundIsDark(sharedPreferences)) { |
|
|
|
if (backgroundIsDark(sharedPreferences)) { |
|
|
@ -104,6 +103,7 @@ class ThemeConfigFragment : PreferenceFragmentCompat(), SharedPreferences.OnShar |
|
|
|
.putInt("colorBackgroundNight", App.INSTANCE.getCompatColor(R.color.md_grey_800)) |
|
|
|
.putInt("colorBackgroundNight", App.INSTANCE.getCompatColor(R.color.md_grey_800)) |
|
|
|
.apply() |
|
|
|
.apply() |
|
|
|
App.INSTANCE.upThemeStore() |
|
|
|
App.INSTANCE.upThemeStore() |
|
|
|
|
|
|
|
recreateActivities() |
|
|
|
} |
|
|
|
} |
|
|
|
.setNegativeButton(R.string.cancel, null) |
|
|
|
.setNegativeButton(R.string.cancel, null) |
|
|
|
.show().upTint() |
|
|
|
.show().upTint() |
|
|
@ -134,7 +134,12 @@ class ThemeConfigFragment : PreferenceFragmentCompat(), SharedPreferences.OnShar |
|
|
|
private fun upTheme(isNightTheme: Boolean) { |
|
|
|
private fun upTheme(isNightTheme: Boolean) { |
|
|
|
if (App.INSTANCE.getPrefBoolean("isNightTheme") == isNightTheme) { |
|
|
|
if (App.INSTANCE.getPrefBoolean("isNightTheme") == isNightTheme) { |
|
|
|
App.INSTANCE.upThemeStore() |
|
|
|
App.INSTANCE.upThemeStore() |
|
|
|
|
|
|
|
recreateActivities() |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private fun recreateActivities() { |
|
|
|
|
|
|
|
postEvent(Bus.RECREATE, "") |
|
|
|
|
|
|
|
Handler().postDelayed({ activity?.recreate() }, 100L) |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |