Merge "Adding MSDL haptics for dragging app icons in Workspace and Hotseat." into main
This commit is contained in:
committed by
Android (Google) Code Review
commit
b5bf7820e6
@@ -71,6 +71,7 @@ import com.android.launcher3.model.data.ItemInfo;
|
||||
import com.android.launcher3.model.data.LauncherAppWidgetInfo;
|
||||
import com.android.launcher3.util.CellAndSpan;
|
||||
import com.android.launcher3.util.GridOccupancy;
|
||||
import com.android.launcher3.util.MSDLPlayerWrapper;
|
||||
import com.android.launcher3.util.MultiTranslateDelegate;
|
||||
import com.android.launcher3.util.ParcelableSparseArray;
|
||||
import com.android.launcher3.util.Themes;
|
||||
@@ -78,6 +79,8 @@ import com.android.launcher3.util.Thunk;
|
||||
import com.android.launcher3.views.ActivityContext;
|
||||
import com.android.launcher3.widget.LauncherAppWidgetHostView;
|
||||
|
||||
import com.google.android.msdl.data.model.MSDLToken;
|
||||
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
import java.util.ArrayList;
|
||||
@@ -204,6 +207,8 @@ public class CellLayout extends ViewGroup {
|
||||
|
||||
private static final Paint sPaint = new Paint();
|
||||
|
||||
private final MSDLPlayerWrapper mMSDLPlayerWrapper;
|
||||
|
||||
// Related to accessible drag and drop
|
||||
DragAndDropAccessibilityDelegate mTouchHelper;
|
||||
|
||||
@@ -237,6 +242,8 @@ public class CellLayout extends ViewGroup {
|
||||
mContainerType = a.getInteger(R.styleable.CellLayout_containerType, WORKSPACE);
|
||||
a.recycle();
|
||||
|
||||
mMSDLPlayerWrapper = MSDLPlayerWrapper.INSTANCE.get(context);
|
||||
|
||||
// A ViewGroup usually does not draw, but CellLayout needs to draw a rectangle to show
|
||||
// the user where a dragged item will land when dropped.
|
||||
setWillNotDraw(false);
|
||||
@@ -1153,6 +1160,9 @@ public class CellLayout extends ViewGroup {
|
||||
DropTarget.DragObject dragObject) {
|
||||
if (mDragCell[0] != cellX || mDragCell[1] != cellY || mDragCellSpan[0] != spanX
|
||||
|| mDragCellSpan[1] != spanY) {
|
||||
if (Flags.msdlFeedback()) {
|
||||
mMSDLPlayerWrapper.playToken(MSDLToken.DRAG_INDICATOR_DISCRETE);
|
||||
}
|
||||
mDragCell[0] = cellX;
|
||||
mDragCell[1] = cellY;
|
||||
mDragCellSpan[0] = spanX;
|
||||
|
||||
@@ -116,6 +116,7 @@ import com.android.launcher3.util.IntArray;
|
||||
import com.android.launcher3.util.IntSet;
|
||||
import com.android.launcher3.util.IntSparseArrayMap;
|
||||
import com.android.launcher3.util.LauncherBindableItemsContainer;
|
||||
import com.android.launcher3.util.MSDLPlayerWrapper;
|
||||
import com.android.launcher3.util.OverlayEdgeEffect;
|
||||
import com.android.launcher3.util.PackageUserKey;
|
||||
import com.android.launcher3.util.RunnableList;
|
||||
@@ -133,6 +134,8 @@ import com.android.launcher3.widget.util.WidgetSizes;
|
||||
import com.android.systemui.plugins.shared.LauncherOverlayManager.LauncherOverlayCallbacks;
|
||||
import com.android.systemui.plugins.shared.LauncherOverlayManager.LauncherOverlayTouchProxy;
|
||||
|
||||
import com.google.android.msdl.data.model.MSDLToken;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
@@ -299,6 +302,8 @@ public class Workspace<T extends View & PageIndicator> extends PagedView<T>
|
||||
|
||||
private final StatsLogManager mStatsLogManager;
|
||||
|
||||
private final MSDLPlayerWrapper mMSDLPlayerWrapper;
|
||||
|
||||
/**
|
||||
* Used to inflate the Workspace from XML.
|
||||
*
|
||||
@@ -331,6 +336,7 @@ public class Workspace<T extends View & PageIndicator> extends PagedView<T>
|
||||
setMotionEventSplittingEnabled(true);
|
||||
setOnTouchListener(new WorkspaceTouchListener(mLauncher, this));
|
||||
mStatsLogManager = StatsLogManager.newInstance(context);
|
||||
mMSDLPlayerWrapper = MSDLPlayerWrapper.INSTANCE.get(context);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -2679,7 +2685,9 @@ public class Workspace<T extends View & PageIndicator> extends PagedView<T>
|
||||
ItemInfo info = dragObject.dragInfo;
|
||||
boolean userFolderPending = willCreateUserFolder(info, mDragOverView, false);
|
||||
if (mDragMode == DRAG_MODE_NONE && userFolderPending) {
|
||||
|
||||
if (Flags.msdlFeedback()) {
|
||||
mMSDLPlayerWrapper.playToken(MSDLToken.DRAG_INDICATOR_DISCRETE);
|
||||
}
|
||||
mFolderCreateBg = new PreviewBackground(getContext());
|
||||
mFolderCreateBg.setup(mLauncher, mLauncher, null,
|
||||
mDragOverView.getMeasuredWidth(), mDragOverView.getPaddingTop());
|
||||
|
||||
Reference in New Issue
Block a user