Bug 1366648 - Fix reload button color problem
configuration: Nexus 5 + Android Hammerhead 5.1.1 LMY48M
In CustomTabsActivity, the menu reload-button use a LevelListDrawable.
On some configurations, icon's state won't be set to Enabled by system, hence
the color of icon is incorrect. We have to enable it manually.
MozReview-Commit-ID: JB9t35OyatY
--- a/mobile/android/base/java/org/mozilla/gecko/customtabs/CustomTabsActivity.java
+++ b/mobile/android/base/java/org/mozilla/gecko/customtabs/CustomTabsActivity.java
@@ -410,16 +410,22 @@ public class CustomTabsActivity extends
final Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse("http://"));
final ResolveInfo info = getPackageManager()
.resolveActivity(browserIntent, PackageManager.MATCH_DEFAULT_ONLY);
final String name = info.loadLabel(getPackageManager()).toString();
openItem.setTitle(getString(R.string.custom_tabs_menu_item_open_in, name));
}
menuItemControl = geckoMenu.findItem(R.id.custom_tabs_menu_control);
+ // on some configurations(ie. Android 5.1.1 + Nexus 5), no idea why the state not be enabled
+ // if the Drawable is a LevelListDrawable, then the icon color is incorrect.
+ final Drawable icon = menuItemControl.getIcon();
+ if (icon != null && !icon.isStateful()) {
+ icon.setState(new int[]{android.R.attr.state_enabled});
+ }
geckoMenu.addFooterView(
getLayoutInflater().inflate(R.layout.customtabs_options_menu_footer, geckoMenu, false),
null,
false);
return popupMenu;
}