修复一些界面问题
This commit is contained in:
@@ -9,9 +9,3 @@ import android.content.Context
|
|||||||
*/
|
*/
|
||||||
val Context.primaryColor: Int
|
val Context.primaryColor: Int
|
||||||
get() = ThemeStore.primaryColor(this)
|
get() = ThemeStore.primaryColor(this)
|
||||||
|
|
||||||
val Context.secondaryColor: Int
|
|
||||||
get() = ThemeStore.secondaryColor(this)
|
|
||||||
|
|
||||||
val Context.primaryContainerColor: Int
|
|
||||||
get() = ThemeStore.primaryContainerColor(this)
|
|
||||||
@@ -39,17 +39,17 @@ private constructor(private val mContext: Context) : ThemeStoreInterface {
|
|||||||
|
|
||||||
val fallback = color
|
val fallback = color
|
||||||
|
|
||||||
val secondary = MaterialColors.getColor(
|
// val secondary = MaterialColors.getColor(
|
||||||
wrapped,
|
// wrapped,
|
||||||
com.google.android.material.R.attr.colorSecondary,
|
// com.google.android.material.R.attr.colorSecondary,
|
||||||
fallback
|
// fallback
|
||||||
)
|
// )
|
||||||
|
//
|
||||||
val primaryContainer = MaterialColors.getColor(
|
// val primaryContainer = MaterialColors.getColor(
|
||||||
wrapped,
|
// wrapped,
|
||||||
com.google.android.material.R.attr.colorSecondaryContainer,
|
// com.google.android.material.R.attr.colorPrimaryContainer,
|
||||||
fallback
|
// fallback
|
||||||
)
|
// )
|
||||||
|
|
||||||
val primary = MaterialColors.getColor(
|
val primary = MaterialColors.getColor(
|
||||||
wrapped,
|
wrapped,
|
||||||
@@ -57,8 +57,8 @@ private constructor(private val mContext: Context) : ThemeStoreInterface {
|
|||||||
fallback
|
fallback
|
||||||
)
|
)
|
||||||
|
|
||||||
mEditor.putInt(ThemeStorePrefKeys.KEY_SECONDARY_COLOR, secondary)
|
//mEditor.putInt(ThemeStorePrefKeys.KEY_SECONDARY_COLOR, secondary)
|
||||||
mEditor.putInt(ThemeStorePrefKeys.KEY_PRIMARY_CONTAINER_COLOR, primaryContainer)
|
//mEditor.putInt(ThemeStorePrefKeys.KEY_PRIMARY_CONTAINER_COLOR, primaryContainer)
|
||||||
mEditor.putInt(ThemeStorePrefKeys.KEY_PRIMARY_COLOR, primary)
|
mEditor.putInt(ThemeStorePrefKeys.KEY_PRIMARY_COLOR, primary)
|
||||||
|
|
||||||
return this
|
return this
|
||||||
@@ -67,7 +67,8 @@ private constructor(private val mContext: Context) : ThemeStoreInterface {
|
|||||||
override fun primaryColor(@ColorInt color: Int): ThemeStore {
|
override fun primaryColor(@ColorInt color: Int): ThemeStore {
|
||||||
if (autoGeneratePrimaryDark(mContext))
|
if (autoGeneratePrimaryDark(mContext))
|
||||||
primaryColorDark(ColorUtils.darkenColor(color))
|
primaryColorDark(ColorUtils.darkenColor(color))
|
||||||
addColorScheme(color)
|
mEditor.putInt(ThemeStorePrefKeys.KEY_PRIMARY_COLOR, color)
|
||||||
|
//addColorScheme(color)
|
||||||
return this
|
return this
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -155,27 +156,27 @@ private constructor(private val mContext: Context) : ThemeStoreInterface {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fun primaryContainerColor(context: Context = appCtx): Int {
|
// fun primaryContainerColor(context: Context = appCtx): Int {
|
||||||
return if (isCustomThemeEnabled(context)) {
|
// return if (isCustomThemeEnabled(context)) {
|
||||||
prefs(context).getInt(
|
// prefs(context).getInt(
|
||||||
ThemeStorePrefKeys.KEY_PRIMARY_CONTAINER_COLOR,
|
// ThemeStorePrefKeys.KEY_PRIMARY_CONTAINER_COLOR,
|
||||||
"#FFFFFF".toColorInt()
|
// "#FFFFFF".toColorInt()
|
||||||
)
|
// )
|
||||||
} else {
|
// } else {
|
||||||
ThemeUtils.resolveColor(context, com.google.android.material.R.attr.colorPrimaryContainer)
|
// ThemeUtils.resolveColor(context, com.google.android.material.R.attr.colorPrimaryContainer)
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
fun secondaryColor(context: Context = appCtx): Int {
|
// fun secondaryColor(context: Context = appCtx): Int {
|
||||||
return if (isCustomThemeEnabled(context)) {
|
// return if (isCustomThemeEnabled(context)) {
|
||||||
prefs(context).getInt(
|
// prefs(context).getInt(
|
||||||
ThemeStorePrefKeys.KEY_SECONDARY_COLOR,
|
// ThemeStorePrefKeys.KEY_SECONDARY_COLOR,
|
||||||
primaryColor(context)
|
// primaryColor(context)
|
||||||
)
|
// )
|
||||||
} else {
|
// } else {
|
||||||
primaryColor(context)
|
// primaryColor(context)
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
|
||||||
@CheckResult
|
@CheckResult
|
||||||
@ColorInt
|
@ColorInt
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
<item android:color="?attr/colorPrimaryContainer" android:state_checked="true" />
|
<item android:color="?attr/colorSecondaryContainer" android:state_checked="true" />
|
||||||
<item android:color="?attr/colorSurfaceContainerLow" />
|
<item android:color="?attr/colorSurfaceContainerLow" />
|
||||||
</selector>
|
</selector>
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
<item android:color="?attr/colorPrimaryContainer" android:state_checked="true" />
|
<item android:color="?attr/colorSecondaryContainer" android:state_checked="true" />
|
||||||
<item android:color="?attr/colorOutlineVariant" />
|
<item android:color="?attr/colorOutlineVariant" />
|
||||||
</selector>
|
</selector>
|
||||||
Reference in New Issue
Block a user