mirror of
https://github.com/LawnchairLauncher/lawnchair.git
synced 2026-03-04 18:06:48 +00:00
Merge "Fix issue with camera overlapping split staging UI" into tm-dev
This commit is contained in:
@@ -399,7 +399,8 @@ public class LandscapePagedViewHandler implements PagedOrientationHandler {
|
||||
// In fake land/seascape, the placeholder always needs to go to the "top" of the device,
|
||||
// which is the same bounds as 0 rotation.
|
||||
int width = dp.widthPx;
|
||||
out.set(0, 0, width, placeholderHeight);
|
||||
int insetThickness = dp.getInsets().top;
|
||||
out.set(0, 0, width, placeholderHeight + insetThickness);
|
||||
out.inset(placeholderInset, 0);
|
||||
|
||||
// Adjust the top to account for content off screen. This will help to animate the view in
|
||||
@@ -411,6 +412,19 @@ public class LandscapePagedViewHandler implements PagedOrientationHandler {
|
||||
out.top -= (totalHeight - placeholderHeight);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateStagedSplitIconParams(FrameLayout.LayoutParams out, float onScreenRectCenterX,
|
||||
float onScreenRectCenterY, float fullscreenScaleX, float fullscreenScaleY,
|
||||
int drawableWidth, int drawableHeight, DeviceProfile dp,
|
||||
@StagePosition int stagePosition) {
|
||||
float inset = dp.getInsets().top;
|
||||
out.leftMargin = Math.round(onScreenRectCenterX / fullscreenScaleX
|
||||
- 1.0f * drawableWidth / 2);
|
||||
out.topMargin = Math.round((onScreenRectCenterY + (inset / 2f)) / fullscreenScaleY
|
||||
- 1.0f * drawableHeight / 2);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getFinalSplitPlaceholderBounds(int splitDividerSize, DeviceProfile dp,
|
||||
@StagePosition int stagePosition, Rect out1, Rect out2) {
|
||||
|
||||
@@ -115,6 +115,25 @@ public interface PagedOrientationHandler {
|
||||
void getInitialSplitPlaceholderBounds(int placeholderHeight, int placeholderInset,
|
||||
DeviceProfile dp, @StagePosition int stagePosition, Rect out);
|
||||
|
||||
/**
|
||||
* Centers an icon in the split staging area, accounting for insets.
|
||||
* @param out The LayoutParams of the icon that needs to be centered.
|
||||
* @param onScreenRectCenterX The x-center of the on-screen staging area (most of the Rect is
|
||||
* offscreen).
|
||||
* @param onScreenRectCenterY The y-center of the on-screen staging area (most of the Rect is
|
||||
* offscreen).
|
||||
* @param fullscreenScaleX A x-scaling factor used to convert coordinates back into pixels.
|
||||
* @param fullscreenScaleY A y-scaling factor used to convert coordinates back into pixels.
|
||||
* @param drawableWidth The icon's drawable (final) width.
|
||||
* @param drawableHeight The icon's drawable (final) height.
|
||||
* @param dp The device profile, used to report rotation and hardware insets.
|
||||
* @param stagePosition 0 if the staging area is pinned to top/left, 1 for bottom/right.
|
||||
*/
|
||||
void updateStagedSplitIconParams(FrameLayout.LayoutParams out, float onScreenRectCenterX,
|
||||
float onScreenRectCenterY, float fullscreenScaleX, float fullscreenScaleY,
|
||||
int drawableWidth, int drawableHeight, DeviceProfile dp,
|
||||
@StagePosition int stagePosition);
|
||||
|
||||
/**
|
||||
* @param splitDividerSize height of split screen drag handle in portrait, width in landscape
|
||||
* @param stagePosition the split position option (top/left, bottom/right) of the first
|
||||
|
||||
@@ -440,7 +440,14 @@ public class PortraitPagedViewHandler implements PagedOrientationHandler {
|
||||
DeviceProfile dp, @StagePosition int stagePosition, Rect out) {
|
||||
int screenWidth = dp.widthPx;
|
||||
int screenHeight = dp.heightPx;
|
||||
out.set(0, 0, screenWidth, placeholderHeight);
|
||||
boolean pinToRight = stagePosition == STAGE_POSITION_BOTTOM_OR_RIGHT;
|
||||
int insetThickness;
|
||||
if (!dp.isLandscape) {
|
||||
insetThickness = dp.getInsets().top;
|
||||
} else {
|
||||
insetThickness = pinToRight ? dp.getInsets().right : dp.getInsets().left;
|
||||
}
|
||||
out.set(0, 0, screenWidth, placeholderHeight + insetThickness);
|
||||
if (!dp.isLandscape) {
|
||||
// portrait, phone or tablet - spans width of screen, nothing else to do
|
||||
out.inset(placeholderInset, 0);
|
||||
@@ -454,7 +461,6 @@ public class PortraitPagedViewHandler implements PagedOrientationHandler {
|
||||
}
|
||||
|
||||
// Now we rotate the portrait rect depending on what side we want pinned
|
||||
boolean pinToRight = stagePosition == STAGE_POSITION_BOTTOM_OR_RIGHT;
|
||||
|
||||
float postRotateScale = (float) screenHeight / screenWidth;
|
||||
mTmpMatrix.reset();
|
||||
@@ -480,6 +486,33 @@ public class PortraitPagedViewHandler implements PagedOrientationHandler {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateStagedSplitIconParams(FrameLayout.LayoutParams out, float onScreenRectCenterX,
|
||||
float onScreenRectCenterY, float fullscreenScaleX, float fullscreenScaleY,
|
||||
int drawableWidth, int drawableHeight, DeviceProfile dp,
|
||||
@StagePosition int stagePosition) {
|
||||
boolean pinToRight = stagePosition == STAGE_POSITION_BOTTOM_OR_RIGHT;
|
||||
if (!dp.isLandscape) {
|
||||
float inset = dp.getInsets().top;
|
||||
out.leftMargin = Math.round(onScreenRectCenterX / fullscreenScaleX
|
||||
- 1.0f * drawableWidth / 2);
|
||||
out.topMargin = Math.round((onScreenRectCenterY + (inset / 2f)) / fullscreenScaleY
|
||||
- 1.0f * drawableHeight / 2);
|
||||
} else {
|
||||
if (pinToRight) {
|
||||
float inset = dp.getInsets().right;
|
||||
out.leftMargin = Math.round((onScreenRectCenterX - (inset / 2f)) / fullscreenScaleX
|
||||
- 1.0f * drawableWidth / 2);
|
||||
} else {
|
||||
float inset = dp.getInsets().left;
|
||||
out.leftMargin = Math.round((onScreenRectCenterX + (inset / 2f)) / fullscreenScaleX
|
||||
- 1.0f * drawableWidth / 2);
|
||||
}
|
||||
out.topMargin = Math.round(onScreenRectCenterY / fullscreenScaleY
|
||||
- 1.0f * drawableHeight / 2);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getFinalSplitPlaceholderBounds(int splitDividerSize, DeviceProfile dp,
|
||||
@StagePosition int stagePosition, Rect out1, Rect out2) {
|
||||
|
||||
Reference in New Issue
Block a user