Search in sources :

Example 11 with Utilities.getDescendantCoordRelativeToAncestor

use of com.android.launcher3.Utilities.getDescendantCoordRelativeToAncestor in project android_packages_apps_Launcher3 by ProtonAOSP.

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

Rect (android.graphics.Rect)6 RectF (android.graphics.RectF)5 View (android.view.View)5 ViewParent (android.view.ViewParent)5 TextView (android.widget.TextView)5 AbstractFloatingView (com.android.launcher3.AbstractFloatingView)5 CellLayout (com.android.launcher3.CellLayout)5 PagedView (com.android.launcher3.PagedView)5 DragAndDropAccessibilityDelegate (com.android.launcher3.accessibility.DragAndDropAccessibilityDelegate)5 BubbleTextView (com.android.launcher3.BubbleTextView)1 FolderIcon (com.android.launcher3.folder.FolderIcon)1 DeepShortcutView (com.android.launcher3.shortcuts.DeepShortcutView)1