Search in sources :

Example 1 with Recents

use of com.android.systemui.recents.Recents in project platform_frameworks_base by android.

the class ShortcutKeyDispatcher method handleDockKey.

private void handleDockKey(long shortcutCode) {
    try {
        int dockSide = mWindowManagerService.getDockedStackSide();
        if (dockSide == WindowManager.DOCKED_INVALID) {
            // If there is no window docked, we dock the top-most window.
            Recents recents = getComponent(Recents.class);
            int dockMode = (shortcutCode == SC_DOCK_LEFT) ? ActivityManager.DOCKED_STACK_CREATE_MODE_TOP_OR_LEFT : ActivityManager.DOCKED_STACK_CREATE_MODE_BOTTOM_OR_RIGHT;
            recents.dockTopTask(NavigationBarGestureHelper.DRAG_MODE_NONE, dockMode, null, MetricsEvent.WINDOW_DOCK_SHORTCUTS);
        } else {
            // If there is already a docked window, we respond by resizing the docking pane.
            DividerView dividerView = getComponent(Divider.class).getView();
            DividerSnapAlgorithm snapAlgorithm = dividerView.getSnapAlgorithm();
            int dividerPosition = dividerView.getCurrentPosition();
            DividerSnapAlgorithm.SnapTarget currentTarget = snapAlgorithm.calculateNonDismissingSnapTarget(dividerPosition);
            int increment = (shortcutCode == SC_DOCK_LEFT) ? -1 : 1;
            DividerSnapAlgorithm.SnapTarget target = snapAlgorithm.cycleNonDismissTarget(currentTarget, increment);
            dividerView.startDragging(true, /* animate */
            false);
            dividerView.stopDragging(target.position, 0f, true, /* avoidDismissStart */
            true);
        }
    } catch (RemoteException e) {
        Log.e(TAG, "handleDockKey() failed.");
    }
}
Also used : Recents(com.android.systemui.recents.Recents) DividerView(com.android.systemui.stackdivider.DividerView) DividerSnapAlgorithm(com.android.internal.policy.DividerSnapAlgorithm) RemoteException(android.os.RemoteException) Divider(com.android.systemui.stackdivider.Divider)

Example 2 with Recents

use of com.android.systemui.recents.Recents in project android_frameworks_base by DirtyUnicorns.

the class ShortcutKeyDispatcher method handleDockKey.

private void handleDockKey(long shortcutCode) {
    try {
        int dockSide = mWindowManagerService.getDockedStackSide();
        if (dockSide == WindowManager.DOCKED_INVALID) {
            // If there is no window docked, we dock the top-most window.
            Recents recents = getComponent(Recents.class);
            int dockMode = (shortcutCode == SC_DOCK_LEFT) ? ActivityManager.DOCKED_STACK_CREATE_MODE_TOP_OR_LEFT : ActivityManager.DOCKED_STACK_CREATE_MODE_BOTTOM_OR_RIGHT;
            recents.dockTopTask(NavigationBarGestureHelper.DRAG_MODE_NONE, dockMode, null, MetricsEvent.WINDOW_DOCK_SHORTCUTS);
        } else {
            // If there is already a docked window, we respond by resizing the docking pane.
            DividerView dividerView = getComponent(Divider.class).getView();
            DividerSnapAlgorithm snapAlgorithm = dividerView.getSnapAlgorithm();
            int dividerPosition = dividerView.getCurrentPosition();
            DividerSnapAlgorithm.SnapTarget currentTarget = snapAlgorithm.calculateNonDismissingSnapTarget(dividerPosition);
            int increment = (shortcutCode == SC_DOCK_LEFT) ? -1 : 1;
            DividerSnapAlgorithm.SnapTarget target = snapAlgorithm.cycleNonDismissTarget(currentTarget, increment);
            dividerView.startDragging(true, /* animate */
            false);
            dividerView.stopDragging(target.position, 0f, true, /* avoidDismissStart */
            true);
        }
    } catch (RemoteException e) {
        Log.e(TAG, "handleDockKey() failed.");
    }
}
Also used : Recents(com.android.systemui.recents.Recents) DividerView(com.android.systemui.stackdivider.DividerView) DividerSnapAlgorithm(com.android.internal.policy.DividerSnapAlgorithm) RemoteException(android.os.RemoteException) Divider(com.android.systemui.stackdivider.Divider)

Example 3 with Recents

use of com.android.systemui.recents.Recents in project android_frameworks_base by ResurrectionRemix.

the class ShortcutKeyDispatcher method handleDockKey.

private void handleDockKey(long shortcutCode) {
    try {
        int dockSide = mWindowManagerService.getDockedStackSide();
        if (dockSide == WindowManager.DOCKED_INVALID) {
            // If there is no window docked, we dock the top-most window.
            Recents recents = getComponent(Recents.class);
            int dockMode = (shortcutCode == SC_DOCK_LEFT) ? ActivityManager.DOCKED_STACK_CREATE_MODE_TOP_OR_LEFT : ActivityManager.DOCKED_STACK_CREATE_MODE_BOTTOM_OR_RIGHT;
            recents.dockTopTask(NavigationBarGestureHelper.DRAG_MODE_NONE, dockMode, null, MetricsEvent.WINDOW_DOCK_SHORTCUTS);
        } else {
            // If there is already a docked window, we respond by resizing the docking pane.
            DividerView dividerView = getComponent(Divider.class).getView();
            DividerSnapAlgorithm snapAlgorithm = dividerView.getSnapAlgorithm();
            int dividerPosition = dividerView.getCurrentPosition();
            DividerSnapAlgorithm.SnapTarget currentTarget = snapAlgorithm.calculateNonDismissingSnapTarget(dividerPosition);
            int increment = (shortcutCode == SC_DOCK_LEFT) ? -1 : 1;
            DividerSnapAlgorithm.SnapTarget target = snapAlgorithm.cycleNonDismissTarget(currentTarget, increment);
            dividerView.startDragging(true, /* animate */
            false);
            dividerView.stopDragging(target.position, 0f, true, /* avoidDismissStart */
            true);
        }
    } catch (RemoteException e) {
        Log.e(TAG, "handleDockKey() failed.");
    }
}
Also used : Recents(com.android.systemui.recents.Recents) DividerView(com.android.systemui.stackdivider.DividerView) DividerSnapAlgorithm(com.android.internal.policy.DividerSnapAlgorithm) RemoteException(android.os.RemoteException) Divider(com.android.systemui.stackdivider.Divider)

Example 4 with Recents

use of com.android.systemui.recents.Recents in project android_frameworks_base by crdroidandroid.

the class ShortcutKeyDispatcher method handleDockKey.

private void handleDockKey(long shortcutCode) {
    try {
        int dockSide = mWindowManagerService.getDockedStackSide();
        if (dockSide == WindowManager.DOCKED_INVALID) {
            // If there is no window docked, we dock the top-most window.
            Recents recents = getComponent(Recents.class);
            int dockMode = (shortcutCode == SC_DOCK_LEFT) ? ActivityManager.DOCKED_STACK_CREATE_MODE_TOP_OR_LEFT : ActivityManager.DOCKED_STACK_CREATE_MODE_BOTTOM_OR_RIGHT;
            recents.dockTopTask(NavigationBarGestureHelper.DRAG_MODE_NONE, dockMode, null, MetricsEvent.WINDOW_DOCK_SHORTCUTS);
        } else {
            // If there is already a docked window, we respond by resizing the docking pane.
            DividerView dividerView = getComponent(Divider.class).getView();
            DividerSnapAlgorithm snapAlgorithm = dividerView.getSnapAlgorithm();
            int dividerPosition = dividerView.getCurrentPosition();
            DividerSnapAlgorithm.SnapTarget currentTarget = snapAlgorithm.calculateNonDismissingSnapTarget(dividerPosition);
            int increment = (shortcutCode == SC_DOCK_LEFT) ? -1 : 1;
            DividerSnapAlgorithm.SnapTarget target = snapAlgorithm.cycleNonDismissTarget(currentTarget, increment);
            dividerView.startDragging(true, /* animate */
            false);
            dividerView.stopDragging(target.position, 0f, true, /* avoidDismissStart */
            true);
        }
    } catch (RemoteException e) {
        Log.e(TAG, "handleDockKey() failed.");
    }
}
Also used : Recents(com.android.systemui.recents.Recents) DividerView(com.android.systemui.stackdivider.DividerView) DividerSnapAlgorithm(com.android.internal.policy.DividerSnapAlgorithm) RemoteException(android.os.RemoteException) Divider(com.android.systemui.stackdivider.Divider)

Example 5 with Recents

use of com.android.systemui.recents.Recents in project android_frameworks_base by AOSPA.

the class ShortcutKeyDispatcher method handleDockKey.

private void handleDockKey(long shortcutCode) {
    try {
        int dockSide = mWindowManagerService.getDockedStackSide();
        if (dockSide == WindowManager.DOCKED_INVALID) {
            // If there is no window docked, we dock the top-most window.
            Recents recents = getComponent(Recents.class);
            int dockMode = (shortcutCode == SC_DOCK_LEFT) ? ActivityManager.DOCKED_STACK_CREATE_MODE_TOP_OR_LEFT : ActivityManager.DOCKED_STACK_CREATE_MODE_BOTTOM_OR_RIGHT;
            recents.dockTopTask(NavigationBarGestureHelper.DRAG_MODE_NONE, dockMode, null, MetricsEvent.WINDOW_DOCK_SHORTCUTS);
        } else {
            // If there is already a docked window, we respond by resizing the docking pane.
            DividerView dividerView = getComponent(Divider.class).getView();
            DividerSnapAlgorithm snapAlgorithm = dividerView.getSnapAlgorithm();
            int dividerPosition = dividerView.getCurrentPosition();
            DividerSnapAlgorithm.SnapTarget currentTarget = snapAlgorithm.calculateNonDismissingSnapTarget(dividerPosition);
            int increment = (shortcutCode == SC_DOCK_LEFT) ? -1 : 1;
            DividerSnapAlgorithm.SnapTarget target = snapAlgorithm.cycleNonDismissTarget(currentTarget, increment);
            dividerView.startDragging(true, /* animate */
            false);
            dividerView.stopDragging(target.position, 0f, true, /* avoidDismissStart */
            true);
        }
    } catch (RemoteException e) {
        Log.e(TAG, "handleDockKey() failed.");
    }
}
Also used : Recents(com.android.systemui.recents.Recents) DividerView(com.android.systemui.stackdivider.DividerView) DividerSnapAlgorithm(com.android.internal.policy.DividerSnapAlgorithm) RemoteException(android.os.RemoteException) Divider(com.android.systemui.stackdivider.Divider)

Aggregations

RemoteException (android.os.RemoteException)5 DividerSnapAlgorithm (com.android.internal.policy.DividerSnapAlgorithm)5 Recents (com.android.systemui.recents.Recents)5 Divider (com.android.systemui.stackdivider.Divider)5 DividerView (com.android.systemui.stackdivider.DividerView)5