Implement swipe gesture for staged split in landscape

* Maintain task split percentages when swiping up.
* Split percentages not maintained in GroupedTaskView, however.
That is a TODO.

Bug: 181704764, 181705607
Test: Swiped up in landscape with home rotation on/off.
Portrait still works.

Change-Id: Iec62abae34f6ccadf98e2afdc9409cf3160f8223
This commit is contained in:
Vinit Nayak
2021-08-24 17:24:49 -07:00
parent c8295216d5
commit 8b78c138d4
6 changed files with 109 additions and 37 deletions

View File

@@ -89,12 +89,24 @@ public final class SplitConfigurationOptions {
public final Rect mLeftTopBounds;
public final Rect mRightBottomBounds;
public final Rect mDividerBounds;
// This class is orientation-agnostic, so we compute both for later use
public final float mTopTaskPercent;
public final float mLeftTaskPercent;
public StagedSplitBounds(Rect leftTopBounds, Rect rightBottomBounds, Rect dividerBounds) {
mLeftTopBounds = leftTopBounds;
mRightBottomBounds = rightBottomBounds;
mDividerBounds = dividerBounds;
float totalHeight = mLeftTopBounds.height()
+ mRightBottomBounds.height()
+ mDividerBounds.height();
float totalWidth = mLeftTopBounds.width()
+ mRightBottomBounds.width()
+ mDividerBounds.width();
mLeftTaskPercent = mLeftTopBounds.width() / totalWidth;
mTopTaskPercent = mLeftTopBounds.height() / totalHeight;
}
}