diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index f5599e44a..480ff42a1 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -34,6 +34,54 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
{
val gson = Gson()
diff --git a/app/src/main/java/com/darkempire78/opencalculator/activities/SettingsActivity.kt b/app/src/main/java/com/darkempire78/opencalculator/activities/SettingsActivity.kt
index f9f374f2b..38194fc02 100644
--- a/app/src/main/java/com/darkempire78/opencalculator/activities/SettingsActivity.kt
+++ b/app/src/main/java/com/darkempire78/opencalculator/activities/SettingsActivity.kt
@@ -133,6 +133,17 @@ class SettingsActivity : AppCompatActivity() {
true
}
+ // Icon Color button
+ val appIconColorPreference = findPreference("darkempire78.opencalculator.APP_ICON_COLOR")
+
+ val currentIconColor = MyPreferences(this.requireContext()).appIconColor ?: "default"
+ appIconColorPreference?.summary = getIconColorDisplayName(this.requireContext(), currentIconColor)
+
+ appIconColorPreference?.setOnPreferenceClickListener {
+ openDialogIconColorSelector(this.requireContext())
+ true
+ }
+
}
private fun openDialogNumberingSystemSelector(context: Context) {
@@ -231,5 +242,86 @@ class SettingsActivity : AppCompatActivity() {
val dialog = builder.create()
dialog.show()
}
+
+ private fun openDialogIconColorSelector(context: Context) {
+ val preferences = MyPreferences(context)
+ val builder = MaterialAlertDialogBuilder(context)
+ builder.background = ContextCompat.getDrawable(context, R.drawable.rounded)
+
+ val iconColors = hashMapOf(
+ "default" to context.getString(R.string.icon_color_default),
+ "blue" to context.getString(R.string.icon_color_blue),
+ "green" to context.getString(R.string.icon_color_green),
+ "red" to context.getString(R.string.icon_color_red),
+ "yellow" to context.getString(R.string.icon_color_yellow)
+ )
+
+ val currentIcon = preferences.appIconColor ?: "default"
+ val checkedItem = iconColors.keys.indexOf(currentIcon)
+
+ builder.setSingleChoiceItems(
+ iconColors.values.toTypedArray(),
+ checkedItem
+ ) { dialog, which ->
+ val selectedColor = iconColors.keys.elementAt(which)
+ preferences.appIconColor = selectedColor
+ changeAppIcon(context, selectedColor)
+ dialog.dismiss()
+
+ // Update the preference summary
+ findPreference("darkempire78.opencalculator.APP_ICON_COLOR")?.summary =
+ getIconColorDisplayName(context, selectedColor)
+ }
+ val dialog = builder.create()
+ dialog.show()
+ }
+
+ private fun changeAppIcon(context: Context, color: String) {
+ val packageManager = context.packageManager
+ // Use the manifest package name, not the application ID (which may have .debug suffix)
+ val manifestPackage = "com.darkempire78.opencalculator"
+
+ // Map color names to activity alias names
+ val aliasMap = mapOf(
+ "default" to ".activities.MainActivity",
+ "blue" to ".activities.MainActivityBlue",
+ "green" to ".activities.MainActivityGreen",
+ "red" to ".activities.MainActivityRed",
+ "yellow" to ".activities.MainActivityYellow"
+ )
+
+ // Disable all aliases first
+ aliasMap.forEach { (_, alias) ->
+ val componentName = android.content.ComponentName(context, "$manifestPackage$alias")
+ try {
+ packageManager.setComponentEnabledSetting(
+ componentName,
+ android.content.pm.PackageManager.COMPONENT_ENABLED_STATE_DISABLED,
+ android.content.pm.PackageManager.DONT_KILL_APP
+ )
+ } catch (e: Exception) {
+ // Ignore if component doesn't exist
+ }
+ }
+
+ // Enable the selected alias
+ val selectedAlias = aliasMap[color] ?: ".activities.MainActivity"
+ val selectedComponentName = android.content.ComponentName(context, "$manifestPackage$selectedAlias")
+ packageManager.setComponentEnabledSetting(
+ selectedComponentName,
+ android.content.pm.PackageManager.COMPONENT_ENABLED_STATE_ENABLED,
+ android.content.pm.PackageManager.DONT_KILL_APP
+ )
+ }
+
+ private fun getIconColorDisplayName(context: Context, color: String): String {
+ return when (color) {
+ "blue" -> context.getString(R.string.icon_color_blue)
+ "green" -> context.getString(R.string.icon_color_green)
+ "red" -> context.getString(R.string.icon_color_red)
+ "yellow" -> context.getString(R.string.icon_color_yellow)
+ else -> context.getString(R.string.icon_color_default)
+ }
+ }
}
}
diff --git a/app/src/main/res/drawable/ic_launcher_foreground_blue.xml b/app/src/main/res/drawable/ic_launcher_foreground_blue.xml
new file mode 100644
index 000000000..1f76a2438
--- /dev/null
+++ b/app/src/main/res/drawable/ic_launcher_foreground_blue.xml
@@ -0,0 +1,15 @@
+
+
+
+
+
diff --git a/app/src/main/res/drawable/ic_launcher_foreground_green.xml b/app/src/main/res/drawable/ic_launcher_foreground_green.xml
new file mode 100644
index 000000000..8d07ded85
--- /dev/null
+++ b/app/src/main/res/drawable/ic_launcher_foreground_green.xml
@@ -0,0 +1,15 @@
+
+
+
+
+
diff --git a/app/src/main/res/drawable/ic_launcher_foreground_red.xml b/app/src/main/res/drawable/ic_launcher_foreground_red.xml
new file mode 100644
index 000000000..4365278ab
--- /dev/null
+++ b/app/src/main/res/drawable/ic_launcher_foreground_red.xml
@@ -0,0 +1,15 @@
+
+
+
+
+
diff --git a/app/src/main/res/drawable/ic_launcher_foreground_yellow.xml b/app/src/main/res/drawable/ic_launcher_foreground_yellow.xml
new file mode 100644
index 000000000..fa9cac82e
--- /dev/null
+++ b/app/src/main/res/drawable/ic_launcher_foreground_yellow.xml
@@ -0,0 +1,15 @@
+
+
+
+
+
diff --git a/app/src/main/res/mipmap-anydpi-v26/ic_launcher_blue.xml b/app/src/main/res/mipmap-anydpi-v26/ic_launcher_blue.xml
new file mode 100644
index 000000000..46c93c56d
--- /dev/null
+++ b/app/src/main/res/mipmap-anydpi-v26/ic_launcher_blue.xml
@@ -0,0 +1,5 @@
+
+
+
+
+
diff --git a/app/src/main/res/mipmap-anydpi-v26/ic_launcher_green.xml b/app/src/main/res/mipmap-anydpi-v26/ic_launcher_green.xml
new file mode 100644
index 000000000..35f389906
--- /dev/null
+++ b/app/src/main/res/mipmap-anydpi-v26/ic_launcher_green.xml
@@ -0,0 +1,5 @@
+
+
+
+
+
diff --git a/app/src/main/res/mipmap-anydpi-v26/ic_launcher_red.xml b/app/src/main/res/mipmap-anydpi-v26/ic_launcher_red.xml
new file mode 100644
index 000000000..e74d0fcf4
--- /dev/null
+++ b/app/src/main/res/mipmap-anydpi-v26/ic_launcher_red.xml
@@ -0,0 +1,5 @@
+
+
+
+
+
diff --git a/app/src/main/res/mipmap-anydpi-v26/ic_launcher_yellow.xml b/app/src/main/res/mipmap-anydpi-v26/ic_launcher_yellow.xml
new file mode 100644
index 000000000..761c182e1
--- /dev/null
+++ b/app/src/main/res/mipmap-anydpi-v26/ic_launcher_yellow.xml
@@ -0,0 +1,5 @@
+
+
+
+
+
diff --git a/app/src/main/res/mipmap-hdpi/ic_launcher.png b/app/src/main/res/mipmap-hdpi/ic_launcher_blue.png
similarity index 100%
rename from app/src/main/res/mipmap-hdpi/ic_launcher.png
rename to app/src/main/res/mipmap-hdpi/ic_launcher_blue.png
diff --git a/app/src/main/res/mipmap-hdpi/ic_launcher_green.png b/app/src/main/res/mipmap-hdpi/ic_launcher_green.png
new file mode 100644
index 000000000..f8996b7c5
Binary files /dev/null and b/app/src/main/res/mipmap-hdpi/ic_launcher_green.png differ
diff --git a/app/src/main/res/mipmap-hdpi/ic_launcher_red.png b/app/src/main/res/mipmap-hdpi/ic_launcher_red.png
new file mode 100644
index 000000000..41c08091f
Binary files /dev/null and b/app/src/main/res/mipmap-hdpi/ic_launcher_red.png differ
diff --git a/app/src/main/res/mipmap-hdpi/ic_launcher_yellow.png b/app/src/main/res/mipmap-hdpi/ic_launcher_yellow.png
new file mode 100644
index 000000000..20253b00c
Binary files /dev/null and b/app/src/main/res/mipmap-hdpi/ic_launcher_yellow.png differ
diff --git a/app/src/main/res/mipmap-mdpi/ic_launcher.png b/app/src/main/res/mipmap-mdpi/ic_launcher_blue.png
similarity index 100%
rename from app/src/main/res/mipmap-mdpi/ic_launcher.png
rename to app/src/main/res/mipmap-mdpi/ic_launcher_blue.png
diff --git a/app/src/main/res/mipmap-mdpi/ic_launcher_green.png b/app/src/main/res/mipmap-mdpi/ic_launcher_green.png
new file mode 100644
index 000000000..f8996b7c5
Binary files /dev/null and b/app/src/main/res/mipmap-mdpi/ic_launcher_green.png differ
diff --git a/app/src/main/res/mipmap-mdpi/ic_launcher_red.png b/app/src/main/res/mipmap-mdpi/ic_launcher_red.png
new file mode 100644
index 000000000..41c08091f
Binary files /dev/null and b/app/src/main/res/mipmap-mdpi/ic_launcher_red.png differ
diff --git a/app/src/main/res/mipmap-mdpi/ic_launcher_yellow.png b/app/src/main/res/mipmap-mdpi/ic_launcher_yellow.png
new file mode 100644
index 000000000..20253b00c
Binary files /dev/null and b/app/src/main/res/mipmap-mdpi/ic_launcher_yellow.png differ
diff --git a/app/src/main/res/mipmap-xhdpi/ic_launcher.png b/app/src/main/res/mipmap-xhdpi/ic_launcher_blue.png
similarity index 100%
rename from app/src/main/res/mipmap-xhdpi/ic_launcher.png
rename to app/src/main/res/mipmap-xhdpi/ic_launcher_blue.png
diff --git a/app/src/main/res/mipmap-xhdpi/ic_launcher_green.png b/app/src/main/res/mipmap-xhdpi/ic_launcher_green.png
new file mode 100644
index 000000000..f8996b7c5
Binary files /dev/null and b/app/src/main/res/mipmap-xhdpi/ic_launcher_green.png differ
diff --git a/app/src/main/res/mipmap-xhdpi/ic_launcher_red.png b/app/src/main/res/mipmap-xhdpi/ic_launcher_red.png
new file mode 100644
index 000000000..41c08091f
Binary files /dev/null and b/app/src/main/res/mipmap-xhdpi/ic_launcher_red.png differ
diff --git a/app/src/main/res/mipmap-xhdpi/ic_launcher_yellow.png b/app/src/main/res/mipmap-xhdpi/ic_launcher_yellow.png
new file mode 100644
index 000000000..20253b00c
Binary files /dev/null and b/app/src/main/res/mipmap-xhdpi/ic_launcher_yellow.png differ
diff --git a/app/src/main/res/mipmap-xxhdpi/ic_launcher.png b/app/src/main/res/mipmap-xxhdpi/ic_launcher_blue.png
similarity index 100%
rename from app/src/main/res/mipmap-xxhdpi/ic_launcher.png
rename to app/src/main/res/mipmap-xxhdpi/ic_launcher_blue.png
diff --git a/app/src/main/res/mipmap-xxhdpi/ic_launcher_green.png b/app/src/main/res/mipmap-xxhdpi/ic_launcher_green.png
new file mode 100644
index 000000000..f8996b7c5
Binary files /dev/null and b/app/src/main/res/mipmap-xxhdpi/ic_launcher_green.png differ
diff --git a/app/src/main/res/mipmap-xxhdpi/ic_launcher_red.png b/app/src/main/res/mipmap-xxhdpi/ic_launcher_red.png
new file mode 100644
index 000000000..41c08091f
Binary files /dev/null and b/app/src/main/res/mipmap-xxhdpi/ic_launcher_red.png differ
diff --git a/app/src/main/res/mipmap-xxhdpi/ic_launcher_yellow.png b/app/src/main/res/mipmap-xxhdpi/ic_launcher_yellow.png
new file mode 100644
index 000000000..20253b00c
Binary files /dev/null and b/app/src/main/res/mipmap-xxhdpi/ic_launcher_yellow.png differ
diff --git a/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png b/app/src/main/res/mipmap-xxxhdpi/ic_launcher_blue.png
similarity index 100%
rename from app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
rename to app/src/main/res/mipmap-xxxhdpi/ic_launcher_blue.png
diff --git a/app/src/main/res/mipmap-xxxhdpi/ic_launcher_foreground.png b/app/src/main/res/mipmap-xxxhdpi/ic_launcher_foreground_blue.png
similarity index 100%
rename from app/src/main/res/mipmap-xxxhdpi/ic_launcher_foreground.png
rename to app/src/main/res/mipmap-xxxhdpi/ic_launcher_foreground_blue.png
diff --git a/app/src/main/res/mipmap-xxxhdpi/ic_launcher_foreground_green.png b/app/src/main/res/mipmap-xxxhdpi/ic_launcher_foreground_green.png
new file mode 100644
index 000000000..aaa3d7714
Binary files /dev/null and b/app/src/main/res/mipmap-xxxhdpi/ic_launcher_foreground_green.png differ
diff --git a/app/src/main/res/mipmap-xxxhdpi/ic_launcher_foreground_red.png b/app/src/main/res/mipmap-xxxhdpi/ic_launcher_foreground_red.png
new file mode 100644
index 000000000..e505438f2
Binary files /dev/null and b/app/src/main/res/mipmap-xxxhdpi/ic_launcher_foreground_red.png differ
diff --git a/app/src/main/res/mipmap-xxxhdpi/ic_launcher_foreground_yellow.png b/app/src/main/res/mipmap-xxxhdpi/ic_launcher_foreground_yellow.png
new file mode 100644
index 000000000..14bfb20e8
Binary files /dev/null and b/app/src/main/res/mipmap-xxxhdpi/ic_launcher_foreground_yellow.png differ
diff --git a/app/src/main/res/mipmap-xxxhdpi/ic_launcher_green.png b/app/src/main/res/mipmap-xxxhdpi/ic_launcher_green.png
new file mode 100644
index 000000000..3fc143b98
Binary files /dev/null and b/app/src/main/res/mipmap-xxxhdpi/ic_launcher_green.png differ
diff --git a/app/src/main/res/mipmap-xxxhdpi/ic_launcher_red.png b/app/src/main/res/mipmap-xxxhdpi/ic_launcher_red.png
new file mode 100644
index 000000000..711e6cc3b
Binary files /dev/null and b/app/src/main/res/mipmap-xxxhdpi/ic_launcher_red.png differ
diff --git a/app/src/main/res/mipmap-xxxhdpi/ic_launcher_yellow.png b/app/src/main/res/mipmap-xxxhdpi/ic_launcher_yellow.png
new file mode 100644
index 000000000..57d5fb9ca
Binary files /dev/null and b/app/src/main/res/mipmap-xxxhdpi/ic_launcher_yellow.png differ
diff --git a/app/src/main/res/values/ic_launcher_background.xml b/app/src/main/res/values/ic_launcher_background.xml
index c22aee278..252ec319f 100644
--- a/app/src/main/res/values/ic_launcher_background.xml
+++ b/app/src/main/res/values/ic_launcher_background.xml
@@ -1,4 +1,8 @@
@color/app_icon_background_color
+ #E3F2FD
+ #E8F5E9
+ #FFEBEE
+ #FFFDE7
\ No newline at end of file
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index 17b95fb60..722bf141d 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -89,6 +89,14 @@
Theme
+ App Icon Color
+ Choose your app icon color
+ Default
+ Blue
+ Green
+ Red
+ Yellow
+
Vibration
Vibrate when a button is pressed
diff --git a/app/src/main/res/xml/root_preferences.xml b/app/src/main/res/xml/root_preferences.xml
index 12d569ca1..4ce696f80 100644
--- a/app/src/main/res/xml/root_preferences.xml
+++ b/app/src/main/res/xml/root_preferences.xml
@@ -25,6 +25,15 @@
app:summary="APP THEME"
app:icon="@drawable/theme" />
+
+