Fix options color on Andorid 5

This commit is contained in:
h4h13 2019-11-21 23:05:27 +05:30
parent 8303c376ca
commit 72964be920
7 changed files with 54 additions and 35 deletions

View file

@ -55,15 +55,15 @@ public class OptionMenuItemView extends FrameLayout {
super(context, attrs, defStyleAttr, defStyleRes);
int accentColor = ThemeStore.Companion.accentColor(context);
setBackground(ContextCompat.getDrawable(context, R.drawable.menu_item_background));
int colorWithAlpha = ColorUtil.INSTANCE.adjustAlpha(accentColor, 0.22f);
setBackground(ContextCompat.getDrawable(context, R.drawable.option_menu_background));
setClickable(true);
setFocusable(true);
inflate(context, R.layout.item_option_menu, this);
setBackgroundTintList(ColorStateList.valueOf(ColorUtil.INSTANCE.adjustAlpha(accentColor, 0.22f)));
textView = findViewById(R.id.title);
iconImageView = findViewById(R.id.icon);
@ -83,8 +83,11 @@ public class OptionMenuItemView extends FrameLayout {
super.setSelected(selected);
if (selected) {
int accentColor = ThemeStore.Companion.accentColor(getContext());
int colorWithAlpha = ColorUtil.INSTANCE.adjustAlpha(accentColor, 0.22f);
textView.setTextColor(accentColor);
iconImageView.setImageTintList(ColorStateList.valueOf(accentColor));
setBackgroundTintList(ColorStateList.valueOf(colorWithAlpha));
}
}
}
}