Fixing Recents sometimes restoring in Clear-all-reveal position.
This happened if a task was added between openings of Recents. Bug: 72222505 Test: Manual Change-Id: Id4cc8e7cbdb493973d329466369b62e4ac8ee0b3
This commit is contained in:
parent
77bf622c01
commit
e628c474ea
|
@ -345,14 +345,22 @@ public abstract class RecentsView<T extends BaseActivity> extends PagedView impl
|
|||
|
||||
private float calculateClearAllButtonAlpha() {
|
||||
final int childCount = getChildCount();
|
||||
if (mShowEmptyMessage || childCount == 0) return 0;
|
||||
if (mShowEmptyMessage || childCount == 0 || mPageScrolls == null
|
||||
|| childCount != mPageScrolls.length) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
final int scrollEnd = getScrollEnd();
|
||||
final int oldestChildScroll = getScrollForPage(childCount - 1);
|
||||
|
||||
return Utilities.boundToRange(
|
||||
((float) (getScrollX() - oldestChildScroll)) /
|
||||
(scrollEnd - oldestChildScroll), 0, 1);
|
||||
final int clearAllButtonMotionRange = scrollEnd - oldestChildScroll;
|
||||
if (clearAllButtonMotionRange == 0) return 0;
|
||||
|
||||
final float alphaUnbound = ((float) (getScrollX() - oldestChildScroll)) /
|
||||
clearAllButtonMotionRange;
|
||||
if (alphaUnbound > 1) return 0;
|
||||
|
||||
return Math.max(alphaUnbound, 0);
|
||||
}
|
||||
|
||||
private void updateClearAllButtonAlpha() {
|
||||
|
|
|
@ -109,7 +109,7 @@ public abstract class PagedView<T extends View & PageIndicator> extends ViewGrou
|
|||
private float mLastMotionXRemainder;
|
||||
private float mTotalMotionX;
|
||||
|
||||
private int[] mPageScrolls;
|
||||
protected int[] mPageScrolls;
|
||||
|
||||
protected final static int TOUCH_STATE_REST = 0;
|
||||
protected final static int TOUCH_STATE_SCROLLING = 1;
|
||||
|
|
Loading…
Reference in New Issue