From 677b4083d83926cfa03767f67ecc849d04260be7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ensar=20Saraj=C4=8Di=C4=87?= Date: Mon, 11 Sep 2023 15:17:03 +0200 Subject: [PATCH 1/2] Fix popup menu colors when MaterialColors returns -1 --- .../com/simplemobiletools/launcher/extensions/Activity.kt | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/launcher/extensions/Activity.kt b/app/src/main/kotlin/com/simplemobiletools/launcher/extensions/Activity.kt index a7fade4..b3847f8 100644 --- a/app/src/main/kotlin/com/simplemobiletools/launcher/extensions/Activity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/launcher/extensions/Activity.kt @@ -91,7 +91,11 @@ fun Activity.handleGridItemPopupMenu(anchorView: View, gridItem: HomeScreenGridI inflate(R.menu.menu_app_icon) menu.forEach { val color = MaterialColors.getColor(contextTheme, android.R.attr.textColorPrimary, getProperTextColor()) - it.iconTintList = ColorStateList.valueOf(color) + if (color != -1) { + it.iconTintList = ColorStateList.valueOf(color) + } else { + it.iconTintList = ColorStateList.valueOf(getProperTextColor()) + } } menu.findItem(R.id.rename).isVisible = (gridItem.type == ITEM_TYPE_ICON || gridItem.type == ITEM_TYPE_FOLDER) && !isOnAllAppsFragment menu.findItem(R.id.hide_icon).isVisible = gridItem.type == ITEM_TYPE_ICON && isOnAllAppsFragment From 9159ecbd447572e00ebe0c14a74e3f6d73244fc8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ensar=20Saraj=C4=8Di=C4=87?= Date: Mon, 11 Sep 2023 17:01:13 +0200 Subject: [PATCH 2/2] Use different strategies for MaterialYou and regular themes for popup icon colors --- .../simplemobiletools/launcher/extensions/Activity.kt | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/launcher/extensions/Activity.kt b/app/src/main/kotlin/com/simplemobiletools/launcher/extensions/Activity.kt index b3847f8..a4c2e50 100644 --- a/app/src/main/kotlin/com/simplemobiletools/launcher/extensions/Activity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/launcher/extensions/Activity.kt @@ -25,6 +25,7 @@ import com.simplemobiletools.commons.extensions.getPopupMenuTheme import com.simplemobiletools.commons.extensions.getProperTextColor import com.simplemobiletools.commons.extensions.showErrorToast import com.simplemobiletools.commons.helpers.isQPlus +import com.simplemobiletools.commons.helpers.isSPlus import com.simplemobiletools.launcher.R import com.simplemobiletools.launcher.activities.SettingsActivity import com.simplemobiletools.launcher.helpers.ITEM_TYPE_FOLDER @@ -90,12 +91,13 @@ fun Activity.handleGridItemPopupMenu(anchorView: View, gridItem: HomeScreenGridI inflate(R.menu.menu_app_icon) menu.forEach { - val color = MaterialColors.getColor(contextTheme, android.R.attr.textColorPrimary, getProperTextColor()) - if (color != -1) { - it.iconTintList = ColorStateList.valueOf(color) + val default = getProperTextColor() + val color = if (isSPlus() && config.isUsingSystemTheme) { + default } else { - it.iconTintList = ColorStateList.valueOf(getProperTextColor()) + MaterialColors.getColor(contextTheme, android.R.attr.actionMenuTextColor, default) } + it.iconTintList = ColorStateList.valueOf(color) } menu.findItem(R.id.rename).isVisible = (gridItem.type == ITEM_TYPE_ICON || gridItem.type == ITEM_TYPE_FOLDER) && !isOnAllAppsFragment menu.findItem(R.id.hide_icon).isVisible = gridItem.type == ITEM_TYPE_ICON && isOnAllAppsFragment