From 01e1c2dc29a695145a5b5c36892fcea29500bbaf Mon Sep 17 00:00:00 2001
From: deniscerri <64997243+deniscerri@users.noreply.github.com>
Date: Wed, 11 Mar 2026 14:23:30 +0100
Subject: [PATCH] add blue and green icons
---
app/src/main/AndroidManifest.xml | 45 +++++++++++++++++++
.../ytdl/ui/adapter/IconsSheetAdapter.kt | 26 +----------
.../settings/general/GeneralSettingsModule.kt | 2 +-
.../com/deniscerri/ytdl/util/ThemeUtil.kt | 40 ++++++++++++-----
...ed.xml => ic_launcher_foreground_blue.xml} | 2 +-
.../drawable/ic_launcher_foreground_green.xml | 15 +++++++
.../mipmap-anydpi-v26/ic_launcher_blue.xml | 6 +++
.../mipmap-anydpi-v26/ic_launcher_green.xml | 6 +++
.../ic_launcher_round_blue.xml | 6 +++
.../ic_launcher_round_green.xml | 6 +++
.../ic_launcher_round_themed.xml | 4 +-
.../ic_launcher_round_themed_dark.xml | 4 +-
.../mipmap-anydpi-v26/ic_launcher_themed.xml | 4 +-
.../ic_launcher_themed_dark.xml | 4 +-
14 files changed, 125 insertions(+), 45 deletions(-)
rename app/src/main/res/drawable/{ic_launcher_foreground_themed.xml => ic_launcher_foreground_blue.xml} (96%)
create mode 100644 app/src/main/res/drawable/ic_launcher_foreground_green.xml
create mode 100644 app/src/main/res/mipmap-anydpi-v26/ic_launcher_blue.xml
create mode 100644 app/src/main/res/mipmap-anydpi-v26/ic_launcher_green.xml
create mode 100644 app/src/main/res/mipmap-anydpi-v26/ic_launcher_round_blue.xml
create mode 100644 app/src/main/res/mipmap-anydpi-v26/ic_launcher_round_green.xml
diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index a0f03c15..dfa874a4 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -463,6 +463,51 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
{
pref.apply {
val currentValue = preferences.getString("ytdlnis_icon", "default")
- IconsSheetAdapter.availableIcons.firstOrNull { it.activityAlias == currentValue }?.let {
+ ThemeUtil.availableIcons.firstOrNull { it.activityAlias == currentValue }?.let {
summary = context.getString(it.nameResource)
}
diff --git a/app/src/main/java/com/deniscerri/ytdl/util/ThemeUtil.kt b/app/src/main/java/com/deniscerri/ytdl/util/ThemeUtil.kt
index 5a161532..1aab8559 100644
--- a/app/src/main/java/com/deniscerri/ytdl/util/ThemeUtil.kt
+++ b/app/src/main/java/com/deniscerri/ytdl/util/ThemeUtil.kt
@@ -9,6 +9,7 @@ import android.os.Bundle
import android.text.Spanned
import android.util.TypedValue
import androidx.annotation.DrawableRes
+import androidx.annotation.StringRes
import androidx.appcompat.app.AppCompatDelegate
import androidx.core.text.HtmlCompat
import androidx.core.text.parseAsHtml
@@ -56,18 +57,23 @@ object ThemeUtil {
}
sealed class AppIcon(
+ @StringRes val nameResource: Int,
@DrawableRes val iconResource: Int,
val activityAlias: String
) {
- object Default : AppIcon(R.mipmap.ic_launcher, "Default")
- object Light : AppIcon(R.mipmap.ic_launcher_light, "LightIcon")
- object Dark : AppIcon(R.mipmap.ic_launcher_dark, "DarkIcon")
+ object Default : AppIcon(R.string.auto, R.mipmap.ic_launcher, "Default")
+ object Light : AppIcon(R.string.light, R.mipmap.ic_launcher_light, "LightIcon")
+ object Dark : AppIcon(R.string.dark, R.mipmap.ic_launcher_dark, "DarkIcon")
+ object Blue : AppIcon(R.string.blue, R.mipmap.ic_launcher_blue, "BlueIcon")
+ object Green : AppIcon(R.string.green, R.mipmap.ic_launcher_green, "GreenIcon")
}
- private val availableIcons = listOf(
+ val availableIcons = listOf(
AppIcon.Default,
AppIcon.Light,
- AppIcon.Dark
+ AppIcon.Dark,
+ AppIcon.Blue,
+ AppIcon.Green,
)
fun recreateMain() {
@@ -125,7 +131,7 @@ object ThemeUtil {
}
- val iconMode = sharedPreferences.getString("ytdlnis_icon", "default")!!
+ val iconMode = sharedPreferences.getString("ytdlnis_icon", "Default")!!
updateAppIcon(activity,theme, iconMode)
}
@@ -167,27 +173,39 @@ object ThemeUtil {
}
var iconMode = appIconMode
- if (appIconMode == "default") {
+ if (appIconMode == "Default") {
iconMode = theme
}
when (iconMode) {
- "Light" -> {
- //set light icon
+ "LightIcon" -> {
activity.packageManager.setComponentEnabledSetting(
ComponentName(activity.packageName, "com.deniscerri.ytdl.LightIcon"),
PackageManager.COMPONENT_ENABLED_STATE_ENABLED,
PackageManager.DONT_KILL_APP
)
}
- "Dark" -> {
- //set dark icon
+ "DarkIcon" -> {
activity.packageManager.setComponentEnabledSetting(
ComponentName(activity.packageName, "com.deniscerri.ytdl.DarkIcon"),
PackageManager.COMPONENT_ENABLED_STATE_ENABLED,
PackageManager.DONT_KILL_APP
)
}
+ "BlueIcon" -> {
+ activity.packageManager.setComponentEnabledSetting(
+ ComponentName(activity.packageName, "com.deniscerri.ytdl.BlueIcon"),
+ PackageManager.COMPONENT_ENABLED_STATE_ENABLED,
+ PackageManager.DONT_KILL_APP
+ )
+ }
+ "GreenIcon" -> {
+ activity.packageManager.setComponentEnabledSetting(
+ ComponentName(activity.packageName, "com.deniscerri.ytdl.GreenIcon"),
+ PackageManager.COMPONENT_ENABLED_STATE_ENABLED,
+ PackageManager.DONT_KILL_APP
+ )
+ }
// or "System"
else -> {
//set dynamic icon
diff --git a/app/src/main/res/drawable/ic_launcher_foreground_themed.xml b/app/src/main/res/drawable/ic_launcher_foreground_blue.xml
similarity index 96%
rename from app/src/main/res/drawable/ic_launcher_foreground_themed.xml
rename to app/src/main/res/drawable/ic_launcher_foreground_blue.xml
index 21d7dbbc..26450d2b 100644
--- a/app/src/main/res/drawable/ic_launcher_foreground_themed.xml
+++ b/app/src/main/res/drawable/ic_launcher_foreground_blue.xml
@@ -9,7 +9,7 @@
\ No newline at end of file
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 00000000..73c25dbe
--- /dev/null
+++ b/app/src/main/res/drawable/ic_launcher_foreground_green.xml
@@ -0,0 +1,15 @@
+
+
+
\ No newline at end of file
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 00000000..bcdcba59
--- /dev/null
+++ b/app/src/main/res/mipmap-anydpi-v26/ic_launcher_blue.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
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 00000000..38991966
--- /dev/null
+++ b/app/src/main/res/mipmap-anydpi-v26/ic_launcher_green.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round_blue.xml b/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round_blue.xml
new file mode 100644
index 00000000..bcdcba59
--- /dev/null
+++ b/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round_blue.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round_green.xml b/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round_green.xml
new file mode 100644
index 00000000..38991966
--- /dev/null
+++ b/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round_green.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round_themed.xml b/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round_themed.xml
index d0d63797..bcdcba59 100644
--- a/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round_themed.xml
+++ b/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round_themed.xml
@@ -1,6 +1,6 @@
-
-
+
+
\ No newline at end of file
diff --git a/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round_themed_dark.xml b/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round_themed_dark.xml
index 3029bad6..e2bee008 100644
--- a/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round_themed_dark.xml
+++ b/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round_themed_dark.xml
@@ -1,6 +1,6 @@
-
-
+
+
\ No newline at end of file
diff --git a/app/src/main/res/mipmap-anydpi-v26/ic_launcher_themed.xml b/app/src/main/res/mipmap-anydpi-v26/ic_launcher_themed.xml
index d0d63797..bcdcba59 100644
--- a/app/src/main/res/mipmap-anydpi-v26/ic_launcher_themed.xml
+++ b/app/src/main/res/mipmap-anydpi-v26/ic_launcher_themed.xml
@@ -1,6 +1,6 @@
-
-
+
+
\ No newline at end of file
diff --git a/app/src/main/res/mipmap-anydpi-v26/ic_launcher_themed_dark.xml b/app/src/main/res/mipmap-anydpi-v26/ic_launcher_themed_dark.xml
index 3029bad6..e2bee008 100644
--- a/app/src/main/res/mipmap-anydpi-v26/ic_launcher_themed_dark.xml
+++ b/app/src/main/res/mipmap-anydpi-v26/ic_launcher_themed_dark.xml
@@ -1,6 +1,6 @@
-
-
+
+
\ No newline at end of file