From dc4574ded38c7e1ba62c2a14ec6cbcadeb198c72 Mon Sep 17 00:00:00 2001 From: SpiritCroc Date: Fri, 15 May 2020 10:19:09 +0200 Subject: [PATCH] Introduce more SC themes --- .../features/themes/ActivityOtherThemes.kt | 13 +++- .../riotx/features/themes/ThemeUtils.kt | 16 ++++- .../highlighted_message_background_sc.xml | 6 +- vector/src/main/res/values-de/strings_sc.xml | 5 ++ vector/src/main/res/values-v21/theme_sc.xml | 42 +++++++++++++ vector/src/main/res/values-v23/theme_sc.xml | 20 ++++++- vector/src/main/res/values-v27/theme_sc.xml | 20 ++++++- vector/src/main/res/values/array.xml | 6 ++ vector/src/main/res/values/colors_sc.xml | 4 +- vector/src/main/res/values/strings.xml | 1 - vector/src/main/res/values/strings_sc.xml | 5 ++ vector/src/main/res/values/styles_sc.xml | 36 +++++++++++ vector/src/main/res/values/theme_sc.xml | 59 ++++++++----------- 13 files changed, 186 insertions(+), 47 deletions(-) create mode 100644 vector/src/main/res/values/styles_sc.xml diff --git a/vector/src/main/java/im/vector/riotx/features/themes/ActivityOtherThemes.kt b/vector/src/main/java/im/vector/riotx/features/themes/ActivityOtherThemes.kt index 31e9f1cf02..f5f4280e5d 100644 --- a/vector/src/main/java/im/vector/riotx/features/themes/ActivityOtherThemes.kt +++ b/vector/src/main/java/im/vector/riotx/features/themes/ActivityOtherThemes.kt @@ -26,16 +26,25 @@ import im.vector.riotx.R sealed class ActivityOtherThemes(@StyleRes val dark: Int, @StyleRes val black: Int, @StyleRes val status: Int, - @StyleRes val sc: Int) { + @StyleRes val sc: Int, + @StyleRes val sc_dark: Int, + @StyleRes val sc_colored: Int, + @StyleRes val sc_dark_colored: Int) { object Default : ActivityOtherThemes( R.style.AppTheme_Dark, R.style.AppTheme_Black, R.style.AppTheme_Status, - R.style.AppTheme_SC + R.style.AppTheme_SC, + R.style.AppTheme_SC_Dark, + R.style.AppTheme_SC_Colored, + R.style.AppTheme_SC_Dark_Colored ) object AttachmentsPreview : ActivityOtherThemes( + R.style.AppTheme_AttachmentsPreview, + R.style.AppTheme_AttachmentsPreview, + R.style.AppTheme_AttachmentsPreview, R.style.AppTheme_AttachmentsPreview, R.style.AppTheme_AttachmentsPreview, R.style.AppTheme_AttachmentsPreview, diff --git a/vector/src/main/java/im/vector/riotx/features/themes/ThemeUtils.kt b/vector/src/main/java/im/vector/riotx/features/themes/ThemeUtils.kt index f9a92c3e7f..d4ef50cfb6 100644 --- a/vector/src/main/java/im/vector/riotx/features/themes/ThemeUtils.kt +++ b/vector/src/main/java/im/vector/riotx/features/themes/ThemeUtils.kt @@ -42,6 +42,9 @@ object ThemeUtils { private const val THEME_BLACK_VALUE = "black" private const val THEME_STATUS_VALUE = "status" private const val THEME_SC_VALUE = "sc" + private const val THEME_SC_DARK_VALUE = "sc_dark" + private const val THEME_SC_COLORED_VALUE = "sc_colored" + private const val THEME_SC_DARK_COLORED_VALUE = "sc_dark_colored" private val mColorByAttr = HashMap() @@ -66,7 +69,10 @@ object ThemeUtils { */ fun isScTheme(context: Context?): Boolean { if (context != null) { - mIsScTheme = THEME_SC_VALUE.equals(getApplicationTheme(context)); + mIsScTheme = when (getApplicationTheme(context)) { + THEME_SC_VALUE, THEME_SC_DARK_VALUE, THEME_SC_COLORED_VALUE, THEME_SC_DARK_COLORED_VALUE -> true + else -> false + } } return mIsScTheme; } @@ -82,6 +88,9 @@ object ThemeUtils { THEME_BLACK_VALUE -> context.setTheme(R.style.AppTheme_Black) THEME_STATUS_VALUE -> context.setTheme(R.style.AppTheme_Status) THEME_SC_VALUE -> context.setTheme(R.style.AppTheme_SC) + THEME_SC_DARK_VALUE -> context.setTheme(R.style.AppTheme_SC_Dark) + THEME_SC_COLORED_VALUE -> context.setTheme(R.style.AppTheme_SC_Colored) + THEME_SC_DARK_COLORED_VALUE -> context.setTheme(R.style.AppTheme_SC_Dark_Colored) else -> context.setTheme(R.style.AppTheme_Light) } @@ -100,6 +109,9 @@ object ThemeUtils { THEME_BLACK_VALUE -> activity.setTheme(otherThemes.black) THEME_STATUS_VALUE -> activity.setTheme(otherThemes.status) THEME_SC_VALUE -> activity.setTheme(otherThemes.sc) + THEME_SC_DARK_VALUE -> activity.setTheme(otherThemes.sc_dark) + THEME_SC_COLORED_VALUE -> activity.setTheme(otherThemes.sc_colored) + THEME_SC_DARK_COLORED_VALUE -> activity.setTheme(otherThemes.sc_dark_colored) } mColorByAttr.clear() @@ -207,7 +219,7 @@ object ThemeUtils { } } } - THEME_SC_VALUE -> { + THEME_SC_VALUE, THEME_SC_DARK_VALUE, THEME_SC_COLORED_VALUE, THEME_SC_DARK_COLORED_VALUE -> { return when (resourceId) { R.drawable.bg_search_edit_text_light -> R.drawable.bg_search_edit_text_sc R.drawable.bg_unread_notification_light -> R.drawable.bg_unread_notification_sc diff --git a/vector/src/main/res/drawable/highlighted_message_background_sc.xml b/vector/src/main/res/drawable/highlighted_message_background_sc.xml index 6832ba01d3..0e2955acea 100644 --- a/vector/src/main/res/drawable/highlighted_message_background_sc.xml +++ b/vector/src/main/res/drawable/highlighted_message_background_sc.xml @@ -9,7 +9,7 @@ - + @@ -17,7 +17,7 @@ - + @@ -32,4 +32,4 @@ - \ No newline at end of file + diff --git a/vector/src/main/res/values-de/strings_sc.xml b/vector/src/main/res/values-de/strings_sc.xml index 70bf5c0a56..9e614e064f 100644 --- a/vector/src/main/res/values-de/strings_sc.xml +++ b/vector/src/main/res/values-de/strings_sc.xml @@ -3,6 +3,11 @@ (Gelöschte Nachricht) + SC Schwarz + SC Dunkel + SC Schwarz, bunte Blasen + SC Dunkel, bunte Blasen + Nachrichtblasen Keine Selbe Seite diff --git a/vector/src/main/res/values-v21/theme_sc.xml b/vector/src/main/res/values-v21/theme_sc.xml index b4bc288b03..3cce94c80c 100644 --- a/vector/src/main/res/values-v21/theme_sc.xml +++ b/vector/src/main/res/values-v21/theme_sc.xml @@ -13,6 +13,48 @@ @transition/image_preview_transition + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/vector/src/main/res/values/theme_sc.xml b/vector/src/main/res/values/theme_sc.xml index 45ba957e2f..f6f532674f 100644 --- a/vector/src/main/res/values/theme_sc.xml +++ b/vector/src/main/res/values/theme_sc.xml @@ -4,8 +4,8 @@ + + + + + + + + + + + - - - - - -