Merge "Fix issue with camera overlapping split staging UI" into tm-dev

This commit is contained in:
Jeremy Sim
2022-03-26 19:41:48 +00:00
committed by Android (Google) Code Review
5 changed files with 90 additions and 17 deletions

View File

@@ -27,6 +27,7 @@ import com.android.launcher3.Utilities;
import com.android.launcher3.anim.PendingAnimation;
import com.android.launcher3.statemanager.StatefulActivity;
import com.android.launcher3.touch.PagedOrientationHandler;
import com.android.launcher3.util.SplitConfigurationOptions;
import com.android.launcher3.views.BaseDragLayer;
import com.android.quickstep.util.MultiValueUpdateListener;
import com.android.quickstep.util.TaskCornerRadius;
@@ -53,6 +54,8 @@ public class FloatingTaskView extends FrameLayout {
private final boolean mIsRtl;
private final FullscreenDrawParams mFullscreenParams;
private PagedOrientationHandler mOrientationHandler;
@SplitConfigurationOptions.StagePosition
private int mStagePosition;
public FloatingTaskView(Context context) {
this(context, null);
@@ -95,6 +98,7 @@ public class FloatingTaskView extends FrameLayout {
RecentsView recentsView = launcher.getOverviewPanel();
mOrientationHandler = recentsView.getPagedOrientationHandler();
mStagePosition = recentsView.getSplitPlaceholder().getActiveSplitStagePosition();
mSplitPlaceholderView.setIcon(icon,
mContext.getResources().getDimensionPixelSize(R.dimen.split_placeholder_icon_size));
mSplitPlaceholderView.getIconView().setRotation(mOrientationHandler.getDegreesRotated());
@@ -215,7 +219,7 @@ public class FloatingTaskView extends FrameLayout {
transitionAnimator.addUpdateListener(listener);
}
public void drawRoundedRect(Canvas canvas, Paint paint) {
void drawRoundedRect(Canvas canvas, Paint paint) {
if (mFullscreenParams == null) {
return;
}
@@ -226,12 +230,21 @@ public class FloatingTaskView extends FrameLayout {
paint);
}
public float getFullscreenScaleX() {
return mFullscreenParams.mScaleX;
}
public float getFullscreenScaleY() {
return mFullscreenParams.mScaleY;
/**
* When a split is staged, center the icon in the staging area. Accounts for device insets.
* @param iconView The icon that should 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).
*/
void centerIconView(IconView iconView, float onScreenRectCenterX, float onScreenRectCenterY) {
FrameLayout.LayoutParams params = (FrameLayout.LayoutParams) iconView.getLayoutParams();
mOrientationHandler.updateStagedSplitIconParams(params, onScreenRectCenterX,
onScreenRectCenterY, mFullscreenParams.mScaleX, mFullscreenParams.mScaleY,
iconView.getDrawableWidth(), iconView.getDrawableHeight(),
mActivity.getDeviceProfile(), mStagePosition);
iconView.setLayoutParams(params);
}
private static class SplitOverlayProperties {

View File

@@ -68,13 +68,7 @@ public class SplitPlaceholderView extends FrameLayout {
// Center the icon view in the visible area.
getLocalVisibleRect(mTempRect);
FloatingTaskView parent = (FloatingTaskView) getParent();
FrameLayout.LayoutParams params =
(FrameLayout.LayoutParams) mIconView.getLayoutParams();
params.leftMargin = Math.round(mTempRect.centerX() / parent.getFullscreenScaleX()
- 1.0f * mIconView.getDrawableWidth() / 2);
params.topMargin = Math.round(mTempRect.centerY() / parent.getFullscreenScaleY()
- 1.0f * mIconView.getDrawableHeight() / 2);
mIconView.setLayoutParams(params);
parent.centerIconView(mIconView, mTempRect.centerX(), mTempRect.centerY());
}
}