cleanup themes

This commit is contained in:
Bnyro 2022-08-12 15:00:07 +02:00
parent 3cf1d99242
commit 16d2e5144b
6 changed files with 30 additions and 59 deletions

View File

@ -1607,6 +1607,7 @@ class PlayerFragment : BaseFragment() {
private fun isServiceRunning(context: Context, serviceClass: Class<*>): Boolean {
val manager = context.getSystemService(Context.ACTIVITY_SERVICE) as ActivityManager
@Suppress("DEPRECATION")
for (service in manager.getRunningServices(Int.MAX_VALUE)) {
if (serviceClass.name == service.service.className) {
return true

View File

@ -18,7 +18,7 @@ import com.google.android.material.color.DynamicColors
object ThemeHelper {
fun updateTheme(activity: AppCompatActivity) {
val themeMode = PreferenceHelper.getString(PreferenceKeys.THEME_MODE, "A")!!
val themeMode = PreferenceHelper.getString(PreferenceKeys.THEME_MODE, "A")
val pureThemeEnabled = PreferenceHelper.getBoolean(PreferenceKeys.PURE_THEME, false)
updateAccentColor(activity, pureThemeEnabled)
@ -37,8 +37,8 @@ object ThemeHelper {
) {
"my" -> {
applyDynamicColors(activity)
if (pureThemeEnabled) R.style.MaterialYou_Pure
else R.style.MaterialYou
if (pureThemeEnabled) R.style.BaseTheme_Pure
else R.style.BaseTheme
}
// set the theme, use the pure theme if enabled
"red" -> if (pureThemeEnabled) R.style.Theme_Red_Pure else R.style.Theme_Red

View File

@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<solid android:color="@android:color/white" />
<corners
android:topLeftRadius="100dp"
android:topRightRadius="100dp" />
</shape>

View File

@ -1,6 +1,6 @@
<resources xmlns:tools="http://schemas.android.com/tools">
<style name="MaterialYou">
<style name="BaseTheme" parent="Theme.Material3.Dark.NoActionBar">
<item name="android:statusBarColor" tools:targetApi="m">@android:color/transparent</item>
<item name="android:windowLightStatusBar" tools:targetApi="m">false</item>
@ -8,14 +8,14 @@
</style>
<style name="MaterialYou.Pure" parent="MaterialYou">
<style name="BaseTheme.Pure" parent="BaseTheme">
<item name="android:colorBackground">@android:color/black</item>
<item name="colorSurface">@android:color/black</item>
</style>
<style name="Theme.Red" parent="Theme.Material3.Dark.NoActionBar">
<style name="Theme.Red" parent="BaseTheme">
<item name="colorPrimary">@color/red_dark_accentLight</item>
<item name="colorOnPrimary">@color/red_dark_accentDark</item>
@ -27,10 +27,6 @@
<item name="android:colorBackground">@color/red_dark_background</item>
<item name="colorOnBackground">@color/red_dark_background</item>
<item name="android:statusBarColor" tools:targetApi="m">@android:color/transparent</item>
<item name="android:windowLightStatusBar" tools:targetApi="m">false</item>
<item name="android:navigationBarColor">@android:color/transparent</item>
</style>
<style name="Theme.Red.Pure" parent="Theme.Red">
@ -40,7 +36,7 @@
</style>
<style name="Theme.Blue" parent="Theme.Material3.Dark.NoActionBar">
<style name="Theme.Blue" parent="BaseTheme">
<item name="colorPrimary">@color/blue_dark_accentLight</item>
<item name="colorOnPrimary">@color/blue_dark_accentDark</item>
@ -52,10 +48,6 @@
<item name="android:colorBackground">@color/blue_dark_background</item>
<item name="colorOnBackground">@color/blue_dark_background</item>
<item name="android:statusBarColor" tools:targetApi="m">@android:color/transparent</item>
<item name="android:windowLightStatusBar" tools:targetApi="m">false</item>
<item name="android:navigationBarColor">@android:color/transparent</item>
</style>
<style name="Theme.Blue.Pure" parent="Theme.Blue">
@ -65,7 +57,7 @@
</style>
<style name="Theme.Yellow" parent="Theme.Material3.Dark.NoActionBar">
<style name="Theme.Yellow" parent="BaseTheme">
<item name="colorPrimary">@color/yellow_dark_accentLight</item>
<item name="colorOnPrimary">@color/yellow_dark_accentDark</item>
@ -77,10 +69,6 @@
<item name="android:colorBackground">@color/yellow_dark_background</item>
<item name="colorOnBackground">@color/yellow_dark_background</item>
<item name="android:statusBarColor" tools:targetApi="m">@android:color/transparent</item>
<item name="android:windowLightStatusBar" tools:targetApi="m">false</item>
<item name="android:navigationBarColor">@android:color/transparent</item>
</style>
<style name="Theme.Yellow.Pure" parent="Theme.Yellow">
@ -90,7 +78,7 @@
</style>
<style name="Theme.Green" parent="Theme.Material3.Dark.NoActionBar">
<style name="Theme.Green" parent="BaseTheme">
<item name="colorPrimary">@color/green_dark_accentLight</item>
<item name="colorOnPrimary">@color/green_dark_accentDark</item>
@ -102,10 +90,6 @@
<item name="android:colorBackground">@color/green_dark_background</item>
<item name="colorOnBackground">@color/green_dark_background</item>
<item name="android:statusBarColor" tools:targetApi="m">@android:color/transparent</item>
<item name="android:windowLightStatusBar" tools:targetApi="m">false</item>
<item name="android:navigationBarColor">@android:color/transparent</item>
</style>
<style name="Theme.Green.Pure" parent="Theme.Green">
@ -115,7 +99,7 @@
</style>
<style name="Theme.Purple" parent="Theme.Material3.Dark.NoActionBar">
<style name="Theme.Purple" parent="BaseTheme">
<item name="colorPrimary">@color/purple_dark_accentLight</item>
<item name="colorOnPrimary">@color/purple_dark_accentDark</item>
@ -127,10 +111,6 @@
<item name="android:colorBackground">@color/purple_dark_background</item>
<item name="colorOnBackground">@color/purple_dark_background</item>
<item name="android:statusBarColor" tools:targetApi="m">@android:color/transparent</item>
<item name="android:windowLightStatusBar" tools:targetApi="m">false</item>
<item name="android:navigationBarColor">@android:color/transparent</item>
</style>
<style name="Theme.Purple.Pure" parent="Theme.Purple">

View File

@ -1,6 +1,6 @@
<resources xmlns:tools="http://schemas.android.com/tools">
<style name="MaterialYou">
<style name="BaseTheme" parent="Theme.Material3.Light.NoActionBar">
<item name="android:statusBarColor" tools:targetApi="m">@android:color/transparent</item>
<item name="android:windowLightStatusBar" tools:targetApi="m">true</item>
@ -8,14 +8,14 @@
</style>
<style name="Theme.MaterialYou.Pure" parent="MaterialYou">
<style name="Theme.BaseTheme.Pure" parent="BaseTheme">
<item name="android:colorBackground">@android:color/white</item>
<item name="colorSurface">@android:color/white</item>
</style>
<style name="Theme.Red" parent="Theme.Material3.Light.NoActionBar">
<style name="Theme.Red" parent="BaseTheme">
<item name="colorPrimary">@color/red_light_accentLight</item>
<item name="colorOnPrimary">@color/red_light_accentDark</item>
@ -28,10 +28,6 @@
<item name="android:colorBackground">@color/red_light_background</item>
<item name="colorOnBackground">@color/red_light_background</item>
<item name="android:statusBarColor" tools:targetApi="m">@android:color/transparent</item>
<item name="android:windowLightStatusBar" tools:targetApi="m">true</item>
<item name="android:navigationBarColor">@android:color/transparent</item>
</style>
<style name="Theme.Red.Pure" parent="Theme.Red">
@ -41,7 +37,7 @@
</style>
<style name="Theme.Blue" parent="Theme.Material3.Light.NoActionBar">
<style name="Theme.Blue" parent="BaseTheme">
<item name="colorPrimary">@color/blue_light_accentLight</item>
<item name="colorOnPrimary">@color/blue_light_accentDark</item>
@ -54,10 +50,6 @@
<item name="android:colorBackground">@color/blue_light_background</item>
<item name="colorOnBackground">@color/blue_light_background</item>
<item name="android:statusBarColor" tools:targetApi="m">@android:color/transparent</item>
<item name="android:windowLightStatusBar" tools:targetApi="m">true</item>
<item name="android:navigationBarColor">@android:color/transparent</item>
</style>
<style name="Theme.Blue.Pure" parent="Theme.Blue">
@ -67,7 +59,7 @@
</style>
<style name="Theme.Yellow" parent="Theme.Material3.Light.NoActionBar">
<style name="Theme.Yellow" parent="BaseTheme">
<item name="colorPrimary">@color/yellow_light_accentLight</item>
<item name="colorOnPrimary">@color/yellow_light_accentDark</item>
@ -80,10 +72,6 @@
<item name="android:colorBackground">@color/yellow_light_background</item>
<item name="colorOnBackground">@color/yellow_light_background</item>
<item name="android:statusBarColor" tools:targetApi="m">@android:color/transparent</item>
<item name="android:windowLightStatusBar" tools:targetApi="m">true</item>
<item name="android:navigationBarColor">@android:color/transparent</item>
</style>
<style name="Theme.Yellow.Pure" parent="Theme.Yellow">
@ -93,7 +81,7 @@
</style>
<style name="Theme.Green" parent="Theme.Material3.Light.NoActionBar">
<style name="Theme.Green" parent="BaseTheme">
<item name="colorPrimary">@color/green_light_accentLight</item>
<item name="colorOnPrimary">@color/green_light_accentDark</item>
@ -106,10 +94,6 @@
<item name="android:colorBackground">@color/green_light_background</item>
<item name="colorOnBackground">@color/green_light_background</item>
<item name="android:statusBarColor" tools:targetApi="m">@android:color/transparent</item>
<item name="android:windowLightStatusBar" tools:targetApi="m">true</item>
<item name="android:navigationBarColor">@android:color/transparent</item>
</style>
<style name="Theme.Green.Pure" parent="Theme.Green">
@ -119,7 +103,7 @@
</style>
<style name="Theme.Purple" parent="Theme.Material3.Light.NoActionBar">
<style name="Theme.Purple" parent="BaseTheme">
<item name="colorPrimary">@color/purple_light_accentLight</item>
<item name="colorOnPrimary">@color/purple_light_accentDark</item>
@ -132,10 +116,6 @@
<item name="android:colorBackground">@color/purple_light_background</item>
<item name="colorOnBackground">@color/purple_light_background</item>
<item name="android:statusBarColor" tools:targetApi="m">@android:color/transparent</item>
<item name="android:windowLightStatusBar" tools:targetApi="m">true</item>
<item name="android:navigationBarColor">@android:color/transparent</item>
</style>
<style name="Theme.Purple.Pure" parent="Theme.Purple">

View File

@ -27,7 +27,7 @@
</KeyFrameSet>
</Transition>
<ConstraintSet android:id="@+id/start"></ConstraintSet>
<ConstraintSet android:id="@+id/start" />
<ConstraintSet android:id="@+id/end"></ConstraintSet>
<ConstraintSet android:id="@+id/end" />
</MotionScene>