Merge "Place TaskMenuView aligned with secondary split thumbnail" into tm-qpr-dev
This commit is contained in:
commit
f5e5c8e1ce
5 files changed
+60
-21
No files matched your search
@@ -376,6 +376,19 @@ public class LandscapePagedViewHandler implements PagedOrientationHandler {
|
||||
return isRtl ? 1 : -1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setSecondaryTaskMenuPosition(SplitBounds splitBounds, View taskView,
|
||||
DeviceProfile deviceProfile, View primarySnaphotView, View taskMenuView) {
|
||||
float topLeftTaskPlusDividerPercent = splitBounds.appsStackedVertically
|
||||
? (splitBounds.topTaskPercent + splitBounds.dividerHeightPercent)
|
||||
: (splitBounds.leftTaskPercent + splitBounds.dividerWidthPercent);
|
||||
FrameLayout.LayoutParams snapshotParams =
|
||||
(FrameLayout.LayoutParams) primarySnaphotView.getLayoutParams();
|
||||
float additionalOffset = (taskView.getHeight() - snapshotParams.topMargin)
|
||||
* topLeftTaskPlusDividerPercent;
|
||||
taskMenuView.setY(taskMenuView.getY() + additionalOffset);
|
||||
}
|
||||
|
||||
/* -------------------- */
|
||||
|
||||
@Override
|
||||
@@ -492,8 +505,8 @@ public class LandscapePagedViewHandler implements PagedOrientationHandler {
|
||||
int spaceAboveSnapshot = dp.overviewTaskThumbnailTopMarginPx;
|
||||
int totalThumbnailHeight = parentHeight - spaceAboveSnapshot;
|
||||
int dividerBar = splitBoundsConfig.appsStackedVertically
|
||||
? splitBoundsConfig.visualDividerBounds.height()
|
||||
: splitBoundsConfig.visualDividerBounds.width();
|
||||
? (int) (splitBoundsConfig.dividerHeightPercent * parentHeight)
|
||||
: (int) (splitBoundsConfig.dividerWidthPercent * parentWidth);
|
||||
int primarySnapshotHeight;
|
||||
int primarySnapshotWidth;
|
||||
int secondarySnapshotHeight;
|
||||
|
||||
@@ -230,6 +230,14 @@ public interface PagedOrientationHandler {
|
||||
/** @return Either 1 or -1, a factor to multiply by so the animation goes the correct way. */
|
||||
int getTaskDragDisplacementFactor(boolean isRtl);
|
||||
|
||||
/**
|
||||
* Calls the corresponding {@link View#setX(float)} or {@link View#setY(float)}
|
||||
* on {@param taskMenuView} by taking the space needed by {@param primarySnapshotView} into
|
||||
* account.
|
||||
* This is expected to only be called for secondary (bottom/right) tasks.
|
||||
*/
|
||||
void setSecondaryTaskMenuPosition(SplitBounds splitBounds, View taskView,
|
||||
DeviceProfile deviceProfile, View primarySnaphotView, View taskMenuView);
|
||||
/**
|
||||
* Maps the velocity from the coordinate plane of the foreground app to that
|
||||
* of Launcher's (which now will always be portrait)
|
||||
|
||||
@@ -315,6 +315,26 @@ public class PortraitPagedViewHandler implements PagedOrientationHandler {
|
||||
return new PointF(0, 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setSecondaryTaskMenuPosition(SplitBounds splitBounds, View taskView,
|
||||
DeviceProfile deviceProfile, View primarySnaphotView, View taskMenuView) {
|
||||
float topLeftTaskPlusDividerPercent = splitBounds.appsStackedVertically
|
||||
? (splitBounds.topTaskPercent + splitBounds.dividerHeightPercent)
|
||||
: (splitBounds.leftTaskPercent + splitBounds.dividerWidthPercent);
|
||||
FrameLayout.LayoutParams snapshotParams =
|
||||
(FrameLayout.LayoutParams) primarySnaphotView.getLayoutParams();
|
||||
float additionalOffset;
|
||||
if (deviceProfile.isLandscape) {
|
||||
additionalOffset = (taskView.getWidth() - snapshotParams.leftMargin)
|
||||
* topLeftTaskPlusDividerPercent;
|
||||
taskMenuView.setX(taskMenuView.getX() + additionalOffset);
|
||||
} else {
|
||||
additionalOffset = (taskView.getHeight() - snapshotParams.topMargin)
|
||||
* topLeftTaskPlusDividerPercent;
|
||||
taskMenuView.setY(taskMenuView.getY() + additionalOffset);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Pair<Float, Float> getDwbLayoutTranslations(int taskViewWidth,
|
||||
int taskViewHeight, SplitBounds splitBounds, DeviceProfile deviceProfile,
|
||||
|
||||
Reference in new issue
Block a user