Bug 918007 - Factor out method to enable/disable buttons (r=sriram)
☠☠ backed out by 2c803fb352c9 ☠ ☠
authorLucas Rocha <lucasr@mozilla.com>
Wed, 23 Oct 2013 14:16:39 +0100
changeset 165614 2d8cdd7baa58bfab0b5cd805e555f4bdb26a4c9b
parent 165613 d91823b449d10871c3504247adf4b99907f4ac3e
child 165615 0117133ba8efeec277059f2f214b1fff55b5dd77
push id3066
push userakeybl@mozilla.com
push dateMon, 09 Dec 2013 19:58:46 +0000
treeherdermozilla-beta@a31a0dce83aa [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssriram
bugs918007
milestone27.0a1
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 918007 - Factor out method to enable/disable buttons (r=sriram)
mobile/android/base/BrowserToolbar.java
--- a/mobile/android/base/BrowserToolbar.java
+++ b/mobile/android/base/BrowserToolbar.java
@@ -1559,22 +1559,27 @@ public class BrowserToolbar extends Geck
         int newInputType = StringUtils.isSearchQuery(text, false)
                            ? (currentInputType & ~InputType.TYPE_TEXT_VARIATION_URI) // Text mode
                            : (currentInputType | InputType.TYPE_TEXT_VARIATION_URI); // URL mode
         if (newInputType != currentInputType) {
             mUrlEditText.setRawInputType(newInputType);
         }
     }
 
+    public void setButtonEnabled(ImageButton button, boolean enabled) {
+        final Drawable drawable = button.getDrawable();
+        if (drawable != null) {
+            drawable.setAlpha(enabled ? 255 : 61);
+        }
+
+        button.setEnabled(enabled);
+    }
+
     public void updateBackButton(boolean enabled) {
-         Drawable drawable = mBack.getDrawable();
-         if (drawable != null)
-             drawable.setAlpha(enabled ? 255 : 77);
-
-         mBack.setEnabled(enabled);
+        setButtonEnabled(mBack, enabled);
     }
 
     public void updateForwardButton(final boolean enabled) {
         if (mForward.isEnabled() == enabled)
             return;
 
         // Save the state on the forward button so that we can skip animations
         // when there's nothing to change