import com.android.launcher3.Utilities;
import com.android.launcher3.Workspace;
import com.android.launcher3.config.FeatureFlags;
+import com.android.launcher3.dragndrop.DragOptions;
import com.android.launcher3.folder.Folder;
import com.android.launcher3.graphics.TintedDrawableSpan;
import com.android.launcher3.keyboard.FocusedItemDecorator;
+import com.android.launcher3.userevent.nano.LauncherLogProto.Target;
import com.android.launcher3.util.ComponentKey;
import java.nio.charset.Charset;
/**
* Returns whether the view itself will handle the touch event or not.
*/
- public boolean shouldContainerScroll(float x, float y) {
+ public boolean shouldContainerScroll(MotionEvent ev) {
int[] point = new int[2];
- point[0] = (int) x;
- point[1] = (int) y;
+ point[0] = (int) ev.getX();
+ point[1] = (int) ev.getY();
Utilities.mapCoordInSelfToDescendent(mAppsRecyclerView, this, point);
- // if the MotionEvent is inside the thumb, container should not be pulled down.
+ // IF the MotionEvent is inside the search box, and the container keeps on receiving
+ // touch input, container should move down.
+ if (mLauncher.getDragLayer().isEventOverView(mSearchContainer, ev)) {
+ return true;
+ }
+
+ // IF the MotionEvent is inside the thumb, container should not be pulled down.
if (mAppsRecyclerView.getScrollBar().isNearThumb(point[0], point[1])) {
return false;
}
+
+ // IF a shortcuts container is open, container should not be pulled down.
+ if (mLauncher.getOpenShortcutsContainer() != null) {
+ return false;
+ }
+
// IF scroller is at the very top OR there is no scroll bar because there is probably not
// enough items to scroll, THEN it's okay for the container to be pulled down.
if (mAppsRecyclerView.getScrollBar().getThumbOffset().y <= 0) {
if (!mLauncher.isDraggingEnabled()) return false;
// Start the drag
- mLauncher.getWorkspace().beginDragShared(v, this, false);
+ mLauncher.getWorkspace().beginDragShared(v, this, new DragOptions());
// Enter spring loaded mode
mLauncher.enterSpringLoadedDragMode();
mSearchQueryBuilder.clearSpans();
Selection.setSelection(mSearchQueryBuilder, 0);
}
+
+ @Override
+ public void fillInLaunchSourceData(View v, ItemInfo info, Target target, Target targetParent) {
+ targetParent.containerType = mAppsRecyclerView.getContainerType(v);
+ }
}