mirror of
https://github.com/LawnchairLauncher/lawnchair.git
synced 2026-02-20 19:38:21 +00:00
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:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user