Adding MSDL feedback to dragging apps and widgest over drop targets.
The ButtonDropTarget class delivers MSDL feedback onDragEnter. Test: DeleteDropTargetTest Test: manual. Verified haptics when dragging apps and widgtes over "Remove" and secondary drop areas. Flag: com.android.launcher3.msdl_feedback Bug: 371249457 Bug: 371315650 Change-Id: Ic3f79ab5e3da7bb26797f2a1bfb79b5e37b3ac97
This commit is contained in:
@@ -41,8 +41,11 @@ import com.android.launcher3.dragndrop.DragLayer;
|
||||
import com.android.launcher3.dragndrop.DragOptions;
|
||||
import com.android.launcher3.dragndrop.DragView;
|
||||
import com.android.launcher3.model.data.ItemInfo;
|
||||
import com.android.launcher3.util.MSDLPlayerWrapper;
|
||||
import com.android.launcher3.views.ActivityContext;
|
||||
|
||||
import com.google.android.msdl.data.model.MSDLToken;
|
||||
|
||||
/**
|
||||
* Implements a DropTarget.
|
||||
*/
|
||||
@@ -62,6 +65,7 @@ public abstract class ButtonDropTarget extends TextView
|
||||
protected final ActivityContext mActivityContext;
|
||||
protected final DropTargetHandler mDropTargetHandler;
|
||||
protected DropTargetBar mDropTargetBar;
|
||||
private final MSDLPlayerWrapper mMSDLPlayerWrapper;
|
||||
|
||||
/** Whether this drop target is active for the current drag */
|
||||
protected boolean mActive;
|
||||
@@ -94,6 +98,7 @@ public abstract class ButtonDropTarget extends TextView
|
||||
super(context, attrs, defStyle);
|
||||
mActivityContext = ActivityContext.lookupContext(context);
|
||||
mDropTargetHandler = mActivityContext.getDropTargetHandler();
|
||||
mMSDLPlayerWrapper = MSDLPlayerWrapper.INSTANCE.get(context);
|
||||
|
||||
Resources resources = getResources();
|
||||
mDragDistanceThreshold = resources.getDimensionPixelSize(R.dimen.drag_distanceThreshold);
|
||||
@@ -142,6 +147,10 @@ public abstract class ButtonDropTarget extends TextView
|
||||
|
||||
@Override
|
||||
public final void onDragEnter(DragObject d) {
|
||||
// Perform Haptic feedback
|
||||
if (Flags.msdlFeedback()) {
|
||||
mMSDLPlayerWrapper.playToken(MSDLToken.SWIPE_THRESHOLD_INDICATOR);
|
||||
}
|
||||
if (!mAccessibleDrag && !mTextVisible) {
|
||||
// Show tooltip
|
||||
hideTooltip();
|
||||
|
||||
Reference in New Issue
Block a user