|
|
@ -5,6 +5,7 @@ import android.app.NotificationChannel |
|
|
|
import android.app.NotificationManager |
|
|
|
import android.app.NotificationManager |
|
|
|
import android.content.Context |
|
|
|
import android.content.Context |
|
|
|
import android.content.res.Configuration |
|
|
|
import android.content.res.Configuration |
|
|
|
|
|
|
|
import android.graphics.Color |
|
|
|
import android.os.Build |
|
|
|
import android.os.Build |
|
|
|
import androidx.annotation.RequiresApi |
|
|
|
import androidx.annotation.RequiresApi |
|
|
|
import androidx.appcompat.app.AppCompatDelegate |
|
|
|
import androidx.appcompat.app.AppCompatDelegate |
|
|
@ -69,30 +70,42 @@ class App : Application() { |
|
|
|
* 更新主题 |
|
|
|
* 更新主题 |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
fun applyTheme() { |
|
|
|
fun applyTheme() { |
|
|
|
if (AppConfig.isNightTheme) { |
|
|
|
when { |
|
|
|
ThemeStore.editTheme(this) |
|
|
|
AppConfig.isEInkMode -> { |
|
|
|
.coloredNavigationBar(true) |
|
|
|
ThemeStore.editTheme(this) |
|
|
|
.primaryColor( |
|
|
|
.coloredNavigationBar(true) |
|
|
|
getPrefInt(PreferKey.cNPrimary, getCompatColor(R.color.md_blue_grey_600)) |
|
|
|
.primaryColor(Color.WHITE) |
|
|
|
).accentColor( |
|
|
|
.accentColor(Color.BLACK) |
|
|
|
getPrefInt(PreferKey.cNAccent, getCompatColor(R.color.md_deep_orange_800)) |
|
|
|
.backgroundColor(Color.WHITE) |
|
|
|
).backgroundColor( |
|
|
|
.bottomBackground(Color.WHITE) |
|
|
|
getPrefInt(PreferKey.cNBackground, getCompatColor(R.color.shine_color)) |
|
|
|
.apply() |
|
|
|
).bottomBackground( |
|
|
|
} |
|
|
|
getPrefInt(PreferKey.cNBBackground, getCompatColor(R.color.md_grey_850)) |
|
|
|
AppConfig.isNightTheme -> { |
|
|
|
).apply() |
|
|
|
ThemeStore.editTheme(this) |
|
|
|
} else { |
|
|
|
.coloredNavigationBar(true) |
|
|
|
ThemeStore.editTheme(this) |
|
|
|
.primaryColor( |
|
|
|
.coloredNavigationBar(true) |
|
|
|
getPrefInt(PreferKey.cNPrimary, getCompatColor(R.color.md_blue_grey_600)) |
|
|
|
.primaryColor( |
|
|
|
).accentColor( |
|
|
|
getPrefInt(PreferKey.cPrimary, getCompatColor(R.color.md_indigo_800)) |
|
|
|
getPrefInt(PreferKey.cNAccent, getCompatColor(R.color.md_deep_orange_800)) |
|
|
|
).accentColor( |
|
|
|
).backgroundColor( |
|
|
|
getPrefInt(PreferKey.cAccent, getCompatColor(R.color.md_red_600)) |
|
|
|
getPrefInt(PreferKey.cNBackground, getCompatColor(R.color.shine_color)) |
|
|
|
).backgroundColor( |
|
|
|
).bottomBackground( |
|
|
|
getPrefInt(PreferKey.cBackground, getCompatColor(R.color.md_grey_100)) |
|
|
|
getPrefInt(PreferKey.cNBBackground, getCompatColor(R.color.md_grey_850)) |
|
|
|
).bottomBackground( |
|
|
|
).apply() |
|
|
|
getPrefInt(PreferKey.cBBackground, getCompatColor(R.color.md_grey_200)) |
|
|
|
} |
|
|
|
).apply() |
|
|
|
else -> { |
|
|
|
|
|
|
|
ThemeStore.editTheme(this) |
|
|
|
|
|
|
|
.coloredNavigationBar(true) |
|
|
|
|
|
|
|
.primaryColor( |
|
|
|
|
|
|
|
getPrefInt(PreferKey.cPrimary, getCompatColor(R.color.md_indigo_800)) |
|
|
|
|
|
|
|
).accentColor( |
|
|
|
|
|
|
|
getPrefInt(PreferKey.cAccent, getCompatColor(R.color.md_red_600)) |
|
|
|
|
|
|
|
).backgroundColor( |
|
|
|
|
|
|
|
getPrefInt(PreferKey.cBackground, getCompatColor(R.color.md_grey_100)) |
|
|
|
|
|
|
|
).bottomBackground( |
|
|
|
|
|
|
|
getPrefInt(PreferKey.cBBackground, getCompatColor(R.color.md_grey_200)) |
|
|
|
|
|
|
|
).apply() |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|