Loading quickstep/src/com/android/quickstep/views/GroupedTaskView.java +2 −1 Original line number Diff line number Diff line Loading @@ -271,7 +271,8 @@ public class GroupedTaskView extends TaskView { getPagedOrientationHandler().setSplitIconParams(mIconView, mIconView2, taskIconHeight, mSnapshotView.getMeasuredWidth(), mSnapshotView.getMeasuredHeight(), isRtl, deviceProfile, mSplitBoundsConfig); getMeasuredHeight(), getMeasuredWidth(), isRtl, deviceProfile, mSplitBoundsConfig); } private void updateSecondaryDwbPlacement() { Loading src/com/android/launcher3/touch/LandscapePagedViewHandler.java +30 −5 Original line number Diff line number Diff line Loading @@ -16,6 +16,7 @@ package com.android.launcher3.touch; import static android.view.Gravity.BOTTOM; import static android.view.Gravity.CENTER_VERTICAL; import static android.view.Gravity.END; import static android.view.Gravity.START; Loading Loading @@ -468,18 +469,42 @@ public class LandscapePagedViewHandler implements PagedOrientationHandler { @Override public void setSplitIconParams(View primaryIconView, View secondaryIconView, int taskIconHeight, int primarySnapshotWidth, int primarySnapshotHeight, boolean isRtl, DeviceProfile deviceProfile, StagedSplitBounds splitConfig) { int groupedTaskViewHeight, int groupedTaskViewWidth, boolean isRtl, DeviceProfile deviceProfile, StagedSplitBounds splitConfig) { FrameLayout.LayoutParams primaryIconParams = (FrameLayout.LayoutParams) primaryIconView.getLayoutParams(); FrameLayout.LayoutParams secondaryIconParams = new FrameLayout.LayoutParams(primaryIconParams); primaryIconParams.gravity = CENTER_VERTICAL | (isRtl ? START : END); // We calculate the "midpoint" of the thumbnail area, and place the icons there. // This is the place where the thumbnail area splits by default, in a near-50/50 split. // It is usually not exactly 50/50, due to insets/screen cutouts. int fullscreenInsetThickness = deviceProfile.getInsets().top; int fullscreenMidpointFromBottom = ((deviceProfile.heightPx - fullscreenInsetThickness) / 2); float midpointFromBottomPct = (float) fullscreenMidpointFromBottom / deviceProfile.heightPx; float insetPct = (float) fullscreenInsetThickness / deviceProfile.heightPx; int spaceAboveSnapshots = deviceProfile.overviewTaskThumbnailTopMarginPx; int overviewThumbnailAreaThickness = groupedTaskViewHeight - spaceAboveSnapshots; int bottomToMidpointOffset = (int) (overviewThumbnailAreaThickness * midpointFromBottomPct); int insetOffset = (int) (overviewThumbnailAreaThickness * insetPct); primaryIconParams.gravity = BOTTOM | (isRtl ? START : END); secondaryIconParams.gravity = BOTTOM | (isRtl ? START : END); primaryIconView.setTranslationX(0); primaryIconView.setTranslationY(-(taskIconHeight / 2f)); secondaryIconParams.gravity = CENTER_VERTICAL | (isRtl ? START : END); secondaryIconView.setTranslationX(0); secondaryIconView.setTranslationY(taskIconHeight / 2f); if (splitConfig.initiatedFromSeascape) { // if the split was initiated from seascape, // the task on the right (secondary) is slightly larger primaryIconView.setTranslationY(-bottomToMidpointOffset - insetOffset); secondaryIconView.setTranslationY(-bottomToMidpointOffset - insetOffset + taskIconHeight); } else { // if not, // the task on the left (primary) is slightly larger primaryIconView.setTranslationY(-bottomToMidpointOffset); secondaryIconView.setTranslationY(-bottomToMidpointOffset + taskIconHeight); } primaryIconView.setLayoutParams(primaryIconParams); secondaryIconView.setLayoutParams(secondaryIconParams); Loading src/com/android/launcher3/touch/PagedOrientationHandler.java +2 −1 Original line number Diff line number Diff line Loading @@ -146,7 +146,8 @@ public interface PagedOrientationHandler { int taskIconMargin, int taskIconHeight, int thumbnailTopMargin, boolean isRtl); void setSplitIconParams(View primaryIconView, View secondaryIconView, int taskIconHeight, int primarySnapshotWidth, int primarySnapshotHeight, boolean isRtl, DeviceProfile deviceProfile, StagedSplitBounds splitConfig); int groupedTaskViewHeight, int groupedTaskViewWidth, boolean isRtl, DeviceProfile deviceProfile, StagedSplitBounds splitConfig); /* * The following two methods try to center the TaskMenuView in landscape by finding the center Loading src/com/android/launcher3/touch/PortraitPagedViewHandler.java +59 −6 Original line number Diff line number Diff line Loading @@ -18,6 +18,7 @@ package com.android.launcher3.touch; import static android.view.Gravity.BOTTOM; import static android.view.Gravity.CENTER_HORIZONTAL; import static android.view.Gravity.END; import static android.view.Gravity.START; import static android.view.Gravity.TOP; import static android.view.ViewGroup.LayoutParams.MATCH_PARENT; Loading Loading @@ -565,18 +566,70 @@ public class PortraitPagedViewHandler implements PagedOrientationHandler { @Override public void setSplitIconParams(View primaryIconView, View secondaryIconView, int taskIconHeight, int primarySnapshotWidth, int primarySnapshotHeight, boolean isRtl, DeviceProfile deviceProfile, StagedSplitBounds splitConfig) { int groupedTaskViewHeight, int groupedTaskViewWidth, boolean isRtl, DeviceProfile deviceProfile, StagedSplitBounds splitConfig) { FrameLayout.LayoutParams primaryIconParams = (FrameLayout.LayoutParams) primaryIconView.getLayoutParams(); FrameLayout.LayoutParams secondaryIconParams = new FrameLayout.LayoutParams(primaryIconParams); if (deviceProfile.isLandscape) { // We calculate the "midpoint" of the thumbnail area, and place the icons there. // This is the place where the thumbnail area splits by default, in a near-50/50 split. // It is usually not exactly 50/50, due to insets/screen cutouts. int fullscreenInsetThickness = deviceProfile.isSeascape() ? deviceProfile.getInsets().right : deviceProfile.getInsets().left; int fullscreenMidpointFromBottom = ((deviceProfile.widthPx - fullscreenInsetThickness) / 2); float midpointFromBottomPct = (float) fullscreenMidpointFromBottom / deviceProfile.widthPx; float insetPct = (float) fullscreenInsetThickness / deviceProfile.widthPx; int spaceAboveSnapshots = 0; int overviewThumbnailAreaThickness = groupedTaskViewWidth - spaceAboveSnapshots; int bottomToMidpointOffset = (int) (overviewThumbnailAreaThickness * midpointFromBottomPct); int insetOffset = (int) (overviewThumbnailAreaThickness * insetPct); if (deviceProfile.isSeascape()) { primaryIconParams.gravity = TOP | (isRtl ? END : START); secondaryIconParams.gravity = TOP | (isRtl ? END : START); if (splitConfig.initiatedFromSeascape) { // if the split was initiated from seascape, // the task on the right (secondary) is slightly larger primaryIconView.setTranslationX(bottomToMidpointOffset - taskIconHeight); secondaryIconView.setTranslationX(bottomToMidpointOffset); } else { // if not, // the task on the left (primary) is slightly larger primaryIconView.setTranslationX(bottomToMidpointOffset + insetOffset - taskIconHeight); secondaryIconView.setTranslationX(bottomToMidpointOffset + insetOffset); } } else { primaryIconParams.gravity = TOP | (isRtl ? START : END); secondaryIconParams.gravity = TOP | (isRtl ? START : END); if (!splitConfig.initiatedFromSeascape) { // if the split was initiated from landscape, // the task on the left (primary) is slightly larger primaryIconView.setTranslationX(-bottomToMidpointOffset); secondaryIconView.setTranslationX(-bottomToMidpointOffset + taskIconHeight); } else { // if not, // the task on the right (secondary) is slightly larger primaryIconView.setTranslationX(-bottomToMidpointOffset - insetOffset); secondaryIconView.setTranslationX(-bottomToMidpointOffset - insetOffset + taskIconHeight); } } } else { primaryIconParams.gravity = TOP | CENTER_HORIZONTAL; // shifts icon half a width left (height is used conveniently here since icons are square) // shifts icon half a width left (height is used here since icons are square) primaryIconView.setTranslationX(-(taskIconHeight / 2f)); primaryIconView.setTranslationY(0); secondaryIconParams.gravity = TOP | CENTER_HORIZONTAL; secondaryIconView.setTranslationX(taskIconHeight / 2f); } primaryIconView.setTranslationY(0); secondaryIconView.setTranslationY(0); primaryIconView.setLayoutParams(primaryIconParams); Loading src/com/android/launcher3/touch/SeascapePagedViewHandler.java +34 −4 Original line number Diff line number Diff line Loading @@ -178,16 +178,46 @@ public class SeascapePagedViewHandler extends LandscapePagedViewHandler { @Override public void setSplitIconParams(View primaryIconView, View secondaryIconView, int taskIconHeight, int primarySnapshotWidth, int primarySnapshotHeight, boolean isRtl, DeviceProfile deviceProfile, StagedSplitBounds splitConfig) { int groupedTaskViewHeight, int groupedTaskViewWidth, boolean isRtl, DeviceProfile deviceProfile, StagedSplitBounds splitConfig) { super.setSplitIconParams(primaryIconView, secondaryIconView, taskIconHeight, primarySnapshotWidth, primarySnapshotHeight, isRtl, deviceProfile, splitConfig); primarySnapshotWidth, primarySnapshotHeight, groupedTaskViewHeight, groupedTaskViewWidth, isRtl, deviceProfile, splitConfig); FrameLayout.LayoutParams primaryIconParams = (FrameLayout.LayoutParams) primaryIconView.getLayoutParams(); FrameLayout.LayoutParams secondaryIconParams = (FrameLayout.LayoutParams) secondaryIconView.getLayoutParams(); primaryIconParams.gravity = CENTER_VERTICAL | (isRtl ? END : START); secondaryIconParams.gravity = CENTER_VERTICAL | (isRtl ? END : START); // We calculate the "midpoint" of the thumbnail area, and place the icons there. // This is the place where the thumbnail area splits by default, in a near-50/50 split. // It is usually not exactly 50/50, due to insets/screen cutouts. int fullscreenInsetThickness = deviceProfile.getInsets().top; int fullscreenMidpointFromBottom = ((deviceProfile.heightPx - fullscreenInsetThickness) / 2); float midpointFromBottomPct = (float) fullscreenMidpointFromBottom / deviceProfile.heightPx; float insetPct = (float) fullscreenInsetThickness / deviceProfile.heightPx; int spaceAboveSnapshots = deviceProfile.overviewTaskThumbnailTopMarginPx; int overviewThumbnailAreaThickness = groupedTaskViewHeight - spaceAboveSnapshots; int bottomToMidpointOffset = (int) (overviewThumbnailAreaThickness * midpointFromBottomPct); int insetOffset = (int) (overviewThumbnailAreaThickness * insetPct); primaryIconParams.gravity = BOTTOM | (isRtl ? END : START); secondaryIconParams.gravity = BOTTOM | (isRtl ? END : START); primaryIconView.setTranslationX(0); secondaryIconView.setTranslationX(0); if (splitConfig.initiatedFromSeascape) { // if the split was initiated from seascape, // the task on the right (secondary) is slightly larger primaryIconView.setTranslationY(-bottomToMidpointOffset - insetOffset); secondaryIconView.setTranslationY(-bottomToMidpointOffset - insetOffset + taskIconHeight); } else { // if not, // the task on the left (primary) is slightly larger primaryIconView.setTranslationY(-bottomToMidpointOffset); secondaryIconView.setTranslationY(-bottomToMidpointOffset + taskIconHeight); } primaryIconView.setLayoutParams(primaryIconParams); secondaryIconView.setLayoutParams(secondaryIconParams); } Loading Loading
quickstep/src/com/android/quickstep/views/GroupedTaskView.java +2 −1 Original line number Diff line number Diff line Loading @@ -271,7 +271,8 @@ public class GroupedTaskView extends TaskView { getPagedOrientationHandler().setSplitIconParams(mIconView, mIconView2, taskIconHeight, mSnapshotView.getMeasuredWidth(), mSnapshotView.getMeasuredHeight(), isRtl, deviceProfile, mSplitBoundsConfig); getMeasuredHeight(), getMeasuredWidth(), isRtl, deviceProfile, mSplitBoundsConfig); } private void updateSecondaryDwbPlacement() { Loading
src/com/android/launcher3/touch/LandscapePagedViewHandler.java +30 −5 Original line number Diff line number Diff line Loading @@ -16,6 +16,7 @@ package com.android.launcher3.touch; import static android.view.Gravity.BOTTOM; import static android.view.Gravity.CENTER_VERTICAL; import static android.view.Gravity.END; import static android.view.Gravity.START; Loading Loading @@ -468,18 +469,42 @@ public class LandscapePagedViewHandler implements PagedOrientationHandler { @Override public void setSplitIconParams(View primaryIconView, View secondaryIconView, int taskIconHeight, int primarySnapshotWidth, int primarySnapshotHeight, boolean isRtl, DeviceProfile deviceProfile, StagedSplitBounds splitConfig) { int groupedTaskViewHeight, int groupedTaskViewWidth, boolean isRtl, DeviceProfile deviceProfile, StagedSplitBounds splitConfig) { FrameLayout.LayoutParams primaryIconParams = (FrameLayout.LayoutParams) primaryIconView.getLayoutParams(); FrameLayout.LayoutParams secondaryIconParams = new FrameLayout.LayoutParams(primaryIconParams); primaryIconParams.gravity = CENTER_VERTICAL | (isRtl ? START : END); // We calculate the "midpoint" of the thumbnail area, and place the icons there. // This is the place where the thumbnail area splits by default, in a near-50/50 split. // It is usually not exactly 50/50, due to insets/screen cutouts. int fullscreenInsetThickness = deviceProfile.getInsets().top; int fullscreenMidpointFromBottom = ((deviceProfile.heightPx - fullscreenInsetThickness) / 2); float midpointFromBottomPct = (float) fullscreenMidpointFromBottom / deviceProfile.heightPx; float insetPct = (float) fullscreenInsetThickness / deviceProfile.heightPx; int spaceAboveSnapshots = deviceProfile.overviewTaskThumbnailTopMarginPx; int overviewThumbnailAreaThickness = groupedTaskViewHeight - spaceAboveSnapshots; int bottomToMidpointOffset = (int) (overviewThumbnailAreaThickness * midpointFromBottomPct); int insetOffset = (int) (overviewThumbnailAreaThickness * insetPct); primaryIconParams.gravity = BOTTOM | (isRtl ? START : END); secondaryIconParams.gravity = BOTTOM | (isRtl ? START : END); primaryIconView.setTranslationX(0); primaryIconView.setTranslationY(-(taskIconHeight / 2f)); secondaryIconParams.gravity = CENTER_VERTICAL | (isRtl ? START : END); secondaryIconView.setTranslationX(0); secondaryIconView.setTranslationY(taskIconHeight / 2f); if (splitConfig.initiatedFromSeascape) { // if the split was initiated from seascape, // the task on the right (secondary) is slightly larger primaryIconView.setTranslationY(-bottomToMidpointOffset - insetOffset); secondaryIconView.setTranslationY(-bottomToMidpointOffset - insetOffset + taskIconHeight); } else { // if not, // the task on the left (primary) is slightly larger primaryIconView.setTranslationY(-bottomToMidpointOffset); secondaryIconView.setTranslationY(-bottomToMidpointOffset + taskIconHeight); } primaryIconView.setLayoutParams(primaryIconParams); secondaryIconView.setLayoutParams(secondaryIconParams); Loading
src/com/android/launcher3/touch/PagedOrientationHandler.java +2 −1 Original line number Diff line number Diff line Loading @@ -146,7 +146,8 @@ public interface PagedOrientationHandler { int taskIconMargin, int taskIconHeight, int thumbnailTopMargin, boolean isRtl); void setSplitIconParams(View primaryIconView, View secondaryIconView, int taskIconHeight, int primarySnapshotWidth, int primarySnapshotHeight, boolean isRtl, DeviceProfile deviceProfile, StagedSplitBounds splitConfig); int groupedTaskViewHeight, int groupedTaskViewWidth, boolean isRtl, DeviceProfile deviceProfile, StagedSplitBounds splitConfig); /* * The following two methods try to center the TaskMenuView in landscape by finding the center Loading
src/com/android/launcher3/touch/PortraitPagedViewHandler.java +59 −6 Original line number Diff line number Diff line Loading @@ -18,6 +18,7 @@ package com.android.launcher3.touch; import static android.view.Gravity.BOTTOM; import static android.view.Gravity.CENTER_HORIZONTAL; import static android.view.Gravity.END; import static android.view.Gravity.START; import static android.view.Gravity.TOP; import static android.view.ViewGroup.LayoutParams.MATCH_PARENT; Loading Loading @@ -565,18 +566,70 @@ public class PortraitPagedViewHandler implements PagedOrientationHandler { @Override public void setSplitIconParams(View primaryIconView, View secondaryIconView, int taskIconHeight, int primarySnapshotWidth, int primarySnapshotHeight, boolean isRtl, DeviceProfile deviceProfile, StagedSplitBounds splitConfig) { int groupedTaskViewHeight, int groupedTaskViewWidth, boolean isRtl, DeviceProfile deviceProfile, StagedSplitBounds splitConfig) { FrameLayout.LayoutParams primaryIconParams = (FrameLayout.LayoutParams) primaryIconView.getLayoutParams(); FrameLayout.LayoutParams secondaryIconParams = new FrameLayout.LayoutParams(primaryIconParams); if (deviceProfile.isLandscape) { // We calculate the "midpoint" of the thumbnail area, and place the icons there. // This is the place where the thumbnail area splits by default, in a near-50/50 split. // It is usually not exactly 50/50, due to insets/screen cutouts. int fullscreenInsetThickness = deviceProfile.isSeascape() ? deviceProfile.getInsets().right : deviceProfile.getInsets().left; int fullscreenMidpointFromBottom = ((deviceProfile.widthPx - fullscreenInsetThickness) / 2); float midpointFromBottomPct = (float) fullscreenMidpointFromBottom / deviceProfile.widthPx; float insetPct = (float) fullscreenInsetThickness / deviceProfile.widthPx; int spaceAboveSnapshots = 0; int overviewThumbnailAreaThickness = groupedTaskViewWidth - spaceAboveSnapshots; int bottomToMidpointOffset = (int) (overviewThumbnailAreaThickness * midpointFromBottomPct); int insetOffset = (int) (overviewThumbnailAreaThickness * insetPct); if (deviceProfile.isSeascape()) { primaryIconParams.gravity = TOP | (isRtl ? END : START); secondaryIconParams.gravity = TOP | (isRtl ? END : START); if (splitConfig.initiatedFromSeascape) { // if the split was initiated from seascape, // the task on the right (secondary) is slightly larger primaryIconView.setTranslationX(bottomToMidpointOffset - taskIconHeight); secondaryIconView.setTranslationX(bottomToMidpointOffset); } else { // if not, // the task on the left (primary) is slightly larger primaryIconView.setTranslationX(bottomToMidpointOffset + insetOffset - taskIconHeight); secondaryIconView.setTranslationX(bottomToMidpointOffset + insetOffset); } } else { primaryIconParams.gravity = TOP | (isRtl ? START : END); secondaryIconParams.gravity = TOP | (isRtl ? START : END); if (!splitConfig.initiatedFromSeascape) { // if the split was initiated from landscape, // the task on the left (primary) is slightly larger primaryIconView.setTranslationX(-bottomToMidpointOffset); secondaryIconView.setTranslationX(-bottomToMidpointOffset + taskIconHeight); } else { // if not, // the task on the right (secondary) is slightly larger primaryIconView.setTranslationX(-bottomToMidpointOffset - insetOffset); secondaryIconView.setTranslationX(-bottomToMidpointOffset - insetOffset + taskIconHeight); } } } else { primaryIconParams.gravity = TOP | CENTER_HORIZONTAL; // shifts icon half a width left (height is used conveniently here since icons are square) // shifts icon half a width left (height is used here since icons are square) primaryIconView.setTranslationX(-(taskIconHeight / 2f)); primaryIconView.setTranslationY(0); secondaryIconParams.gravity = TOP | CENTER_HORIZONTAL; secondaryIconView.setTranslationX(taskIconHeight / 2f); } primaryIconView.setTranslationY(0); secondaryIconView.setTranslationY(0); primaryIconView.setLayoutParams(primaryIconParams); Loading
src/com/android/launcher3/touch/SeascapePagedViewHandler.java +34 −4 Original line number Diff line number Diff line Loading @@ -178,16 +178,46 @@ public class SeascapePagedViewHandler extends LandscapePagedViewHandler { @Override public void setSplitIconParams(View primaryIconView, View secondaryIconView, int taskIconHeight, int primarySnapshotWidth, int primarySnapshotHeight, boolean isRtl, DeviceProfile deviceProfile, StagedSplitBounds splitConfig) { int groupedTaskViewHeight, int groupedTaskViewWidth, boolean isRtl, DeviceProfile deviceProfile, StagedSplitBounds splitConfig) { super.setSplitIconParams(primaryIconView, secondaryIconView, taskIconHeight, primarySnapshotWidth, primarySnapshotHeight, isRtl, deviceProfile, splitConfig); primarySnapshotWidth, primarySnapshotHeight, groupedTaskViewHeight, groupedTaskViewWidth, isRtl, deviceProfile, splitConfig); FrameLayout.LayoutParams primaryIconParams = (FrameLayout.LayoutParams) primaryIconView.getLayoutParams(); FrameLayout.LayoutParams secondaryIconParams = (FrameLayout.LayoutParams) secondaryIconView.getLayoutParams(); primaryIconParams.gravity = CENTER_VERTICAL | (isRtl ? END : START); secondaryIconParams.gravity = CENTER_VERTICAL | (isRtl ? END : START); // We calculate the "midpoint" of the thumbnail area, and place the icons there. // This is the place where the thumbnail area splits by default, in a near-50/50 split. // It is usually not exactly 50/50, due to insets/screen cutouts. int fullscreenInsetThickness = deviceProfile.getInsets().top; int fullscreenMidpointFromBottom = ((deviceProfile.heightPx - fullscreenInsetThickness) / 2); float midpointFromBottomPct = (float) fullscreenMidpointFromBottom / deviceProfile.heightPx; float insetPct = (float) fullscreenInsetThickness / deviceProfile.heightPx; int spaceAboveSnapshots = deviceProfile.overviewTaskThumbnailTopMarginPx; int overviewThumbnailAreaThickness = groupedTaskViewHeight - spaceAboveSnapshots; int bottomToMidpointOffset = (int) (overviewThumbnailAreaThickness * midpointFromBottomPct); int insetOffset = (int) (overviewThumbnailAreaThickness * insetPct); primaryIconParams.gravity = BOTTOM | (isRtl ? END : START); secondaryIconParams.gravity = BOTTOM | (isRtl ? END : START); primaryIconView.setTranslationX(0); secondaryIconView.setTranslationX(0); if (splitConfig.initiatedFromSeascape) { // if the split was initiated from seascape, // the task on the right (secondary) is slightly larger primaryIconView.setTranslationY(-bottomToMidpointOffset - insetOffset); secondaryIconView.setTranslationY(-bottomToMidpointOffset - insetOffset + taskIconHeight); } else { // if not, // the task on the left (primary) is slightly larger primaryIconView.setTranslationY(-bottomToMidpointOffset); secondaryIconView.setTranslationY(-bottomToMidpointOffset + taskIconHeight); } primaryIconView.setLayoutParams(primaryIconParams); secondaryIconView.setLayoutParams(secondaryIconParams); } Loading