Search in sources :

Example 36 with Launcher

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

the class Launcher method dump.

/**
 * $ adb shell dumpsys activity com.android.launcher3.Launcher [--all]
 */
@Override
public void dump(String prefix, FileDescriptor fd, PrintWriter writer, String[] args) {
    super.dump(prefix, fd, writer, args);
    if (args.length > 0 && TextUtils.equals(args[0], "--all")) {
        writer.println(prefix + "Workspace Items");
        for (int i = 0; i < mWorkspace.getPageCount(); i++) {
            writer.println(prefix + "  Homescreen " + i);
            ViewGroup layout = ((CellLayout) mWorkspace.getPageAt(i)).getShortcutsAndWidgets();
            for (int j = 0; j < layout.getChildCount(); j++) {
                Object tag = layout.getChildAt(j).getTag();
                if (tag != null) {
                    writer.println(prefix + "    " + tag.toString());
                }
            }
        }
        writer.println(prefix + "  Hotseat");
        ViewGroup layout = mHotseat.getShortcutsAndWidgets();
        for (int j = 0; j < layout.getChildCount(); j++) {
            Object tag = layout.getChildAt(j).getTag();
            if (tag != null) {
                writer.println(prefix + "    " + tag.toString());
            }
        }
    }
    writer.println(prefix + "Misc:");
    dumpMisc(prefix + "\t", writer);
    writer.println(prefix + "\tmWorkspaceLoading=" + mWorkspaceLoading);
    writer.println(prefix + "\tmPendingRequestArgs=" + mPendingRequestArgs + " mPendingActivityResult=" + mPendingActivityResult);
    writer.println(prefix + "\tmRotationHelper: " + mRotationHelper);
    writer.println(prefix + "\tmAppWidgetHost.isListening: " + mAppWidgetHost.isListening());
    // Extra logging for general debugging
    mDragLayer.dump(prefix, writer);
    mStateManager.dump(prefix, writer);
    mPopupDataProvider.dump(prefix, writer);
    mDeviceProfile.dump(prefix, writer);
    try {
        FileLog.flushAll(writer);
    } catch (Exception e) {
    // Ignore
    }
    mModel.dumpState(prefix, fd, writer, args);
    if (mLauncherCallbacks != null) {
        mLauncherCallbacks.dump(prefix, fd, writer, args);
    }
    mOverlayManager.dump(prefix, writer);
}
Also used : ViewGroup(android.view.ViewGroup) DragObject(com.android.launcher3.DropTarget.DragObject) ActivityNotFoundException(android.content.ActivityNotFoundException)

Example 37 with Launcher

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

the class LauncherUIScrollTest method testWidgetsListScroll.

@Test
public void testWidgetsListScroll() throws Exception {
    // Install 100 widgets
    for (int i = 0; i < 100; i++) {
        mModelHelper.installCustomShortcut(TEST_PACKAGE + i, "shortcutProvider");
    }
    // Bind and open widgets
    Launcher launcher = loadLauncher();
    WidgetsFullSheet widgets = WidgetsFullSheet.show(launcher, false);
    doLayout(launcher);
    int currentScroll = widgets.getRecyclerView().getCurrentScrollY();
    launcher.dispatchGenericMotionEvent(createScrollEvent(-1));
    int newScroll = widgets.getRecyclerView().getCurrentScrollY();
    assertNotEquals("Widgets was not scrolled", currentScroll, newScroll);
    assertEquals("Workspace was scrolled", 0, launcher.getWorkspace().getNextPage());
}
Also used : LauncherUIHelper.buildAndBindLauncher(com.android.launcher3.util.LauncherUIHelper.buildAndBindLauncher) Launcher(com.android.launcher3.Launcher) WidgetsFullSheet(com.android.launcher3.widget.picker.WidgetsFullSheet) Test(org.junit.Test)

Example 38 with Launcher

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

the class LauncherUIScrollTest method testFolderPageScroll.

@Test
public void testFolderPageScroll() throws Exception {
    // Add a folder with multiple icons
    FolderBuilder fb = mLayoutBuilder.atWorkspace(mIdp.numColumns / 2, mIdp.numRows / 2, 0).putFolder(0);
    for (int i = 0; i < 100; i++) {
        fb.addApp(TEST_PACKAGE, TEST_PACKAGE);
    }
    // Bind and open folder
    Launcher launcher = loadLauncher();
    doLayout(launcher);
    launcher.getWorkspace().getFirstMatch((i, v) -> v instanceof FolderIcon).performClick();
    ShadowLooper.idleMainLooper();
    doLayout(launcher);
    FolderPagedView folderPages = Folder.getOpen(launcher).getContent();
    assertEquals(0, folderPages.getNextPage());
    launcher.dispatchGenericMotionEvent(createScrollEvent(-1));
    assertNotEquals("Folder page was not scrolled", 0, folderPages.getNextPage());
    assertEquals("Workspace was scrolled", 0, launcher.getWorkspace().getNextPage());
}
Also used : Folder(com.android.launcher3.folder.Folder) Context(android.content.Context) WidgetsFullSheet(com.android.launcher3.widget.picker.WidgetsFullSheet) PointerProperties(android.view.MotionEvent.PointerProperties) LauncherLayoutBuilder(com.android.launcher3.util.LauncherLayoutBuilder) FolderIcon(com.android.launcher3.folder.FolderIcon) RunWith(org.junit.runner.RunWith) LauncherUIHelper.buildAndBindLauncher(com.android.launcher3.util.LauncherUIHelper.buildAndBindLauncher) SystemClock(android.os.SystemClock) Mode(org.robolectric.annotation.LooperMode.Mode) InputDevice(android.view.InputDevice) MotionEvent(android.view.MotionEvent) TEST_PACKAGE(com.android.launcher3.util.LauncherModelHelper.TEST_PACKAGE) Settings(android.provider.Settings) FolderPagedView(com.android.launcher3.folder.FolderPagedView) Before(org.junit.Before) Launcher(com.android.launcher3.Launcher) LauncherModelHelper(com.android.launcher3.util.LauncherModelHelper) ShadowLooper(org.robolectric.shadows.ShadowLooper) Test(org.junit.Test) LooperMode(org.robolectric.annotation.LooperMode) RuntimeEnvironment(org.robolectric.RuntimeEnvironment) Assert.assertNotEquals(org.junit.Assert.assertNotEquals) DeviceProfile(com.android.launcher3.DeviceProfile) LauncherState(com.android.launcher3.LauncherState) FolderBuilder(com.android.launcher3.util.LauncherLayoutBuilder.FolderBuilder) RobolectricTestRunner(org.robolectric.RobolectricTestRunner) InvariantDeviceProfile(com.android.launcher3.InvariantDeviceProfile) LauncherUIHelper.doLayout(com.android.launcher3.util.LauncherUIHelper.doLayout) Assert.assertEquals(org.junit.Assert.assertEquals) FolderPagedView(com.android.launcher3.folder.FolderPagedView) FolderBuilder(com.android.launcher3.util.LauncherLayoutBuilder.FolderBuilder) FolderIcon(com.android.launcher3.folder.FolderIcon) LauncherUIHelper.buildAndBindLauncher(com.android.launcher3.util.LauncherUIHelper.buildAndBindLauncher) Launcher(com.android.launcher3.Launcher) Test(org.junit.Test)

Example 39 with Launcher

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

the class AppWidgetResizeFrame method showForWidget.

public static void showForWidget(LauncherAppWidgetHostView widget, CellLayout cellLayout) {
    Launcher launcher = Launcher.getLauncher(cellLayout.getContext());
    AbstractFloatingView.closeAllOpenViews(launcher);
    DragLayer dl = launcher.getDragLayer();
    AppWidgetResizeFrame frame = (AppWidgetResizeFrame) launcher.getLayoutInflater().inflate(R.layout.app_widget_resize_frame, dl, false);
    if (widget.hasEnforcedCornerRadius()) {
        float enforcedCornerRadius = widget.getEnforcedCornerRadius();
        ImageView imageView = frame.findViewById(R.id.widget_resize_frame);
        Drawable d = imageView.getDrawable();
        if (d instanceof GradientDrawable) {
            GradientDrawable gd = (GradientDrawable) d.mutate();
            gd.setCornerRadius(enforcedCornerRadius);
        }
    }
    frame.setupForWidget(widget, cellLayout, dl);
    ((DragLayer.LayoutParams) frame.getLayoutParams()).customPosition = true;
    dl.addView(frame);
    frame.mIsOpen = true;
    frame.snapToWidget(false);
}
Also used : DragLayer(com.android.launcher3.dragndrop.DragLayer) Drawable(android.graphics.drawable.Drawable) GradientDrawable(android.graphics.drawable.GradientDrawable) ImageView(android.widget.ImageView) GradientDrawable(android.graphics.drawable.GradientDrawable)

Example 40 with Launcher

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

the class TaplTestsLauncher3 method testAppIconLaunchFromAllAppsFromHome.

@Test
@PortraitLandscape
public void testAppIconLaunchFromAllAppsFromHome() throws Exception {
    final AllApps allApps = mLauncher.getWorkspace().switchToAllApps();
    assertTrue("Launcher internal state is not All Apps", isInState(() -> LauncherState.ALL_APPS));
    runIconLaunchFromAllAppsTest(this, allApps);
}
Also used : AllApps(com.android.launcher3.tapl.AllApps) LargeTest(androidx.test.filters.LargeTest) Test(org.junit.Test)

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