Merge "Deprecate custom toasts"
This commit is contained in:
committed by
Android (Google) Code Review
commit
871fe0a968
@@ -59839,7 +59839,7 @@ package android.widget {
|
||||
method public int getGravity();
|
||||
method public float getHorizontalMargin();
|
||||
method public float getVerticalMargin();
|
||||
method public android.view.View getView();
|
||||
method @Deprecated public android.view.View getView();
|
||||
method public int getXOffset();
|
||||
method public int getYOffset();
|
||||
method public static android.widget.Toast makeText(android.content.Context, CharSequence, int);
|
||||
@@ -59850,7 +59850,7 @@ package android.widget {
|
||||
method public void setMargin(float, float);
|
||||
method public void setText(@StringRes int);
|
||||
method public void setText(CharSequence);
|
||||
method public void setView(android.view.View);
|
||||
method @Deprecated public void setView(android.view.View);
|
||||
method public void show();
|
||||
field public static final int LENGTH_LONG = 1; // 0x1
|
||||
field public static final int LENGTH_SHORT = 0; // 0x0
|
||||
|
||||
@@ -66,6 +66,10 @@ import java.util.List;
|
||||
* <p>
|
||||
* The easiest way to use this class is to call one of the static methods that constructs
|
||||
* everything you need and returns a new Toast object.
|
||||
* <p>
|
||||
* Note that
|
||||
* <a href="{@docRoot}reference/com/google/android/material/snackbar/Snackbar">Snackbars</a> are
|
||||
* preferred for brief messages while the app is in the foreground.
|
||||
*
|
||||
* <div class="special reference">
|
||||
* <h3>Developer Guides</h3>
|
||||
@@ -169,8 +173,16 @@ public class Toast {
|
||||
|
||||
/**
|
||||
* Set the view to show.
|
||||
*
|
||||
* @see #getView
|
||||
* @deprecated Custom toast views are deprecated. Apps can create a standard text toast with the
|
||||
* {@link #makeText(Context, CharSequence, int)} method, or use a
|
||||
* <a href="{@docRoot}reference/com/google/android/material/snackbar/Snackbar">Snackbar</a>
|
||||
* when in the foreground. Starting from Android {@link Build.VERSION_CODES#R}, apps
|
||||
* targeting API level {@link Build.VERSION_CODES#R} or higher that are in the background
|
||||
* will not have custom toast views displayed.
|
||||
*/
|
||||
@Deprecated
|
||||
public void setView(View view) {
|
||||
mIsCustomToast = true;
|
||||
mNextView = view;
|
||||
@@ -178,7 +190,14 @@ public class Toast {
|
||||
|
||||
/**
|
||||
* Return the view.
|
||||
*
|
||||
* @see #setView
|
||||
* @deprecated Custom toast views are deprecated. Apps can create a standard text toast with the
|
||||
* {@link #makeText(Context, CharSequence, int)} method, or use a
|
||||
* <a href="{@docRoot}reference/com/google/android/material/snackbar/Snackbar">Snackbar</a>
|
||||
* when in the foreground. Starting from Android {@link Build.VERSION_CODES#R}, apps
|
||||
* targeting API level {@link Build.VERSION_CODES#R} or higher that are in the background
|
||||
* will not have custom toast views displayed.
|
||||
*/
|
||||
public View getView() {
|
||||
mIsCustomToast = true;
|
||||
|
||||
Reference in New Issue
Block a user