Java Code Examples for android.widget.AdapterView#performHapticFeedback()
The following examples show how to use
android.widget.AdapterView#performHapticFeedback() .
These examples are extracted from open source projects.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source Project: StickyListHeadersWithRefreshAndLoadMore File: SwipeLayout.java License: Apache License 2.0 | 5 votes |
private boolean performAdapterViewItemLongClick() { if (getOpenStatus() != Status.Close) return false; ViewParent t = getParent(); if (t instanceof AdapterView) { AdapterView view = (AdapterView) t; int p = view.getPositionForView(SwipeLayout.this); if (p == AdapterView.INVALID_POSITION) return false; long vId = view.getItemIdAtPosition(p); boolean handled = false; try { Method m = AbsListView.class.getDeclaredMethod("performLongPress", View.class, int.class, long.class); m.setAccessible(true); handled = (boolean) m.invoke(view, SwipeLayout.this, p, vId); } catch (Exception e) { e.printStackTrace(); if (view.getOnItemLongClickListener() != null) { handled = view.getOnItemLongClickListener().onItemLongClick(view, SwipeLayout.this, p, vId); } if (handled) { view.performHapticFeedback(HapticFeedbackConstants.LONG_PRESS); } } return handled; } return false; }
Example 2
Source Project: IndexRecyclerView File: SwipeItemLayout.java License: Apache License 2.0 | 5 votes |
private boolean performAdapterViewItemLongClick() { ViewParent t = getParent(); if (t instanceof AdapterView) { AdapterView view = (AdapterView) t; int p = view.getPositionForView(SwipeItemLayout.this); if (p == AdapterView.INVALID_POSITION) return false; long vId = view.getItemIdAtPosition(p); boolean handled = false; try { Method m = AbsListView.class.getDeclaredMethod("performLongPress", View.class, int.class, long.class); m.setAccessible(true); handled = (boolean) m.invoke(view, SwipeItemLayout.this, p, vId); } catch (Exception e) { e.printStackTrace(); if (view.getOnItemLongClickListener() != null) { handled = view.getOnItemLongClickListener().onItemLongClick(view, SwipeItemLayout.this, p, vId); } if (handled) { view.performHapticFeedback(HapticFeedbackConstants.LONG_PRESS); } } return handled; } return false; }
Example 3
Source Project: UltimateSwipeTool File: SwipeViewLayout.java License: Apache License 2.0 | 5 votes |
private boolean performAdapterViewItemLongClick() { if (getOpenStatus() != Status.Close) return false; ViewParent t = getParent(); if (t instanceof AdapterView) { AdapterView view = (AdapterView) t; int p = view.getPositionForView(SwipeViewLayout.this); if (p == AdapterView.INVALID_POSITION) return false; long vId = view.getItemIdAtPosition(p); boolean handled = false; try { Method m = AbsListView.class.getDeclaredMethod("performLongPress", View.class, int.class, long.class); m.setAccessible(true); handled = (boolean) m.invoke(view, SwipeViewLayout.this, p, vId); } catch (Exception e) { e.printStackTrace(); if (view.getOnItemLongClickListener() != null) { handled = view.getOnItemLongClickListener().onItemLongClick(view, SwipeViewLayout.this, p, vId); } if (handled) { view.performHapticFeedback(HapticFeedbackConstants.LONG_PRESS); } } return handled; } return false; }
Example 4
Source Project: UltimateRecyclerView File: SwipeLayout.java License: Apache License 2.0 | 5 votes |
private boolean performAdapterViewItemLongClick() { if (getOpenStatus() != Status.Close) return false; ViewParent t = getParent(); if (t instanceof AdapterView) { AdapterView view = (AdapterView) t; int p = view.getPositionForView(SwipeLayout.this); if (p == AdapterView.INVALID_POSITION) return false; long vId = view.getItemIdAtPosition(p); boolean handled = false; try { Method m = AbsListView.class.getDeclaredMethod("performLongPress", View.class, int.class, long.class); m.setAccessible(true); handled = (boolean) m.invoke(view, SwipeLayout.this, p, vId); } catch (Exception e) { e.printStackTrace(); if (view.getOnItemLongClickListener() != null) { handled = view.getOnItemLongClickListener().onItemLongClick(view, SwipeLayout.this, p, vId); } if (handled) { view.performHapticFeedback(HapticFeedbackConstants.LONG_PRESS); } } return handled; } return false; }
Example 5
Source Project: AndroidSwipeLayout File: SwipeLayout.java License: MIT License | 5 votes |
private boolean performAdapterViewItemLongClick() { if (getOpenStatus() != Status.Close) return false; ViewParent t = getParent(); if (t instanceof AdapterView) { AdapterView view = (AdapterView) t; int p = view.getPositionForView(SwipeLayout.this); if (p == AdapterView.INVALID_POSITION) return false; long vId = view.getItemIdAtPosition(p); boolean handled = false; try { Method m = AbsListView.class.getDeclaredMethod("performLongPress", View.class, int.class, long.class); m.setAccessible(true); handled = (boolean) m.invoke(view, SwipeLayout.this, p, vId); } catch (Exception e) { e.printStackTrace(); if (view.getOnItemLongClickListener() != null) { handled = view.getOnItemLongClickListener().onItemLongClick(view, SwipeLayout.this, p, vId); } if (handled) { view.performHapticFeedback(HapticFeedbackConstants.LONG_PRESS); } } return handled; } return false; }