Remove final from View.setTooltipText/getTooltipText

This resolves the binary compatibity issue with some
existing apps.

Bug: 35150720
Test: framework builds
Change-Id: I4242186b7103ad35a1e09264c0c9f86bbcf88f49
This commit is contained in:
Vladislav Kaznacheev
2017-02-14 11:43:16 -08:00
parent d0e1022237
commit 9aa7edfa89
4 changed files with 24 additions and 12 deletions

View File

@@ -44567,7 +44567,7 @@ package android.view {
method public java.lang.Object getTag(int);
method public int getTextAlignment();
method public int getTextDirection();
method public final java.lang.CharSequence getTooltipText();
method public java.lang.CharSequence getTooltipText();
method public final int getTop();
method protected float getTopFadingEdgeStrength();
method protected int getTopPaddingOffset();
@@ -44873,7 +44873,7 @@ package android.view {
method public void setTag(int, java.lang.Object);
method public void setTextAlignment(int);
method public void setTextDirection(int);
method public final void setTooltipText(java.lang.CharSequence);
method public void setTooltipText(java.lang.CharSequence);
method public final void setTop(int);
method public void setTouchDelegate(android.view.TouchDelegate);
method public final void setTransitionName(java.lang.String);

View File

@@ -47983,7 +47983,7 @@ package android.view {
method public java.lang.Object getTag(int);
method public int getTextAlignment();
method public int getTextDirection();
method public final java.lang.CharSequence getTooltipText();
method public java.lang.CharSequence getTooltipText();
method public final int getTop();
method protected float getTopFadingEdgeStrength();
method protected int getTopPaddingOffset();
@@ -48289,7 +48289,7 @@ package android.view {
method public void setTag(int, java.lang.Object);
method public void setTextAlignment(int);
method public void setTextDirection(int);
method public final void setTooltipText(java.lang.CharSequence);
method public void setTooltipText(java.lang.CharSequence);
method public final void setTop(int);
method public void setTouchDelegate(android.view.TouchDelegate);
method public final void setTransitionName(java.lang.String);

View File

@@ -44873,7 +44873,7 @@ package android.view {
method public java.lang.Object getTag(int);
method public int getTextAlignment();
method public int getTextDirection();
method public final java.lang.CharSequence getTooltipText();
method public java.lang.CharSequence getTooltipText();
method public android.view.View getTooltipView();
method public final int getTop();
method protected float getTopFadingEdgeStrength();
@@ -45180,7 +45180,7 @@ package android.view {
method public void setTag(int, java.lang.Object);
method public void setTextAlignment(int);
method public void setTextDirection(int);
method public final void setTooltipText(java.lang.CharSequence);
method public void setTooltipText(java.lang.CharSequence);
method public final void setTop(int);
method public void setTouchDelegate(android.view.TouchDelegate);
method public final void setTransitionName(java.lang.String);

View File

@@ -24796,13 +24796,20 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
* Sets the tooltip text which will be displayed in a small popup next to the view.
* <p>
* The tooltip will be displayed:
* <ul>
* <li>On long click, unless is not handled otherwise (by OnLongClickListener or a context
* menu). </li>
* <li>On hover, after a brief delay since the pointer has stopped moving </li>
* </ul>
* <p>
* <strong>Note:</strong> Do not override this method, as it will have no
* effect on the text displayed in the tooltip.
*
* @param tooltipText the tooltip text, or null if no tooltip is required
* @see #getTooltipText()
* @attr ref android.R.styleable#View_tooltipText
*/
public final void setTooltipText(@Nullable CharSequence tooltipText) {
public void setTooltipText(@Nullable CharSequence tooltipText) {
if (TextUtils.isEmpty(tooltipText)) {
setFlags(0, TOOLTIP);
hideTooltip();
@@ -24831,10 +24838,16 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
/**
* Returns the view's tooltip text.
*
* <strong>Note:</strong> Do not override this method, as it will have no
* effect on the text displayed in the tooltip. You must call
* {@link #setTooltipText(CharSequence)} to modify the tooltip text.
*
* @return the tooltip text
* @see #setTooltipText(CharSequence)
* @attr ref android.R.styleable#View_tooltipText
*/
@Nullable
public final CharSequence getTooltipText() {
public CharSequence getTooltipText() {
return mTooltipInfo != null ? mTooltipInfo.mTooltipText : null;
}
@@ -24847,21 +24860,20 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
}
private boolean showTooltip(int x, int y, boolean fromLongClick) {
if (mAttachInfo == null) {
if (mAttachInfo == null || mTooltipInfo == null) {
return false;
}
if ((mViewFlags & ENABLED_MASK) != ENABLED) {
return false;
}
final CharSequence tooltipText = getTooltipText();
if (TextUtils.isEmpty(tooltipText)) {
if (TextUtils.isEmpty(mTooltipInfo.mTooltipText)) {
return false;
}
hideTooltip();
mTooltipInfo.mTooltipFromLongClick = fromLongClick;
mTooltipInfo.mTooltipPopup = new TooltipPopup(getContext());
final boolean fromTouch = (mPrivateFlags3 & PFLAG3_FINGER_DOWN) == PFLAG3_FINGER_DOWN;
mTooltipInfo.mTooltipPopup.show(this, x, y, fromTouch, tooltipText);
mTooltipInfo.mTooltipPopup.show(this, x, y, fromTouch, mTooltipInfo.mTooltipText);
mAttachInfo.mTooltipHost = this;
return true;
}