|
|
@ -19,12 +19,8 @@ import splitties.init.appCtx |
|
|
|
@Suppress("unused") |
|
|
|
@Suppress("unused") |
|
|
|
class ThemeStore @SuppressLint("CommitPrefEdits") |
|
|
|
class ThemeStore @SuppressLint("CommitPrefEdits") |
|
|
|
private constructor(private val mContext: Context) : ThemeStoreInterface { |
|
|
|
private constructor(private val mContext: Context) : ThemeStoreInterface { |
|
|
|
private val mEditor: SharedPreferences.Editor |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
init { |
|
|
|
|
|
|
|
mEditor = prefs(mContext).edit() |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private val mEditor = prefs(mContext).edit() |
|
|
|
|
|
|
|
|
|
|
|
override fun primaryColor(@ColorInt color: Int): ThemeStore { |
|
|
|
override fun primaryColor(@ColorInt color: Int): ThemeStore { |
|
|
|
mEditor.putInt(ThemeStorePrefKeys.KEY_PRIMARY_COLOR, color) |
|
|
|
mEditor.putInt(ThemeStorePrefKeys.KEY_PRIMARY_COLOR, color) |
|
|
@ -155,16 +151,6 @@ private constructor(private val mContext: Context) : ThemeStoreInterface { |
|
|
|
return this |
|
|
|
return this |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
override fun coloredStatusBar(colored: Boolean): ThemeStore { |
|
|
|
|
|
|
|
mEditor.putBoolean(ThemeStorePrefKeys.KEY_APPLY_PRIMARYDARK_STATUSBAR, colored) |
|
|
|
|
|
|
|
return this |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
override fun coloredNavigationBar(applyToNavBar: Boolean): ThemeStore { |
|
|
|
|
|
|
|
mEditor.putBoolean(ThemeStorePrefKeys.KEY_APPLY_PRIMARY_NAVBAR, applyToNavBar) |
|
|
|
|
|
|
|
return this |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
override fun autoGeneratePrimaryDark(autoGenerate: Boolean): ThemeStore { |
|
|
|
override fun autoGeneratePrimaryDark(autoGenerate: Boolean): ThemeStore { |
|
|
|
mEditor.putBoolean(ThemeStorePrefKeys.KEY_AUTO_GENERATE_PRIMARYDARK, autoGenerate) |
|
|
|
mEditor.putBoolean(ThemeStorePrefKeys.KEY_AUTO_GENERATE_PRIMARYDARK, autoGenerate) |
|
|
|
return this |
|
|
|
return this |
|
|
@ -228,9 +214,7 @@ private constructor(private val mContext: Context) : ThemeStoreInterface { |
|
|
|
@CheckResult |
|
|
|
@CheckResult |
|
|
|
@ColorInt |
|
|
|
@ColorInt |
|
|
|
fun statusBarColor(context: Context, transparent: Boolean): Int { |
|
|
|
fun statusBarColor(context: Context, transparent: Boolean): Int { |
|
|
|
return if (!coloredStatusBar(context)) { |
|
|
|
return if (transparent) { |
|
|
|
Color.BLACK |
|
|
|
|
|
|
|
} else if (transparent) { |
|
|
|
|
|
|
|
prefs(context).getInt( |
|
|
|
prefs(context).getInt( |
|
|
|
ThemeStorePrefKeys.KEY_STATUS_BAR_COLOR, |
|
|
|
ThemeStorePrefKeys.KEY_STATUS_BAR_COLOR, |
|
|
|
primaryColor(context) |
|
|
|
primaryColor(context) |
|
|
@ -246,9 +230,7 @@ private constructor(private val mContext: Context) : ThemeStoreInterface { |
|
|
|
@CheckResult |
|
|
|
@CheckResult |
|
|
|
@ColorInt |
|
|
|
@ColorInt |
|
|
|
fun navigationBarColor(context: Context): Int { |
|
|
|
fun navigationBarColor(context: Context): Int { |
|
|
|
return if (!coloredNavigationBar(context)) { |
|
|
|
return prefs(context).getInt( |
|
|
|
Color.BLACK |
|
|
|
|
|
|
|
} else prefs(context).getInt( |
|
|
|
|
|
|
|
ThemeStorePrefKeys.KEY_NAVIGATION_BAR_COLOR, |
|
|
|
ThemeStorePrefKeys.KEY_NAVIGATION_BAR_COLOR, |
|
|
|
bottomBackground(context) |
|
|
|
bottomBackground(context) |
|
|
|
) |
|
|
|
) |
|
|
|