mirror of
https://github.com/libre-tube/LibreTube.git
synced 2024-12-14 14:20:30 +05:30
fix black theme
This commit is contained in:
parent
44175b35c5
commit
d949b38789
@ -23,7 +23,7 @@
|
||||
android:requestLegacyExternalStorage="true"
|
||||
android:roundIcon="@mipmap/ic_launcher_round"
|
||||
android:supportsRtl="true"
|
||||
android:theme="@style/Theme.Purple.Pure"
|
||||
android:theme="@style/StartupTheme"
|
||||
tools:targetApi="n">
|
||||
|
||||
<activity
|
||||
|
@ -1,5 +1,6 @@
|
||||
package com.github.libretube.util
|
||||
|
||||
import android.app.Activity
|
||||
import android.app.NotificationManager
|
||||
import android.content.ComponentName
|
||||
import android.content.Context
|
||||
@ -22,10 +23,10 @@ object ThemeHelper {
|
||||
*/
|
||||
fun updateTheme(activity: AppCompatActivity) {
|
||||
val themeMode = PreferenceHelper.getString(PreferenceKeys.THEME_MODE, "A")
|
||||
val pureThemeEnabled = PreferenceHelper.getBoolean(PreferenceKeys.PURE_THEME, false)
|
||||
|
||||
updateAccentColor(activity, pureThemeEnabled)
|
||||
updateAccentColor(activity)
|
||||
applyDynamicColorsIfEnabled(activity)
|
||||
applyPureThemeIfEnabled(activity)
|
||||
updateThemeMode(themeMode)
|
||||
}
|
||||
|
||||
@ -33,8 +34,7 @@ object ThemeHelper {
|
||||
* Update the accent color of the app
|
||||
*/
|
||||
private fun updateAccentColor(
|
||||
activity: AppCompatActivity,
|
||||
pureThemeEnabled: Boolean
|
||||
activity: AppCompatActivity
|
||||
) {
|
||||
val theme = when (
|
||||
PreferenceHelper.getString(
|
||||
@ -43,13 +43,13 @@ object ThemeHelper {
|
||||
)
|
||||
) {
|
||||
// set the accent color, use the pure black/white theme if enabled
|
||||
"my" -> if (pureThemeEnabled) R.style.BaseTheme_Pure else R.style.BaseTheme
|
||||
"red" -> if (pureThemeEnabled) R.style.Theme_Red_Pure else R.style.Theme_Red
|
||||
"blue" -> if (pureThemeEnabled) R.style.Theme_Blue_Pure else R.style.Theme_Blue
|
||||
"yellow" -> if (pureThemeEnabled) R.style.Theme_Yellow_Pure else R.style.Theme_Yellow
|
||||
"green" -> if (pureThemeEnabled) R.style.Theme_Green_Pure else R.style.Theme_Green
|
||||
"purple" -> if (pureThemeEnabled) R.style.Theme_Purple_Pure else R.style.Theme_Purple
|
||||
else -> if (pureThemeEnabled) R.style.Theme_Purple_Pure else R.style.Theme_Purple
|
||||
"my" -> R.style.BaseTheme
|
||||
"red" -> R.style.Theme_Red
|
||||
"blue" -> R.style.Theme_Blue
|
||||
"yellow" -> R.style.Theme_Yellow
|
||||
"green" -> R.style.Theme_Green
|
||||
"purple" -> R.style.Theme_Purple
|
||||
else -> R.style.Theme_Purple
|
||||
}
|
||||
activity.setTheme(theme)
|
||||
}
|
||||
@ -63,7 +63,20 @@ object ThemeHelper {
|
||||
PreferenceKeys.ACCENT_COLOR,
|
||||
"purple"
|
||||
) == "my"
|
||||
) DynamicColors.applyToActivityIfAvailable(activity)
|
||||
) {
|
||||
DynamicColors.applyToActivityIfAvailable(activity)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* apply the pure black/white theme
|
||||
*/
|
||||
private fun applyPureThemeIfEnabled(activity: Activity) {
|
||||
val pureThemeEnabled = PreferenceHelper.getBoolean(
|
||||
PreferenceKeys.PURE_THEME,
|
||||
false
|
||||
)
|
||||
if (pureThemeEnabled) activity.theme.applyStyle(R.style.Pure, true)
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -8,7 +8,7 @@
|
||||
|
||||
</style>
|
||||
|
||||
<style name="BaseTheme.Pure" parent="BaseTheme">
|
||||
<style name="StartupTheme" parent="BaseTheme">
|
||||
|
||||
<item name="android:colorBackground">@android:color/black</item>
|
||||
<item name="colorSurface">@android:color/black</item>
|
||||
@ -29,13 +29,6 @@
|
||||
|
||||
</style>
|
||||
|
||||
<style name="Theme.Red.Pure" parent="Theme.Red">
|
||||
|
||||
<item name="android:colorBackground">@android:color/black</item>
|
||||
<item name="colorSurface">@android:color/black</item>
|
||||
|
||||
</style>
|
||||
|
||||
<style name="Theme.Blue" parent="BaseTheme">
|
||||
|
||||
<item name="colorPrimary">@color/blue_dark_accentLight</item>
|
||||
@ -50,13 +43,6 @@
|
||||
|
||||
</style>
|
||||
|
||||
<style name="Theme.Blue.Pure" parent="Theme.Blue">
|
||||
|
||||
<item name="android:colorBackground">@android:color/black</item>
|
||||
<item name="colorSurface">@android:color/black</item>
|
||||
|
||||
</style>
|
||||
|
||||
<style name="Theme.Yellow" parent="BaseTheme">
|
||||
|
||||
<item name="colorPrimary">@color/yellow_dark_accentLight</item>
|
||||
@ -71,13 +57,6 @@
|
||||
|
||||
</style>
|
||||
|
||||
<style name="Theme.Yellow.Pure" parent="Theme.Yellow">
|
||||
|
||||
<item name="android:colorBackground">@android:color/black</item>
|
||||
<item name="colorSurface">@android:color/black</item>
|
||||
|
||||
</style>
|
||||
|
||||
<style name="Theme.Green" parent="BaseTheme">
|
||||
|
||||
<item name="colorPrimary">@color/green_dark_accentLight</item>
|
||||
@ -92,13 +71,6 @@
|
||||
|
||||
</style>
|
||||
|
||||
<style name="Theme.Green.Pure" parent="Theme.Green">
|
||||
|
||||
<item name="android:colorBackground">@android:color/black</item>
|
||||
<item name="colorSurface">@android:color/black</item>
|
||||
|
||||
</style>
|
||||
|
||||
<style name="Theme.Purple" parent="BaseTheme">
|
||||
|
||||
<item name="colorPrimary">@color/purple_dark_accentLight</item>
|
||||
@ -113,7 +85,7 @@
|
||||
|
||||
</style>
|
||||
|
||||
<style name="Theme.Purple.Pure" parent="Theme.Purple">
|
||||
<style name="Pure">
|
||||
|
||||
<item name="android:colorBackground">@android:color/black</item>
|
||||
<item name="colorSurface">@android:color/black</item>
|
||||
|
@ -8,7 +8,7 @@
|
||||
|
||||
</style>
|
||||
|
||||
<style name="Theme.BaseTheme.Pure" parent="BaseTheme">
|
||||
<style name="StartupTheme" parent="BaseTheme">
|
||||
|
||||
<item name="android:colorBackground">@android:color/white</item>
|
||||
<item name="colorSurface">@android:color/white</item>
|
||||
@ -30,13 +30,6 @@
|
||||
|
||||
</style>
|
||||
|
||||
<style name="Theme.Red.Pure" parent="Theme.Red">
|
||||
|
||||
<item name="android:colorBackground">@android:color/white</item>
|
||||
<item name="colorSurface">@android:color/white</item>
|
||||
|
||||
</style>
|
||||
|
||||
<style name="Theme.Blue" parent="BaseTheme">
|
||||
|
||||
<item name="colorPrimary">@color/blue_light_accentLight</item>
|
||||
@ -52,13 +45,6 @@
|
||||
|
||||
</style>
|
||||
|
||||
<style name="Theme.Blue.Pure" parent="Theme.Blue">
|
||||
|
||||
<item name="android:colorBackground">@android:color/white</item>
|
||||
<item name="colorSurface">@android:color/white</item>
|
||||
|
||||
</style>
|
||||
|
||||
<style name="Theme.Yellow" parent="BaseTheme">
|
||||
|
||||
<item name="colorPrimary">@color/yellow_light_accentLight</item>
|
||||
@ -74,13 +60,6 @@
|
||||
|
||||
</style>
|
||||
|
||||
<style name="Theme.Yellow.Pure" parent="Theme.Yellow">
|
||||
|
||||
<item name="android:colorBackground">@android:color/white</item>
|
||||
<item name="colorSurface">@android:color/white</item>
|
||||
|
||||
</style>
|
||||
|
||||
<style name="Theme.Green" parent="BaseTheme">
|
||||
|
||||
<item name="colorPrimary">@color/green_light_accentLight</item>
|
||||
@ -96,13 +75,6 @@
|
||||
|
||||
</style>
|
||||
|
||||
<style name="Theme.Green.Pure" parent="Theme.Green">
|
||||
|
||||
<item name="android:colorBackground">@android:color/white</item>
|
||||
<item name="colorSurface">@android:color/white</item>
|
||||
|
||||
</style>
|
||||
|
||||
<style name="Theme.Purple" parent="BaseTheme">
|
||||
|
||||
<item name="colorPrimary">@color/purple_light_accentLight</item>
|
||||
@ -118,7 +90,7 @@
|
||||
|
||||
</style>
|
||||
|
||||
<style name="Theme.Purple.Pure" parent="Theme.Purple">
|
||||
<style name="Pure">
|
||||
|
||||
<item name="android:colorBackground">@android:color/white</item>
|
||||
<item name="colorSurface">@android:color/white</item>
|
||||
|
Loading…
Reference in New Issue
Block a user