Search in sources :

Example 6 with SimpleViewsFactory

use of com.android.launcher3.testcomponent.ListViewService.SimpleViewsFactory in project android_packages_apps_Launcher3 by ProtonAOSP.

the class ViewInflationDuringSwipeUp method testSwipeUp_with_list_widgets.

@Test
@NavigationModeSwitch(mode = ZERO_BUTTON)
// until b/190729479 is fixed
@Suppress
public void testSwipeUp_with_list_widgets() {
    SimpleViewsFactory viewFactory = new SimpleViewsFactory();
    viewFactory.viewCount = 1;
    Bundle args = new Bundle();
    args.putBinder(EXTRA_VALUE, viewFactory.toBinder());
    TestCommandReceiver.callCommand(SET_LIST_VIEW_SERVICE_BINDER, null, args);
    try {
        executeSwipeUpTestWithWidget(widgetId -> {
            // Initialize widget
            RemoteViews views = createMainWidgetViews("List widget title");
            views.setRemoteAdapter(android.R.id.list, new Intent(getContext(), ListViewService.class));
            AppWidgetManager.getInstance(getContext()).updateAppWidget(widgetId, views);
            verifyWidget(viewFactory.getLabel(0));
        }, widgetId -> {
            // Update widget
            viewFactory.viewCount = 2;
            AppWidgetManager.getInstance(getContext()).notifyAppWidgetViewDataChanged(widgetId, android.R.id.list);
        }, viewFactory.getLabel(1));
    } finally {
        TestCommandReceiver.callCommand(SET_LIST_VIEW_SERVICE_BINDER, null, new Bundle());
    }
}
Also used : RemoteViews(android.widget.RemoteViews) ListViewService(com.android.launcher3.testcomponent.ListViewService) Bundle(android.os.Bundle) Intent(android.content.Intent) SimpleViewsFactory(com.android.launcher3.testcomponent.ListViewService.SimpleViewsFactory) LargeTest(androidx.test.filters.LargeTest) Test(org.junit.Test) NavigationModeSwitch(com.android.quickstep.NavigationModeSwitchRule.NavigationModeSwitch) Suppress(androidx.test.filters.Suppress)

Aggregations

Intent (android.content.Intent)6 Bundle (android.os.Bundle)6 RemoteViews (android.widget.RemoteViews)6 LargeTest (androidx.test.filters.LargeTest)6 ListViewService (com.android.launcher3.testcomponent.ListViewService)6 SimpleViewsFactory (com.android.launcher3.testcomponent.ListViewService.SimpleViewsFactory)6 NavigationModeSwitch (com.android.quickstep.NavigationModeSwitchRule.NavigationModeSwitch)6 Test (org.junit.Test)6 Suppress (androidx.test.filters.Suppress)5