use of com.android.launcher3.tapl.AllApps in project android_packages_apps_Trebuchet by LineageOS.
the class TaplTestsLauncher3 method testDragShortcut.
@Test
@PortraitLandscape
public void testDragShortcut() throws Throwable {
// 1. Open all apps and wait for load complete.
// 2. Find the app and long press it to show shortcuts.
// 3. Press icon center until shortcuts appear
final AllApps allApps = mLauncher.getWorkspace().switchToAllApps();
allApps.freeze();
try {
final AppIconMenuItem menuItem = allApps.getAppIcon(APP_NAME).openMenu().getMenuItem(0);
final String shortcutName = menuItem.getText();
menuItem.dragToWorkspace(false, false);
mLauncher.getWorkspace().getWorkspaceAppIcon(shortcutName).launch(getAppPackageName());
} finally {
allApps.unfreeze();
}
}
use of com.android.launcher3.tapl.AllApps in project android_packages_apps_Trebuchet by LineageOS.
the class TaplTestsLauncher3 method runAllAppsTest.
public static void runAllAppsTest(AbstractLauncherUiTest test, AllApps allApps) {
allApps.freeze();
try {
assertNotNull("allApps parameter is null", allApps);
assertTrue("Launcher internal state is not All Apps", test.isInState(() -> LauncherState.ALL_APPS));
// Test flinging forward and backward.
test.executeOnLauncher(launcher -> assertEquals("All Apps started in already scrolled state", 0, test.getAllAppsScroll(launcher)));
allApps.flingForward();
assertTrue("Launcher internal state is not All Apps", test.isInState(() -> LauncherState.ALL_APPS));
final Integer flingForwardY = test.getFromLauncher(launcher -> test.getAllAppsScroll(launcher));
test.executeOnLauncher(launcher -> assertTrue("flingForward() didn't scroll App Apps", flingForwardY > 0));
allApps.flingBackward();
assertTrue("Launcher internal state is not All Apps", test.isInState(() -> LauncherState.ALL_APPS));
final Integer flingBackwardY = test.getFromLauncher(launcher -> test.getAllAppsScroll(launcher));
test.executeOnLauncher(launcher -> assertTrue("flingBackward() didn't scroll App Apps", flingBackwardY < flingForwardY));
// Test scrolling down to YouTube.
assertNotNull("All apps: can't fine YouTube", allApps.getAppIcon("YouTube"));
// Test scrolling up to Camera.
assertNotNull("All apps: can't fine Camera", allApps.getAppIcon("Camera"));
// Test failing to find a non-existing app.
final AllApps allAppsFinal = allApps;
expectFail("All apps: could find a non-existing app", () -> allAppsFinal.getAppIcon("NO APP"));
assertTrue("Launcher internal state is not All Apps", test.isInState(() -> LauncherState.ALL_APPS));
} finally {
allApps.unfreeze();
}
}
use of com.android.launcher3.tapl.AllApps in project android_packages_apps_Trebuchet by LineageOS.
the class CellLayout method commitTempPlacement.
private void commitTempPlacement() {
mTmpOccupied.copyTo(mOccupied);
int screenId = Launcher.cast(mActivity).getWorkspace().getIdForScreen(this);
int container = Favorites.CONTAINER_DESKTOP;
if (mContainerType == HOTSEAT) {
screenId = -1;
container = Favorites.CONTAINER_HOTSEAT;
}
int childCount = mShortcutsAndWidgets.getChildCount();
for (int i = 0; i < childCount; i++) {
View child = mShortcutsAndWidgets.getChildAt(i);
LayoutParams lp = (LayoutParams) child.getLayoutParams();
ItemInfo info = (ItemInfo) child.getTag();
// AllApps button in the hotseat.
if (info != null) {
final boolean requiresDbUpdate = (info.cellX != lp.tmpCellX || info.cellY != lp.tmpCellY || info.spanX != lp.cellHSpan || info.spanY != lp.cellVSpan);
info.cellX = lp.cellX = lp.tmpCellX;
info.cellY = lp.cellY = lp.tmpCellY;
info.spanX = lp.cellHSpan;
info.spanY = lp.cellVSpan;
if (requiresDbUpdate) {
Launcher.cast(mActivity).getModelWriter().modifyItemInDatabase(info, container, screenId, info.cellX, info.cellY, info.spanX, info.spanY);
}
}
}
}
use of com.android.launcher3.tapl.AllApps in project android_packages_apps_Trebuchet by LineageOS.
the class TaplTestsQuickstep method testAppIconLaunchFromAllAppsFromOverview.
@Test
public void testAppIconLaunchFromAllAppsFromOverview() throws Exception {
if (!mLauncher.hasAllAppsInOverview()) {
return;
}
final AllApps allApps = mLauncher.getWorkspace().switchToOverview().switchToAllApps();
assertTrue("Launcher internal state is not All Apps", isInState(() -> LauncherState.ALL_APPS));
TaplTestsLauncher3.runIconLaunchFromAllAppsTest(this, allApps);
}
use of com.android.launcher3.tapl.AllApps in project Neo-Launcher by NeoApplications.
the class CellLayout method commitTempPlacement.
private void commitTempPlacement() {
mTmpOccupied.copyTo(mOccupied);
int screenId = Launcher.cast(mActivity).getWorkspace().getIdForScreen(this);
int container = Favorites.CONTAINER_DESKTOP;
if (mContainerType == HOTSEAT) {
screenId = -1;
container = Favorites.CONTAINER_HOTSEAT;
}
int childCount = mShortcutsAndWidgets.getChildCount();
for (int i = 0; i < childCount; i++) {
View child = mShortcutsAndWidgets.getChildAt(i);
LayoutParams lp = (LayoutParams) child.getLayoutParams();
ItemInfo info = (ItemInfo) child.getTag();
// AllApps button in the hotseat.
if (info != null) {
final boolean requiresDbUpdate = (info.cellX != lp.tmpCellX || info.cellY != lp.tmpCellY || info.spanX != lp.cellHSpan || info.spanY != lp.cellVSpan);
info.cellX = lp.cellX = lp.tmpCellX;
info.cellY = lp.cellY = lp.tmpCellY;
info.spanX = lp.cellHSpan;
info.spanY = lp.cellVSpan;
if (requiresDbUpdate) {
Launcher.cast(mActivity).getModelWriter().modifyItemInDatabase(info, container, screenId, info.cellX, info.cellY, info.spanX, info.spanY);
}
}
}
}
Aggregations