Merge pull request #123 from esensar/fix/popup-menu-you-colors

Fix popup menu colors when MaterialColors returns -1
This commit is contained in:
Tibor Kaputa 2023-09-13 11:02:15 +02:00 committed by GitHub
commit a1a960428a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 1 deletions

View File

@ -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,7 +91,12 @@ 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())
val default = getProperTextColor()
val color = if (isSPlus() && config.isUsingSystemTheme) {
default
} else {
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