Search in sources :

Example 1 with DragAndDropAccessibilityDelegate

use of com.android.launcher3.accessibility.DragAndDropAccessibilityDelegate in project android_packages_apps_Launcher3 by crdroidandroid.

the class KeyboardDragAndDropView method showForIcon.

/**
 * Shows the keyboard drag popup for the provided view
 */
public void showForIcon(View icon, ItemInfo item, DragOptions dragOptions) {
    mIsOpen = true;
    mLauncher.getDragLayer().addView(this);
    mLauncher.getStateManager().addStateListener(this);
    // Find current selection
    CellLayout currentParent = (CellLayout) icon.getParent().getParent();
    float[] iconPos = new float[] { currentParent.getCellWidth() / 2, currentParent.getCellHeight() / 2 };
    Utilities.getDescendantCoordRelativeToAncestor(icon, currentParent, iconPos, false);
    ItemLongClickListener.beginDrag(icon, mLauncher, item, dragOptions);
    DragAndDropAccessibilityDelegate dndDelegate = currentParent.getDragAndDropAccessibilityDelegate();
    setCurrentSelection(new VirtualNodeInfo(dndDelegate, dndDelegate.getVirtualViewAt(iconPos[0], iconPos[1])));
    mLauncher.setDefaultKeyMode(Activity.DEFAULT_KEYS_DISABLE);
    requestFocus();
}
Also used : CellLayout(com.android.launcher3.CellLayout) DragAndDropAccessibilityDelegate(com.android.launcher3.accessibility.DragAndDropAccessibilityDelegate)

Aggregations

CellLayout (com.android.launcher3.CellLayout)1 DragAndDropAccessibilityDelegate (com.android.launcher3.accessibility.DragAndDropAccessibilityDelegate)1