show a warning before changing the app icon color for the first time

This commit is contained in:
tibbi 2018-12-24 21:14:39 +01:00
parent adcf4f43ea
commit 1ede5203b6
4 changed files with 41 additions and 16 deletions

View file

@ -7,7 +7,7 @@ buildscript {
propMinSdkVersion = 21
propTargetSdkVersion = propCompileSdkVersion
propVersionCode = 1
propVersionName = '5.5.20'
propVersionName = '5.6.0'
kotlin_version = '1.3.11'
}

View file

@ -131,22 +131,33 @@ class CustomizationActivity : BaseSimpleActivity() {
curSelectedThemeId = getCurrentThemeId()
customization_theme.text = getThemeText()
customization_theme_holder.setOnClickListener {
val items = arrayListOf<RadioItem>()
for ((key, value) in predefinedThemes) {
items.add(RadioItem(key, getString(value.nameId)))
if (baseConfig.wasAppIconCustomizationWarningShown) {
themePickerClicked()
} else {
ConfirmationDialog(this, "", R.string.app_icon_color_warning, R.string.ok, 0) {
baseConfig.wasAppIconCustomizationWarningShown = true
themePickerClicked()
}
}
}
}
private fun themePickerClicked() {
val items = arrayListOf<RadioItem>()
for ((key, value) in predefinedThemes) {
items.add(RadioItem(key, getString(value.nameId)))
}
RadioGroupDialog(this@CustomizationActivity, items, curSelectedThemeId) {
if (it == THEME_SHARED && !isThankYouInstalled()) {
PurchaseThankYouDialog(this)
return@RadioGroupDialog
}
RadioGroupDialog(this@CustomizationActivity, items, curSelectedThemeId) {
if (it == THEME_SHARED && !isThankYouInstalled()) {
PurchaseThankYouDialog(this)
return@RadioGroupDialog
}
updateColorTheme(it as Int, true)
if (it != THEME_CUSTOM && it != THEME_SHARED && !baseConfig.wasCustomThemeSwitchDescriptionShown) {
baseConfig.wasCustomThemeSwitchDescriptionShown = true
toast(R.string.changing_color_description)
}
updateColorTheme(it as Int, true)
if (it != THEME_CUSTOM && it != THEME_SHARED && !baseConfig.wasCustomThemeSwitchDescriptionShown) {
baseConfig.wasCustomThemeSwitchDescriptionShown = true
toast(R.string.changing_color_description)
}
}
}
@ -298,8 +309,17 @@ class CustomizationActivity : BaseSimpleActivity() {
customization_text_color_holder.setOnClickListener { pickTextColor() }
customization_background_color_holder.setOnClickListener { pickBackgroundColor() }
customization_primary_color_holder.setOnClickListener { pickPrimaryColor() }
customization_app_icon_color_holder.setOnClickListener { pickAppIconColor() }
apply_to_all_holder.setOnClickListener { applyToAll() }
customization_app_icon_color_holder.setOnClickListener {
if (baseConfig.wasAppIconCustomizationWarningShown) {
pickAppIconColor()
} else {
ConfirmationDialog(this, "", R.string.app_icon_color_warning, R.string.ok, 0) {
baseConfig.wasAppIconCustomizationWarningShown = true
pickAppIconColor()
}
}
}
}
private fun hasColorChanged(old: Int, new: Int) = Math.abs(old - new) > 1

View file

@ -270,4 +270,8 @@ open class BaseConfig(val context: Context) {
var wasInitialUpgradeToProShown: Boolean
get() = prefs.getBoolean(WAS_INITIAL_UPGRADE_TO_PRO_SHOWN, false)
set(wasInitialUpgradeToProShown) = prefs.edit().putBoolean(WAS_INITIAL_UPGRADE_TO_PRO_SHOWN, wasInitialUpgradeToProShown).apply()
var wasAppIconCustomizationWarningShown: Boolean
get() = prefs.getBoolean(WAS_APP_ICON_CUSTOMIZATION_WARNING_SHOWN, false)
set(wasAppIconCustomizationWarningShown) = prefs.edit().putBoolean(WAS_APP_ICON_CUSTOMIZATION_WARNING_SHOWN, wasAppIconCustomizationWarningShown).apply()
}

View file

@ -96,6 +96,7 @@ const val WAS_ORANGE_ICON_CHECKED = "was_orange_icon_checked"
const val WAS_APP_ON_SD_SHOWN = "was_app_on_sd_shown"
const val WAS_BEFORE_ASKING_SHOWN = "was_before_asking_shown"
const val WAS_INITIAL_UPGRADE_TO_PRO_SHOWN = "was_initial_upgrade_to_pro_shown"
const val WAS_APP_ICON_CUSTOMIZATION_WARNING_SHOWN = "was_app_icon_customization_warning_shown"
// licenses
internal const val LICENSE_KOTLIN = 1