mirror of
https://github.com/LawnchairLauncher/lawnchair.git
synced 2026-03-04 01:46:49 +00:00
Add Split button in OverviewActions
Shows up only for large screen devices, not phones. Tested for NexusLauncher, general 3P launcher support needed for staged split (TODO b/195607777) Bug: 195423591 Change-Id: I4d455769b17637174b590c640516b9fbb6352c3d
This commit is contained in:
@@ -44,6 +44,7 @@ import com.android.launcher3.R;
|
||||
import com.android.launcher3.Utilities;
|
||||
import com.android.launcher3.util.SplitConfigurationOptions;
|
||||
import com.android.launcher3.util.SplitConfigurationOptions.SplitPositionOption;
|
||||
import com.android.launcher3.util.SplitConfigurationOptions.StagePosition;
|
||||
import com.android.launcher3.views.BaseDragLayer;
|
||||
|
||||
import java.util.ArrayList;
|
||||
@@ -165,9 +166,13 @@ public class PortraitPagedViewHandler implements PagedOrientationHandler {
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getSplitTaskViewDismissDirection(SplitPositionOption splitPosition,
|
||||
public int getSplitTaskViewDismissDirection(@StagePosition int stagePosition,
|
||||
DeviceProfile dp) {
|
||||
if (splitPosition.stagePosition == STAGE_POSITION_TOP_OR_LEFT) {
|
||||
//<<<<<<< HEAD
|
||||
// if (splitPosition.stagePosition == STAGE_POSITION_TOP_OR_LEFT) {
|
||||
//=======
|
||||
if (stagePosition == STAGE_POSITION_TOP_OR_LEFT) {
|
||||
//>>>>>>> f6769c8532 (Add Split button in OverviewActions)
|
||||
if (dp.isLandscape) {
|
||||
// Left side
|
||||
return SPLIT_TRANSLATE_PRIMARY_NEGATIVE;
|
||||
@@ -175,12 +180,20 @@ public class PortraitPagedViewHandler implements PagedOrientationHandler {
|
||||
// Top side
|
||||
return SPLIT_TRANSLATE_SECONDARY_NEGATIVE;
|
||||
}
|
||||
} else if (splitPosition.stagePosition == STAGE_POSITION_BOTTOM_OR_RIGHT) {
|
||||
//<<<<<<< HEAD
|
||||
// } else if (splitPosition.stagePosition == STAGE_POSITION_BOTTOM_OR_RIGHT) {
|
||||
// We don't have a bottom option, so should be right
|
||||
// return SPLIT_TRANSLATE_PRIMARY_POSITIVE;
|
||||
// }
|
||||
// throw new IllegalStateException("Invalid split stage position: " +
|
||||
// splitPosition.stagePosition);
|
||||
//=======
|
||||
} else if (stagePosition == STAGE_POSITION_BOTTOM_OR_RIGHT) {
|
||||
// We don't have a bottom option, so should be right
|
||||
return SPLIT_TRANSLATE_PRIMARY_POSITIVE;
|
||||
}
|
||||
throw new IllegalStateException("Invalid split stage position: " +
|
||||
splitPosition.stagePosition);
|
||||
throw new IllegalStateException("Invalid split stage position: " + stagePosition);
|
||||
//>>>>>>> f6769c8532 (Add Split button in OverviewActions)
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -416,7 +429,7 @@ public class PortraitPagedViewHandler implements PagedOrientationHandler {
|
||||
|
||||
@Override
|
||||
public void getInitialSplitPlaceholderBounds(int placeholderHeight, DeviceProfile dp,
|
||||
SplitPositionOption splitPositionOption, Rect out) {
|
||||
@StagePosition int stagePosition, Rect out) {
|
||||
int width = dp.widthPx;
|
||||
out.set(0, 0, width, placeholderHeight);
|
||||
if (!dp.isLandscape) {
|
||||
@@ -425,7 +438,11 @@ public class PortraitPagedViewHandler implements PagedOrientationHandler {
|
||||
}
|
||||
|
||||
// Now we rotate the portrait rect depending on what side we want pinned
|
||||
boolean pinToRight = splitPositionOption.stagePosition == STAGE_POSITION_BOTTOM_OR_RIGHT;
|
||||
//<<<<<<< HEAD
|
||||
// boolean pinToRight = splitPositionOption.stagePosition == STAGE_POSITION_BOTTOM_OR_RIGHT;
|
||||
//=======
|
||||
boolean pinToRight = stagePosition == STAGE_POSITION_BOTTOM_OR_RIGHT;
|
||||
//>>>>>>> f6769c8532 (Add Split button in OverviewActions)
|
||||
|
||||
int screenHeight = dp.heightPx;
|
||||
float postRotateScale = (float) screenHeight / width;
|
||||
@@ -442,7 +459,7 @@ public class PortraitPagedViewHandler implements PagedOrientationHandler {
|
||||
|
||||
@Override
|
||||
public void getFinalSplitPlaceholderBounds(int splitDividerSize, DeviceProfile dp,
|
||||
SplitPositionOption initialSplitOption, Rect out1, Rect out2) {
|
||||
@StagePosition int stagePosition, Rect out1, Rect out2) {
|
||||
int screenHeight = dp.heightPx;
|
||||
int screenWidth = dp.widthPx;
|
||||
out1.set(0, 0, screenWidth, screenHeight / 2 - splitDividerSize);
|
||||
@@ -453,7 +470,11 @@ public class PortraitPagedViewHandler implements PagedOrientationHandler {
|
||||
}
|
||||
|
||||
// Now we rotate the portrait rect depending on what side we want pinned
|
||||
boolean pinToRight = initialSplitOption.stagePosition == STAGE_POSITION_BOTTOM_OR_RIGHT;
|
||||
//<<<<<<< HEAD
|
||||
// boolean pinToRight = initialSplitOption.stagePosition == STAGE_POSITION_BOTTOM_OR_RIGHT;
|
||||
//=======
|
||||
boolean pinToRight = stagePosition == STAGE_POSITION_BOTTOM_OR_RIGHT;
|
||||
//>>>>>>> f6769c8532 (Add Split button in OverviewActions)
|
||||
float postRotateScale = (float) screenHeight / screenWidth;
|
||||
|
||||
mTmpMatrix.reset();
|
||||
@@ -471,6 +492,7 @@ public class PortraitPagedViewHandler implements PagedOrientationHandler {
|
||||
}
|
||||
|
||||
@Override
|
||||
//<<<<<<< HEAD
|
||||
public void setSplitTaskSwipeRect(DeviceProfile dp, Rect outRect,
|
||||
SplitConfigurationOptions.StagedSplitBounds splitInfo, int desiredStagePosition) {
|
||||
boolean isLandscape = dp.isLandscape;
|
||||
@@ -524,7 +546,7 @@ public class PortraitPagedViewHandler implements PagedOrientationHandler {
|
||||
|
||||
if (dp.isLandscape) {
|
||||
primaryLp.height = totalThumbnailHeight;
|
||||
primaryLp.width = (int)(totalThumbnailWidth * splitBoundsConfig.leftTaskPercent);
|
||||
primaryLp.width = (int) (totalThumbnailWidth * splitBoundsConfig.leftTaskPercent);
|
||||
|
||||
secondaryLp.height = totalThumbnailHeight;
|
||||
secondaryLp.width = totalThumbnailWidth - primaryLp.width - dividerBar;
|
||||
@@ -532,7 +554,7 @@ public class PortraitPagedViewHandler implements PagedOrientationHandler {
|
||||
mSnapshotView2.setTranslationY(spaceAboveSnapshot);
|
||||
} else {
|
||||
primaryLp.width = totalThumbnailWidth;
|
||||
primaryLp.height = (int)(totalThumbnailHeight * splitBoundsConfig.topTaskPercent);
|
||||
primaryLp.height = (int) (totalThumbnailHeight * splitBoundsConfig.topTaskPercent);
|
||||
|
||||
secondaryLp.width = totalThumbnailWidth;
|
||||
secondaryLp.height = totalThumbnailHeight - primaryLp.height - dividerBar;
|
||||
@@ -541,6 +563,20 @@ public class PortraitPagedViewHandler implements PagedOrientationHandler {
|
||||
}
|
||||
}
|
||||
|
||||
//=======
|
||||
@Override
|
||||
public int getDefaultSplitPosition(DeviceProfile deviceProfile) {
|
||||
if (!deviceProfile.isTablet) {
|
||||
throw new IllegalStateException("Default position available only for large screens");
|
||||
}
|
||||
if (deviceProfile.isLandscape) {
|
||||
return STAGE_POSITION_BOTTOM_OR_RIGHT;
|
||||
} else {
|
||||
return STAGE_POSITION_TOP_OR_LEFT;
|
||||
//>>>>>>> f6769c8532 (Add Split button in OverviewActions)
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public FloatProperty getSplitSelectTaskOffset(FloatProperty primary, FloatProperty secondary,
|
||||
DeviceProfile dp) {
|
||||
|
||||
Reference in New Issue
Block a user