Commit 5b9af220 authored by Gang Wu's avatar Gang Wu Committed by Commit Bot

Set default tint for the icon

This is follow up from the comment in
https://chromium-review.googlesource.com/c/chromium/src/+/2446450/comment/9408fb53_5f37aaef/
Wee should set default tint for the icon since the view may be reused
previously.

Bug: 1148950
Change-Id: Idfb641ff1865caea0763da613a61ec07274c8b74
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2538350Reviewed-by: default avatarTheresa  <twellington@chromium.org>
Reviewed-by: default avatarGang Wu <gangwu@chromium.org>
Commit-Queue: Gang Wu <gangwu@chromium.org>
Cr-Commit-Position: refs/heads/master@{#827911}
parent 97f084d3
......@@ -11,6 +11,7 @@ import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
import androidx.annotation.ColorRes;
import androidx.annotation.Nullable;
import androidx.appcompat.content.res.AppCompatResources;
......@@ -88,10 +89,11 @@ class ChipViewMenuItemViewBinder implements CustomViewBinder {
holder.title.setEnabled(mainMenuItem.isEnabled());
final MenuItem finalMainMenuItem = mainMenuItem;
holder.title.setOnClickListener(v -> appMenuClickHandler.onItemClick(finalMainMenuItem));
if (mainMenuItem.isChecked()) {
holder.title.setDrawableTintColor(AppCompatResources.getColorStateList(
convertView.getContext(), R.color.blue_mode_tint));
}
@ColorRes
int theme = mainMenuItem.isChecked() ? R.color.blue_mode_tint
: R.color.default_icon_color_secondary_tint_list;
holder.title.setDrawableTintColor(
AppCompatResources.getColorStateList(convertView.getContext(), theme));
if (chipViewMenuItem != null) {
holder.chipView.setVisibility(View.VISIBLE);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment