Fix popup menu colors when MaterialColors returns -1

This commit is contained in:
Ensar Sarajčić 2023-09-11 15:17:03 +02:00
parent 8202e5dde7
commit 677b4083d8
1 changed files with 5 additions and 1 deletions

View File

@ -91,7 +91,11 @@ fun Activity.handleGridItemPopupMenu(anchorView: View, gridItem: HomeScreenGridI
inflate(R.menu.menu_app_icon) inflate(R.menu.menu_app_icon)
menu.forEach { menu.forEach {
val color = MaterialColors.getColor(contextTheme, android.R.attr.textColorPrimary, getProperTextColor()) val color = MaterialColors.getColor(contextTheme, android.R.attr.textColorPrimary, getProperTextColor())
if (color != -1) {
it.iconTintList = ColorStateList.valueOf(color) 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.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 menu.findItem(R.id.hide_icon).isVisible = gridItem.type == ITEM_TYPE_ICON && isOnAllAppsFragment