mirror of
https://github.com/LawnchairLauncher/lawnchair.git
synced 2026-03-01 08:16:49 +00:00
Only setup SecondaryDropTarget in onDragStart
- In LauncherAccessibilityDelegate.getsupportedActions, it calls supportsAccessibilityDrop on each button regardless if DropTargetBar is visible or not. SecondaryDropTarget.supportsAccessibilityDrop attempts to setupUi which causes measure/layout of DropTargetBar (as well as DragLayer) each time LauncherAccessibilityDelegate.getsupportedActions is called - To avoid this, only setupUi in onDragStart. In other cases don't call setUi. - Also fixed a bug that when accessibility is on, upon dragging a suggested app, the secondary action suddenly changed to Uninstall Fix: 233383721 Test: Enable accessibility, observe no excessive amount of onLayout is called on DropTargetBar Change-Id: I4d1a00d320cceed81fa1312b5fc5f1081637bea8
This commit is contained in:
@@ -179,7 +179,12 @@ public abstract class ButtonDropTarget extends TextView
|
||||
|
||||
@Override
|
||||
public void onDragStart(DropTarget.DragObject dragObject, DragOptions options) {
|
||||
mActive = !options.isKeyboardDrag && supportsDrop(dragObject.dragInfo);
|
||||
if (options.isKeyboardDrag) {
|
||||
mActive = false;
|
||||
} else {
|
||||
setupItemInfo(dragObject.dragInfo);
|
||||
mActive = supportsDrop(dragObject.dragInfo);
|
||||
}
|
||||
setVisibility(mActive ? View.VISIBLE : View.GONE);
|
||||
|
||||
mAccessibleDrag = options.isAccessibleDrag;
|
||||
@@ -191,6 +196,11 @@ public abstract class ButtonDropTarget extends TextView
|
||||
return supportsDrop(dragObject.dragInfo);
|
||||
}
|
||||
|
||||
/**
|
||||
* Setups button for the specified ItemInfo.
|
||||
*/
|
||||
protected abstract void setupItemInfo(ItemInfo info);
|
||||
|
||||
protected abstract boolean supportsDrop(ItemInfo info);
|
||||
|
||||
public abstract boolean supportsAccessibilityDrop(ItemInfo info, View view);
|
||||
|
||||
Reference in New Issue
Block a user