Use different strategies for MaterialYou and regular themes for popup icon colors
This commit is contained in:
parent
677b4083d8
commit
9159ecbd44
|
@ -25,6 +25,7 @@ import com.simplemobiletools.commons.extensions.getPopupMenuTheme
|
||||||
import com.simplemobiletools.commons.extensions.getProperTextColor
|
import com.simplemobiletools.commons.extensions.getProperTextColor
|
||||||
import com.simplemobiletools.commons.extensions.showErrorToast
|
import com.simplemobiletools.commons.extensions.showErrorToast
|
||||||
import com.simplemobiletools.commons.helpers.isQPlus
|
import com.simplemobiletools.commons.helpers.isQPlus
|
||||||
|
import com.simplemobiletools.commons.helpers.isSPlus
|
||||||
import com.simplemobiletools.launcher.R
|
import com.simplemobiletools.launcher.R
|
||||||
import com.simplemobiletools.launcher.activities.SettingsActivity
|
import com.simplemobiletools.launcher.activities.SettingsActivity
|
||||||
import com.simplemobiletools.launcher.helpers.ITEM_TYPE_FOLDER
|
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)
|
inflate(R.menu.menu_app_icon)
|
||||||
menu.forEach {
|
menu.forEach {
|
||||||
val color = MaterialColors.getColor(contextTheme, android.R.attr.textColorPrimary, getProperTextColor())
|
val default = getProperTextColor()
|
||||||
if (color != -1) {
|
val color = if (isSPlus() && config.isUsingSystemTheme) {
|
||||||
it.iconTintList = ColorStateList.valueOf(color)
|
default
|
||||||
} else {
|
} 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.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
|
||||||
|
|
Loading…
Reference in New Issue