mirror of
https://github.com/LawnchairLauncher/lawnchair.git
synced 2026-03-04 01:46:49 +00:00
Implement swipe gesture for staged split in landscape
* Maintain task split percentages when swiping up. * Split percentages not maintained in GroupedTaskView, however. That is a TODO. Bug: 181704764, 181705607 Test: Swiped up in landscape with home rotation on/off. Portrait still works. Change-Id: Iec62abae34f6ccadf98e2afdc9409cf3160f8223
This commit is contained in:
@@ -26,6 +26,7 @@ import static com.android.launcher3.util.SplitConfigurationOptions.STAGE_POSITIO
|
||||
import static com.android.launcher3.util.SplitConfigurationOptions.STAGE_TYPE_MAIN;
|
||||
|
||||
import android.content.res.Resources;
|
||||
import android.graphics.Point;
|
||||
import android.graphics.PointF;
|
||||
import android.graphics.Rect;
|
||||
import android.graphics.RectF;
|
||||
@@ -41,6 +42,7 @@ import android.widget.LinearLayout;
|
||||
import com.android.launcher3.DeviceProfile;
|
||||
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.views.BaseDragLayer;
|
||||
|
||||
@@ -381,6 +383,28 @@ public class LandscapePagedViewHandler implements PagedOrientationHandler {
|
||||
out2.set(0, screenHeight / 2 + splitDividerSize, screenWidth, screenHeight);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setSplitTaskSwipeRect(DeviceProfile dp, Rect outRect,
|
||||
SplitConfigurationOptions.StagedSplitBounds splitInfo, int desiredStagePosition) {
|
||||
float diff;
|
||||
if (desiredStagePosition == SplitConfigurationOptions.STAGE_POSITION_TOP_OR_LEFT) {
|
||||
diff = outRect.height() * (1f - splitInfo.mLeftTaskPercent);
|
||||
outRect.bottom -= diff;
|
||||
} else {
|
||||
diff = outRect.height() * splitInfo.mLeftTaskPercent;
|
||||
outRect.top += diff;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setLeashSplitOffset(Point splitOffset, DeviceProfile dp,
|
||||
SplitConfigurationOptions.StagedSplitBounds splitInfo, int desiredStagePosition) {
|
||||
if (desiredStagePosition == STAGE_POSITION_BOTTOM_OR_RIGHT) {
|
||||
// The preview set is for the bottom/right, inset by top/left task
|
||||
splitOffset.x = splitInfo.mLeftTopBounds.width() + splitInfo.mDividerBounds.width() / 2;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public FloatProperty getSplitSelectTaskOffset(FloatProperty primary, FloatProperty secondary,
|
||||
DeviceProfile deviceProfile) {
|
||||
|
||||
Reference in New Issue
Block a user