Update Icon App Chip Menu to new specs.
Fix: 304228083 Test: TaplOverviewIconAppChipMenuTest Flag: ACONFIG com.android.launcher3.enable_overview_icon_menu DEVELOPMENT Change-Id: Ib018c7f59e1141b6f21618b28d411facc937ac7c
This commit is contained in:
@@ -21,6 +21,8 @@ import static android.view.Gravity.CENTER_VERTICAL;
|
||||
import static android.view.Gravity.END;
|
||||
import static android.view.Gravity.RIGHT;
|
||||
import static android.view.Gravity.START;
|
||||
import static android.view.Gravity.TOP;
|
||||
import static android.view.View.LAYOUT_DIRECTION_RTL;
|
||||
|
||||
import static com.android.launcher3.Flags.enableOverviewIconMenu;
|
||||
import static com.android.launcher3.touch.SingleAxisSwipeDetector.HORIZONTAL;
|
||||
@@ -32,6 +34,7 @@ import android.content.res.Resources;
|
||||
import android.graphics.PointF;
|
||||
import android.graphics.Rect;
|
||||
import android.util.Pair;
|
||||
import android.view.Gravity;
|
||||
import android.view.Surface;
|
||||
import android.view.View;
|
||||
import android.widget.FrameLayout;
|
||||
@@ -89,7 +92,7 @@ public class SeascapePagedViewHandler extends LandscapePagedViewHandler {
|
||||
public float getTaskMenuX(float x, View thumbnailView,
|
||||
DeviceProfile deviceProfile, float taskInsetMargin, View taskViewIcon) {
|
||||
if (enableOverviewIconMenu()) {
|
||||
return x + taskViewIcon.getHeight() + taskInsetMargin * 2;
|
||||
return x + (taskViewIcon.getHeight() * 2);
|
||||
}
|
||||
return x + taskInsetMargin;
|
||||
}
|
||||
@@ -98,7 +101,9 @@ public class SeascapePagedViewHandler extends LandscapePagedViewHandler {
|
||||
public float getTaskMenuY(float y, View thumbnailView, int stagePosition,
|
||||
View taskMenuView, float taskInsetMargin, View taskViewIcon) {
|
||||
if (enableOverviewIconMenu()) {
|
||||
return y + taskViewIcon.getWidth() - taskViewIcon.getHeight();
|
||||
return y + taskViewIcon.getWidth() + (
|
||||
thumbnailView.getLayoutDirection() == LAYOUT_DIRECTION_RTL ? taskInsetMargin
|
||||
/ 2f : -taskViewIcon.getHeight());
|
||||
}
|
||||
BaseDragLayer.LayoutParams lp = (BaseDragLayer.LayoutParams) taskMenuView.getLayoutParams();
|
||||
int taskMenuWidth = lp.width;
|
||||
@@ -134,7 +139,7 @@ public class SeascapePagedViewHandler extends LandscapePagedViewHandler {
|
||||
public Pair<Float, Float> getDwbLayoutTranslations(int taskViewWidth,
|
||||
int taskViewHeight, SplitBounds splitBounds, DeviceProfile deviceProfile,
|
||||
View[] thumbnailViews, int desiredTaskId, View banner) {
|
||||
boolean isRtl = banner.getLayoutDirection() == View.LAYOUT_DIRECTION_RTL;
|
||||
boolean isRtl = banner.getLayoutDirection() == LAYOUT_DIRECTION_RTL;
|
||||
float translationX = 0;
|
||||
float translationY = 0;
|
||||
FrameLayout.LayoutParams bannerParams = (FrameLayout.LayoutParams) banner.getLayoutParams();
|
||||
@@ -214,22 +219,37 @@ public class SeascapePagedViewHandler extends LandscapePagedViewHandler {
|
||||
@Override
|
||||
public void setTaskIconParams(FrameLayout.LayoutParams iconParams,
|
||||
int taskIconMargin, int taskIconHeight, int thumbnailTopMargin, boolean isRtl) {
|
||||
iconParams.gravity = (isRtl ? END : START) | CENTER_VERTICAL;
|
||||
iconParams.leftMargin =
|
||||
enableOverviewIconMenu() ? 0 : -taskIconHeight - taskIconMargin / 2;
|
||||
iconParams.rightMargin = 0;
|
||||
iconParams.topMargin = enableOverviewIconMenu() ? 0 : thumbnailTopMargin / 2;
|
||||
iconParams.bottomMargin = 0;
|
||||
if (enableOverviewIconMenu()) {
|
||||
iconParams.setMarginStart(taskIconMargin);
|
||||
iconParams.gravity = Gravity.START | Gravity.CENTER_VERTICAL;
|
||||
iconParams.leftMargin = 0;
|
||||
iconParams.topMargin = 0;
|
||||
} else {
|
||||
iconParams.gravity = (isRtl ? END : START) | CENTER_VERTICAL;
|
||||
iconParams.leftMargin = -taskIconHeight - taskIconMargin / 2;
|
||||
iconParams.topMargin = thumbnailTopMargin / 2;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setTaskIconMenuParams(FrameLayout.LayoutParams iconMenuParams, int iconMenuMargin,
|
||||
int thumbnailTopMargin) {
|
||||
iconMenuParams.gravity = BOTTOM | START;
|
||||
public void setIconAppChipMenuParams(View iconAppChipMenuView,
|
||||
FrameLayout.LayoutParams iconMenuParams, int iconMenuMargin, int thumbnailTopMargin) {
|
||||
boolean isRtl = iconAppChipMenuView.getLayoutDirection() == LAYOUT_DIRECTION_RTL;
|
||||
iconMenuParams.gravity = (isRtl ? TOP : BOTTOM) | (isRtl ? END : START);
|
||||
iconMenuParams.setMarginStart(0);
|
||||
iconMenuParams.topMargin = 0;
|
||||
iconMenuParams.topMargin = isRtl ? iconMenuMargin : 0;
|
||||
iconMenuParams.bottomMargin = 0;
|
||||
iconMenuParams.setMarginEnd(0);
|
||||
iconMenuParams.setMarginEnd(isRtl ? thumbnailTopMargin : 0);
|
||||
|
||||
// Use half menu height to place the pivot within the X/Y center of icon in the menu.
|
||||
float iconCenter = iconAppChipMenuView.getHeight() / 2f;
|
||||
iconAppChipMenuView.setPivotX(isRtl ? iconMenuParams.width / 2f : iconCenter);
|
||||
iconAppChipMenuView.setPivotY(
|
||||
isRtl ? iconMenuParams.width / 2f : iconCenter - iconMenuMargin);
|
||||
iconAppChipMenuView.setTranslationY(0);
|
||||
iconAppChipMenuView.setRotation(getDegreesRotated());
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -259,14 +279,19 @@ public class SeascapePagedViewHandler extends LandscapePagedViewHandler {
|
||||
int bottomToMidpointOffset = (int) (overviewThumbnailAreaThickness * midpointFromBottomPct);
|
||||
int insetOffset = (int) (overviewThumbnailAreaThickness * insetPct);
|
||||
|
||||
primaryIconParams.gravity = BOTTOM | (isRtl ? END : START);
|
||||
secondaryIconParams.gravity = BOTTOM | (isRtl ? END : START);
|
||||
int gravity = (isRtl ? TOP : BOTTOM) | (isRtl ? END : START);
|
||||
primaryIconParams.gravity = gravity;
|
||||
secondaryIconParams.gravity = gravity;
|
||||
primaryIconView.setTranslationX(0);
|
||||
secondaryIconView.setTranslationX(0);
|
||||
if (enableOverviewIconMenu()) {
|
||||
int dividerThickness = Math.min(splitConfig.visualDividerBounds.width(),
|
||||
splitConfig.visualDividerBounds.height());
|
||||
secondaryIconView.setTranslationY(-primarySnapshotHeight - dividerThickness);
|
||||
if (primaryIconView.getLayoutDirection() == LAYOUT_DIRECTION_RTL) {
|
||||
primaryIconView.setTranslationY(groupedTaskViewHeight - primarySnapshotHeight);
|
||||
secondaryIconView.setTranslationY(0);
|
||||
} else {
|
||||
secondaryIconView.setTranslationY(-primarySnapshotHeight);
|
||||
primaryIconView.setTranslationY(0);
|
||||
}
|
||||
} else if (splitConfig.initiatedFromSeascape) {
|
||||
// if the split was initiated from seascape,
|
||||
// the task on the right (secondary) is slightly larger
|
||||
|
||||
Reference in New Issue
Block a user