Bug 1366648 - Fix reload button color problem r=sebastian
authorJulian_Chu <walkingice0204@gmail.com>
Tue, 23 May 2017 11:13:06 +0800
changeset 360149 3369440c538a332588c48389046112fe3d05152b
parent 360148 17797be764258e7c8f99f4f1d41c164375cc7656
child 360150 46704306beac283ab27d233378d8f20f12218320
push id31871
push userryanvm@gmail.com
push dateTue, 23 May 2017 22:02:07 +0000
treeherdermozilla-central@545ffce30eac [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1366648 - Fix reload button color problem r=sebastian 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
@@ -404,16 +404,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});
+        }
                 getLayoutInflater().inflate(R.layout.customtabs_options_menu_footer, geckoMenu, false),
         return popupMenu;