Loading build.gradle +1 −1 Original line number Diff line number Diff line Loading @@ -7,7 +7,7 @@ buildscript { propMinSdkVersion = 16 propTargetSdkVersion = propCompileSdkVersion propVersionCode = 1 propVersionName = '4.3.15' propVersionName = '4.3.21' kotlin_version = '1.2.50' support_libs = '27.1.1' } Loading commons/src/main/kotlin/com/simplemobiletools/commons/extensions/Context.kt +6 −3 Original line number Diff line number Diff line Loading @@ -534,18 +534,21 @@ fun Context.saveExifRotation(exif: ExifInterface, degrees: Int) { fun Context.checkAppIconColor() { val appId = baseConfig.appId if (appId.isNotEmpty()) { if (appId.isNotEmpty() && baseConfig.lastIconColor != baseConfig.appIconColor) { getAppIconColors().forEachIndexed { index, color -> toggleAppIconColor(appId, index, baseConfig.appIconColor == color) toggleAppIconColor(appId, index, color, baseConfig.appIconColor == color) } } } fun Context.toggleAppIconColor(appId: String, colorIndex: Int, enable: Boolean) { fun Context.toggleAppIconColor(appId: String, colorIndex: Int, color: Int, enable: Boolean) { val className = "${appId.removeSuffix(".debug")}.activities.SplashActivity${appIconColorStrings[colorIndex]}" val state = if (enable) PackageManager.COMPONENT_ENABLED_STATE_ENABLED else PackageManager.COMPONENT_ENABLED_STATE_DISABLED try { packageManager.setComponentEnabledSetting(ComponentName(appId, className), state, PackageManager.DONT_KILL_APP) if (enable) { baseConfig.lastIconColor = color } } catch (e: Exception) { } } Loading commons/src/main/kotlin/com/simplemobiletools/commons/helpers/BaseConfig.kt +4 −0 Original line number Diff line number Diff line Loading @@ -66,6 +66,10 @@ open class BaseConfig(val context: Context) { prefs.edit().putInt(APP_ICON_COLOR, appIconColor).apply() } var lastIconColor: Int get() = prefs.getInt(LAST_ICON_COLOR, context.resources.getColor(R.color.color_primary)) set(lastIconColor) = prefs.edit().putInt(LAST_ICON_COLOR, lastIconColor).apply() var customTextColor: Int get() = prefs.getInt(CUSTOM_TEXT_COLOR, textColor) set(customTextColor) = prefs.edit().putInt(CUSTOM_TEXT_COLOR, customTextColor).apply() Loading commons/src/main/kotlin/com/simplemobiletools/commons/helpers/Constants.kt +1 −0 Original line number Diff line number Diff line Loading @@ -45,6 +45,7 @@ const val TEXT_COLOR = "text_color" const val BACKGROUND_COLOR = "background_color" const val PRIMARY_COLOR = "primary_color_2" const val APP_ICON_COLOR = "app_icon_color" const val LAST_ICON_COLOR = "last_icon_color" const val CUSTOM_TEXT_COLOR = "custom_text_color" const val CUSTOM_BACKGROUND_COLOR = "custom_background_color" const val CUSTOM_PRIMARY_COLOR = "custom_primary_color" Loading Loading
build.gradle +1 −1 Original line number Diff line number Diff line Loading @@ -7,7 +7,7 @@ buildscript { propMinSdkVersion = 16 propTargetSdkVersion = propCompileSdkVersion propVersionCode = 1 propVersionName = '4.3.15' propVersionName = '4.3.21' kotlin_version = '1.2.50' support_libs = '27.1.1' } Loading
commons/src/main/kotlin/com/simplemobiletools/commons/extensions/Context.kt +6 −3 Original line number Diff line number Diff line Loading @@ -534,18 +534,21 @@ fun Context.saveExifRotation(exif: ExifInterface, degrees: Int) { fun Context.checkAppIconColor() { val appId = baseConfig.appId if (appId.isNotEmpty()) { if (appId.isNotEmpty() && baseConfig.lastIconColor != baseConfig.appIconColor) { getAppIconColors().forEachIndexed { index, color -> toggleAppIconColor(appId, index, baseConfig.appIconColor == color) toggleAppIconColor(appId, index, color, baseConfig.appIconColor == color) } } } fun Context.toggleAppIconColor(appId: String, colorIndex: Int, enable: Boolean) { fun Context.toggleAppIconColor(appId: String, colorIndex: Int, color: Int, enable: Boolean) { val className = "${appId.removeSuffix(".debug")}.activities.SplashActivity${appIconColorStrings[colorIndex]}" val state = if (enable) PackageManager.COMPONENT_ENABLED_STATE_ENABLED else PackageManager.COMPONENT_ENABLED_STATE_DISABLED try { packageManager.setComponentEnabledSetting(ComponentName(appId, className), state, PackageManager.DONT_KILL_APP) if (enable) { baseConfig.lastIconColor = color } } catch (e: Exception) { } } Loading
commons/src/main/kotlin/com/simplemobiletools/commons/helpers/BaseConfig.kt +4 −0 Original line number Diff line number Diff line Loading @@ -66,6 +66,10 @@ open class BaseConfig(val context: Context) { prefs.edit().putInt(APP_ICON_COLOR, appIconColor).apply() } var lastIconColor: Int get() = prefs.getInt(LAST_ICON_COLOR, context.resources.getColor(R.color.color_primary)) set(lastIconColor) = prefs.edit().putInt(LAST_ICON_COLOR, lastIconColor).apply() var customTextColor: Int get() = prefs.getInt(CUSTOM_TEXT_COLOR, textColor) set(customTextColor) = prefs.edit().putInt(CUSTOM_TEXT_COLOR, customTextColor).apply() Loading
commons/src/main/kotlin/com/simplemobiletools/commons/helpers/Constants.kt +1 −0 Original line number Diff line number Diff line Loading @@ -45,6 +45,7 @@ const val TEXT_COLOR = "text_color" const val BACKGROUND_COLOR = "background_color" const val PRIMARY_COLOR = "primary_color_2" const val APP_ICON_COLOR = "app_icon_color" const val LAST_ICON_COLOR = "last_icon_color" const val CUSTOM_TEXT_COLOR = "custom_text_color" const val CUSTOM_BACKGROUND_COLOR = "custom_background_color" const val CUSTOM_PRIMARY_COLOR = "custom_primary_color" Loading