public S isInTouchMode() { isNotNull(); assertThat(actual.isInTouchMode()) // .overridingErrorMessage("Expected to be in touch mode but was not") // .isTrue(); return myself; }
public S isNotInTouchMode() { isNotNull(); assertThat(actual.isInTouchMode()) // .overridingErrorMessage("Expected to not be in touch mode but was") // .isFalse(); return myself; }
public S isNotInTouchMode() { isNotNull(); assertThat(actual.isInTouchMode()) // .overridingErrorMessage("Expected to not be in touch mode but was") // .isFalse(); return myself; }
public S isInTouchMode() { isNotNull(); assertThat(actual.isInTouchMode()) // .overridingErrorMessage("Expected to be in touch mode but was not") // .isTrue(); return myself; }
void startDrag(CellLayout.CellInfo cellInfo) { View child = cellInfo.cell; // Make sure the drag was started by a long press as opposed to a long click. if (!child.isInTouchMode()) { return; } mDragInfo = cellInfo; child.setVisibility(INVISIBLE); CellLayout layout = (CellLayout) child.getParent().getParent(); layout.prepareChildForDrag(child); beginDragShared(child, this); }
@Override public void startDrag(CellLayout.CellInfo cellInfo, boolean accessible) { View child = cellInfo.cell; // Make sure the drag was started by a long press as opposed to a long click. if (!child.isInTouchMode()) { return; } mDragInfo = cellInfo; child.setVisibility(INVISIBLE); CellLayout layout = (CellLayout) child.getParent().getParent(); layout.prepareChildForDrag(child); beginDragShared(child, this, accessible); }
private boolean beginDrag(View v, boolean accessible) { Object tag = v.getTag(); if (tag instanceof ShortcutInfo) { ShortcutInfo item = (ShortcutInfo) tag; if (!v.isInTouchMode()) { return false; } mLauncher.getWorkspace().beginDragShared(v, new Point(), this, accessible); mCurrentDragInfo = item; mEmptyCellRank = item.rank; mCurrentDragView = v; mContent.removeItem(mCurrentDragView); mInfo.remove(mCurrentDragInfo); mDragInProgress = true; mItemAddedBackToSelfViaIcon = false; } return true; }
public void startDrag(CellLayout.CellInfo cellInfo, DragOptions options) { View child = cellInfo.cell; // Make sure the drag was started by a long press as opposed to a long click. if (!child.isInTouchMode()) { return; } mDragInfo = cellInfo; child.setVisibility(INVISIBLE); CellLayout layout = (CellLayout) child.getParent().getParent(); layout.prepareChildForDrag(child); if (options.isAccessibleDrag) { mDragController.addDragListener(new AccessibileDragListenerAdapter( this, CellLayout.WORKSPACE_ACCESSIBILITY_DRAG) { @Override protected void enableAccessibleDrag(boolean enable) { super.enableAccessibleDrag(enable); setEnableForLayout(mLauncher.getHotseat().getLayout(),enable); // We need to allow our individual children to become click handlers in this // case, so temporarily unset the click handlers. setOnClickListener(enable ? null : mLauncher); } }); } beginDragShared(child, this, options); }
public boolean handleLongClick(View v) { // Return early if this is not initiated from a touch if (!v.isInTouchMode()) return false; // When we are in transition, disregard long clicks if (mLauncher.getWorkspace().isSwitchingState()) return false; // Return if global dragging is not enabled if (!mLauncher.isDraggingEnabled()) return false; return beginDragging(v); }
@Override public boolean onLongClick(View v) { if (DEBUG) { Log.d(TAG, String.format("onLonglick [v=%s]", v)); } // Return early if this is not initiated from a touch if (!v.isInTouchMode()) return false; // When we have exited all apps or are in transition, disregard long clicks if (!mLauncher.isWidgetsViewVisible() || mLauncher.getWorkspace().isSwitchingState()) return false; // Return if global dragging is not enabled Log.d(TAG, String.format("onLonglick dragging enabled?.", v)); if (!mLauncher.isDraggingEnabled()) return false; boolean status = beginDragging(v); if (status && v.getTag() instanceof PendingAddWidgetInfo) { WidgetHostViewLoader hostLoader = new WidgetHostViewLoader(mLauncher, v); boolean preloadStatus = hostLoader.preloadWidget(); if (DEBUG) { Log.d(TAG, String.format("preloading widget [status=%s]", preloadStatus)); } mLauncher.getDragController().addDragListener(hostLoader); } return status; }
public boolean startDrag(View v, DragOptions options) { Object tag = v.getTag(); if (tag instanceof ShortcutInfo) { ShortcutInfo item = (ShortcutInfo) tag; if (!v.isInTouchMode()) { return false; } mEmptyCellRank = item.rank; mCurrentDragView = v; mDragController.addDragListener(this); if (options.isAccessibleDrag) { mDragController.addDragListener(new AccessibleDragListenerAdapter( mContent, CellLayout.FOLDER_ACCESSIBILITY_DRAG) { @Override protected void enableAccessibleDrag(boolean enable) { super.enableAccessibleDrag(enable); mFooter.setImportantForAccessibility(enable ? IMPORTANT_FOR_ACCESSIBILITY_NO_HIDE_DESCENDANTS : IMPORTANT_FOR_ACCESSIBILITY_AUTO); } }); } mLauncher.getWorkspace().beginDragShared(v, this, options); } return true; }
public boolean startDrag(View v, DragOptions options) { Object tag = v.getTag(); if (tag instanceof ShortcutInfo) { ShortcutInfo item = (ShortcutInfo) tag; if (!v.isInTouchMode()) { return false; } mEmptyCellRank = item.rank; mCurrentDragView = v; mDragController.addDragListener(this); if (options.isAccessibleDrag) { mDragController.addDragListener(new AccessibileDragListenerAdapter( mContent, CellLayout.FOLDER_ACCESSIBILITY_DRAG) { @Override protected void enableAccessibleDrag(boolean enable) { super.enableAccessibleDrag(enable); mFooter.setImportantForAccessibility(enable ? IMPORTANT_FOR_ACCESSIBILITY_NO_HIDE_DESCENDANTS : IMPORTANT_FOR_ACCESSIBILITY_AUTO); } }); } mLauncher.getWorkspace().beginDragShared(v, this, options); } return true; }
public boolean onLongClick(View v) { // Return if global dragging is not enabled if (!mLauncher.isDraggingEnabled()) { return true; } Object tag = v.getTag(); if (tag instanceof ShortcutInfo) { ShortcutInfo item = (ShortcutInfo) tag; if (!v.isInTouchMode()) { return false; } mLauncher.getWorkspace().beginDragShared(v, this); mCurrentDragInfo = item; mEmptyCell[0] = item.cellX; mEmptyCell[1] = item.cellY; mCurrentDragView = v; mContent.removeView(mCurrentDragView); mInfo.remove(mCurrentDragInfo); mDragInProgress = true; mItemAddedBackToSelfViaIcon = false; } return true; }
@Override public boolean onLongClick(View v) { // Return early if this is not initiated from a touch if (!v.isInTouchMode()) { return false; } // Return early if we are still animating the pages if (mNextPage != INVALID_PAGE) { return false; } // When we have exited all apps or are in transition, disregard long clicks if (!mLauncher.isAllAppsVisible() || mLauncher.getWorkspace().isSwitchingState()) { return false; } // Return if global dragging is not enabled return mLauncher.isDraggingEnabled() && beginDragging(v); }
@Override public boolean onLongClick(View v) { // Return early if this is not initiated from a touch if (!v.isInTouchMode()) return false; // When we have exited all apps or are in transition, disregard long clicks if (!mLauncher.isAppsViewVisible() || mLauncher.getWorkspace().isSwitchingState()) return false; // Return if global dragging is not enabled if (!mLauncher.isDraggingEnabled()) return false; // Start the drag mLauncher.getWorkspace().beginDragShared(v, mIconLastTouchPos, this, false); // Enter spring loaded mode mLauncher.enterSpringLoadedDragMode(); return false; }
@Override public boolean onLongClick(View v) { if (LOGD) { Log.d(TAG, String.format("onLonglick [v=%s]", v)); } // Return early if this is not initiated from a touch if (!v.isInTouchMode()) return false; // When we have exited all apps or are in transition, disregard long clicks if (!mLauncher.isWidgetsViewVisible() || mLauncher.getWorkspace().isSwitchingState()) return false; // Return if global dragging is not enabled if (!mLauncher.isDraggingEnabled()) return false; boolean status = beginDragging(v); if (status && v.getTag() instanceof PendingAddWidgetInfo) { WidgetHostViewLoader hostLoader = new WidgetHostViewLoader(mLauncher, v); boolean preloadStatus = hostLoader.preloadWidget(); if (LOGD) { Log.d(TAG, String.format("preloading widget [status=%s]", preloadStatus)); } mLauncher.getDragController().addDragListener(hostLoader); } return status; }
@Override public boolean onLongClick(View v) { if (LOGD) { Log.d(TAG, String.format("onLonglick [v=%s]", v)); } // Return early if this is not initiated from a touch if (!v.isInTouchMode()) return false; // When we have exited all apps or are in transition, disregard long clicks if (!mLauncher.isWidgetsViewVisible() || mLauncher.getWorkspace().isSwitchingState()) return false; // Return if global dragging is not enabled if (!mLauncher.isDraggingEnabled()) return false; boolean status = beginDragging(v); if (status && v.getTag() instanceof PendingAddWidgetInfo) { WidgetHostViewLoader hostLoader = new WidgetHostViewLoader(mLauncher, v); boolean preloadStatus = hostLoader.preloadWidget(); if (LOGD) { Log.d(TAG, String.format("preloading widget [status=%s]", preloadStatus)); } mLauncher.getDragController().addDragListener(hostLoader); } return status; }
public boolean onLongClick(View v) { // Return early if this is not initiated from a touch or not the correct view if (!v.isInTouchMode() || !(v.getParent() instanceof DeepShortcutView)) return false; // Return if global dragging is not enabled if (!mLauncher.isDraggingEnabled()) return false; // Long clicked on a shortcut. mDeferContainerRemoval = true; DeepShortcutView sv = (DeepShortcutView) v.getParent(); sv.setWillDrawIcon(false); // Move the icon to align with the center-top of the touch point mIconShift.x = mIconLastTouchPos.x - sv.getIconCenter().x; mIconShift.y = mIconLastTouchPos.y - mLauncher.getDeviceProfile().iconSizePx; DragView dv = mLauncher.getWorkspace().beginDragShared( sv.getBubbleText(), this, sv.getFinalInfo(), new ShortcutDragPreviewProvider(sv.getIconView(), mIconShift), new DragOptions()); dv.animateShift(-mIconShift.x, -mIconShift.y); // TODO: support dragging from within folder without having to close it mLauncher.closeFolder(); return false; }
public boolean onLongClick(View v) { // Return early if this is not initiated from a touch or not the correct view if (!v.isInTouchMode() || !(v.getParent() instanceof DeepShortcutView)) return false; // Return if global dragging is not enabled if (!mLauncher.isDraggingEnabled()) return false; // Long clicked on a shortcut. mDeferContainerRemoval = true; DeepShortcutView sv = (DeepShortcutView) v.getParent(); sv.setWillDrawIcon(false); // Move the icon to align with the center-top of the touch point mIconShift.x = mIconLastTouchPos.x - sv.getIconCenter().x; mIconShift.y = mIconLastTouchPos.y - mLauncher.getDeviceProfile().iconSizePx; DragView dv = mLauncher.getWorkspace().beginDragShared( sv.getBubbleText(), this, sv.getFinalInfo(), new ShortcutDragPreviewProvider(sv.getIconView(), mIconShift), new DragOptions()); dv.animateShift(-mIconShift.x, -mIconShift.y); // TODO: support dragging from within folder without having to close it mLauncher.closeFolder(); return false; }
@Override public boolean onLongClick(View v) { // Return early if this is not initiated from a touch or not the correct view if (!v.isInTouchMode() || !(v.getParent() instanceof DeepShortcutView)) return false; // Return early if global dragging is not enabled if (!mLauncher.isDraggingEnabled()) return false; // Return early if an item is already being dragged (e.g. when long-pressing two shortcuts) if (mLauncher.getDragController().isDragging()) return false; // Long clicked on a shortcut. DeepShortcutView sv = (DeepShortcutView) v.getParent(); sv.setWillDrawIcon(false); // Move the icon to align with the center-top of the touch point mIconShift.x = mIconLastTouchPos.x - sv.getIconCenter().x; mIconShift.y = mIconLastTouchPos.y - mLauncher.getDeviceProfile().iconSizePx; DragView dv = mLauncher.getWorkspace().beginDragShared(sv.getIconView(), (PopupContainerWithArrow) getParent(), sv.getFinalInfo(), new ShortcutDragPreviewProvider(sv.getIconView(), mIconShift), new DragOptions()); dv.animateShift(-mIconShift.x, -mIconShift.y); // TODO: support dragging from within folder without having to close it AbstractFloatingView.closeOpenContainer(mLauncher, AbstractFloatingView.TYPE_FOLDER); return false; }