lets always show recent colors, because why not

This commit is contained in:
tibbi 2021-09-24 23:07:43 +02:00
parent 345239c31d
commit 085b497ed0
2 changed files with 36 additions and 17 deletions

View file

@ -125,10 +125,31 @@ class CustomizationActivity : BaseSimpleActivity() {
private fun setupThemes() {
predefinedThemes.apply {
put(THEME_LIGHT, MyTheme(R.string.light_theme, R.color.theme_light_text_color, R.color.theme_light_background_color, R.color.color_primary, R.color.color_primary))
put(THEME_DARK, MyTheme(R.string.dark_theme, R.color.theme_dark_text_color, R.color.theme_dark_background_color, R.color.color_primary, R.color.color_primary))
put(
THEME_LIGHT,
MyTheme(
R.string.light_theme,
R.color.theme_light_text_color,
R.color.theme_light_background_color,
R.color.color_primary,
R.color.color_primary
)
)
put(
THEME_DARK,
MyTheme(R.string.dark_theme, R.color.theme_dark_text_color, R.color.theme_dark_background_color, R.color.color_primary, R.color.color_primary)
)
//put(THEME_SOLARIZED, MyTheme(R.string.solarized, R.color.theme_solarized_text_color, R.color.theme_solarized_background_color, R.color.theme_solarized_primary_color))
put(THEME_DARK_RED, MyTheme(R.string.dark_red, R.color.theme_dark_text_color, R.color.theme_dark_background_color, R.color.theme_dark_red_primary_color, R.color.md_red_700))
put(
THEME_DARK_RED,
MyTheme(
R.string.dark_red,
R.color.theme_dark_text_color,
R.color.theme_dark_background_color,
R.color.theme_dark_red_primary_color,
R.color.md_red_700
)
)
put(THEME_WHITE, MyTheme(R.string.white, R.color.dark_grey, android.R.color.white, android.R.color.white, R.color.color_primary))
put(THEME_BLACK_WHITE, MyTheme(R.string.black_white, android.R.color.white, android.R.color.black, android.R.color.black, R.color.md_grey_black))
put(THEME_CUSTOM, MyTheme(R.string.custom, 0, 0, 0, 0))
@ -408,11 +429,13 @@ class CustomizationActivity : BaseSimpleActivity() {
private fun handleAccentColorLayout() {
customization_accent_color_holder.beVisibleIf(curSelectedThemeId == THEME_WHITE || isCurrentWhiteTheme() || curSelectedThemeId == THEME_BLACK_WHITE || isCurrentBlackAndWhiteTheme())
customization_accent_color_label.text = getString(if (curSelectedThemeId == THEME_WHITE || isCurrentWhiteTheme()) {
R.string.accent_color_white
} else {
R.string.accent_color_black_and_white
})
customization_accent_color_label.text = getString(
if (curSelectedThemeId == THEME_WHITE || isCurrentWhiteTheme()) {
R.string.accent_color_white
} else {
R.string.accent_color_black_and_white
}
)
}
private fun isCurrentWhiteTheme() = curTextColor == DARK_GREY && curPrimaryColor == Color.WHITE && curBackgroundColor == Color.WHITE
@ -420,7 +443,7 @@ class CustomizationActivity : BaseSimpleActivity() {
private fun isCurrentBlackAndWhiteTheme() = curTextColor == Color.WHITE && curPrimaryColor == Color.BLACK && curBackgroundColor == Color.BLACK
private fun pickTextColor() {
ColorPickerDialog(this, curTextColor, true) { wasPositivePressed, color ->
ColorPickerDialog(this, curTextColor) { wasPositivePressed, color ->
if (wasPositivePressed) {
if (hasColorChanged(curTextColor, color)) {
setCurrentTextColor(color)
@ -432,7 +455,7 @@ class CustomizationActivity : BaseSimpleActivity() {
}
private fun pickBackgroundColor() {
ColorPickerDialog(this, curBackgroundColor, true) { wasPositivePressed, color ->
ColorPickerDialog(this, curBackgroundColor) { wasPositivePressed, color ->
if (wasPositivePressed) {
if (hasColorChanged(curBackgroundColor, color)) {
setCurrentBackgroundColor(color)
@ -468,7 +491,7 @@ class CustomizationActivity : BaseSimpleActivity() {
}
private fun pickAccentColor() {
ColorPickerDialog(this, curAccentColor, true) { wasPositivePressed, color ->
ColorPickerDialog(this, curAccentColor) { wasPositivePressed, color ->
if (wasPositivePressed) {
if (hasColorChanged(curAccentColor, color)) {
curAccentColor = color
@ -479,7 +502,7 @@ class CustomizationActivity : BaseSimpleActivity() {
}
private fun pickNavigationBarColor() {
ColorPickerDialog(this, curNavigationBarColor, true, true, true, currentColorCallback = {
ColorPickerDialog(this, curNavigationBarColor, true, true, currentColorCallback = {
updateNavigationBarColor(it)
}, callback = { wasPositivePressed, color ->
if (wasPositivePressed) {

View file

@ -22,7 +22,6 @@ private const val RECENT_COLORS_NUMBER = 5
class ColorPickerDialog(
val activity: Activity,
color: Int,
showRecentColors: Boolean = false,
val removeDimmedBackground: Boolean = false,
showUseDefaultButton: Boolean = false,
val currentColorCallback: ((color: Int) -> Unit)? = null,
@ -68,10 +67,7 @@ class ColorPickerDialog(
true
}
newHexField.setText(hexCode)
if (showRecentColors) {
setupRecentColors()
}
setupRecentColors()
}
viewHue.setOnTouchListener(OnTouchListener { v, event ->