Rename themes follow Android conventions

This commit is contained in:
Benoit Marty 2021-06-16 12:05:10 +02:00
parent ece9d19d8c
commit 1a898f0404
16 changed files with 55 additions and 57 deletions

View File

@ -2,39 +2,39 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="im.vector.lib.ui.styles">
<application android:theme="@style/AppTheme.Light">
<application android:theme="@style/Theme.Vector.Light">
<activity
android:name=".debug.DebugMaterialThemeLightDefaultActivity"
android:theme="@style/VectorMaterialThemeDebugLight" />
android:theme="@style/Theme.Debug.Light" />
<activity
android:name=".debug.DebugMaterialThemeLightTestActivity"
android:theme="@style/VectorMaterialThemeDebugLight.Test" />
android:theme="@style/Theme.Debug.Light.Test" />
<activity
android:name=".debug.DebugMaterialThemeLightVectorActivity"
android:theme="@style/AppTheme.Light" />
android:theme="@style/Theme.Vector.Light" />
<activity
android:name=".debug.DebugMaterialThemeDarkDefaultActivity"
android:theme="@style/VectorMaterialThemeDebugDark" />
android:theme="@style/Theme.Debug.Dark" />
<activity
android:name=".debug.DebugMaterialThemeDarkTestActivity"
android:theme="@style/VectorMaterialThemeDebugDark.Test" />
android:theme="@style/Theme.Debug.Dark.Test" />
<activity
android:name=".debug.DebugMaterialThemeDarkVectorActivity"
android:theme="@style/AppTheme.Dark" />
android:theme="@style/Theme.Vector.Dark" />
<activity
android:name=".debug.DebugVectorButtonStylesLightActivity"
android:theme="@style/AppTheme.Light" />
android:theme="@style/Theme.Vector.Light" />
<activity
android:name=".debug.DebugVectorButtonStylesDarkActivity"
android:theme="@style/AppTheme.Dark" />
android:theme="@style/Theme.Vector.Dark" />
<activity
android:name=".debug.DebugVectorTextViewLightActivity"
android:theme="@style/AppTheme.Light" />
android:theme="@style/Theme.Vector.Light" />
<activity
android:name=".debug.DebugVectorTextViewDarkActivity"
android:theme="@style/AppTheme.Dark" />
android:theme="@style/Theme.Vector.Dark" />
</application>
</manifest>

View File

@ -6,11 +6,11 @@
</style>
<style name="VectorMaterialThemeDebugLight" parent="Theme.MaterialComponents.Light.NoActionBar">
<style name="Theme.Debug.Light" parent="Theme.MaterialComponents.Light.NoActionBar">
<!-- Keep all default value -->
</style>
<style name="VectorMaterialThemeDebugLight.Test">
<style name="Theme.Debug.Light.Test">
<item name="colorPrimary">#7F7F00</item>
<item name="colorPrimaryVariant">#00FF00</item>
<item name="colorOnPrimary">#0000FF</item>
@ -34,11 +34,11 @@
<item name="android:textColorLink">#000FFF</item>
</style>
<style name="VectorMaterialThemeDebugDark" parent="Theme.MaterialComponents.NoActionBar">
<style name="Theme.Debug.Dark" parent="Theme.MaterialComponents.NoActionBar">
<!-- Keep all default value -->
</style>
<style name="VectorMaterialThemeDebugDark.Test">
<style name="Theme.Debug.Dark.Test">
<item name="colorPrimary">#7F7F00</item>
<item name="colorPrimaryVariant">#00FF00</item>
<item name="colorOnPrimary">#0000FF</item>

View File

@ -1,10 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="AppTheme.Black.v23" parent="AppTheme.Base.Black">
<style name="Theme.Vector.Black.v23" parent="Base.Theme.Vector.Black">
<item name="android:windowLightStatusBar">false</item>
</style>
<style name="AppTheme.Black" parent="AppTheme.Black.v23"/>
<style name="Theme.Vector.Black" parent="Theme.Vector.Black.v23"/>
</resources>

View File

@ -1,10 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="AppTheme.Dark.v23" parent="AppTheme.Base.Dark">
<style name="Theme.Vector.Dark.v23" parent="Base.Theme.Vector.Dark">
<item name="android:windowLightStatusBar">false</item>
</style>
<style name="AppTheme.Dark" parent="AppTheme.Dark.v23"/>
<style name="Theme.Vector.Dark" parent="Theme.Vector.Dark.v23"/>
</resources>

View File

@ -1,11 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="AppTheme.Light.v23" parent="AppTheme.Base.Light">
<style name="Theme.Vector.Light.v23" parent="Base.Theme.Vector.Light">
<item name="android:statusBarColor">@color/android_status_bar_background_light</item>
<item name="android:windowLightStatusBar">true</item>
</style>
<style name="AppTheme.Light" parent="AppTheme.Light.v23"/>
<style name="Theme.Vector.Light" parent="Theme.Vector.Light.v23"/>
</resources>

View File

@ -1,10 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="AppTheme.Black.v27" parent="AppTheme.Black.v23">
<style name="Theme.Vector.Black.v27" parent="Theme.Vector.Black.v23">
<item name="android:windowLightNavigationBar">false</item>
</style>
<style name="AppTheme.Black" parent="AppTheme.Black.v27" />
<style name="Theme.Vector.Black" parent="Theme.Vector.Black.v27" />
</resources>

View File

@ -1,10 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="AppTheme.Dark.v27" parent="AppTheme.Dark.v23">
<style name="Theme.Vector.Dark.v27" parent="Theme.Vector.Dark.v23">
<item name="android:windowLightNavigationBar">false</item>
</style>
<style name="AppTheme.Dark" parent="AppTheme.Dark.v27" />
<style name="Theme.Vector.Dark" parent="Theme.Vector.Dark.v27" />
</resources>

View File

@ -1,11 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="AppTheme.Light.v27" parent="AppTheme.Light.v23">
<style name="Theme.Vector.Light.v27" parent="Theme.Vector.Light.v23">
<item name="android:navigationBarColor">@color/android_navigation_bar_background_light</item>
<item name="android:windowLightNavigationBar">true</item>
</style>
<style name="AppTheme.Light" parent="AppTheme.Light.v27" />
<style name="Theme.Vector.Light" parent="Theme.Vector.Light.v27" />
</resources>

View File

@ -3,7 +3,7 @@
<!-- BLACK THEME COLORS -->
<style name="AppTheme.Base.Black" parent="AppTheme.Base.Dark">
<style name="Base.Theme.Vector.Black" parent="Base.Theme.Vector.Dark">
<!-- Only setting the items we need to override to get the background to be pure black, otherwise inheriting -->
<!-- other colors -->
@ -31,6 +31,6 @@
<item name="android:navigationBarColor">@android:color/black</item>
</style>
<style name="AppTheme.Black" parent="AppTheme.Base.Black" />
<style name="Theme.Vector.Black" parent="Base.Theme.Vector.Black" />
</resources>

View File

@ -2,21 +2,19 @@
<resources>
<!-- Launcher Theme, only used for VectorLauncherActivity (will be use even before the Activity is started) -->
<style name="AppTheme.Launcher" parent="AppTheme.Launcher.Base"/>
<style name="AppTheme.Launcher.Base" parent="Theme.MaterialComponents.Light.NoActionBar">
<style name="Theme.Vector.Launcher" parent="Theme.MaterialComponents.Light.NoActionBar">
<item name="android:windowBackground">@drawable/splash</item>
<item name="colorPrimary">@color/element_accent_light</item>
<item name="android:statusBarColor">@color/element_accent_light</item>
<item name="android:navigationBarColor">@color/element_accent_light</item>
</style>
<style name="AppTheme.AttachmentsPreview" parent="AppTheme.Base.Black">
<style name="Theme.Vector.Black.AttachmentsPreview">
<item name="android:statusBarColor">@android:color/transparent</item>
<item name="android:navigationBarColor">@android:color/transparent</item>
</style>
<style name="AppTheme.Transparent" parent="AppTheme.Base.Black">
<style name="Theme.Vector.Black.Transparent">
<item name="windowActionBar">false</item>
<item name="windowNoTitle">true</item>
<item name="android:windowIsTranslucent">true</item>

View File

@ -3,7 +3,7 @@
<!-- DARK THEME COLORS -->
<style name="AppTheme.Base.Dark" parent="Theme.MaterialComponents.NoActionBar">
<style name="Base.Theme.Vector.Dark" parent="Theme.MaterialComponents.NoActionBar">
<!-- Element attribute for palette -->
<!-- content colors -->
<item name="vctr_content_primary">@color/element_content_primary_dark</item>
@ -132,6 +132,6 @@
<item name="vctr_social_login_button_gitlab_style">@style/Widget.Vector.Button.Outlined.SocialLogin.Gitlab.Dark</item>
</style>
<style name="AppTheme.Dark" parent="AppTheme.Base.Dark" />
<style name="Theme.Vector.Dark" parent="Base.Theme.Vector.Dark" />
</resources>

View File

@ -3,7 +3,7 @@
<!-- LIGHT THEME COLORS -->
<style name="AppTheme.Base.Light" parent="Theme.MaterialComponents.Light.NoActionBar">
<style name="Base.Theme.Vector.Light" parent="Theme.MaterialComponents.Light.NoActionBar">
<!-- Element attribute for palette -->
<!-- content colors -->
<item name="vctr_content_primary">@color/element_content_primary_light</item>
@ -134,6 +134,6 @@
<item name="vctr_social_login_button_gitlab_style">@style/Widget.Vector.Button.Outlined.SocialLogin.Gitlab.Light</item>
</style>
<style name="AppTheme.Light" parent="AppTheme.Base.Light" />
<style name="Theme.Vector.Light" parent="Base.Theme.Vector.Light" />
</resources>

View File

@ -14,7 +14,7 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:theme="@style/AppTheme.Light">
android:theme="@style/Theme.Vector.Light">
<include layout="@layout/demo_theme_sample" />
@ -24,7 +24,7 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:theme="@style/AppTheme.Dark">
android:theme="@style/Theme.Vector.Dark">
<include layout="@layout/demo_theme_sample" />
@ -34,7 +34,7 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:theme="@style/AppTheme.Black">
android:theme="@style/Theme.Vector.Black">
<include layout="@layout/demo_theme_sample" />

View File

@ -75,7 +75,7 @@
android:networkSecurityConfig="@xml/network_security_config"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/AppTheme.Light"
android:theme="@style/Theme.Vector.Light"
tools:replace="android:allowBackup">
<!-- No limit for screen ratio: avoid black strips -->
@ -85,7 +85,7 @@
<activity
android:name=".features.MainActivity"
android:theme="@style/AppTheme.Launcher" />
android:theme="@style/Theme.Vector.Launcher" />
<!-- Activity alias for the launcher Activity (must be declared after the Activity it targets) -->
<activity-alias
@ -141,7 +141,7 @@
<!-- Add tools:ignore="Instantiatable" for the error reported only by Buildkite :/ -->
<activity
android:name=".features.media.VectorAttachmentViewerActivity"
android:theme="@style/AppTheme.Transparent"
android:theme="@style/Theme.Vector.Black.Transparent"
tools:ignore="Instantiatable" />
<activity android:name=".features.media.BigImageViewerActivity" />
@ -268,7 +268,7 @@
<activity
android:name=".features.attachments.preview.AttachmentsPreviewActivity"
android:theme="@style/AppTheme.AttachmentsPreview" />
android:theme="@style/Theme.Vector.Black.AttachmentsPreview" />
<activity
android:name=".features.call.VectorCallActivity"
android:excludeFromRecents="true" />

View File

@ -27,22 +27,22 @@ sealed class ActivityOtherThemes(@StyleRes val dark: Int,
@StyleRes val black: Int) {
object Default : ActivityOtherThemes(
R.style.AppTheme_Dark,
R.style.AppTheme_Black
R.style.Theme_Vector_Dark,
R.style.Theme_Vector_Black
)
object Launcher : ActivityOtherThemes(
R.style.AppTheme_Launcher,
R.style.AppTheme_Launcher
R.style.Theme_Vector_Launcher,
R.style.Theme_Vector_Launcher
)
object AttachmentsPreview : ActivityOtherThemes(
R.style.AppTheme_AttachmentsPreview,
R.style.AppTheme_AttachmentsPreview
R.style.Theme_Vector_Black_AttachmentsPreview,
R.style.Theme_Vector_Black_AttachmentsPreview
)
object VectorAttachmentsPreview : ActivityOtherThemes(
R.style.AppTheme_Transparent,
R.style.AppTheme_Transparent
R.style.Theme_Vector_Black_Transparent,
R.style.Theme_Vector_Black_Transparent
)
}

View File

@ -114,10 +114,10 @@ object ThemeUtils {
currentTheme.set(aTheme)
context.setTheme(
when (aTheme) {
SYSTEM_THEME_VALUE -> if (isSystemDarkTheme(context.resources)) R.style.AppTheme_Dark else R.style.AppTheme_Light
THEME_DARK_VALUE -> R.style.AppTheme_Dark
THEME_BLACK_VALUE -> R.style.AppTheme_Black
else -> R.style.AppTheme_Light
SYSTEM_THEME_VALUE -> if (isSystemDarkTheme(context.resources)) R.style.Theme_Vector_Dark else R.style.Theme_Vector_Light
THEME_DARK_VALUE -> R.style.Theme_Vector_Dark
THEME_BLACK_VALUE -> R.style.Theme_Vector_Black
else -> R.style.Theme_Vector_Light
}
)