Search in sources :

Example 1 with DragController

use of com.android.launcher3.dragndrop.DragController in project android_packages_apps_Launcher3 by crdroidandroid.

the class ItemLongClickListener method onAllAppsItemLongClick.

private static boolean onAllAppsItemLongClick(View v) {
    TestLogging.recordEvent(TestProtocol.SEQUENCE_MAIN, "onAllAppsItemLongClick");
    v.cancelLongPress();
    Launcher launcher = Launcher.getLauncher(v.getContext());
    if (!canStartDrag(launcher))
        return false;
    // When we have exited all apps or are in transition, disregard long clicks
    if (!launcher.isInState(ALL_APPS) && !launcher.isInState(OVERVIEW))
        return false;
    if (launcher.getWorkspace().isSwitchingState())
        return false;
    StatsLogger logger = launcher.getStatsLogManager().logger();
    if (v.getTag() instanceof ItemInfo) {
        logger.withItemInfo((ItemInfo) v.getTag());
    }
    logger.log(LAUNCHER_ALLAPPS_ITEM_LONG_PRESSED);
    // Start the drag
    final DragController dragController = launcher.getDragController();
    dragController.addDragListener(new DragController.DragListener() {

        @Override
        public void onDragStart(DropTarget.DragObject dragObject, DragOptions options) {
            v.setVisibility(INVISIBLE);
        }

        @Override
        public void onDragEnd() {
            v.setVisibility(VISIBLE);
            dragController.removeDragListener(this);
        }
    });
    DeviceProfile grid = launcher.getDeviceProfile();
    DragOptions options = new DragOptions();
    options.intrinsicIconScaleFactor = (float) grid.allAppsIconSizePx / grid.iconSizePx;
    launcher.getWorkspace().beginDragShared(v, launcher.getAppsView(), options);
    return false;
}
Also used : DragOptions(com.android.launcher3.dragndrop.DragOptions) DeviceProfile(com.android.launcher3.DeviceProfile) StatsLogger(com.android.launcher3.logging.StatsLogManager.StatsLogger) ItemInfo(com.android.launcher3.model.data.ItemInfo) DragController(com.android.launcher3.dragndrop.DragController) Launcher(com.android.launcher3.Launcher) DropTarget(com.android.launcher3.DropTarget)

Example 2 with DragController

use of com.android.launcher3.dragndrop.DragController in project android_packages_apps_Launcher3 by crdroidandroid.

the class DragLayer method setup.

public void setup(DragController dragController, Workspace workspace) {
    mDragController = dragController;
    recreateControllers();
    mWorkspaceDragScrim = new Scrim(this);
}
Also used : Scrim(com.android.launcher3.graphics.Scrim)

Example 3 with DragController

use of com.android.launcher3.dragndrop.DragController in project android_packages_apps_Launcher3 by crdroidandroid.

the class Workspace method setup.

void setup(DragController dragController) {
    mSpringLoadedDragController = new SpringLoadedDragController(mLauncher);
    mDragController = dragController;
    // hardware layers on children are enabled on startup, but should be disabled until
    // needed
    updateChildrenLayersEnabled();
}
Also used : SpringLoadedDragController(com.android.launcher3.dragndrop.SpringLoadedDragController)

Aggregations

DeviceProfile (com.android.launcher3.DeviceProfile)1 DropTarget (com.android.launcher3.DropTarget)1 Launcher (com.android.launcher3.Launcher)1 DragController (com.android.launcher3.dragndrop.DragController)1 DragOptions (com.android.launcher3.dragndrop.DragOptions)1 SpringLoadedDragController (com.android.launcher3.dragndrop.SpringLoadedDragController)1 Scrim (com.android.launcher3.graphics.Scrim)1 StatsLogger (com.android.launcher3.logging.StatsLogManager.StatsLogger)1 ItemInfo (com.android.launcher3.model.data.ItemInfo)1