mirror of
https://github.com/LawnchairLauncher/lawnchair.git
synced 2026-02-20 03:08:19 +00:00
Show TaskView as grid in large screens
- Introduced gridProgress to RecentsView/TaskView ofr animating into grid - Introduced gridProgress dependant translation and scale properties in TaskView - Animate running task into grid with TaskViewSimulator - Remove overview actions (for now) but keep clear all button in large screens - Adjust ClearAllButton translation to acoomodate for grid - Use screen width +-50% to calculate task visibility - Use the position where TaskView is on screenEnd as pageScroll - TODO: Handle separate recents activity Doc: go/foldables-launcher-overview Video: http://dr/file/d/107Aydii1LoFCwP63nWG3Twr2PBDE5ZgD/view?resourcekey=0-aUjdnx8ezimS9tmAgao9ag Test: Test Launchering overview and launching overview from apps with folloiwng combination: - large / small screen sizes - portrait / landscape - thumbnails from different screen sizes / orientations Bug: 174464863 Fixes: 181509346 Change-Id: I4b691cde774f2e37532b68ba83c6eed399f2332e
This commit is contained in:
@@ -219,7 +219,7 @@ public abstract class PagedView<T extends View & PageIndicator> extends ViewGrou
|
||||
/**
|
||||
* Returns the index of the currently displayed page. When in free scroll mode, this is the page
|
||||
* that the user was on before entering free scroll mode (e.g. the home screen page they
|
||||
* long-pressed on to enter the overview). Try using {@link #getPageNearestToCenterOfScreen()}
|
||||
* long-pressed on to enter the overview). Try using {@link #getDestinationPage()}
|
||||
* to get the page the user is currently scrolling over.
|
||||
*/
|
||||
public int getCurrentPage() {
|
||||
@@ -1289,7 +1289,7 @@ public abstract class PagedView<T extends View & PageIndicator> extends ViewGrou
|
||||
if (((initialScroll >= maxScroll) && (isVelocityLeft || !isFling)) ||
|
||||
((initialScroll <= minScroll) && (!isVelocityLeft || !isFling))) {
|
||||
mScroller.springBack(initialScroll, minScroll, maxScroll);
|
||||
mNextPage = getPageNearestToCenterOfScreen();
|
||||
mNextPage = getDestinationPage();
|
||||
} else {
|
||||
mScroller.setInterpolator(mDefaultInterpolator);
|
||||
mScroller.fling(initialScroll, -velocity,
|
||||
@@ -1297,11 +1297,12 @@ public abstract class PagedView<T extends View & PageIndicator> extends ViewGrou
|
||||
Math.round(getWidth() * 0.5f * OVERSCROLL_DAMP_FACTOR));
|
||||
|
||||
int finalPos = mScroller.getFinalPos();
|
||||
mNextPage = getPageNearestToCenterOfScreen(finalPos);
|
||||
mNextPage = getDestinationPage(finalPos);
|
||||
|
||||
int firstPageScroll = getScrollForPage(!mIsRtl ? 0 : getPageCount() - 1);
|
||||
int lastPageScroll = getScrollForPage(!mIsRtl ? getPageCount() - 1 : 0);
|
||||
if (finalPos > minScroll && finalPos < maxScroll) {
|
||||
if (snapToPageInFreeScroll() && finalPos > minScroll
|
||||
&& finalPos < maxScroll) {
|
||||
// If scrolling ends in the half of the added space that is closer to
|
||||
// the end, settle to the end. Otherwise snap to the nearest page.
|
||||
// If flinging past one of the ends, don't change the velocity as it
|
||||
@@ -1347,6 +1348,10 @@ public abstract class PagedView<T extends View & PageIndicator> extends ViewGrou
|
||||
return true;
|
||||
}
|
||||
|
||||
protected boolean snapToPageInFreeScroll() {
|
||||
return true;
|
||||
}
|
||||
|
||||
protected boolean shouldFlingForVelocity(int velocity) {
|
||||
float threshold = mAllowEasyFling ? mEasyFlingThresholdVelocity : mFlingThresholdVelocity;
|
||||
return Math.abs(velocity) > threshold;
|
||||
@@ -1452,6 +1457,14 @@ public abstract class PagedView<T extends View & PageIndicator> extends ViewGrou
|
||||
}
|
||||
}
|
||||
|
||||
public int getDestinationPage() {
|
||||
return getDestinationPage(mOrientationHandler.getPrimaryScroll(this));
|
||||
}
|
||||
|
||||
protected int getDestinationPage(int scaledScroll) {
|
||||
return getPageNearestToCenterOfScreen(scaledScroll);
|
||||
}
|
||||
|
||||
public int getPageNearestToCenterOfScreen() {
|
||||
return getPageNearestToCenterOfScreen(mOrientationHandler.getPrimaryScroll(this));
|
||||
}
|
||||
@@ -1487,7 +1500,7 @@ public abstract class PagedView<T extends View & PageIndicator> extends ViewGrou
|
||||
}
|
||||
|
||||
protected void snapToDestination() {
|
||||
snapToPage(getPageNearestToCenterOfScreen(), getPageSnapDuration());
|
||||
snapToPage(getDestinationPage(), getPageSnapDuration());
|
||||
}
|
||||
|
||||
protected boolean isInOverScroll() {
|
||||
|
||||
Reference in New Issue
Block a user