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:
1 parent
13d5079e90
commit
b794ea64c7
22 files changed
+614
-140
No files matched your search
@@ -43,9 +43,12 @@ public class ClearAllButton extends Button implements PageCallbacks {
|
||||
private float mScrollAlpha = 1;
|
||||
private float mContentAlpha = 1;
|
||||
private float mVisibilityAlpha = 1;
|
||||
private float mGridProgress = 1;
|
||||
|
||||
private boolean mIsRtl;
|
||||
private final float mOriginalTranslationX, mOriginalTranslationY;
|
||||
private float mNormalTranslationPrimary;
|
||||
private float mGridTranslationPrimary;
|
||||
|
||||
private int mScrollOffset;
|
||||
|
||||
@@ -100,10 +103,18 @@ public class ClearAllButton extends Button implements PageCallbacks {
|
||||
return;
|
||||
}
|
||||
|
||||
float shift = Math.min(scrollState.scrollFromEdge, orientationSize);
|
||||
float translation = mIsRtl ? (mScrollOffset - shift) : (mScrollOffset + shift);
|
||||
orientationHandler.setPrimaryAndResetSecondaryTranslate(
|
||||
this, translation, mOriginalTranslationX, mOriginalTranslationY);
|
||||
float shift;
|
||||
if (mIsRtl) {
|
||||
shift = Math.min(scrollState.scrollFromEdge, orientationSize);
|
||||
} else {
|
||||
shift = Math.min(scrollState.scrollFromEdge,
|
||||
orientationSize + getGridTrans(mGridTranslationPrimary))
|
||||
- getGridTrans(mGridTranslationPrimary);
|
||||
}
|
||||
mNormalTranslationPrimary = mIsRtl ? (mScrollOffset - shift) : (mScrollOffset + shift);
|
||||
applyPrimaryTranslation();
|
||||
orientationHandler.getSecondaryViewTranslate().set(this,
|
||||
orientationHandler.getSecondaryValue(mOriginalTranslationX, mOriginalTranslationY));
|
||||
mScrollAlpha = 1 - shift / orientationSize;
|
||||
updateAlpha();
|
||||
}
|
||||
@@ -111,6 +122,48 @@ public class ClearAllButton extends Button implements PageCallbacks {
|
||||
private void updateAlpha() {
|
||||
final float alpha = mScrollAlpha * mContentAlpha * mVisibilityAlpha;
|
||||
setAlpha(alpha);
|
||||
setClickable(alpha == 1);
|
||||
setClickable(Math.min(alpha, 1) == 1);
|
||||
}
|
||||
|
||||
public void setGridTranslationPrimary(float gridTranslationPrimary) {
|
||||
mGridTranslationPrimary = gridTranslationPrimary;
|
||||
applyPrimaryTranslation();
|
||||
}
|
||||
|
||||
public float getScrollAdjustment() {
|
||||
float scrollAdjustment = 0;
|
||||
if (mGridProgress > 0) {
|
||||
scrollAdjustment += mGridTranslationPrimary;
|
||||
}
|
||||
return scrollAdjustment;
|
||||
}
|
||||
|
||||
public float getOffsetAdjustment() {
|
||||
return getScrollAdjustment();
|
||||
}
|
||||
|
||||
/**
|
||||
* Moves ClearAllButton between carousel and 2 row grid.
|
||||
*
|
||||
* @param gridProgress 0 = carousel; 1 = 2 row grid.
|
||||
*/
|
||||
public void setGridProgress(float gridProgress) {
|
||||
mGridProgress = gridProgress;
|
||||
applyPrimaryTranslation();
|
||||
}
|
||||
|
||||
private void applyPrimaryTranslation() {
|
||||
RecentsView recentsView = getRecentsView();
|
||||
if (recentsView == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
PagedOrientationHandler orientationHandler = recentsView.getPagedOrientationHandler();
|
||||
orientationHandler.getPrimaryViewTranslate().set(this,
|
||||
mNormalTranslationPrimary + getGridTrans(mGridTranslationPrimary));
|
||||
}
|
||||
|
||||
private float getGridTrans(float endTranslation) {
|
||||
return mGridProgress > 0 ? endTranslation : 0;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user