use of com.android.launcher3.tapl.Workspace in project android_packages_apps_Launcher3 by AOSPA.
the class AllAppsGridAdapter method onCreateViewHolder.
@Override
public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
switch(viewType) {
case VIEW_TYPE_ICON:
int layout = !FeatureFlags.ENABLE_TWOLINE_ALLAPPS.get() ? R.layout.all_apps_icon : R.layout.all_apps_icon_twoline;
BubbleTextView icon = (BubbleTextView) mLayoutInflater.inflate(layout, parent, false);
icon.setLongPressTimeoutFactor(1f);
icon.setOnFocusChangeListener(mIconFocusListener);
icon.setOnClickListener(mOnIconClickListener);
icon.setOnLongClickListener(mOnIconLongClickListener);
// Ensure the all apps icon height matches the workspace icons in portrait mode.
icon.getLayoutParams().height = mLauncher.getDeviceProfile().allAppsCellHeightPx;
if (FeatureFlags.ENABLE_TWOLINE_ALLAPPS.get()) {
icon.getLayoutParams().height += mExtraHeight;
}
return new ViewHolder(icon);
case VIEW_TYPE_EMPTY_SEARCH:
return new ViewHolder(mLayoutInflater.inflate(R.layout.all_apps_empty_search, parent, false));
case VIEW_TYPE_SEARCH_MARKET:
View searchMarketView = mLayoutInflater.inflate(R.layout.all_apps_search_market, parent, false);
searchMarketView.setOnClickListener(v -> mLauncher.startActivitySafely(v, mMarketSearchIntent, null));
return new ViewHolder(searchMarketView);
case VIEW_TYPE_ALL_APPS_DIVIDER:
return new ViewHolder(mLayoutInflater.inflate(R.layout.all_apps_divider, parent, false));
default:
BaseAdapterProvider adapterProvider = getAdapterProvider(viewType);
if (adapterProvider != null) {
return adapterProvider.onCreateViewHolder(mLayoutInflater, parent, viewType);
}
throw new RuntimeException("Unexpected view type" + viewType);
}
}
use of com.android.launcher3.tapl.Workspace in project android_packages_apps_Launcher3 by AOSPA.
the class AddConfigWidgetTest method runTest.
/**
* @param acceptConfig accept the config activity
*/
private void runTest(boolean acceptConfig) throws Throwable {
clearHomescreen();
mDevice.pressHome();
final Widgets widgets = mLauncher.getWorkspace().openAllWidgets();
// Drag widget to homescreen
WidgetConfigStartupMonitor monitor = new WidgetConfigStartupMonitor();
WidgetResizeFrame resizeFrame = widgets.getWidget(mWidgetInfo.getLabel(mTargetContext.getPackageManager())).dragConfigWidgetToWorkspace(acceptConfig);
// Widget id for which the config activity was opened
mWidgetId = monitor.getWidgetId();
// Verify that the widget id is valid and bound
assertNotNull(mAppWidgetManager.getAppWidgetInfo(mWidgetId));
if (acceptConfig) {
assertNotNull("Widget resize frame not shown after widget added", resizeFrame);
resizeFrame.dismiss();
final Widget widget = mLauncher.getWorkspace().tryGetWidget(mWidgetInfo.label, DEFAULT_UI_TIMEOUT);
assertNotNull("Widget not found on the workspace", widget);
} else {
final Widget widget = mLauncher.getWorkspace().tryGetWidget(mWidgetInfo.label, DEFAULT_UI_TIMEOUT);
assertNull("Widget unexpectedly found on the workspace", widget);
}
}
use of com.android.launcher3.tapl.Workspace in project android_packages_apps_Launcher3 by AOSPA.
the class TaplTestsLauncher3 method testDragToFolder.
@Ignore("b/205014516")
@Test
@PortraitLandscape
public void testDragToFolder() throws Exception {
final AppIcon playStoreIcon = createShortcutIfNotExist("Play Store");
final AppIcon gmailIcon = createShortcutIfNotExist("Gmail");
FolderIcon folderIcon = gmailIcon.dragToIcon(playStoreIcon);
Folder folder = folderIcon.open();
folder.getAppIcon("Play Store");
folder.getAppIcon("Gmail");
Workspace workspace = folder.close();
assertNull("Gmail should be moved to a folder.", workspace.tryGetWorkspaceAppIcon("Gmail"));
assertNull("Play Store should be moved to a folder.", workspace.tryGetWorkspaceAppIcon("Play Store"));
final AppIcon youTubeIcon = createShortcutIfNotExist("YouTube");
folderIcon = youTubeIcon.dragToIcon(folderIcon);
folder = folderIcon.open();
folder.getAppIcon("YouTube");
folder.close();
}
use of com.android.launcher3.tapl.Workspace in project android_packages_apps_Launcher3 by AOSPA.
the class AddWidgetTest method testDragIcon.
@Test
@PortraitLandscape
public void testDragIcon() throws Throwable {
clearHomescreen();
mDevice.pressHome();
final LauncherAppWidgetProviderInfo widgetInfo = TestViewHelpers.findWidgetProvider(this, false);
WidgetResizeFrame resizeFrame = mLauncher.getWorkspace().openAllWidgets().getWidget(widgetInfo.getLabel(mTargetContext.getPackageManager())).dragWidgetToWorkspace();
assertTrue(mActivityMonitor.itemExists((info, view) -> info instanceof LauncherAppWidgetInfo && ((LauncherAppWidgetInfo) info).providerName.getClassName().equals(widgetInfo.provider.getClassName())).call());
assertNotNull("Widget resize frame not shown after widget add", resizeFrame);
resizeFrame.dismiss();
final Widget widget = mLauncher.getWorkspace().tryGetWidget(widgetInfo.label, DEFAULT_UI_TIMEOUT);
assertNotNull("Widget not found on the workspace", widget);
widget.launch(getAppPackageName());
}
use of com.android.launcher3.tapl.Workspace in project android_packages_apps_Launcher3 by AOSPA.
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);
}
}
Aggregations