Search in sources :

Example 26 with ALL_APPS

use of com.android.launcher3.LauncherState.ALL_APPS in project android_packages_apps_404Launcher by P-404.

the class Launcher method onInitialBindComplete.

@Override
@TargetApi(Build.VERSION_CODES.S)
public void onInitialBindComplete(IntSet boundPages, RunnableList pendingTasks) {
    mSynchronouslyBoundPages = boundPages;
    mPagesToBindSynchronously = new IntSet();
    clearPendingBinds();
    ViewOnDrawExecutor executor = new ViewOnDrawExecutor(pendingTasks);
    mPendingExecutor = executor;
    if (!isInState(ALL_APPS)) {
        mAppsView.getAppsStore().enableDeferUpdates(AllAppsStore.DEFER_UPDATES_NEXT_DRAW);
        pendingTasks.add(() -> mAppsView.getAppsStore().disableDeferUpdates(AllAppsStore.DEFER_UPDATES_NEXT_DRAW));
    }
    AlphaProperty property = mDragLayer.getAlphaProperty(ALPHA_INDEX_LAUNCHER_LOAD);
    if (property.getValue() < 1) {
        ObjectAnimator anim = ObjectAnimator.ofFloat(property, MultiValueAlpha.VALUE, 1);
        anim.addListener(AnimatorListeners.forEndCallback(executor::onLoadAnimationCompleted));
        anim.start();
    } else {
        executor.onLoadAnimationCompleted();
    }
    executor.attachTo(this);
    if (Utilities.ATLEAST_S) {
        Trace.endAsyncSection(DISPLAY_WORKSPACE_TRACE_METHOD_NAME, DISPLAY_WORKSPACE_TRACE_COOKIE);
    }
}
Also used : AlphaProperty(com.android.launcher3.util.MultiValueAlpha.AlphaProperty) IntSet(com.android.launcher3.util.IntSet) ObjectAnimator(android.animation.ObjectAnimator) ViewOnDrawExecutor(com.android.launcher3.util.ViewOnDrawExecutor) TargetApi(android.annotation.TargetApi)

Example 27 with ALL_APPS

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

the class AbstractLauncherUiTest method checkLauncherIntegrity.

private void checkLauncherIntegrity(Launcher launcher, ContainerType expectedContainerType) {
    if (launcher != null) {
        final StateManager<LauncherState> 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();
        final boolean isStarted = launcher.isStarted();
        checkLauncherState(launcher, expectedContainerType, isResumed, isStarted);
        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:
                {
                    checkLauncherStateInOverview(launcher, expectedContainerType, isStarted, 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);
    }
}
Also used : LauncherState(com.android.launcher3.LauncherState)

Example 28 with ALL_APPS

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

the class WorkTabTest method toggleWorks.

@Ignore("b/182844465")
@Test
public void toggleWorks() {
    mDevice.pressHome();
    waitForLauncherCondition("Launcher didn't start", Objects::nonNull);
    executeOnLauncher(launcher -> launcher.getStateManager().goToState(ALL_APPS));
    waitForState("Launcher internal state didn't switch to All Apps", () -> ALL_APPS);
    getOnceNotNull("Apps view did not bind", launcher -> launcher.getAppsView().getWorkModeSwitch(), 60000);
    UserManager userManager = getFromLauncher(l -> l.getSystemService(UserManager.class));
    assertEquals(2, userManager.getUserProfiles().size());
    UserHandle workProfile = getFromLauncher(l -> {
        UserHandle myHandle = Process.myUserHandle();
        List<UserHandle> userProfiles = userManager.getUserProfiles();
        return userProfiles.get(0) == myHandle ? userProfiles.get(1) : userProfiles.get(0);
    });
    waitForLauncherCondition("work profile can't be turned off", l -> userManager.requestQuietModeEnabled(true, workProfile));
    assertTrue(userManager.isQuietModeEnabled(workProfile));
    executeOnLauncher(launcher -> {
        WorkModeSwitch wf = launcher.getAppsView().getWorkModeSwitch();
        ((AllAppsPagedView) launcher.getAppsView().getContentView()).snapToPageImmediately(AllAppsContainerView.AdapterHolder.WORK);
        wf.toggle();
    });
    waitForLauncherCondition("Work toggle did not work", l -> l.getSystemService(UserManager.class).isQuietModeEnabled(workProfile));
}
Also used : UserManager(android.os.UserManager) UserHandle(android.os.UserHandle) Objects(java.util.Objects) WorkModeSwitch(com.android.launcher3.allapps.WorkModeSwitch) AllAppsPagedView(com.android.launcher3.allapps.AllAppsPagedView) Ignore(org.junit.Ignore) LargeTest(androidx.test.filters.LargeTest) Test(org.junit.Test)

Example 29 with ALL_APPS

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

the class WorkTabTest method testWorkEduIntermittent.

@Ignore("b/182844465")
@Test
public void testWorkEduIntermittent() {
    mDevice.pressHome();
    waitForLauncherCondition("Launcher didn't start", Objects::nonNull);
    executeOnLauncher(launcher -> launcher.getSharedPrefs().edit().remove(WorkEduView.KEY_WORK_EDU_STEP).remove(WorkEduView.KEY_LEGACY_WORK_EDU_SEEN).commit());
    waitForLauncherCondition("Work tab not setup", launcher -> launcher.getAppsView().getContentView() instanceof AllAppsPagedView, 60000);
    executeOnLauncher(launcher -> launcher.getStateManager().goToState(ALL_APPS));
    // verify personal app edu is seen
    getEduView();
    // dismiss personal edu
    mDevice.pressHome();
    waitForState("Launcher did not go home", () -> NORMAL);
    // open work tab
    executeOnLauncher(launcher -> launcher.getStateManager().goToState(ALL_APPS));
    waitForState("Launcher did not switch to all apps", () -> ALL_APPS);
    waitForLauncherCondition("Work tab not setup", launcher -> launcher.getAppsView().getContentView() instanceof AllAppsPagedView, 60000);
    executeOnLauncher(launcher -> {
        AllAppsPagedView pagedView = (AllAppsPagedView) launcher.getAppsView().getContentView();
        pagedView.setCurrentPage(WORK_PAGE);
    });
    WorkEduView workEduView = getEduView();
    // verify work tab edu is shown
    waitForLauncherCondition("Launcher did not show the next edu screen", l -> ((TextView) workEduView.findViewById(R.id.content_text)).getText().equals(l.getResources().getString(R.string.work_profile_edu_work_apps)));
}
Also used : Objects(java.util.Objects) AllAppsPagedView(com.android.launcher3.allapps.AllAppsPagedView) WorkEduView(com.android.launcher3.views.WorkEduView) TextView(android.widget.TextView) Ignore(org.junit.Ignore) LargeTest(androidx.test.filters.LargeTest) Test(org.junit.Test)

Example 30 with ALL_APPS

use of com.android.launcher3.LauncherState.ALL_APPS in project Neo-Launcher by NeoApplications.

the class PortraitStatesTouchController method canInterceptTouch.

@Override
protected boolean canInterceptTouch(MotionEvent ev) {
    mStartedFromHotseat = isTouchOverHotseat(mLauncher, ev);
    mGoToOverview = false;
    if (mCurrentAnimation != null) {
        if (mFinishFastOnSecondTouch) {
            // TODO: Animate to finish instead.
            mCurrentAnimation.skipToEnd();
        }
        AllAppsTransitionController allAppsController = mLauncher.getAllAppsController();
        if (ev.getY() >= allAppsController.getShiftRange() * allAppsController.getProgress()) {
            // the touch is below the current all apps progress (to allow for double swipe).
            return true;
        }
        // recents, dismiss a task, etc.
        if (mAtomicAnim != null) {
            mAtomicAnim.end();
        }
        return false;
    }
    if (mLauncher.isInState(ALL_APPS)) {
        // In all-apps only listen if the container cannot scroll itself
        if (!mLauncher.getAppsView().shouldContainerScroll(ev)) {
            return false;
        }
    } else if (mLauncher.isInState(OVERVIEW)) {
        if (!mOverviewPortraitStateTouchHelper.canInterceptTouch(ev)) {
            return false;
        }
    } else {
        if ((ev.getEdgeFlags() & EDGE_NAV_BAR) != 0) {
            mGoToOverview = true;
        }
        // If we are swiping to all apps instead of overview, allow it from anywhere.
        // boolean interceptAnywhere = mLauncher.isInState(NORMAL) && !mAllowDragToOverview;
        boolean interceptAnywhere = mLauncher.isInState(NORMAL);
        // For all other states, only listen if the event originated below the hotseat height
        if (!interceptAnywhere && !isTouchOverHotseat(mLauncher, ev)) {
            return false;
        }
    }
    if (AbstractFloatingView.getTopOpenViewWithType(mLauncher, TYPE_ACCESSIBLE) != null) {
        return false;
    }
    return true;
}
Also used : AllAppsTransitionController(com.android.launcher3.allapps.AllAppsTransitionController)

Aggregations

RecentsView (com.android.quickstep.views.RecentsView)16 ValueAnimator (android.animation.ValueAnimator)15 LauncherState (com.android.launcher3.LauncherState)13 ObjectAnimator (android.animation.ObjectAnimator)12 StateAnimationConfig (com.android.launcher3.states.StateAnimationConfig)12 AllAppsTransitionController (com.android.launcher3.allapps.AllAppsTransitionController)11 Animator (android.animation.Animator)9 AnimatorSet (android.animation.AnimatorSet)9 ALL_APPS (com.android.launcher3.LauncherState.ALL_APPS)9 OVERVIEW (com.android.launcher3.LauncherState.OVERVIEW)9 DEACCEL_1_7 (com.android.launcher3.anim.Interpolators.DEACCEL_1_7)9 LINEAR (com.android.launcher3.anim.Interpolators.LINEAR)9 AnimatorListenerAdapter (android.animation.AnimatorListenerAdapter)8 Pair (android.util.Pair)7 View (android.view.View)7 DeviceProfile (com.android.launcher3.DeviceProfile)7 DropTarget (com.android.launcher3.DropTarget)7 Launcher (com.android.launcher3.Launcher)7 DragController (com.android.launcher3.dragndrop.DragController)7 AlphaProperty (com.android.launcher3.util.MultiValueAlpha.AlphaProperty)7