Backed out changeset 59a25222200e (bug 884075)
authorEd Morley <emorley@mozilla.com>
Tue, 16 Jul 2013 12:00:01 +0100
changeset 138657 f4a2d2218a298353ed1525cb9f63b6447da30500
parent 138656 69d9290e58eeda5124f29b54119d6fb67c17fc68
child 138658 a5cd81c55a7a62b2ade9e1d6bc2f9833b62f10a8
push id24964
push userryanvm@gmail.com
push dateTue, 16 Jul 2013 20:04:09 +0000
treeherderautoland@fd10ead17ace [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs884075
milestone25.0a1
backs out59a25222200e6dce173a95f1c5332093f78a4f8d
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
Backed out changeset 59a25222200e (bug 884075)
mobile/android/base/BrowserApp.java
mobile/android/base/resources/values/dimens.xml
mobile/android/base/resources/values/styles.xml
mobile/android/base/widget/ButtonToast.java
--- a/mobile/android/base/BrowserApp.java
+++ b/mobile/android/base/BrowserApp.java
@@ -1675,17 +1675,17 @@ abstract public class BrowserApp extends
                         tab.removeBookmark();
                         Toast.makeText(this, R.string.bookmark_removed, Toast.LENGTH_SHORT).show();
                         item.setIcon(R.drawable.ic_menu_bookmark_add);
                     } else {
                         tab.addBookmark();
                         mToast.show(false,
                             getResources().getString(R.string.bookmark_added),
                             getResources().getString(R.string.bookmark_options),
-                            null,
+                            0,
                             new ButtonToast.ToastListener() {
                                 @Override
                                 public void onButtonClicked() {
                                     showBookmarkDialog();
                                 }
                             });
                         item.setIcon(R.drawable.ic_menu_bookmark_remove);
                     }
--- a/mobile/android/base/resources/values/dimens.xml
+++ b/mobile/android/base/resources/values/dimens.xml
@@ -71,10 +71,9 @@
     <dimen name="tabs_tray_horizontal_height">156dp</dimen>
     <dimen name="text_selection_handle_width">47dp</dimen>
     <dimen name="text_selection_handle_height">58dp</dimen>
     <dimen name="text_selection_handle_shadow">11dp</dimen>
     <dimen name="validation_message_height">50dp</dimen>
     <dimen name="validation_message_margin_top">6dp</dimen>
     <dimen name="forward_default_offset">-13dip</dimen>
     <dimen name="addressbar_offset_left">32dp</dimen>
-    <dimen name="toast_button_padding">8dp</dimen>
 </resources>
--- a/mobile/android/base/resources/values/styles.xml
+++ b/mobile/android/base/resources/values/styles.xml
@@ -501,17 +501,17 @@
         <item name="android:layout_width">0dp</item>
         <item name="android:layout_weight">1</item>
         <item name="android:layout_height">wrap_content</item>
         <item name="android:layout_gravity">center_vertical</item>
         <item name="android:textColor">#fff</item>
         <item name="android:textAppearance">?android:textAppearanceSmall</item>
         <item name="android:paddingTop">0dp</item>
         <item name="android:paddingBottom">0dp</item>
-        <item name="android:paddingLeft">@dimen/toast_button_padding</item>
+        <item name="android:paddingLeft">8dp</item>
         <item name="android:paddingRight">0dp</item>
         <item name="android:layout_marginTop">0dp</item>
         <item name="android:layout_marginBottom">0dp</item>
         <item name="android:layout_marginLeft">8dp</item>
         <item name="android:layout_marginRight">0dp</item>
     </style>
 
     <style name="ToastButton">
--- a/mobile/android/base/widget/ButtonToast.java
+++ b/mobile/android/base/widget/ButtonToast.java
@@ -13,58 +13,56 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
 
 package org.mozilla.gecko.widget;
 
 import android.animation.Animator;
 import android.animation.AnimatorListenerAdapter;
-import android.graphics.drawable.BitmapDrawable;
-import android.graphics.drawable.Drawable;
 import android.os.Bundle;
 import android.os.Handler;
 import android.text.TextUtils;
 import android.view.animation.Animation;
 import android.view.animation.AlphaAnimation;
 import android.view.View;
 import android.widget.Button;
 import android.widget.TextView;
 
 import java.util.LinkedList;
 
 import org.mozilla.gecko.R;
-import org.mozilla.gecko.gfx.BitmapUtils;
 
 public class ButtonToast {
     private final static String LOGTAG = "GeckoButtonToast";
     private final static int TOAST_DURATION = 5000;
 
     private final View mView;
     private final TextView mMessageView;
     private final Button mButton;
     private final Handler mHideHandler = new Handler();
 
     private final ToastListener mListener;
     private final LinkedList<Toast> mQueue = new LinkedList<Toast>();
     private Toast mCurrentToast;
 
     // State objects
     private static class Toast {
+        public final CharSequence token;
         public final CharSequence buttonMessage;
-        public Drawable buttonDrawable;
+        public final int buttonIcon;
         public final CharSequence message;
         public ToastListener listener;
 
-        public Toast(CharSequence aMessage, CharSequence aButtonMessage,
-                     Drawable aDrawable, ToastListener aListener) {
+        public Toast(CharSequence aMessage, CharSequence aButtonMessage, int aIcon, ToastListener aListener) {
             message = aMessage;
             buttonMessage = aButtonMessage;
-            buttonDrawable = aDrawable;
+            buttonIcon = aIcon;
             listener = aListener;
+            token = "";
         }
     }
 
     public interface ToastListener {
         void onButtonClicked();
     }
 
     public ButtonToast(View view) {
@@ -85,35 +83,35 @@ public class ButtonToast {
                         }
                     }
                 });
 
         hide(true);
     }
 
     public void show(boolean immediate, CharSequence message,
-                     CharSequence buttonMessage, Drawable buttonDrawable,
+                     CharSequence buttonMessage, int buttonIcon,
                      ToastListener listener) {
-        show(new Toast(message, buttonMessage, buttonDrawable, listener), immediate);
+        Toast t = new Toast(message, buttonMessage, buttonIcon, listener);
+        show(t, immediate);
     }
 
     private void show(Toast t, boolean immediate) {
         // If we're already showing a toast, add this one to the queue to show later
         if (mView.getVisibility() == View.VISIBLE) {
             mQueue.offer(t);
             return;
         }
 
         mCurrentToast = t;
         mButton.setEnabled(true);
 
         mMessageView.setText(t.message);
         mButton.setText(t.buttonMessage);
-        mButton.setCompoundDrawablePadding(mView.getContext().getResources().getDimensionPixelSize(R.dimen.toast_button_padding));
-        mButton.setCompoundDrawablesWithIntrinsicBounds(null, null, t.buttonDrawable, null);
+        mButton.setCompoundDrawablesWithIntrinsicBounds(0, 0, t.buttonIcon, 0);
 
         mHideHandler.removeCallbacks(mHideRunnable);
         mHideHandler.postDelayed(mHideRunnable, TOAST_DURATION);
 
         mView.setVisibility(View.VISIBLE);
         int duration = immediate ? 0 : mView.getResources().getInteger(android.R.integer.config_longAnimTime);
 
         mView.clearAnimation();