Merge "Avoiding MSDL haptics when first starting a drag in workspace." into main
This commit is contained in:
committed by
Android (Google) Code Review
commit
d6479f1b1a
@@ -173,6 +173,7 @@ public class CellLayout extends ViewGroup {
|
||||
|
||||
private boolean mDragging = false;
|
||||
public boolean mHasOnLayoutBeenCalled = false;
|
||||
private boolean mPlayDragHaptics = false;
|
||||
|
||||
private final TimeInterpolator mEaseOutInterpolator;
|
||||
protected final ShortcutAndWidgetContainer mShortcutsAndWidgets;
|
||||
@@ -1183,7 +1184,8 @@ public class CellLayout extends ViewGroup {
|
||||
DropTarget.DragObject dragObject) {
|
||||
if (mDragCell[0] != cellX || mDragCell[1] != cellY || mDragCellSpan[0] != spanX
|
||||
|| mDragCellSpan[1] != spanY) {
|
||||
if (Flags.msdlFeedback()) {
|
||||
determineIfDragHapticsPlay();
|
||||
if (mPlayDragHaptics && Flags.msdlFeedback()) {
|
||||
mMSDLPlayerWrapper.playToken(MSDLToken.DRAG_INDICATOR_DISCRETE);
|
||||
}
|
||||
mDragCell[0] = cellX;
|
||||
@@ -1211,6 +1213,14 @@ public class CellLayout extends ViewGroup {
|
||||
}
|
||||
}
|
||||
|
||||
private void determineIfDragHapticsPlay() {
|
||||
if (mDragCell[0] != -1 || mDragCell[1] != -1
|
||||
|| mDragCellSpan[0] != -1 || mDragCellSpan[1] != -1) {
|
||||
// The nearest cell is known and we can play haptics
|
||||
mPlayDragHaptics = true;
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressLint("StringFormatMatches")
|
||||
public String getItemMoveDescription(int cellX, int cellY) {
|
||||
if (mContainerType == HOTSEAT) {
|
||||
@@ -1812,6 +1822,7 @@ public class CellLayout extends ViewGroup {
|
||||
* @param child The child that is being dropped
|
||||
*/
|
||||
void onDropChild(View child) {
|
||||
mPlayDragHaptics = false;
|
||||
if (child != null) {
|
||||
CellLayoutLayoutParams
|
||||
lp = (CellLayoutLayoutParams) child.getLayoutParams();
|
||||
|
||||
Reference in New Issue
Block a user