Backed out changeset 46f75b2f314c (bug 884075)

This commit is contained in:
Ed Morley 2013-07-16 11:59:58 +01:00
parent d586cec710
commit 5f1a46517a
2 changed files with 5 additions and 18 deletions

View File

@ -1686,9 +1686,6 @@ abstract public class BrowserApp extends GeckoApp
public void onButtonClicked() { public void onButtonClicked() {
showBookmarkDialog(); showBookmarkDialog();
} }
@Override
public void onToastHidden(ButtonToast.ReasonHidden reason) { }
}); });
item.setIcon(R.drawable.ic_menu_bookmark_remove); item.setIcon(R.drawable.ic_menu_bookmark_remove);
} }

View File

@ -47,12 +47,6 @@ public class ButtonToast {
private final LinkedList<Toast> mQueue = new LinkedList<Toast>(); private final LinkedList<Toast> mQueue = new LinkedList<Toast>();
private Toast mCurrentToast; private Toast mCurrentToast;
public enum ReasonHidden {
CLICKED,
TIMEOUT,
STARTUP
}
// State objects // State objects
private static class Toast { private static class Toast {
public final CharSequence buttonMessage; public final CharSequence buttonMessage;
@ -71,7 +65,6 @@ public class ButtonToast {
public interface ToastListener { public interface ToastListener {
void onButtonClicked(); void onButtonClicked();
void onToastHidden(ReasonHidden reason);
} }
public ButtonToast(View view) { public ButtonToast(View view) {
@ -86,14 +79,14 @@ public class ButtonToast {
if (t == null) if (t == null)
return; return;
hide(false, ReasonHidden.CLICKED); hide(false);
if (t.listener != null) { if (t.listener != null) {
t.listener.onButtonClicked(); t.listener.onButtonClicked();
} }
} }
}); });
hide(true, ReasonHidden.STARTUP); hide(true);
} }
public void show(boolean immediate, CharSequence message, public void show(boolean immediate, CharSequence message,
@ -130,15 +123,12 @@ public class ButtonToast {
mView.startAnimation(alpha); mView.startAnimation(alpha);
} }
public void hide(boolean immediate, ReasonHidden reason) { public void hide(boolean immediate) {
if (mButton.isPressed() && reason != ReasonHidden.CLICKED) { if (mButton.isPressed()) {
mHideHandler.postDelayed(mHideRunnable, TOAST_DURATION); mHideHandler.postDelayed(mHideRunnable, TOAST_DURATION);
return; return;
} }
if (mCurrentToast != null && mCurrentToast.listener != null) {
mCurrentToast.listener.onToastHidden(reason);
}
mCurrentToast = null; mCurrentToast = null;
mButton.setEnabled(false); mButton.setEnabled(false);
mHideHandler.removeCallbacks(mHideRunnable); mHideHandler.removeCallbacks(mHideRunnable);
@ -183,7 +173,7 @@ public class ButtonToast {
private Runnable mHideRunnable = new Runnable() { private Runnable mHideRunnable = new Runnable() {
@Override @Override
public void run() { public void run() {
hide(false, ReasonHidden.TIMEOUT); hide(false);
} }
}; };
} }