зеркало из https://github.com/mozilla/gecko-dev.git
Backed out changeset 59a25222200e (bug 884075)
This commit is contained in:
Родитель
4bb2a6f1f8
Коммит
f085c5db80
|
@ -1680,7 +1680,7 @@ abstract public class BrowserApp extends GeckoApp
|
||||||
mToast.show(false,
|
mToast.show(false,
|
||||||
getResources().getString(R.string.bookmark_added),
|
getResources().getString(R.string.bookmark_added),
|
||||||
getResources().getString(R.string.bookmark_options),
|
getResources().getString(R.string.bookmark_options),
|
||||||
null,
|
0,
|
||||||
new ButtonToast.ToastListener() {
|
new ButtonToast.ToastListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onButtonClicked() {
|
public void onButtonClicked() {
|
||||||
|
|
|
@ -76,5 +76,4 @@
|
||||||
<dimen name="validation_message_margin_top">6dp</dimen>
|
<dimen name="validation_message_margin_top">6dp</dimen>
|
||||||
<dimen name="forward_default_offset">-13dip</dimen>
|
<dimen name="forward_default_offset">-13dip</dimen>
|
||||||
<dimen name="addressbar_offset_left">32dp</dimen>
|
<dimen name="addressbar_offset_left">32dp</dimen>
|
||||||
<dimen name="toast_button_padding">8dp</dimen>
|
|
||||||
</resources>
|
</resources>
|
||||||
|
|
|
@ -506,7 +506,7 @@
|
||||||
<item name="android:textAppearance">?android:textAppearanceSmall</item>
|
<item name="android:textAppearance">?android:textAppearanceSmall</item>
|
||||||
<item name="android:paddingTop">0dp</item>
|
<item name="android:paddingTop">0dp</item>
|
||||||
<item name="android:paddingBottom">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:paddingRight">0dp</item>
|
||||||
<item name="android:layout_marginTop">0dp</item>
|
<item name="android:layout_marginTop">0dp</item>
|
||||||
<item name="android:layout_marginBottom">0dp</item>
|
<item name="android:layout_marginBottom">0dp</item>
|
||||||
|
|
|
@ -18,8 +18,6 @@ package org.mozilla.gecko.widget;
|
||||||
|
|
||||||
import android.animation.Animator;
|
import android.animation.Animator;
|
||||||
import android.animation.AnimatorListenerAdapter;
|
import android.animation.AnimatorListenerAdapter;
|
||||||
import android.graphics.drawable.BitmapDrawable;
|
|
||||||
import android.graphics.drawable.Drawable;
|
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.os.Handler;
|
import android.os.Handler;
|
||||||
import android.text.TextUtils;
|
import android.text.TextUtils;
|
||||||
|
@ -32,7 +30,6 @@ import android.widget.TextView;
|
||||||
import java.util.LinkedList;
|
import java.util.LinkedList;
|
||||||
|
|
||||||
import org.mozilla.gecko.R;
|
import org.mozilla.gecko.R;
|
||||||
import org.mozilla.gecko.gfx.BitmapUtils;
|
|
||||||
|
|
||||||
public class ButtonToast {
|
public class ButtonToast {
|
||||||
private final static String LOGTAG = "GeckoButtonToast";
|
private final static String LOGTAG = "GeckoButtonToast";
|
||||||
|
@ -49,17 +46,18 @@ public class ButtonToast {
|
||||||
|
|
||||||
// State objects
|
// State objects
|
||||||
private static class Toast {
|
private static class Toast {
|
||||||
|
public final CharSequence token;
|
||||||
public final CharSequence buttonMessage;
|
public final CharSequence buttonMessage;
|
||||||
public Drawable buttonDrawable;
|
public final int buttonIcon;
|
||||||
public final CharSequence message;
|
public final CharSequence message;
|
||||||
public ToastListener listener;
|
public ToastListener listener;
|
||||||
|
|
||||||
public Toast(CharSequence aMessage, CharSequence aButtonMessage,
|
public Toast(CharSequence aMessage, CharSequence aButtonMessage, int aIcon, ToastListener aListener) {
|
||||||
Drawable aDrawable, ToastListener aListener) {
|
|
||||||
message = aMessage;
|
message = aMessage;
|
||||||
buttonMessage = aButtonMessage;
|
buttonMessage = aButtonMessage;
|
||||||
buttonDrawable = aDrawable;
|
buttonIcon = aIcon;
|
||||||
listener = aListener;
|
listener = aListener;
|
||||||
|
token = "";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -90,9 +88,10 @@ public class ButtonToast {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void show(boolean immediate, CharSequence message,
|
public void show(boolean immediate, CharSequence message,
|
||||||
CharSequence buttonMessage, Drawable buttonDrawable,
|
CharSequence buttonMessage, int buttonIcon,
|
||||||
ToastListener listener) {
|
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) {
|
private void show(Toast t, boolean immediate) {
|
||||||
|
@ -107,8 +106,7 @@ public class ButtonToast {
|
||||||
|
|
||||||
mMessageView.setText(t.message);
|
mMessageView.setText(t.message);
|
||||||
mButton.setText(t.buttonMessage);
|
mButton.setText(t.buttonMessage);
|
||||||
mButton.setCompoundDrawablePadding(mView.getContext().getResources().getDimensionPixelSize(R.dimen.toast_button_padding));
|
mButton.setCompoundDrawablesWithIntrinsicBounds(0, 0, t.buttonIcon, 0);
|
||||||
mButton.setCompoundDrawablesWithIntrinsicBounds(null, null, t.buttonDrawable, null);
|
|
||||||
|
|
||||||
mHideHandler.removeCallbacks(mHideRunnable);
|
mHideHandler.removeCallbacks(mHideRunnable);
|
||||||
mHideHandler.postDelayed(mHideRunnable, TOAST_DURATION);
|
mHideHandler.postDelayed(mHideRunnable, TOAST_DURATION);
|
||||||
|
|
Загрузка…
Ссылка в новой задаче