Don't animate TextView marquee if not visible
Test: guess Bug: ??? Change-Id: I0d978d18ca66a36b24160f71eae0766da0bdd7d4
This commit is contained in:
@@ -14952,8 +14952,10 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
|
||||
/**
|
||||
* @return true if this view and all ancestors are visible as of the last
|
||||
* {@link #onVisibilityAggregated(boolean)} call.
|
||||
*
|
||||
* @hide
|
||||
*/
|
||||
boolean isAggregatedVisible() {
|
||||
public boolean isAggregatedVisible() {
|
||||
return (mPrivateFlags3 & PFLAG3_AGGREGATED_VISIBLE) != 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -10631,8 +10631,8 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener
|
||||
return;
|
||||
}
|
||||
|
||||
if ((mMarquee == null || mMarquee.isStopped()) && (isFocused() || isSelected())
|
||||
&& getLineCount() == 1 && canMarquee()) {
|
||||
if ((mMarquee == null || mMarquee.isStopped()) && isAggregatedVisible()
|
||||
&& (isFocused() || isSelected()) && getLineCount() == 1 && canMarquee()) {
|
||||
|
||||
if (mMarqueeFadeMode == MARQUEE_FADE_SWITCH_SHOW_ELLIPSIS) {
|
||||
mMarqueeFadeMode = MARQUEE_FADE_SWITCH_SHOW_FADE;
|
||||
@@ -11091,6 +11091,12 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onVisibilityAggregated(boolean isVisible) {
|
||||
super.onVisibilityAggregated(isVisible);
|
||||
startStopMarquee(isVisible);
|
||||
}
|
||||
|
||||
/**
|
||||
* Use {@link BaseInputConnection#removeComposingSpans
|
||||
* BaseInputConnection.removeComposingSpans()} to remove any IME composing
|
||||
@@ -13712,7 +13718,8 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener
|
||||
mChoreographer.removeFrameCallback(mTickCallback);
|
||||
|
||||
final TextView textView = mView.get();
|
||||
if (textView != null && (textView.isFocused() || textView.isSelected())) {
|
||||
if (textView != null && textView.isAggregatedVisible()
|
||||
&& (textView.isFocused() || textView.isSelected())) {
|
||||
long currentMs = mChoreographer.getFrameTime();
|
||||
long deltaMs = currentMs - mLastAnimationMs;
|
||||
mLastAnimationMs = currentMs;
|
||||
|
||||
Reference in New Issue
Block a user