diff options
Diffstat (limited to 'core/java/android')
| -rw-r--r-- | core/java/android/app/MediaRouteButton.java | 2 | ||||
| -rw-r--r-- | core/java/android/view/MenuInflater.java | 6 | ||||
| -rw-r--r-- | core/java/android/view/MenuItem.java | 6 | ||||
| -rw-r--r-- | core/java/android/view/View.java | 41 |
4 files changed, 38 insertions, 17 deletions
diff --git a/core/java/android/app/MediaRouteButton.java b/core/java/android/app/MediaRouteButton.java index 09e95dfa3044..d2d7b6d9fa62 100644 --- a/core/java/android/app/MediaRouteButton.java +++ b/core/java/android/app/MediaRouteButton.java @@ -174,7 +174,7 @@ public class MediaRouteButton extends View { @Override public void setContentDescription(CharSequence contentDescription) { super.setContentDescription(contentDescription); - setTooltip(contentDescription); + setTooltipText(contentDescription); } @Override diff --git a/core/java/android/view/MenuInflater.java b/core/java/android/view/MenuInflater.java index f3f3d40213ec..7a5c65f6a87e 100644 --- a/core/java/android/view/MenuInflater.java +++ b/core/java/android/view/MenuInflater.java @@ -335,7 +335,7 @@ public class MenuInflater { private ActionProvider itemActionProvider; private CharSequence itemContentDescription; - private CharSequence itemTooltip; + private CharSequence itemTooltipText; private static final int defaultGroupId = NO_ID; private static final int defaultItemId = NO_ID; @@ -429,7 +429,7 @@ public class MenuInflater { itemContentDescription = a.getText(com.android.internal.R.styleable.MenuItem_contentDescription); - itemTooltip = a.getText(com.android.internal.R.styleable.MenuItem_tooltip); + itemTooltipText = a.getText(com.android.internal.R.styleable.MenuItem_tooltipText); a.recycle(); @@ -495,7 +495,7 @@ public class MenuInflater { } item.setContentDescription(itemContentDescription); - item.setTooltip(itemTooltip); + item.setTooltipText(itemTooltipText); } public MenuItem addItem() { diff --git a/core/java/android/view/MenuItem.java b/core/java/android/view/MenuItem.java index 5ced76592756..3f8d08937a77 100644 --- a/core/java/android/view/MenuItem.java +++ b/core/java/android/view/MenuItem.java @@ -621,9 +621,9 @@ public interface MenuItem { /** * Change the tooltip text associated with this menu item. * - * @param tooltip The new tooltip text. + * @param tooltipText The new tooltip text. */ - default MenuItem setTooltip(CharSequence tooltip) { + default MenuItem setTooltipText(CharSequence tooltipText) { return this; } @@ -632,7 +632,7 @@ public interface MenuItem { * * @return The tooltip text. */ - default CharSequence getTooltip() { + default CharSequence getTooltipText() { return null; } } diff --git a/core/java/android/view/View.java b/core/java/android/view/View.java index 37dfdb92996b..cbcec0e07017 100644 --- a/core/java/android/view/View.java +++ b/core/java/android/view/View.java @@ -3718,7 +3718,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback, * Text to be displayed in a tooltip popup. */ @Nullable - CharSequence mTooltip; + CharSequence mTooltipText; /** * View-relative position of the tooltip anchor point. @@ -4761,8 +4761,8 @@ public class View implements Drawable.Callback, KeyEvent.Callback, forceHasOverlappingRendering(a.getBoolean(attr, true)); } break; - case R.styleable.View_tooltip: - setTooltip(a.getText(attr)); + case R.styleable.View_tooltipText: + setTooltipText(a.getText(attr)); break; case R.styleable.View_keyboardNavigationCluster: if (a.peekValue(attr) != null) { @@ -24638,10 +24638,10 @@ public class View implements Drawable.Callback, KeyEvent.Callback, * menu). </li> * <li>On hover, after a brief delay since the pointer has stopped moving </li> * - * @param tooltip the tooltip text, or null if no tooltip is required + * @param tooltipText the tooltip text, or null if no tooltip is required */ - public final void setTooltip(@Nullable CharSequence tooltip) { - if (TextUtils.isEmpty(tooltip)) { + public final void setTooltipText(@Nullable CharSequence tooltipText) { + if (TextUtils.isEmpty(tooltipText)) { setFlags(0, TOOLTIP); hideTooltip(); mTooltipInfo = null; @@ -24652,21 +24652,42 @@ public class View implements Drawable.Callback, KeyEvent.Callback, mTooltipInfo.mShowTooltipRunnable = this::showHoverTooltip; mTooltipInfo.mHideTooltipRunnable = this::hideTooltip; } - mTooltipInfo.mTooltip = tooltip; + mTooltipInfo.mTooltipText = tooltipText; if (mTooltipInfo.mTooltipPopup != null && mTooltipInfo.mTooltipPopup.isShowing()) { - mTooltipInfo.mTooltipPopup.updateContent(mTooltipInfo.mTooltip); + mTooltipInfo.mTooltipPopup.updateContent(mTooltipInfo.mTooltipText); } } } /** + * To be removed once the support library has stopped using it. + * + * @deprecated use {@link #setTooltipText} instead + */ + @Deprecated + public final void setTooltip(@Nullable CharSequence tooltipText) { + setTooltipText(tooltipText); + } + + /** * Returns the view's tooltip text. * * @return the tooltip text */ @Nullable + public final CharSequence getTooltipText() { + return mTooltipInfo != null ? mTooltipInfo.mTooltipText : null; + } + + /** + * To be removed once the support library has stopped using it. + * + * @deprecated use {@link #getTooltipText} instead + */ + @Deprecated + @Nullable public final CharSequence getTooltip() { - return mTooltipInfo != null ? mTooltipInfo.mTooltip : null; + return getTooltipText(); } private boolean showTooltip(int x, int y, boolean fromLongClick) { @@ -24676,7 +24697,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback, if ((mViewFlags & ENABLED_MASK) != ENABLED) { return false; } - final CharSequence tooltipText = getTooltip(); + final CharSequence tooltipText = getTooltipText(); if (TextUtils.isEmpty(tooltipText)) { return false; } |
