List of usage examples for android.view HapticFeedbackConstants LONG_PRESS
int LONG_PRESS
To view the source code for android.view HapticFeedbackConstants LONG_PRESS.
Click Source Link
From source file:com.juick.android.ThreadFragment.java
private void openNavigationMenu(float currentTranslation) { try {/* www . ja va 2s . c om*/ navigationMenuShown = true; for (final FlyingItem item : flyingItems) { item.setVisibility(View.VISIBLE); item.ani = new TranslateAnimation(Animation.ABSOLUTE, 300, Animation.ABSOLUTE, item.designedX, Animation.ABSOLUTE, 0, Animation.ABSOLUTE, item.designedY); item.ani.setInterpolator(new OvershootInterpolator(2)); item.ani.setDuration(500); item.ani.setFillAfter(true); item.ani.setAnimationListener(new Animation.AnimationListener() { @Override public void onAnimationStart(Animation animation) { //To change body of implemented methods use File | Settings | File Templates. } @Override public void onAnimationEnd(Animation animation) { // this code is very ugly because it's all android 2.3 animations. item.widget.getHitRect(item.originalHitRect); item.widget.clearAnimation(); item.widget.layout(item.originalHitRect.left + (int) item.widget.initialTranslationX, item.originalHitRect.top + (int) item.widget.initialTranslationY, item.originalHitRect.right + (int) item.widget.initialTranslationX, item.originalHitRect.bottom + (int) item.widget.initialTranslationY); item.widget.disableReposition = true; } @Override public void onAnimationRepeat(Animation animation) { //To change body of implemented methods use File | Settings | File Templates. } }); item.widget.startAnimation(item.ani); } TranslateAnimation aniOut = new TranslateAnimation(Animation.ABSOLUTE, currentTranslation, Animation.ABSOLUTE, -1.2f * getActivity().getWindowManager().getDefaultDisplay().getWidth(), Animation.ABSOLUTE, 0, Animation.ABSOLUTE, 0); aniOut.setInterpolator(new DecelerateInterpolator(1)); aniOut.setDuration(700); aniOut.setFillAfter(true); navMenu.startAnimation(aniOut); getListView().performHapticFeedback(HapticFeedbackConstants.LONG_PRESS); } catch (Throwable e) { e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates. } }
From source file:com.songcode.materialnotes.ui.NotesListActivity.java
public boolean onItemLongClick(AdapterView<?> parent, View view, int position, long id) { if (view instanceof NotesListItem) { mFocusNoteDataItem = ((NotesListItem) view).getItemData(); if (mFocusNoteDataItem.getType() == Notes.TYPE_NOTE && !mNotesListAdapter.isInChoiceMode()) { if (mNotesListView.startActionMode(mModeCallBack) != null) { mModeCallBack.onItemCheckedStateChanged(null, position, id, true); mNotesListView.performHapticFeedback(HapticFeedbackConstants.LONG_PRESS); } else { Log.e(TAG, "startActionMode fails"); }/* w ww .j ava2s . co m*/ } else if (mFocusNoteDataItem.getType() == Notes.TYPE_FOLDER) { mNotesListView.setOnCreateContextMenuListener(mFolderOnCreateContextMenuListener); } } return false; }
From source file:org.mozilla.gecko.GeckoAppShell.java
public static void performHapticFeedback(boolean aIsLongPress) { // Don't perform haptic feedback if a vibration is currently playing, // because the haptic feedback will nuke the vibration. if (!sVibrationMaybePlaying || System.nanoTime() >= sVibrationEndTime) { LayerController layerController = GeckoApp.mAppContext.getLayerController(); LayerView layerView = layerController.getView(); layerView.performHapticFeedback( aIsLongPress ? HapticFeedbackConstants.LONG_PRESS : HapticFeedbackConstants.VIRTUAL_KEY); }/*from w w w . jav a2 s . c o m*/ }
From source file:com.marshalchen.common.uimodule.freeflow.core.FreeFlowContainer.java
boolean performLongPress() { // CHOICE_MODE_MULTIPLE_MODAL takes over long press. if (mChoiceMode == CHOICE_MODE_MULTIPLE_MODAL) { if (mChoiceActionMode == null && (mChoiceActionMode = startActionMode(mMultiChoiceModeCallback)) != null) { setItemChecked(beginTouchAt.itemSection, beginTouchAt.itemIndex, true); updateOnScreenCheckedViews(); performHapticFeedback(HapticFeedbackConstants.LONG_PRESS); }//from w w w . java 2 s.co m return true; } boolean handled = false; final long longPressId = mAdapter.getItemId(beginTouchAt.itemSection, beginTouchAt.itemSection); if (mOnItemLongClickListener != null) { handled = mOnItemLongClickListener.onItemLongClick(this, beginTouchAt.view, beginTouchAt.itemSection, beginTouchAt.itemIndex, longPressId); } if (!handled) { mContextMenuInfo = createContextMenuInfo(beginTouchAt.view, beginTouchAt.itemSection, beginTouchAt.itemIndex, longPressId); handled = super.showContextMenuForChild(this); } if (handled) { updateOnScreenCheckedViews(); performHapticFeedback(HapticFeedbackConstants.LONG_PRESS); } return handled; }
From source file:com.android.leanlauncher.LauncherTransitionable.java
public boolean onLongClick(View v) { if (!isDraggingEnabled()) return false; if (isWorkspaceLocked()) return false; if (mState != State.WORKSPACE) return false; if (v instanceof Workspace) { if (!mWorkspace.isInOverviewMode()) { if (mWorkspace.enterOverviewMode()) { mWorkspace.performHapticFeedback(HapticFeedbackConstants.LONG_PRESS, HapticFeedbackConstants.FLAG_IGNORE_VIEW_SETTING); return true; } else { return false; }/*from w w w .ja va2s .com*/ } else { return false; } } CellLayout.CellInfo longClickCellInfo = null; View itemUnderLongClick = null; if (v.getTag() instanceof ItemInfo) { ItemInfo info = (ItemInfo) v.getTag(); longClickCellInfo = new CellLayout.CellInfo(v, info); itemUnderLongClick = longClickCellInfo.cell; resetAddInfo(); } if (!mDragController.isDragging()) { if (itemUnderLongClick == null) { // User long pressed on empty space mWorkspace.performHapticFeedback(HapticFeedbackConstants.LONG_PRESS, HapticFeedbackConstants.FLAG_IGNORE_VIEW_SETTING); if (!mWorkspace.isInOverviewMode()) { mWorkspace.enterOverviewMode(); } } else { // User long pressed on an item mWorkspace.startDrag(longClickCellInfo); } } return true; }
From source file:com.glview.widget.AbsListView.java
boolean performLongPress(final View child, final int longPressPosition, final long longPressId) { // CHOICE_MODE_MULTIPLE_MODAL takes over long press. if (mChoiceMode == CHOICE_MODE_MULTIPLE_MODAL) { setItemChecked(longPressPosition, true); performHapticFeedback(HapticFeedbackConstants.LONG_PRESS); return true; }/* w ww . ja va 2 s. co m*/ boolean handled = false; if (mOnItemLongClickListener != null) { handled = mOnItemLongClickListener.onItemLongClick(AbsListView.this, child, longPressPosition, longPressId); } if (handled) { performHapticFeedback(HapticFeedbackConstants.LONG_PRESS); } return handled; }
From source file:cn.iterlog.myapplication.widget.overscroll.StaggeredGridView.java
boolean performLongPress(final View child, final int longPressPosition, final long longPressId) { // TODO : add check for multiple choice mode.. currently modes are yet to be supported boolean handled = false; if (mOnItemLongClickListener != null) { handled = mOnItemLongClickListener.onItemLongClick(this, child, longPressPosition, longPressId); }//from www . j a va 2 s .c om if (!handled) { mContextMenuInfo = createContextMenuInfo(child, longPressPosition, longPressId); handled = super.showContextMenuForChild(this); } if (handled) { performHapticFeedback(HapticFeedbackConstants.LONG_PRESS); } return handled; }
From source file:com.ad.view.staggeredgridview.StaggeredGridView.java
boolean performLongPress(final View child, final int longPressPosition, final long longPressId) { // TODO : add check for multiple choice mode.. currently modes are yet // to be supported boolean handled = false; if (mOnItemLongClickListener != null) { handled = mOnItemLongClickListener.onItemLongClick(this, child, longPressPosition, longPressId); }/*from w w w . jav a 2 s.c o m*/ if (!handled) { mContextMenuInfo = createContextMenuInfo(child, longPressPosition, longPressId); handled = super.showContextMenuForChild(this); } if (handled) { performHapticFeedback(HapticFeedbackConstants.LONG_PRESS); } return handled; }
From source file:chan.android.app.bitwise.util.StaggeredGridView.java
boolean performLongPress(final View child, final int longPressPosition, final long longPressId) { // TODO : add check for multiple choice mode.. currently modes are yet to be supported boolean handled = false; if (mOnItemLongClickListener != null) { handled = mOnItemLongClickListener.onItemLongClick(this, child, longPressPosition, longPressId); }//from w w w. j a va2s .c o m if (!handled) { mContextMenuInfo = createContextMenuInfo(child, longPressPosition, longPressId); handled = super.showContextMenuForChild(this); } if (handled) { performHapticFeedback(HapticFeedbackConstants.LONG_PRESS); } return handled; }
From source file:com.app.afteryou.ui.staggered.StaggeredGridView.java
boolean performLongPress(final View child, final int longPressPosition, final long longPressId) { // TODO : add check for multiple choice mode.. currently modes are yet // to be supported boolean handled = false; if (getOnItemLongClickListener() != null) { handled = getOnItemLongClickListener().onItemLongClick(this, child, longPressPosition, longPressId); }/*ww w. j a va 2 s .c om*/ if (!handled) { mContextMenuInfo = createContextMenuInfo(child, longPressPosition, longPressId); handled = super.showContextMenuForChild(this); } if (handled) { performHapticFeedback(HapticFeedbackConstants.LONG_PRESS); } return handled; }