Fix DWB placement in grouped task view

In grouped task view, DWB banners will now rotate properly when phone is
in landscape or seascape orientation. Also fixes a couple of minor
existing issues with the bottom task not displaying correctly in the
first place.

Fixes: 208357326
Fixes: 216218406

Test: Tested locally on Pixel 6, using landscape, seascape, and
portrait. Double-checked with task proportions changed, RtL/LtR, and
split top/split left/split right initialization.

Change-Id: I945f9937d2d4d784c0c74a006c7d0680daf628c2
This commit is contained in:
Jeremy Sim
2022-02-09 06:01:24 +00:00
parent e8b200eb6b
commit c78ac6277c
7 changed files with 52 additions and 20 deletions
@@ -324,7 +324,7 @@ public class PortraitPagedViewHandler implements PagedOrientationHandler {
}
@Override
public Pair<Float, Float> setDwbLayoutParamsAndGetTranslations(int taskViewWidth,
public Pair<Float, Float> getDwbLayoutTranslations(int taskViewWidth,
int taskViewHeight, StagedSplitBounds splitBounds, DeviceProfile deviceProfile,
View[] thumbnailViews, int desiredTaskId, View banner) {
float translationX = 0;
@@ -360,8 +360,11 @@ public class PortraitPagedViewHandler implements PagedOrientationHandler {
FrameLayout.LayoutParams snapshotParams =
(FrameLayout.LayoutParams) thumbnailViews[0]
.getLayoutParams();
float bottomRightTaskPlusDividerPercent = splitBounds.appsStackedVertically
? (1f - splitBounds.topTaskPercent)
: (1f - splitBounds.leftTaskPercent);
translationY = -((taskViewHeight - snapshotParams.topMargin)
* (1f - splitBounds.topTaskPercent));
* bottomRightTaskPlusDividerPercent);
}
}
return new Pair<>(translationX, translationY);