Merge "Don't animate TextView marquee if not visible"
This commit is contained in:
@@ -15012,8 +15012,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;
|
||||
}
|
||||
|
||||
|
||||
@@ -10636,8 +10636,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;
|
||||
@@ -11096,6 +11096,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
|
||||
@@ -13749,7 +13755,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