Search in sources :

Example 6 with OVERVIEW

use of com.android.launcher3.LauncherState.OVERVIEW in project android_packages_apps_Launcher3 by crdroidandroid.

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());
}
Also used : Launcher(com.android.launcher3.Launcher) BaseQuickstepLauncher(com.android.launcher3.BaseQuickstepLauncher)

Example 7 with OVERVIEW

use of com.android.launcher3.LauncherState.OVERVIEW in project android_packages_apps_Launcher3 by crdroidandroid.

the class LauncherActivityInterface method onLaunchTaskFailed.

@Override
public void onLaunchTaskFailed() {
    Launcher launcher = getCreatedActivity();
    if (launcher == null) {
        return;
    }
    launcher.getStateManager().goToState(OVERVIEW);
}
Also used : Launcher(com.android.launcher3.Launcher) BaseQuickstepLauncher(com.android.launcher3.BaseQuickstepLauncher)

Example 8 with OVERVIEW

use of com.android.launcher3.LauncherState.OVERVIEW in project android_packages_apps_Launcher3 by crdroidandroid.

the class QuickstepLauncher method onStateOrResumeChanging.

/**
 * Recents logic that triggers when launcher state changes or launcher activity stops/resumes.
 */
private void onStateOrResumeChanging(boolean inTransition) {
    LauncherState state = getStateManager().getState();
    boolean started = ((getActivityFlags() & ACTIVITY_STATE_STARTED)) != 0;
    if (started) {
        DeviceProfile profile = getDeviceProfile();
        boolean willUserBeActive = (getActivityFlags() & ACTIVITY_STATE_USER_WILL_BE_ACTIVE) != 0;
        boolean visible = (state == NORMAL || state == OVERVIEW) && (willUserBeActive || isUserActive()) && !profile.isVerticalBarLayout() && profile.isPhone && !profile.isLandscape;
        UiThreadHelper.runAsyncCommand(this, SET_SHELF_HEIGHT, visible ? 1 : 0, profile.hotseatBarSizePx);
    }
    if (state == NORMAL && !inTransition) {
        ((RecentsView) getOverviewPanel()).setSwipeDownShouldLaunchApp(false);
    }
}
Also used : LauncherState(com.android.launcher3.LauncherState) DeviceProfile(com.android.launcher3.DeviceProfile) RecentsView(com.android.quickstep.views.RecentsView)

Example 9 with OVERVIEW

use of com.android.launcher3.LauncherState.OVERVIEW in project android_packages_apps_Launcher3 by crdroidandroid.

the class FallbackRecentsTest method testOverview.

// b/143488140
// @NavigationModeSwitch
@Test
public void testOverview() {
    startAppFast(getAppPackageName());
    startAppFast(resolveSystemApp(Intent.CATEGORY_APP_CALCULATOR));
    startTestActivity(2);
    Wait.atMost("Expected three apps in the task list", () -> mLauncher.getRecentTasks().size() >= 3, DEFAULT_ACTIVITY_TIMEOUT, mLauncher);
    BaseOverview overview = mLauncher.getBackground().switchToOverview();
    executeOnRecents(recents -> {
        assertTrue("Don't have at least 3 tasks", getTaskCount(recents) >= 3);
    });
    // Test flinging forward and backward.
    overview.flingForward();
    final Integer currentTaskAfterFlingForward = getFromRecents(this::getCurrentOverviewPage);
    executeOnRecents(recents -> assertTrue("Current task in Overview is still 0", currentTaskAfterFlingForward > 0));
    overview.flingBackward();
    executeOnRecents(recents -> assertTrue("Flinging back in Overview did nothing", getCurrentOverviewPage(recents) < currentTaskAfterFlingForward));
    // Test opening a task.
    overview = pressHomeAndGoToOverview();
    OverviewTask task = overview.getCurrentTask();
    assertNotNull("overview.getCurrentTask() returned null (1)", task);
    assertNotNull("OverviewTask.open returned null", task.open());
    assertTrue("Test activity didn't open from Overview", TestHelpers.wait(Until.hasObject(By.pkg(getAppPackageName()).text("TestActivity2")), DEFAULT_UI_TIMEOUT));
    // Test dismissing a task.
    overview = pressHomeAndGoToOverview();
    final Integer numTasks = getFromRecents(this::getTaskCount);
    task = overview.getCurrentTask();
    assertNotNull("overview.getCurrentTask() returned null (2)", task);
    task.dismiss();
    executeOnRecents(recents -> assertEquals("Dismissing a task didn't remove 1 task from Overview", numTasks - 1, getTaskCount(recents)));
    // Test dismissing all tasks.
    pressHomeAndGoToOverview().dismissAllTasks();
    assertTrue("Fallback Launcher not visible", TestHelpers.wait(Until.hasObject(By.pkg(mOtherLauncherActivity.packageName)), WAIT_TIME_MS));
}
Also used : OverviewTask(com.android.launcher3.tapl.OverviewTask) BaseOverview(com.android.launcher3.tapl.BaseOverview) LargeTest(androidx.test.filters.LargeTest) Test(org.junit.Test)

Example 10 with OVERVIEW

use of com.android.launcher3.LauncherState.OVERVIEW in project android_packages_apps_Launcher3 by crdroidandroid.

the class TaplTestsQuickstep method testOverviewActions.

/**
 * Smoke test for action buttons: Presses all the buttons and makes sure no crashes occur.
 */
@Test
@NavigationModeSwitch
@PortraitLandscape
public void testOverviewActions() throws Exception {
    // Experimenting for b/165029151:
    final Overview overview = mLauncher.pressHome().switchToOverview();
    if (overview.hasTasks())
        overview.dismissAllTasks();
    mLauncher.pressHome();
    // 
    startTestAppsWithCheck();
    OverviewActions actionsView = mLauncher.pressHome().switchToOverview().getOverviewActions();
    actionsView.clickAndDismissScreenshot();
    actionsView.clickAndDismissShare();
}
Also used : OverviewActions(com.android.launcher3.tapl.OverviewActions) Overview(com.android.launcher3.tapl.Overview) LargeTest(androidx.test.filters.LargeTest) Test(org.junit.Test) NavigationModeSwitch(com.android.quickstep.NavigationModeSwitchRule.NavigationModeSwitch)

Aggregations

LauncherState (com.android.launcher3.LauncherState)53 Animator (android.animation.Animator)50 ValueAnimator (android.animation.ValueAnimator)42 StateAnimationConfig (com.android.launcher3.states.StateAnimationConfig)41 RecentsView (com.android.quickstep.views.RecentsView)40 AnimatorSet (android.animation.AnimatorSet)38 Launcher (com.android.launcher3.Launcher)36 AnimatorListenerAdapter (android.animation.AnimatorListenerAdapter)34 ObjectAnimator (android.animation.ObjectAnimator)30 LargeTest (androidx.test.filters.LargeTest)29 Test (org.junit.Test)29 Point (android.graphics.Point)24 View (android.view.View)22 DeviceProfile (com.android.launcher3.DeviceProfile)19 PendingAnimation (com.android.launcher3.anim.PendingAnimation)19 RemoteAnimationTargetCompat (com.android.systemui.shared.system.RemoteAnimationTargetCompat)19 ItemInfo (com.android.launcher3.model.data.ItemInfo)18 DepthController (com.android.launcher3.statehandlers.DepthController)17 Task (com.android.systemui.shared.recents.model.Task)17 Rect (android.graphics.Rect)16