Merge "Take margin insets into account when setting position" into sc-dev am: 0f3053ceae
Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/apps/Launcher3/+/15152173 Change-Id: Ib3639aeb91dabbb4283d21e3e6cb6da69af08d23
This commit is contained in:
commit
0a740a074a
|
@ -1683,7 +1683,6 @@ public abstract class RecentsView<ACTIVITY_TYPE extends StatefulActivity<STATE_T
|
|||
pa.addListener(AnimatorListeners.forSuccessCallback(() -> {
|
||||
setLayoutRotation(newRotation, mOrientationState.getDisplayRotation());
|
||||
mActivity.getDragLayer().recreateControllers();
|
||||
updateChildTaskOrientations();
|
||||
setRecentsChangedOrientation(false).start();
|
||||
}));
|
||||
pa.start();
|
||||
|
|
|
@ -59,6 +59,7 @@ public class TaskMenuView extends AbstractFloatingView implements OnScrollChange
|
|||
|
||||
private static final int REVEAL_OPEN_DURATION = 150;
|
||||
private static final int REVEAL_CLOSE_DURATION = 100;
|
||||
private final float mTaskInsetMargin;
|
||||
|
||||
private BaseDraggingActivity mActivity;
|
||||
private TextView mTaskName;
|
||||
|
@ -75,6 +76,7 @@ public class TaskMenuView extends AbstractFloatingView implements OnScrollChange
|
|||
|
||||
mActivity = BaseDraggingActivity.fromContext(context);
|
||||
setClipToOutline(true);
|
||||
mTaskInsetMargin = getResources().getDimension(R.dimen.task_card_margin);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -124,8 +126,13 @@ public class TaskMenuView extends AbstractFloatingView implements OnScrollChange
|
|||
|
||||
private void setPosition(float x, float y, int overscrollShift) {
|
||||
PagedOrientationHandler pagedOrientationHandler = mTaskView.getPagedOrientationHandler();
|
||||
// Inset due to margin
|
||||
PointF additionalInset = pagedOrientationHandler
|
||||
.getAdditionalInsetForTaskMenu(mTaskInsetMargin);
|
||||
int taskTopMargin = mActivity.getDeviceProfile().overviewTaskThumbnailTopMarginPx;
|
||||
float adjustedY = y + taskTopMargin;
|
||||
|
||||
float adjustedY = y + taskTopMargin - additionalInset.y;
|
||||
float adjustedX = x - additionalInset.x;
|
||||
// Changing pivot to make computations easier
|
||||
// NOTE: Changing the pivots means the rotated view gets rotated about the new pivots set,
|
||||
// which would render the X and Y position set here incorrect
|
||||
|
@ -137,7 +144,8 @@ public class TaskMenuView extends AbstractFloatingView implements OnScrollChange
|
|||
setPivotY(0);
|
||||
}
|
||||
setRotation(pagedOrientationHandler.getDegreesRotated());
|
||||
setX(pagedOrientationHandler.getTaskMenuX(x, mTaskView.getThumbnail(), overscrollShift));
|
||||
setX(pagedOrientationHandler.getTaskMenuX(adjustedX,
|
||||
mTaskView.getThumbnail(), overscrollShift));
|
||||
setY(pagedOrientationHandler.getTaskMenuY(
|
||||
adjustedY, mTaskView.getThumbnail(), overscrollShift));
|
||||
}
|
||||
|
@ -228,8 +236,7 @@ public class TaskMenuView extends AbstractFloatingView implements OnScrollChange
|
|||
private void orientAroundTaskView(TaskView taskView) {
|
||||
PagedOrientationHandler orientationHandler = taskView.getPagedOrientationHandler();
|
||||
measure(MeasureSpec.UNSPECIFIED, MeasureSpec.UNSPECIFIED);
|
||||
float taskInsetMargin = getResources().getDimension(R.dimen.task_card_margin);
|
||||
orientationHandler.setTaskMenuAroundTaskView(this, taskInsetMargin);
|
||||
orientationHandler.setTaskMenuAroundTaskView(this, mTaskInsetMargin);
|
||||
mActivity.getDragLayer().getDescendantRectRelativeToSelf(taskView, sTempRect);
|
||||
Rect insets = mActivity.getDragLayer().getInsets();
|
||||
BaseDragLayer.LayoutParams params = (BaseDragLayer.LayoutParams) getLayoutParams();
|
||||
|
@ -243,9 +250,6 @@ public class TaskMenuView extends AbstractFloatingView implements OnScrollChange
|
|||
setScaleY(taskView.getScaleY());
|
||||
orientationHandler.setTaskOptionsMenuLayoutOrientation(
|
||||
mActivity.getDeviceProfile(), mOptionLayout);
|
||||
PointF additionalInset = orientationHandler.getAdditionalInsetForTaskMenu(taskInsetMargin);
|
||||
insets.left += additionalInset.x;
|
||||
insets.top += additionalInset.y;
|
||||
setPosition(sTempRect.left - insets.left, sTempRect.top - insets.top, 0);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue