Search in sources :

Example 41 with Launcher

use of com.android.launcher3.Launcher in project android_packages_apps_Launcher3 by crdroidandroid.

the class TaplTestsLauncher3 method testDragAppIcon.

@Test
@PortraitLandscape
public void testDragAppIcon() throws Throwable {
    // 1. Open all apps and wait for load complete.
    // 2. Drag icon to homescreen.
    // 3. Verify that the icon works on homescreen.
    final AllApps allApps = mLauncher.getWorkspace().switchToAllApps();
    allApps.freeze();
    try {
        allApps.getAppIcon(APP_NAME).dragToWorkspace(false, false);
        mLauncher.getWorkspace().getWorkspaceAppIcon(APP_NAME).launch(getAppPackageName());
    } finally {
        allApps.unfreeze();
    }
    executeOnLauncher(launcher -> assertTrue("Launcher activity is the top activity; expecting another activity to be the top " + "one", isInBackground(launcher)));
}
Also used : AllApps(com.android.launcher3.tapl.AllApps) LargeTest(androidx.test.filters.LargeTest) Test(org.junit.Test)

Example 42 with Launcher

use of com.android.launcher3.Launcher in project android_packages_apps_Launcher3 by crdroidandroid.

the class TaplTestsLauncher3 method runIconLaunchFromAllAppsTest.

public static void runIconLaunchFromAllAppsTest(AbstractLauncherUiTest test, AllApps allApps) {
    allApps.freeze();
    try {
        final AppIcon app = allApps.getAppIcon("TestActivity7");
        assertNotNull("AppIcon.launch returned null", app.launch(getAppPackageName()));
        test.executeOnLauncher(launcher -> assertTrue("Launcher activity is the top activity; expecting another activity to be the " + "top " + "one", test.isInBackground(launcher)));
    } finally {
        allApps.unfreeze();
    }
}
Also used : AppIcon(com.android.launcher3.tapl.AppIcon)

Example 43 with Launcher

use of com.android.launcher3.Launcher in project android_packages_apps_Launcher3 by crdroidandroid.

the class WorkTabTest method testWorkEduFlow.

@Ignore("b/182844465")
@Test
public void testWorkEduFlow() {
    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 -> {
        if (launcher.getAppsView().getContentView() instanceof AllAppsPagedView) {
            launcher.getAppsView().getAppsStore().enableDeferUpdates(DEFER_UPDATES_TEST);
            return true;
        }
        return false;
    }, LauncherInstrumentation.WAIT_TIME_MS);
    executeOnLauncher(launcher -> launcher.getStateManager().goToState(ALL_APPS));
    WorkEduView workEduView = getEduView();
    // verify personal app edu is seen first and click "next"
    executeOnLauncher(l -> {
        assertEquals(((TextView) workEduView.findViewById(R.id.content_text)).getText(), l.getResources().getString(R.string.work_profile_edu_personal_apps));
        workEduView.findViewById(R.id.proceed).callOnClick();
    });
    AtomicInteger attempt = new AtomicInteger(0);
    // verify work edu is seen next
    waitForLauncherCondition("Launcher did not show the next edu screen", l -> {
        Log.d(TestProtocol.WORK_PROFILE_REMOVED, "running test attempt" + attempt.getAndIncrement());
        if (!(l.getAppsView().getContentView() instanceof AllAppsPagedView)) {
            Log.d(TestProtocol.WORK_PROFILE_REMOVED, "Work tab not setup. Skipping test");
            return false;
        }
        if (((AllAppsPagedView) l.getAppsView().getContentView()).getCurrentPage() != WORK_PAGE) {
            Log.d(TestProtocol.WORK_PROFILE_REMOVED, "Work page not highlighted");
        }
        return ((TextView) workEduView.findViewById(R.id.content_text)).getText().equals(l.getResources().getString(R.string.work_profile_edu_work_apps));
    });
}
Also used : AtomicInteger(java.util.concurrent.atomic.AtomicInteger) Objects(java.util.Objects) AllAppsPagedView(com.android.launcher3.allapps.AllAppsPagedView) WorkEduView(com.android.launcher3.views.WorkEduView) Ignore(org.junit.Ignore) LargeTest(androidx.test.filters.LargeTest) Test(org.junit.Test)

Example 44 with Launcher

use of com.android.launcher3.Launcher in project android_packages_apps_Launcher3 by crdroidandroid.

the class StaggeredWorkspaceAnim method prepareToAnimate.

/**
 * Setup workspace with 0 duration to prepare for our staggered animation.
 */
private void prepareToAnimate(Launcher launcher, boolean animateOverviewScrim) {
    StateAnimationConfig config = new StateAnimationConfig();
    config.animFlags = SKIP_OVERVIEW | SKIP_DEPTH_CONTROLLER | SKIP_SCRIM;
    config.duration = 0;
    // setRecentsAttachedToAppWindow() will animate recents out.
    launcher.getStateManager().createAtomicAnimation(BACKGROUND_APP, NORMAL, config).start();
    // Stop scrolling so that it doesn't interfere with the translation offscreen.
    launcher.<RecentsView>getOverviewPanel().getScroller().forceFinished(true);
    if (animateOverviewScrim) {
        launcher.getWorkspace().getStateTransitionAnimation().setScrim(NO_ANIM_PROPERTY_SETTER, BACKGROUND_APP, config);
    }
}
Also used : StateAnimationConfig(com.android.launcher3.states.StateAnimationConfig) RecentsView(com.android.quickstep.views.RecentsView)

Example 45 with Launcher

use of com.android.launcher3.Launcher in project android_packages_apps_Launcher3 by crdroidandroid.

the class StaggeredWorkspaceAnim method addDepthAnimationForState.

private void addDepthAnimationForState(Launcher launcher, LauncherState state, long duration) {
    if (!(launcher instanceof BaseQuickstepLauncher)) {
        return;
    }
    PendingAnimation builder = new PendingAnimation(duration);
    DepthController depthController = ((BaseQuickstepLauncher) launcher).getDepthController();
    depthController.setStateWithAnimation(state, new StateAnimationConfig(), builder);
    mAnimators.play(builder.buildAnim());
}
Also used : PendingAnimation(com.android.launcher3.anim.PendingAnimation) BaseQuickstepLauncher(com.android.launcher3.BaseQuickstepLauncher) StateAnimationConfig(com.android.launcher3.states.StateAnimationConfig) DepthController(com.android.launcher3.statehandlers.DepthController)

Aggregations

Launcher (com.android.launcher3.Launcher)194 WorkspaceItemInfo (com.android.launcher3.model.data.WorkspaceItemInfo)102 Test (org.junit.Test)102 View (android.view.View)87 LargeTest (androidx.test.filters.LargeTest)83 ItemInfo (com.android.launcher3.model.data.ItemInfo)83 Rect (android.graphics.Rect)80 Point (android.graphics.Point)77 Intent (android.content.Intent)71 ArrayList (java.util.ArrayList)69 DeviceProfile (com.android.launcher3.DeviceProfile)66 BaseQuickstepLauncher (com.android.launcher3.BaseQuickstepLauncher)64 Context (android.content.Context)61 LauncherAppWidgetInfo (com.android.launcher3.model.data.LauncherAppWidgetInfo)49 RecentsView (com.android.quickstep.views.RecentsView)46 DragLayer (com.android.launcher3.dragndrop.DragLayer)45 ComponentName (android.content.ComponentName)43 FolderInfo (com.android.launcher3.model.data.FolderInfo)42 ViewGroup (android.view.ViewGroup)41 AllApps (com.android.launcher3.tapl.AllApps)40