Search in sources :

Example 1 with STAGE_POSITION_BOTTOM_OR_RIGHT

use of com.android.launcher3.util.SplitConfigurationOptions.STAGE_POSITION_BOTTOM_OR_RIGHT in project android_packages_apps_Launcher3 by crdroidandroid.

the class SplitSelectStateController method setSecondTaskId.

/**
 * To be called after second task selected
 */
public void setSecondTaskId(TaskView taskView) {
    if (TaskAnimationManager.ENABLE_SHELL_TRANSITIONS) {
        // Assume initial task is for top/left part of screen
        final int[] taskIds = mInitialPosition.mStagePosition == STAGE_POSITION_TOP_OR_LEFT ? new int[] { mInitialTaskView.getTask().key.id, taskView.getTask().key.id } : new int[] { taskView.getTask().key.id, mInitialTaskView.getTask().key.id };
        RemoteSplitLaunchAnimationRunner animationRunner = new RemoteSplitLaunchAnimationRunner(mInitialTaskView, taskView);
        mSystemUiProxy.startTasks(taskIds[0], null, /* mainOptions */
        taskIds[1], null, /* sideOptions */
        STAGE_POSITION_BOTTOM_OR_RIGHT, new RemoteTransitionCompat(animationRunner, MAIN_EXECUTOR));
        return;
    }
    // Assume initial mInitialTaskId is for top/left part of screen
    RemoteAnimationFactory initialSplitRunnerWrapped = new SplitLaunchAnimationRunner(mInitialTaskView, 0);
    RemoteAnimationFactory secondarySplitRunnerWrapped = new SplitLaunchAnimationRunner(taskView, 1);
    RemoteAnimationRunnerCompat initialSplitRunner = new LauncherAnimationRunner(new Handler(Looper.getMainLooper()), initialSplitRunnerWrapped, true);
    RemoteAnimationRunnerCompat secondarySplitRunner = new LauncherAnimationRunner(new Handler(Looper.getMainLooper()), secondarySplitRunnerWrapped, true);
    ActivityOptions initialOptions = ActivityOptionsCompat.makeRemoteAnimation(new RemoteAnimationAdapterCompat(initialSplitRunner, 300, 150));
    ActivityOptions secondaryOptions = ActivityOptionsCompat.makeRemoteAnimation(new RemoteAnimationAdapterCompat(secondarySplitRunner, 300, 150));
    mSystemUiProxy.startTask(mInitialTaskView.getTask().key.id, mInitialPosition.mStageType, mInitialPosition.mStagePosition, /*null*/
    initialOptions.toBundle());
    Pair<Integer, Integer> compliment = getComplimentaryStageAndPosition(mInitialPosition);
    mSystemUiProxy.startTask(taskView.getTask().key.id, compliment.first, compliment.second, /*null*/
    secondaryOptions.toBundle());
    // After successful launch, call resetState
    resetState();
}
Also used : RemoteAnimationAdapterCompat(com.android.systemui.shared.system.RemoteAnimationAdapterCompat) RemoteAnimationFactory(com.android.launcher3.LauncherAnimationRunner.RemoteAnimationFactory) Handler(android.os.Handler) LauncherAnimationRunner(com.android.launcher3.LauncherAnimationRunner) RemoteTransitionCompat(com.android.systemui.shared.system.RemoteTransitionCompat) RemoteAnimationRunnerCompat(com.android.systemui.shared.system.RemoteAnimationRunnerCompat) ActivityOptions(android.app.ActivityOptions)

Example 2 with STAGE_POSITION_BOTTOM_OR_RIGHT

use of com.android.launcher3.util.SplitConfigurationOptions.STAGE_POSITION_BOTTOM_OR_RIGHT in project android_packages_apps_Launcher3 by AOSPA.

the class PortraitPagedViewHandler method getSplitPositionOptions.

@Override
public List<SplitPositionOption> getSplitPositionOptions(DeviceProfile dp) {
    List<SplitPositionOption> options = new ArrayList<>(1);
    // Add both left and right options if we're in tablet mode
    if (dp.isTablet && dp.isLandscape) {
        options.add(new SplitPositionOption(R.drawable.ic_split_right, R.string.split_screen_position_right, STAGE_POSITION_BOTTOM_OR_RIGHT, STAGE_TYPE_MAIN));
        options.add(new SplitPositionOption(R.drawable.ic_split_left, R.string.split_screen_position_left, STAGE_POSITION_TOP_OR_LEFT, STAGE_TYPE_MAIN));
    } else {
        if (dp.isSeascape()) {
            // Add left/right options
            options.add(new SplitPositionOption(R.drawable.ic_split_right, R.string.split_screen_position_right, STAGE_POSITION_BOTTOM_OR_RIGHT, STAGE_TYPE_MAIN));
        } else if (dp.isLandscape) {
            options.add(new SplitPositionOption(R.drawable.ic_split_left, R.string.split_screen_position_left, STAGE_POSITION_TOP_OR_LEFT, STAGE_TYPE_MAIN));
        } else {
            // Only add top option
            options.add(new SplitPositionOption(R.drawable.ic_split_top, R.string.split_screen_position_top, STAGE_POSITION_TOP_OR_LEFT, STAGE_TYPE_MAIN));
        }
    }
    return options;
}
Also used : SplitPositionOption(com.android.launcher3.util.SplitConfigurationOptions.SplitPositionOption) ArrayList(java.util.ArrayList)

Example 3 with STAGE_POSITION_BOTTOM_OR_RIGHT

use of com.android.launcher3.util.SplitConfigurationOptions.STAGE_POSITION_BOTTOM_OR_RIGHT in project android_packages_apps_Launcher3 by ArrowOS.

the class PortraitPagedViewHandler method getSplitPositionOptions.

@Override
public List<SplitPositionOption> getSplitPositionOptions(DeviceProfile dp) {
    List<SplitPositionOption> options = new ArrayList<>(1);
    // Add both left and right options if we're in tablet mode
    if (dp.isTablet && dp.isLandscape) {
        options.add(new SplitPositionOption(R.drawable.ic_split_right, R.string.split_screen_position_right, STAGE_POSITION_BOTTOM_OR_RIGHT, STAGE_TYPE_MAIN));
        options.add(new SplitPositionOption(R.drawable.ic_split_left, R.string.split_screen_position_left, STAGE_POSITION_TOP_OR_LEFT, STAGE_TYPE_MAIN));
    } else {
        if (dp.isSeascape()) {
            // Add left/right options
            options.add(new SplitPositionOption(R.drawable.ic_split_right, R.string.split_screen_position_right, STAGE_POSITION_BOTTOM_OR_RIGHT, STAGE_TYPE_MAIN));
        } else if (dp.isLandscape) {
            options.add(new SplitPositionOption(R.drawable.ic_split_left, R.string.split_screen_position_left, STAGE_POSITION_TOP_OR_LEFT, STAGE_TYPE_MAIN));
        } else {
            // Only add top option
            options.add(new SplitPositionOption(R.drawable.ic_split_top, R.string.split_screen_position_top, STAGE_POSITION_TOP_OR_LEFT, STAGE_TYPE_MAIN));
        }
    }
    return options;
}
Also used : SplitPositionOption(com.android.launcher3.util.SplitConfigurationOptions.SplitPositionOption) ArrayList(java.util.ArrayList)

Example 4 with STAGE_POSITION_BOTTOM_OR_RIGHT

use of com.android.launcher3.util.SplitConfigurationOptions.STAGE_POSITION_BOTTOM_OR_RIGHT in project android_packages_apps_404Launcher by P-404.

the class TaskMenuView method setPosition.

private void setPosition(float x, float y, int overscrollShift) {
    PagedOrientationHandler pagedOrientationHandler = mTaskView.getPagedOrientationHandler();
    // Inset due to margin
    PointF additionalInset = pagedOrientationHandler.getAdditionalInsetForTaskMenu(mTaskInsetMargin);
    DeviceProfile deviceProfile = mActivity.getDeviceProfile();
    int taskTopMargin = deviceProfile.overviewTaskThumbnailTopMarginPx;
    float adjustedY = y + taskTopMargin - additionalInset.y;
    float adjustedX = x - additionalInset.x;
    // Changing pivot to make computations easier
    // NOTE: Changing the pivots means the rotated view gets rotated about the new pivots set,
    // which would render the X and Y position set here incorrect
    setPivotX(0);
    if (deviceProfile.overviewShowAsGrid) {
        // In tablet, set pivotY to original position without mThumbnailTopMargin adjustment.
        setPivotY(-taskTopMargin);
    } else {
        setPivotY(0);
    }
    setRotation(pagedOrientationHandler.getDegreesRotated());
    setX(pagedOrientationHandler.getTaskMenuX(adjustedX, mTaskContainer.getThumbnailView(), overscrollShift, deviceProfile));
    setY(pagedOrientationHandler.getTaskMenuY(adjustedY, mTaskContainer.getThumbnailView(), overscrollShift));
    // TODO(b/193432925) temporary menu placement for split screen task menus
    TaskIdAttributeContainer[] taskIdAttributeContainers = mTaskView.getTaskIdAttributeContainers();
    if (taskIdAttributeContainers[0].getStagePosition() != STAGE_POSITION_UNDEFINED) {
        if (mTaskContainer.getStagePosition() != STAGE_POSITION_BOTTOM_OR_RIGHT) {
            return;
        }
        Rect r = new Rect();
        mTaskContainer.getThumbnailView().getBoundsOnScreen(r);
        if (deviceProfile.isLandscape) {
            setX(r.left);
        } else {
            setY(r.top);
        }
    }
}
Also used : DeviceProfile(com.android.launcher3.DeviceProfile) Rect(android.graphics.Rect) PagedOrientationHandler(com.android.launcher3.touch.PagedOrientationHandler) TaskIdAttributeContainer(com.android.quickstep.views.TaskView.TaskIdAttributeContainer) PointF(android.graphics.PointF)

Example 5 with STAGE_POSITION_BOTTOM_OR_RIGHT

use of com.android.launcher3.util.SplitConfigurationOptions.STAGE_POSITION_BOTTOM_OR_RIGHT in project android_packages_apps_404Launcher by P-404.

the class PortraitPagedViewHandler method getSplitPositionOptions.

@Override
public List<SplitPositionOption> getSplitPositionOptions(DeviceProfile dp) {
    List<SplitPositionOption> options = new ArrayList<>(1);
    // Add both left and right options if we're in tablet mode
    if (dp.isTablet && dp.isLandscape) {
        options.add(new SplitPositionOption(R.drawable.ic_split_right, R.string.split_screen_position_right, STAGE_POSITION_BOTTOM_OR_RIGHT, STAGE_TYPE_MAIN));
        options.add(new SplitPositionOption(R.drawable.ic_split_left, R.string.split_screen_position_left, STAGE_POSITION_TOP_OR_LEFT, STAGE_TYPE_MAIN));
    } else {
        if (dp.isSeascape()) {
            // Add left/right options
            options.add(new SplitPositionOption(R.drawable.ic_split_right, R.string.split_screen_position_right, STAGE_POSITION_BOTTOM_OR_RIGHT, STAGE_TYPE_MAIN));
        } else if (dp.isLandscape) {
            options.add(new SplitPositionOption(R.drawable.ic_split_left, R.string.split_screen_position_left, STAGE_POSITION_TOP_OR_LEFT, STAGE_TYPE_MAIN));
        } else {
            // Only add top option
            options.add(new SplitPositionOption(R.drawable.ic_split_top, R.string.split_screen_position_top, STAGE_POSITION_TOP_OR_LEFT, STAGE_TYPE_MAIN));
        }
    }
    return options;
}
Also used : SplitPositionOption(com.android.launcher3.util.SplitConfigurationOptions.SplitPositionOption) ArrayList(java.util.ArrayList)

Aggregations

SplitPositionOption (com.android.launcher3.util.SplitConfigurationOptions.SplitPositionOption)5 ArrayList (java.util.ArrayList)5 PointF (android.graphics.PointF)4 Rect (android.graphics.Rect)4 DeviceProfile (com.android.launcher3.DeviceProfile)4 PagedOrientationHandler (com.android.launcher3.touch.PagedOrientationHandler)4 TaskIdAttributeContainer (com.android.quickstep.views.TaskView.TaskIdAttributeContainer)4 ActivityOptions (android.app.ActivityOptions)1 Handler (android.os.Handler)1 LauncherAnimationRunner (com.android.launcher3.LauncherAnimationRunner)1 RemoteAnimationFactory (com.android.launcher3.LauncherAnimationRunner.RemoteAnimationFactory)1 RemoteAnimationAdapterCompat (com.android.systemui.shared.system.RemoteAnimationAdapterCompat)1 RemoteAnimationRunnerCompat (com.android.systemui.shared.system.RemoteAnimationRunnerCompat)1 RemoteTransitionCompat (com.android.systemui.shared.system.RemoteTransitionCompat)1