use of com.android.launcher3.LauncherState.OVERVIEW in project Neo-Launcher by NeoApplications.
the class AbstractLauncherUiTest method checkLauncherIntegrity.
private static void checkLauncherIntegrity(Launcher launcher, ContainerType expectedContainerType) {
if (launcher != null) {
final LauncherStateManager stateManager = launcher.getStateManager();
final LauncherState stableState = stateManager.getCurrentStableState();
assertTrue("Stable state != state: " + stableState.getClass().getSimpleName() + ", " + stateManager.getState().getClass().getSimpleName(), stableState == stateManager.getState());
final boolean isResumed = launcher.hasBeenResumed();
assertTrue("hasBeenResumed() != isStarted(), hasBeenResumed(): " + isResumed, isResumed == launcher.isStarted());
assertTrue("hasBeenResumed() != isUserActive(), hasBeenResumed(): " + isResumed, isResumed == launcher.isUserActive());
final int ordinal = stableState.ordinal;
switch(expectedContainerType) {
case WORKSPACE:
case WIDGETS:
{
assertTrue("Launcher is not resumed in state: " + expectedContainerType, isResumed);
assertTrue(TestProtocol.stateOrdinalToString(ordinal), ordinal == TestProtocol.NORMAL_STATE_ORDINAL);
break;
}
case ALL_APPS:
{
assertTrue("Launcher is not resumed in state: " + expectedContainerType, isResumed);
assertTrue(TestProtocol.stateOrdinalToString(ordinal), ordinal == TestProtocol.ALL_APPS_STATE_ORDINAL);
break;
}
case OVERVIEW:
{
assertTrue("Launcher is not resumed in state: " + expectedContainerType, isResumed);
assertTrue(TestProtocol.stateOrdinalToString(ordinal), ordinal == TestProtocol.OVERVIEW_STATE_ORDINAL);
break;
}
case BACKGROUND:
{
assertTrue("Launcher is resumed in state: " + expectedContainerType, !isResumed);
assertTrue(TestProtocol.stateOrdinalToString(ordinal), ordinal == TestProtocol.NORMAL_STATE_ORDINAL);
break;
}
default:
throw new IllegalArgumentException("Illegal container: " + expectedContainerType);
}
} else {
assertTrue("Container type is not BACKGROUND or FALLBACK_OVERVIEW: " + expectedContainerType, expectedContainerType == ContainerType.BACKGROUND || expectedContainerType == ContainerType.FALLBACK_OVERVIEW);
}
}
use of com.android.launcher3.LauncherState.OVERVIEW in project android_packages_apps_Launcher3 by ArrowOS.
the class LauncherActivityInterface method onSwipeUpToHomeComplete.
@Override
public void onSwipeUpToHomeComplete(RecentsAnimationDeviceState deviceState) {
Launcher launcher = getCreatedActivity();
if (launcher == null) {
return;
}
// When going to home, the state animator we use has SKIP_OVERVIEW because we assume that
// setRecentsAttachedToAppWindow() will handle animating Overview instead. Thus, at the end
// of the animation, we should ensure recents is at the correct position for NORMAL state.
// For example, when doing a long swipe to home, RecentsView may be scaled down. This is
// relatively expensive, so do it on the next frame instead of critical path.
MAIN_EXECUTOR.getHandler().post(launcher.getStateManager()::reapplyState);
launcher.getRootView().setForceHideBackArrow(false);
notifyRecentsOfOrientation(deviceState.getRotationTouchHelper());
}
use of com.android.launcher3.LauncherState.OVERVIEW in project android_packages_apps_Launcher3 by ArrowOS.
the class TaskOverlayFactory method addSplitOptions.
/**
* Does NOT add split options in the following scenarios:
* * The taskView to add split options is already showing split screen tasks
* * There aren't at least 2 tasks in overview to show split options for
* * Device is in "Lock task mode"
* * The taskView to show split options for is the focused task AND we haven't started
* scrolling in overview (if we haven't scrolled, there's a split overview action button so
* we don't need this menu option)
*/
private static void addSplitOptions(List<SystemShortcut> outShortcuts, BaseDraggingActivity activity, TaskView taskView, DeviceProfile deviceProfile) {
RecentsView recentsView = taskView.getRecentsView();
PagedOrientationHandler orientationHandler = recentsView.getPagedOrientationHandler();
int[] taskViewTaskIds = taskView.getTaskIds();
boolean taskViewHasMultipleTasks = taskViewTaskIds[0] != -1 && taskViewTaskIds[1] != -1;
boolean notEnoughTasksToSplit = recentsView.getTaskViewCount() < 2;
boolean isFocusedTask = deviceProfile.overviewShowAsGrid && taskView.isFocusedTask();
boolean isTaskInExpectedScrollPosition = recentsView.isTaskInExpectedScrollPosition(recentsView.indexOfChild(taskView));
ActivityManager activityManager = (ActivityManager) taskView.getContext().getSystemService(Context.ACTIVITY_SERVICE);
boolean isLockTaskMode = activityManager.isInLockTaskMode();
if (taskViewHasMultipleTasks || notEnoughTasksToSplit || isLockTaskMode || (isFocusedTask && isTaskInExpectedScrollPosition)) {
return;
}
List<SplitPositionOption> positions = orientationHandler.getSplitPositionOptions(deviceProfile);
for (SplitPositionOption option : positions) {
outShortcuts.add(new SplitSelectSystemShortcut(activity, taskView, option));
}
}
use of com.android.launcher3.LauncherState.OVERVIEW in project android_packages_apps_Launcher3 by ArrowOS.
the class TaskOverlayFactory method getEnabledShortcuts.
public static List<SystemShortcut> getEnabledShortcuts(TaskView taskView, DeviceProfile deviceProfile, TaskIdAttributeContainer taskContainer) {
final ArrayList<SystemShortcut> shortcuts = new ArrayList<>();
final BaseDraggingActivity activity = BaseActivity.fromContext(taskView.getContext());
boolean hasMultipleTasks = taskView.getTaskIds()[1] != -1;
for (TaskShortcutFactory menuOption : MENU_OPTIONS) {
if (hasMultipleTasks && !menuOption.showForSplitscreen()) {
continue;
}
SystemShortcut shortcut = menuOption.getShortcut(activity, taskContainer);
if (shortcut == null) {
continue;
}
if (menuOption == TaskShortcutFactory.SPLIT_SCREEN && FeatureFlags.ENABLE_SPLIT_SELECT.get()) {
addSplitOptions(shortcuts, activity, taskView, deviceProfile);
} else {
shortcuts.add(shortcut);
}
}
RecentsOrientedState orientedState = taskView.getRecentsView().getPagedViewOrientedState();
boolean canLauncherRotate = orientedState.isRecentsActivityRotationAllowed();
boolean isInLandscape = orientedState.getTouchRotation() != ROTATION_0;
// Add overview actions to the menu when in in-place rotate landscape mode.
if (!canLauncherRotate && isInLandscape) {
// Add screenshot action to task menu.
SystemShortcut screenshotShortcut = TaskShortcutFactory.SCREENSHOT.getShortcut(activity, taskContainer);
if (screenshotShortcut != null) {
shortcuts.add(screenshotShortcut);
}
// Add modal action only if display orientation is the same as the device orientation.
if (orientedState.getDisplayRotation() == ROTATION_0) {
SystemShortcut modalShortcut = TaskShortcutFactory.MODAL.getShortcut(activity, taskContainer);
if (modalShortcut != null) {
shortcuts.add(modalShortcut);
}
}
}
return shortcuts;
}
use of com.android.launcher3.LauncherState.OVERVIEW in project android_packages_apps_Launcher3 by ArrowOS.
the class ItemLongClickListener method onAllAppsItemLongClick.
private static boolean onAllAppsItemLongClick(View v) {
TestLogging.recordEvent(TestProtocol.SEQUENCE_MAIN, "onAllAppsItemLongClick");
v.cancelLongPress();
Launcher launcher = Launcher.getLauncher(v.getContext());
if (!canStartDrag(launcher))
return false;
// When we have exited all apps or are in transition, disregard long clicks
if (!launcher.isInState(ALL_APPS) && !launcher.isInState(OVERVIEW))
return false;
if (launcher.getWorkspace().isSwitchingState())
return false;
StatsLogger logger = launcher.getStatsLogManager().logger();
if (v.getTag() instanceof ItemInfo) {
logger.withItemInfo((ItemInfo) v.getTag());
}
logger.log(LAUNCHER_ALLAPPS_ITEM_LONG_PRESSED);
// Start the drag
final DragController dragController = launcher.getDragController();
dragController.addDragListener(new DragController.DragListener() {
@Override
public void onDragStart(DropTarget.DragObject dragObject, DragOptions options) {
v.setVisibility(INVISIBLE);
}
@Override
public void onDragEnd() {
v.setVisibility(VISIBLE);
dragController.removeDragListener(this);
}
});
DeviceProfile grid = launcher.getDeviceProfile();
DragOptions options = new DragOptions();
options.intrinsicIconScaleFactor = (float) grid.allAppsIconSizePx / grid.iconSizePx;
launcher.getWorkspace().beginDragShared(v, launcher.getAppsView(), options);
return false;
}
Aggregations