Search in sources :

Example 1 with KeyboardDragAndDropView

use of com.android.launcher3.keyboard.KeyboardDragAndDropView in project android_packages_apps_Launcher3 by crdroidandroid.

the class LauncherAccessibilityDelegate method beginAccessibleDrag.

private boolean beginAccessibleDrag(View item, ItemInfo info, boolean fromKeyboard) {
    if (!itemSupportsAccessibleDrag(info)) {
        return false;
    }
    mDragInfo = new DragInfo();
    mDragInfo.info = info;
    mDragInfo.item = item;
    mDragInfo.dragType = DragType.ICON;
    if (info instanceof FolderInfo) {
        mDragInfo.dragType = DragType.FOLDER;
    } else if (info instanceof LauncherAppWidgetInfo) {
        mDragInfo.dragType = DragType.WIDGET;
    }
    Rect pos = new Rect();
    mLauncher.getDragLayer().getDescendantRectRelativeToSelf(item, pos);
    mLauncher.getDragController().addDragListener(this);
    DragOptions options = new DragOptions();
    options.isAccessibleDrag = true;
    options.isKeyboardDrag = fromKeyboard;
    options.simulatedDndStartPoint = new Point(pos.centerX(), pos.centerY());
    if (fromKeyboard) {
        KeyboardDragAndDropView popup = (KeyboardDragAndDropView) mLauncher.getLayoutInflater().inflate(R.layout.keyboard_drag_and_drop, mLauncher.getDragLayer(), false);
        popup.showForIcon(item, info, options);
    } else {
        ItemLongClickListener.beginDrag(item, mLauncher, info, options);
    }
    return true;
}
Also used : DragOptions(com.android.launcher3.dragndrop.DragOptions) Rect(android.graphics.Rect) LauncherAppWidgetInfo(com.android.launcher3.model.data.LauncherAppWidgetInfo) KeyboardDragAndDropView(com.android.launcher3.keyboard.KeyboardDragAndDropView) Point(android.graphics.Point) FolderInfo(com.android.launcher3.model.data.FolderInfo)

Aggregations

Point (android.graphics.Point)1 Rect (android.graphics.Rect)1 DragOptions (com.android.launcher3.dragndrop.DragOptions)1 KeyboardDragAndDropView (com.android.launcher3.keyboard.KeyboardDragAndDropView)1 FolderInfo (com.android.launcher3.model.data.FolderInfo)1 LauncherAppWidgetInfo (com.android.launcher3.model.data.LauncherAppWidgetInfo)1