Merge "Add Split button in OverviewActions" into sc-v2-dev am: b862d2c30f
Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/apps/Launcher3/+/15587782 Change-Id: I1bbb495f0728372bc2ae7b8a36fa5a69836894e2
This commit is contained in:
committed by
Automerger Merge Worker
commit
1f41b44e14
@@ -46,6 +46,23 @@
|
||||
android:layout_height="1dp"
|
||||
android:layout_weight="1" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/action_split"
|
||||
style="@style/OverviewActionButton"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:drawableStart="@drawable/ic_split_screen"
|
||||
android:text="@string/action_split"
|
||||
android:theme="@style/ThemeControlHighlightWorkspaceColor"
|
||||
android:visibility="gone" />
|
||||
|
||||
<Space
|
||||
android:id="@+id/action_split_space"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="1dp"
|
||||
android:layout_weight="1"
|
||||
android:visibility="gone" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/action_share"
|
||||
style="@style/OverviewActionButton"
|
||||
|
||||
@@ -191,6 +191,8 @@
|
||||
<string name="action_share">Share</string>
|
||||
<!-- Label for a button that causes a screen shot of the current app to be taken. [CHAR_LIMIT=40] -->
|
||||
<string name="action_screenshot">Screenshot</string>
|
||||
<!-- Label for a button that enters split screen selection mode. [CHAR_LIMIT=20] -->
|
||||
<string name="action_split">Split</string>
|
||||
<!-- Message shown when an action is blocked by a policy enforced by the app or the organization managing the device. [CHAR_LIMIT=NONE] -->
|
||||
<string name="blocked_by_policy">This action isn\'t allowed by the app or your organization</string>
|
||||
|
||||
|
||||
@@ -43,8 +43,12 @@ public class SplitScreenSelectState extends OverviewState {
|
||||
@Override
|
||||
public float getSplitSelectTranslation(Launcher launcher) {
|
||||
RecentsView recentsView = launcher.getOverviewPanel();
|
||||
int splitPosition = recentsView.getSplitPlaceholder()
|
||||
.getActiveSplitPositionOption().stagePosition;
|
||||
//<<<<<<< HEAD
|
||||
// int splitPosition = recentsView.getSplitPlaceholder()
|
||||
// .getActiveSplitPositionOption().stagePosition;
|
||||
//=======
|
||||
int splitPosition = recentsView.getSplitPlaceholder().getActiveSplitStagePosition();
|
||||
//>>>>>>> f6769c8532 (Add Split button in OverviewActions)
|
||||
if (!recentsView.shouldShiftThumbnailsForSplitSelect(splitPosition)) {
|
||||
return 0f;
|
||||
}
|
||||
|
||||
@@ -218,6 +218,11 @@ public class TaskOverlayFactory implements ResourceBasedOverride {
|
||||
}
|
||||
}
|
||||
|
||||
private void enterSplitSelect() {
|
||||
RecentsView overviewPanel = mThumbnailView.getTaskView().getRecentsView();
|
||||
overviewPanel.initiateSplitSelect(mThumbnailView.getTaskView());
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when the overlay is no longer used.
|
||||
*/
|
||||
@@ -323,6 +328,10 @@ public class TaskOverlayFactory implements ResourceBasedOverride {
|
||||
public void onScreenshot() {
|
||||
endLiveTileMode(() -> saveScreenshot(mTask));
|
||||
}
|
||||
|
||||
public void onSplit() {
|
||||
endLiveTileMode(TaskOverlay.this::enterSplitSelect);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -336,5 +345,8 @@ public class TaskOverlayFactory implements ResourceBasedOverride {
|
||||
|
||||
/** User has indicated they want to screenshot the current task. */
|
||||
void onScreenshot();
|
||||
|
||||
/** User wants to start split screen with current app. */
|
||||
void onSplit();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -32,12 +32,11 @@ import android.view.RemoteAnimationAdapter;
|
||||
import android.view.SurfaceControl;
|
||||
import android.window.TransitionInfo;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import com.android.launcher3.DeviceProfile;
|
||||
import com.android.launcher3.InsettableFrameLayout;
|
||||
import com.android.launcher3.R;
|
||||
import com.android.launcher3.util.SplitConfigurationOptions.SplitPositionOption;
|
||||
import com.android.launcher3.util.SplitConfigurationOptions;
|
||||
import com.android.launcher3.util.SplitConfigurationOptions.StagePosition;
|
||||
import com.android.quickstep.SystemUiProxy;
|
||||
import com.android.quickstep.TaskAnimationManager;
|
||||
import com.android.quickstep.TaskViewUtils;
|
||||
@@ -57,7 +56,7 @@ public class SplitSelectStateController {
|
||||
private final SystemUiProxy mSystemUiProxy;
|
||||
private TaskView mInitialTaskView;
|
||||
private TaskView mSecondTaskView;
|
||||
private SplitPositionOption mInitialPosition;
|
||||
private @StagePosition int mStagePosition;
|
||||
private Rect mInitialBounds;
|
||||
private final Handler mHandler;
|
||||
|
||||
@@ -69,10 +68,10 @@ public class SplitSelectStateController {
|
||||
/**
|
||||
* To be called after first task selected
|
||||
*/
|
||||
public void setInitialTaskSelect(TaskView taskView, SplitPositionOption positionOption,
|
||||
public void setInitialTaskSelect(TaskView taskView, @StagePosition int stagePosition,
|
||||
Rect initialBounds) {
|
||||
mInitialTaskView = taskView;
|
||||
mInitialPosition = positionOption;
|
||||
mStagePosition = stagePosition;
|
||||
mInitialBounds = initialBounds;
|
||||
}
|
||||
|
||||
@@ -83,7 +82,11 @@ public class SplitSelectStateController {
|
||||
mSecondTaskView = taskView;
|
||||
// Assume initial task is for top/left part of screen
|
||||
|
||||
final int[] taskIds = mInitialPosition.stagePosition == STAGE_POSITION_TOP_OR_LEFT
|
||||
//<<<<<<< HEAD
|
||||
// final int[] taskIds = mInitialPosition.stagePosition == STAGE_POSITION_TOP_OR_LEFT
|
||||
//=======
|
||||
final int[] taskIds = mStagePosition == STAGE_POSITION_TOP_OR_LEFT
|
||||
//>>>>>>> f6769c8532 (Add Split button in OverviewActions)
|
||||
? new int[]{mInitialTaskView.getTask().key.id, taskView.getTask().key.id}
|
||||
: new int[]{taskView.getTask().key.id, mInitialTaskView.getTask().key.id};
|
||||
if (TaskAnimationManager.ENABLE_SHELL_TRANSITIONS) {
|
||||
@@ -113,7 +116,11 @@ public class SplitSelectStateController {
|
||||
DeviceProfile deviceProfile) {
|
||||
InsettableFrameLayout.LayoutParams params =
|
||||
new InsettableFrameLayout.LayoutParams(MATCH_PARENT, MATCH_PARENT);
|
||||
boolean topLeftPosition = mInitialPosition.stagePosition == STAGE_POSITION_TOP_OR_LEFT;
|
||||
//<<<<<<< HEAD
|
||||
// boolean topLeftPosition = mInitialPosition.stagePosition == STAGE_POSITION_TOP_OR_LEFT;
|
||||
//=======
|
||||
boolean topLeftPosition = mStagePosition == STAGE_POSITION_TOP_OR_LEFT;
|
||||
//>>>>>>> f6769c8532 (Add Split button in OverviewActions)
|
||||
if (deviceProfile.isLandscape) {
|
||||
params.width = (int) resources.getDimension(R.dimen.split_placeholder_size);
|
||||
params.gravity = topLeftPosition ? Gravity.START : Gravity.END;
|
||||
@@ -125,9 +132,8 @@ public class SplitSelectStateController {
|
||||
return params;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public SplitPositionOption getActiveSplitPositionOption() {
|
||||
return mInitialPosition;
|
||||
public @StagePosition int getActiveSplitStagePosition() {
|
||||
return mStagePosition;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -189,7 +195,7 @@ public class SplitSelectStateController {
|
||||
public void resetState() {
|
||||
mInitialTaskView = null;
|
||||
mSecondTaskView = null;
|
||||
mInitialPosition = null;
|
||||
mStagePosition = SplitConfigurationOptions.STAGE_POSITION_UNDEFINED;
|
||||
mInitialBounds = null;
|
||||
}
|
||||
|
||||
|
||||
@@ -245,8 +245,8 @@ public class LauncherRecentsView extends RecentsView<BaseQuickstepLauncher, Laun
|
||||
|
||||
@Override
|
||||
public void initiateSplitSelect(TaskView taskView,
|
||||
SplitConfigurationOptions.SplitPositionOption splitPositionOption) {
|
||||
super.initiateSplitSelect(taskView, splitPositionOption);
|
||||
@SplitConfigurationOptions.StagePosition int stagePosition) {
|
||||
super.initiateSplitSelect(taskView, stagePosition);
|
||||
mActivity.getStateManager().goToState(LauncherState.OVERVIEW_SPLIT_SELECT);
|
||||
}
|
||||
|
||||
|
||||
@@ -79,6 +79,7 @@ public class OverviewActionsView<T extends OverlayUICallbacks> extends FrameLayo
|
||||
private static final int INDEX_SCROLL_ALPHA = 4;
|
||||
|
||||
private final MultiValueAlpha mMultiValueAlpha;
|
||||
private View mSplitButton;
|
||||
|
||||
@ActionsHiddenFlags
|
||||
private int mHiddenFlags;
|
||||
@@ -110,6 +111,8 @@ public class OverviewActionsView<T extends OverlayUICallbacks> extends FrameLayo
|
||||
View share = findViewById(R.id.action_share);
|
||||
share.setOnClickListener(this);
|
||||
findViewById(R.id.action_screenshot).setOnClickListener(this);
|
||||
mSplitButton = findViewById(R.id.action_split);
|
||||
mSplitButton.setOnClickListener(this);
|
||||
if (ENABLE_OVERVIEW_SHARE.get()) {
|
||||
share.setVisibility(VISIBLE);
|
||||
findViewById(R.id.oav_three_button_space).setVisibility(VISIBLE);
|
||||
@@ -135,6 +138,8 @@ public class OverviewActionsView<T extends OverlayUICallbacks> extends FrameLayo
|
||||
mCallbacks.onShare();
|
||||
} else if (id == R.id.action_screenshot) {
|
||||
mCallbacks.onScreenshot();
|
||||
} else if (id == R.id.action_split) {
|
||||
mCallbacks.onSplit();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -218,6 +223,16 @@ public class OverviewActionsView<T extends OverlayUICallbacks> extends FrameLayo
|
||||
mDp = dp;
|
||||
updateVerticalMargin(SysUINavigationMode.getMode(getContext()));
|
||||
requestLayout();
|
||||
setSplitButtonVisible(mDp.isTablet);
|
||||
}
|
||||
|
||||
public void setSplitButtonVisible(boolean visible) {
|
||||
if (mSplitButton == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
mSplitButton.setVisibility(visible ? VISIBLE : GONE);
|
||||
findViewById(R.id.action_split_space).setVisibility(visible ? VISIBLE : GONE);
|
||||
}
|
||||
|
||||
/** Get the top margin associated with the action buttons in Overview. */
|
||||
|
||||
@@ -133,7 +133,7 @@ import com.android.launcher3.util.MultiValueAlpha;
|
||||
import com.android.launcher3.util.ResourceBasedOverride.Overrides;
|
||||
import com.android.launcher3.util.RunnableList;
|
||||
import com.android.launcher3.util.SplitConfigurationOptions;
|
||||
import com.android.launcher3.util.SplitConfigurationOptions.SplitPositionOption;
|
||||
import com.android.launcher3.util.SplitConfigurationOptions.StagePosition;
|
||||
import com.android.launcher3.util.Themes;
|
||||
import com.android.launcher3.util.TranslateEdgeEffect;
|
||||
import com.android.launcher3.util.ViewPool;
|
||||
@@ -2572,8 +2572,8 @@ public abstract class RecentsView<ACTIVITY_TYPE extends StatefulActivity<STATE_T
|
||||
private void createInitialSplitSelectAnimation(PendingAnimation anim) {
|
||||
float placeholderHeight = getResources().getDimension(R.dimen.split_placeholder_size);
|
||||
mOrientationHandler.getInitialSplitPlaceholderBounds((int) placeholderHeight,
|
||||
mActivity.getDeviceProfile(),
|
||||
mSplitSelectStateController.getActiveSplitPositionOption(), mTempRect);
|
||||
mActivity.getDeviceProfile(),
|
||||
mSplitSelectStateController.getActiveSplitStagePosition(), mTempRect);
|
||||
|
||||
RectF startingTaskRect = new RectF();
|
||||
mSplitHiddenTaskView.setVisibility(INVISIBLE);
|
||||
@@ -2582,6 +2582,7 @@ public abstract class RecentsView<ACTIVITY_TYPE extends StatefulActivity<STATE_T
|
||||
mFirstFloatingTaskView.setAlpha(1);
|
||||
mFirstFloatingTaskView.addAnimation(anim, startingTaskRect,
|
||||
mTempRect, mSplitHiddenTaskView, true /*fadeWithThumbnail*/);
|
||||
anim.addEndListener(aBoolean -> mActionsView.setSplitButtonVisible(false));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -3014,8 +3015,7 @@ public abstract class RecentsView<ACTIVITY_TYPE extends StatefulActivity<STATE_T
|
||||
* @return {@code true} if one of the task thumbnails would intersect/overlap with the
|
||||
* {@link #mFirstFloatingTaskView}
|
||||
*/
|
||||
public boolean shouldShiftThumbnailsForSplitSelect(@SplitConfigurationOptions.StagePosition
|
||||
int stagePosition) {
|
||||
public boolean shouldShiftThumbnailsForSplitSelect(@StagePosition int stagePosition) {
|
||||
if (!mActivity.getDeviceProfile().isTablet) {
|
||||
// Never enough space on phones
|
||||
return true;
|
||||
@@ -3547,12 +3547,17 @@ public abstract class RecentsView<ACTIVITY_TYPE extends StatefulActivity<STATE_T
|
||||
}
|
||||
}
|
||||
|
||||
public void initiateSplitSelect(TaskView taskView, SplitPositionOption splitPositionOption) {
|
||||
public void initiateSplitSelect(TaskView taskView) {
|
||||
int defaultSplitPosition = mOrientationHandler
|
||||
.getDefaultSplitPosition(mActivity.getDeviceProfile());
|
||||
initiateSplitSelect(taskView, defaultSplitPosition);
|
||||
}
|
||||
|
||||
public void initiateSplitSelect(TaskView taskView, @StagePosition int stagePosition) {
|
||||
mSplitHiddenTaskView = taskView;
|
||||
Rect initialBounds = new Rect(taskView.getLeft(), taskView.getTop(), taskView.getRight(),
|
||||
taskView.getBottom());
|
||||
mSplitSelectStateController.setInitialTaskSelect(taskView,
|
||||
splitPositionOption, initialBounds);
|
||||
mSplitSelectStateController.setInitialTaskSelect(taskView, stagePosition, initialBounds);
|
||||
mSplitHiddenTaskViewIndex = indexOfChild(taskView);
|
||||
if (ENABLE_QUICKSTEP_LIVE_TILE.get()) {
|
||||
finishRecentsAnimation(true, null);
|
||||
@@ -3578,7 +3583,7 @@ public abstract class RecentsView<ACTIVITY_TYPE extends StatefulActivity<STATE_T
|
||||
.getDimensionPixelSize(R.dimen.multi_window_task_divider_size) / 2;
|
||||
mOrientationHandler.getFinalSplitPlaceholderBounds(halfDividerSize,
|
||||
mActivity.getDeviceProfile(),
|
||||
mSplitSelectStateController.getActiveSplitPositionOption(), firstTaskEndingBounds,
|
||||
mSplitSelectStateController.getActiveSplitStagePosition(), firstTaskEndingBounds,
|
||||
secondTaskEndingBounds);
|
||||
|
||||
mFirstFloatingTaskView.getBoundsOnScreen(firstTaskStartingBounds);
|
||||
@@ -3603,7 +3608,7 @@ public abstract class RecentsView<ACTIVITY_TYPE extends StatefulActivity<STATE_T
|
||||
|
||||
public PendingAnimation cancelSplitSelect(boolean animate) {
|
||||
SplitSelectStateController splitController = mSplitSelectStateController;
|
||||
SplitPositionOption splitOption = splitController.getActiveSplitPositionOption();
|
||||
@StagePosition int stagePosition = splitController.getActiveSplitStagePosition();
|
||||
Rect initialBounds = splitController.getInitialBounds();
|
||||
splitController.resetState();
|
||||
int duration = mActivity.getStateManager().getState().getTransitionDuration(getContext());
|
||||
@@ -3629,7 +3634,7 @@ public abstract class RecentsView<ACTIVITY_TYPE extends StatefulActivity<STATE_T
|
||||
if (child == mSplitHiddenTaskView) {
|
||||
TaskView taskView = (TaskView) child;
|
||||
|
||||
int dir = mOrientationHandler.getSplitTaskViewDismissDirection(splitOption,
|
||||
int dir = mOrientationHandler.getSplitTaskViewDismissDirection(stagePosition,
|
||||
mActivity.getDeviceProfile());
|
||||
FloatProperty<TaskView> dismissingTaskViewTranslate;
|
||||
Rect hiddenBounds = new Rect(taskView.getLeft(), taskView.getTop(),
|
||||
@@ -3701,10 +3706,10 @@ public abstract class RecentsView<ACTIVITY_TYPE extends StatefulActivity<STATE_T
|
||||
return pendingAnim;
|
||||
}
|
||||
|
||||
/** TODO(b/181707736) More gracefully handle exiting split selection state */
|
||||
private void resetFromSplitSelectionState() {
|
||||
mSplitHiddenTaskView.setTranslationY(0);
|
||||
if (!showAsGrid()) {
|
||||
// TODO(b/186800707)
|
||||
int pageToSnapTo = mCurrentPage;
|
||||
if (mSplitHiddenTaskViewIndex <= pageToSnapTo) {
|
||||
pageToSnapTo += 1;
|
||||
@@ -3728,6 +3733,7 @@ public abstract class RecentsView<ACTIVITY_TYPE extends StatefulActivity<STATE_T
|
||||
mSecondSplitHiddenTaskView.setVisibility(VISIBLE);
|
||||
mSecondSplitHiddenTaskView = null;
|
||||
}
|
||||
mActionsView.setSplitButtonVisible(true);
|
||||
}
|
||||
|
||||
private void updateDeadZoneRects() {
|
||||
|
||||
@@ -1514,7 +1514,7 @@ public class TaskView extends FrameLayout implements Reusable {
|
||||
|
||||
public void initiateSplitSelect(SplitPositionOption splitPositionOption) {
|
||||
AbstractFloatingView.closeOpenViews(mActivity, false, TYPE_TASK_MENU);
|
||||
getRecentsView().initiateSplitSelect(this, splitPositionOption);
|
||||
getRecentsView().initiateSplitSelect(this, splitPositionOption.stagePosition);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -45,6 +45,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.Collections;
|
||||
@@ -165,16 +166,24 @@ public class LandscapePagedViewHandler implements PagedOrientationHandler {
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getSplitTaskViewDismissDirection(SplitPositionOption splitPosition,
|
||||
public int getSplitTaskViewDismissDirection(@StagePosition int stagePosition,
|
||||
DeviceProfile dp) {
|
||||
// Don't use device profile here because we know we're in fake landscape, only split option
|
||||
// available is top/left
|
||||
if (splitPosition.stagePosition == STAGE_POSITION_TOP_OR_LEFT) {
|
||||
//<<<<<<< HEAD
|
||||
// if (splitPosition.stagePosition == STAGE_POSITION_TOP_OR_LEFT) {
|
||||
// // Top (visually left) side
|
||||
// return SPLIT_TRANSLATE_PRIMARY_NEGATIVE;
|
||||
// }
|
||||
// throw new IllegalStateException("Invalid split stage position: " +
|
||||
// splitPosition.stagePosition);
|
||||
//=======
|
||||
if (stagePosition == STAGE_POSITION_TOP_OR_LEFT) {
|
||||
// Top (visually left) side
|
||||
return SPLIT_TRANSLATE_PRIMARY_NEGATIVE;
|
||||
}
|
||||
throw new IllegalStateException("Invalid split stage position: " +
|
||||
splitPosition.stagePosition);
|
||||
throw new IllegalStateException("Invalid split stage position: " + stagePosition);
|
||||
//>>>>>>> f6769c8532 (Add Split button in OverviewActions)
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -367,7 +376,7 @@ public class LandscapePagedViewHandler implements PagedOrientationHandler {
|
||||
|
||||
@Override
|
||||
public void getInitialSplitPlaceholderBounds(int placeholderHeight, DeviceProfile dp,
|
||||
SplitPositionOption splitPositionOption, Rect out) {
|
||||
@StagePosition int stagePosition, Rect out) {
|
||||
// In fake land/seascape, the placeholder always needs to go to the "top" of the device,
|
||||
// which is the same bounds as 0 rotation.
|
||||
int width = dp.widthPx;
|
||||
@@ -376,7 +385,7 @@ public class LandscapePagedViewHandler implements PagedOrientationHandler {
|
||||
|
||||
@Override
|
||||
public void getFinalSplitPlaceholderBounds(int splitDividerSize, DeviceProfile dp,
|
||||
SplitPositionOption initialSplitOption, Rect out1, Rect out2) {
|
||||
@StagePosition int stagePosition, Rect out1, Rect out2) {
|
||||
// In fake land/seascape, the window bounds are always top and bottom half
|
||||
int screenHeight = dp.heightPx;
|
||||
int screenWidth = dp.widthPx;
|
||||
@@ -385,6 +394,7 @@ public class LandscapePagedViewHandler implements PagedOrientationHandler {
|
||||
}
|
||||
|
||||
@Override
|
||||
//<<<<<<< HEAD
|
||||
public void setSplitTaskSwipeRect(DeviceProfile dp, Rect outRect,
|
||||
SplitConfigurationOptions.StagedSplitBounds splitInfo, int desiredStagePosition) {
|
||||
float diff;
|
||||
@@ -418,13 +428,20 @@ public class LandscapePagedViewHandler implements PagedOrientationHandler {
|
||||
ViewGroup.LayoutParams secondaryLp = mSnapshotView2.getLayoutParams();
|
||||
|
||||
primaryLp.width = totalThumbnailWidth;
|
||||
primaryLp.height = (int)(totalThumbnailHeight * splitBoundsConfig.leftTaskPercent);
|
||||
primaryLp.height = (int) (totalThumbnailHeight * splitBoundsConfig.leftTaskPercent);
|
||||
|
||||
secondaryLp.width = totalThumbnailWidth;
|
||||
secondaryLp.height = totalThumbnailHeight - primaryLp.height - dividerBar;
|
||||
mSnapshotView2.setTranslationY(primaryLp.height + spaceAboveSnapshot + dividerBar);
|
||||
}
|
||||
|
||||
//=======
|
||||
@Override
|
||||
public int getDefaultSplitPosition(DeviceProfile deviceProfile) {
|
||||
throw new IllegalStateException("Default position not available in fake landscape");
|
||||
//>>>>>>> f6769c8532 (Add Split button in OverviewActions)
|
||||
}
|
||||
|
||||
@Override
|
||||
public FloatProperty getSplitSelectTaskOffset(FloatProperty primary, FloatProperty secondary,
|
||||
DeviceProfile deviceProfile) {
|
||||
|
||||
@@ -80,11 +80,11 @@ public interface PagedOrientationHandler {
|
||||
FloatProperty<View> getSecondaryViewTranslate();
|
||||
|
||||
/**
|
||||
* @param splitPosition The position where the view to be split will go
|
||||
* @param stagePosition The position where the view to be split will go
|
||||
* @return {@link #SPLIT_TRANSLATE_*} constants to indicate which direction the
|
||||
* dismissal should happen
|
||||
*/
|
||||
int getSplitTaskViewDismissDirection(SplitPositionOption splitPosition, DeviceProfile dp);
|
||||
int getSplitTaskViewDismissDirection(@StagePosition int stagePosition, DeviceProfile dp);
|
||||
int getPrimaryScroll(View view);
|
||||
float getPrimaryScale(View view);
|
||||
int getChildStart(View view);
|
||||
@@ -122,18 +122,20 @@ public interface PagedOrientationHandler {
|
||||
* @param splitholderSize height of placeholder view in portrait, width in landscape
|
||||
*/
|
||||
void getInitialSplitPlaceholderBounds(int splitholderSize, DeviceProfile dp,
|
||||
SplitPositionOption splitPositionOption, Rect out);
|
||||
@StagePosition int stagePosition, Rect out);
|
||||
|
||||
/**
|
||||
* @param splitDividerSize height of split screen drag handle in portrait, width in landscape
|
||||
* @param initialSplitOption the split position option (top/left, bottom/right) of the first
|
||||
* @param stagePosition the split position option (top/left, bottom/right) of the first
|
||||
* task selected for entering split
|
||||
* @param out1 the bounds for where the first selected app will be
|
||||
* @param out2 the bounds for where the second selected app will be, complimentary to
|
||||
* {@param out1} based on {@param initialSplitOption}
|
||||
*/
|
||||
void getFinalSplitPlaceholderBounds(int splitDividerSize, DeviceProfile dp,
|
||||
SplitPositionOption initialSplitOption, Rect out1, Rect out2);
|
||||
@StagePosition int stagePosition, Rect out1, Rect out2);
|
||||
|
||||
int getDefaultSplitPosition(DeviceProfile deviceProfile);
|
||||
|
||||
/**
|
||||
* @param outRect This is expected to be the rect that has the dimensions for a non-split,
|
||||
|
||||
@@ -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