Fix usage of old light theme

It is no longer the default theme, so we can't count on that
This commit is contained in:
SpiritCroc 2020-07-20 16:39:02 +02:00
parent f37a948f8e
commit 7f07833a9e
2 changed files with 8 additions and 2 deletions

View File

@ -21,9 +21,10 @@ import im.vector.riotx.R
/** /**
* Class to manage Activity other possible themes. * Class to manage Activity other possible themes.
* Note that style for light theme is default and is declared in the Android Manifest * Note that style for light theme is no more default and is no more declared in the Android Manifest
*/ */
sealed class ActivityOtherThemes(@StyleRes val dark: Int, sealed class ActivityOtherThemes(@StyleRes val light: Int,
@StyleRes val dark: Int,
@StyleRes val black: Int, @StyleRes val black: Int,
@StyleRes val status: Int, @StyleRes val status: Int,
@StyleRes val sc_light: Int, @StyleRes val sc_light: Int,
@ -33,6 +34,7 @@ sealed class ActivityOtherThemes(@StyleRes val dark: Int,
@StyleRes val sc_dark_colored: Int) { @StyleRes val sc_dark_colored: Int) {
object Default : ActivityOtherThemes( object Default : ActivityOtherThemes(
R.style.AppTheme_Light,
R.style.AppTheme_Dark, R.style.AppTheme_Dark,
R.style.AppTheme_Black, R.style.AppTheme_Black,
R.style.AppTheme_Status, R.style.AppTheme_Status,
@ -47,6 +49,7 @@ sealed class ActivityOtherThemes(@StyleRes val dark: Int,
R.style.AppTheme_AttachmentsPreview, R.style.AppTheme_AttachmentsPreview,
R.style.AppTheme_AttachmentsPreview, R.style.AppTheme_AttachmentsPreview,
R.style.AppTheme_AttachmentsPreview, R.style.AppTheme_AttachmentsPreview,
R.style.AppTheme_AttachmentsPreview,
R.style.AppTheme_AttachmentsPreview_SC, R.style.AppTheme_AttachmentsPreview_SC,
R.style.AppTheme_AttachmentsPreview_SC, R.style.AppTheme_AttachmentsPreview_SC,
R.style.AppTheme_AttachmentsPreview_SC, R.style.AppTheme_AttachmentsPreview_SC,
@ -58,6 +61,7 @@ sealed class ActivityOtherThemes(@StyleRes val dark: Int,
R.style.AppTheme_Transparent, R.style.AppTheme_Transparent,
R.style.AppTheme_Transparent, R.style.AppTheme_Transparent,
R.style.AppTheme_Transparent, R.style.AppTheme_Transparent,
R.style.AppTheme_Transparent,
R.style.AppTheme_Transparent_SC, R.style.AppTheme_Transparent_SC,
R.style.AppTheme_Transparent_SC, R.style.AppTheme_Transparent_SC,
R.style.AppTheme_Transparent_SC, R.style.AppTheme_Transparent_SC,

View File

@ -147,6 +147,7 @@ object ThemeUtils {
fun setApplicationTheme(context: Context, aLightTheme: String, aDarkTheme: String) { fun setApplicationTheme(context: Context, aLightTheme: String, aDarkTheme: String) {
val aTheme = if (useDarkTheme(context)) aDarkTheme else aLightTheme val aTheme = if (useDarkTheme(context)) aDarkTheme else aLightTheme
when (aTheme) { when (aTheme) {
THEME_LIGHT_VALUE -> context.setTheme(R.style.AppTheme_Light)
THEME_DARK_VALUE -> context.setTheme(R.style.AppTheme_Dark) THEME_DARK_VALUE -> context.setTheme(R.style.AppTheme_Dark)
THEME_BLACK_VALUE -> context.setTheme(R.style.AppTheme_Black) THEME_BLACK_VALUE -> context.setTheme(R.style.AppTheme_Black)
THEME_STATUS_VALUE -> context.setTheme(R.style.AppTheme_Status) THEME_STATUS_VALUE -> context.setTheme(R.style.AppTheme_Status)
@ -177,6 +178,7 @@ object ThemeUtils {
*/ */
fun setActivityTheme(activity: Activity, otherThemes: ActivityOtherThemes) { fun setActivityTheme(activity: Activity, otherThemes: ActivityOtherThemes) {
when (getApplicationTheme(activity)) { when (getApplicationTheme(activity)) {
THEME_LIGHT_VALUE -> activity.setTheme(otherThemes.light)
THEME_DARK_VALUE -> activity.setTheme(otherThemes.dark) THEME_DARK_VALUE -> activity.setTheme(otherThemes.dark)
THEME_BLACK_VALUE -> activity.setTheme(otherThemes.black) THEME_BLACK_VALUE -> activity.setTheme(otherThemes.black)
THEME_STATUS_VALUE -> activity.setTheme(otherThemes.status) THEME_STATUS_VALUE -> activity.setTheme(otherThemes.status)