Java Code Examples for android.support.v7.widget.RecyclerView#findChildViewUnder()
The following examples show how to use
android.support.v7.widget.RecyclerView#findChildViewUnder() .
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 File: RecyclerItemClickListener.java From example with Apache License 2.0 | 5 votes |
@Override public boolean onInterceptTouchEvent(RecyclerView rv, MotionEvent e) { View childView = rv.findChildViewUnder(e.getX(), e.getY()); if (childView != null && mListener != null && gestureDetector.onTouchEvent(e)) { mListener.onItemClick(childView, rv.getChildPosition(childView)); return true; } return false; }
Example 2
Source File: RecyclerItemClickListener.java From Material-Animation-Samples with Apache License 2.0 | 5 votes |
@Override public boolean onInterceptTouchEvent(RecyclerView view, MotionEvent e) { View childView = view.findChildViewUnder(e.getX(), e.getY()); if (childView != null && mListener != null && mGestureDetector.onTouchEvent(e)) { mListener.onItemClick(childView, view.getChildPosition(childView)); } return false; }
Example 3
Source File: RecyclerItemClickListener.java From JalanJalan with Do What The F*ck You Want To Public License | 5 votes |
@Override public boolean onInterceptTouchEvent(RecyclerView rv, MotionEvent e) { View childView = rv.findChildViewUnder(e.getX(), e.getY()); if (childView != null && mListener != null && gestureDetector.onTouchEvent(e)) { mListener.onItemClick(childView, rv.getChildPosition(childView)); return true; } return false; }
Example 4
Source File: OnItemTouchListener.java From Hillffair17 with GNU General Public License v3.0 | 5 votes |
@Override public boolean onInterceptTouchEvent(RecyclerView view, MotionEvent e) { View childView = view.findChildViewUnder(e.getX(), e.getY()); if (childView != null && mListener != null && mGestureDetector.onTouchEvent(e)) { mListener.onItemClick(childView, view.getChildAdapterPosition(childView)); } return false; }
Example 5
Source File: OnItemClickListener.java From CommonAdapter with Apache License 2.0 | 5 votes |
@Override public boolean onInterceptTouchEvent(RecyclerView view, MotionEvent e) { View childView = view.findChildViewUnder(e.getX(), e.getY()); if (childView != null && mListener != null && mGestureDetector.onTouchEvent(e)) { int position = view.getChildAdapterPosition(childView); mListener.onItemClick(null, childView, position, position); return false; // 如果是false,那么item和外面的recycleView都能捕获点击事件 } return false; }
Example 6
Source File: RecyclerTouchListener.java From Andzu with MIT License | 5 votes |
@Override public boolean onInterceptTouchEvent(RecyclerView rv, MotionEvent e) { View child = rv.findChildViewUnder(e.getX(), e.getY()); if (child != null && clickListener != null && gestureDetector.onTouchEvent(e)) { clickListener.onClick(child, rv.getChildPosition(child)); } return false; }
Example 7
Source File: FragmentDrawer.java From Sparkplug with Eclipse Public License 1.0 | 5 votes |
@Override public boolean onInterceptTouchEvent(RecyclerView rv, MotionEvent e) { View child = rv.findChildViewUnder(e.getX(), e.getY()); if (child != null && clickListener != null && gestureDetector.onTouchEvent(e)) { clickListener.onClick(rv.getChildPosition(child)); } return false; }
Example 8
Source File: RecyclerTouchListener.java From Alexa-Voice-Service with MIT License | 5 votes |
@Override public boolean onInterceptTouchEvent(RecyclerView rv, MotionEvent e) { View child=rv.findChildViewUnder(e.getX(),e.getY()); if(child!=null && clicklistener!=null && gestureDetector.onTouchEvent(e)){ clicklistener.onClick(child,rv.getChildAdapterPosition(child)); } return false; }
Example 9
Source File: RecyclerItemClickListener.java From AndroPress with Apache License 2.0 | 5 votes |
@Override public boolean onInterceptTouchEvent(RecyclerView view, MotionEvent e) { View childView = view.findChildViewUnder(e.getX(), e.getY()); if (childView != null && mListener != null && mGestureDetector.onTouchEvent(e)) { mListener.onItemClick(childView, view.getChildAdapterPosition(childView)); } return false; }
Example 10
Source File: RecyclerItemClickListener.java From AndroidSmartHome with Apache License 2.0 | 5 votes |
@Override public boolean onInterceptTouchEvent(RecyclerView view, MotionEvent e) { View childView = view.findChildViewUnder(e.getX(), e.getY()); if (childView != null && mListener != null && mGestureDetector.onTouchEvent(e)) { mListener.onItemClick(childView, view.getChildAdapterPosition(childView)); } return false; }
Example 11
Source File: GalleryAdapter.java From splitapkinstall with Apache License 2.0 | 5 votes |
@Override public boolean onInterceptTouchEvent(RecyclerView rv, MotionEvent e) { View child = rv.findChildViewUnder(e.getX(), e.getY()); if (child != null && clickListener != null && gestureDetector.onTouchEvent(e)) { clickListener.onClick(child, rv.getChildPosition(child)); } return false; }
Example 12
Source File: RecyclerItemClickListener.java From privacy-friendly-weather with GNU General Public License v3.0 | 5 votes |
@Override public boolean onInterceptTouchEvent(RecyclerView view, MotionEvent e) { View childView = view.findChildViewUnder(e.getX(), e.getY()); if (childView != null && mListener != null && mGestureDetector.onTouchEvent(e)) { mListener.onItemClick(childView, view.getChildAdapterPosition(childView)); return true; } return false; }
Example 13
Source File: RecyclerItemClickListener.java From Wifi-Connect with Apache License 2.0 | 5 votes |
@Override public boolean onInterceptTouchEvent(RecyclerView view, MotionEvent e) { View childView = view.findChildViewUnder(e.getX(), e.getY()); if (childView != null && mListener != null && mGestureDetector.onTouchEvent(e)) { mListener.onItemClick(childView, view.getChildPosition(childView)); } else if (childView != null && recyclerViewItemClickListener != null && mGestureDetector.onTouchEvent(e)) { recyclerViewItemClickListener.onItemClick(view, childView, view.getChildPosition(childView)); } return false; }
Example 14
Source File: MyRecyclerItemClickListener.java From Musync with MIT License | 5 votes |
@Override public boolean onInterceptTouchEvent(RecyclerView view, MotionEvent e) { View childView = view.findChildViewUnder(e.getX(), e.getY()); if (childView != null && mListener != null && mGestureDetector.onTouchEvent(e)) { mListener.onItemClick(childView, view.getChildAdapterPosition(childView)); } return false; }
Example 15
Source File: RecyclerItemClickListener.java From Hacktoberfest with MIT License | 5 votes |
@Override public boolean onInterceptTouchEvent(RecyclerView view, MotionEvent e) { View childView = view.findChildViewUnder(e.getX(), e.getY()); if (childView != null && mListener != null && mGestureDetector.onTouchEvent(e)) { mListener.onItemClick(childView, view.getChildAdapterPosition(childView)); } return false; }
Example 16
Source File: OnItemTouchListener.java From Nimbus with GNU General Public License v3.0 | 5 votes |
@Override public boolean onInterceptTouchEvent(RecyclerView view, MotionEvent e) { View childView = view.findChildViewUnder(e.getX(), e.getY()); if (childView != null && mListener != null && mGestureDetector.onTouchEvent(e)) { mListener.onItemClick(childView, view.getChildAdapterPosition(childView)); } return false; }
Example 17
Source File: DoubleHeaderFragment.java From LRecyclerView with Apache License 2.0 | 5 votes |
@Override public boolean onInterceptTouchEvent(RecyclerView rv, MotionEvent e) { // really bad click detection just for demonstration purposes // it will not allow the list to scroll if the swipe motion starts // on top of a header return rv.findChildViewUnder(e.getX(), e.getY()) == null; }
Example 18
Source File: RecyclerItemClickListener.java From sticky-headers-recyclerview with Apache License 2.0 | 5 votes |
@Override public boolean onInterceptTouchEvent(RecyclerView view, MotionEvent e) { View childView = view.findChildViewUnder(e.getX(), e.getY()); if (childView != null && mListener != null && mGestureDetector.onTouchEvent(e)) { mListener.onItemClick(childView, view.getChildAdapterPosition(childView)); } return false; }
Example 19
Source File: DragSortRecycler.java From rox-android with Apache License 2.0 | 4 votes |
@Override public boolean onInterceptTouchEvent(RecyclerView rv, MotionEvent e) { debugLog("onInterceptTouchEvent"); //if (e.getAction() == MotionEvent.ACTION_DOWN) { View itemView = rv.findChildViewUnder(e.getX(), e.getY()); if (itemView==null) return false; boolean dragging = false; if ((dragHandleWidth > 0 ) && (e.getX() < dragHandleWidth)) { dragging = true; } else if (viewHandleId != -1) { //Find the handle in the list item View handleView = itemView.findViewById(viewHandleId); if (handleView == null) { Log.e(TAG, "The view ID " + viewHandleId + " was not found in the RecycleView item"); return false; } //View should be visible to drag if(handleView.getVisibility()!=View.VISIBLE) { return false; } //We need to find the relative position of the handle to the parent view //Then we can work out if the touch is within the handle int[] parentItemPos = new int[2]; itemView.getLocationInWindow(parentItemPos); int[] handlePos = new int[2]; handleView.getLocationInWindow(handlePos); int xRel = handlePos[0] - parentItemPos[0]; int yRel = handlePos[1] - parentItemPos[1]; Rect touchBounds = new Rect(itemView.getLeft() + xRel, itemView.getTop() + yRel, itemView.getLeft() + xRel + handleView.getWidth(), itemView.getTop() + yRel + handleView.getHeight() ); if (touchBounds.contains((int)e.getX(), (int)e.getY())) dragging = true; debugLog("parentItemPos = " + parentItemPos[0] + " " + parentItemPos[1]); debugLog("handlePos = " + handlePos[0] + " " + handlePos[1]); } if (dragging) { debugLog("Started Drag"); setIsDragging(true); floatingItem = createFloatingBitmap(itemView); fingerAnchorY = (int)e.getY(); fingerOffsetInViewY = fingerAnchorY - itemView.getTop(); fingerY = fingerAnchorY; selectedDragItemPos = rv.getChildPosition(itemView); debugLog("selectedDragItemPos = " + selectedDragItemPos); return true; } } return false; }
Example 20
Source File: DragSortRecycler.java From OmniList with GNU Affero General Public License v3.0 | 4 votes |
@Override public boolean onInterceptTouchEvent(RecyclerView rv, MotionEvent e) { debugLog("onInterceptTouchEvent"); //if (e.getAction() == MotionEvent.ACTION_DOWN) { View itemView = rv.findChildViewUnder(e.getX(), e.getY()); if (itemView == null) return false; boolean dragging = false; if ((dragHandleWidth > 0) && (e.getX() < dragHandleWidth)) { dragging = true; } else if (viewHandleId != -1) { //Find the handle in the list item View handleView = itemView.findViewById(viewHandleId); if (handleView == null) { Log.e(TAG, "The view ID " + viewHandleId + " was not found in the RecycleView item"); return false; } //View should be visible to drag if (handleView.getVisibility() != View.VISIBLE) { return false; } //We need to find the relative position of the handle to the parent view //Then we can work out if the touch is within the handle int[] parentItemPos = new int[2]; itemView.getLocationInWindow(parentItemPos); int[] handlePos = new int[2]; handleView.getLocationInWindow(handlePos); int xRel = handlePos[0] - parentItemPos[0]; int yRel = handlePos[1] - parentItemPos[1]; Rect touchBounds = new Rect(itemView.getLeft() + xRel, itemView.getTop() + yRel, itemView.getLeft() + xRel + handleView.getWidth(), itemView.getTop() + yRel + handleView.getHeight() ); if (touchBounds.contains((int) e.getX(), (int) e.getY())) dragging = true; debugLog("parentItemPos = " + parentItemPos[0] + " " + parentItemPos[1]); debugLog("handlePos = " + handlePos[0] + " " + handlePos[1]); } if (dragging) { debugLog("Started Drag"); setIsDragging(true); floatingItem = createFloatingBitmap(itemView); fingerAnchorY = (int) e.getY(); fingerOffsetInViewY = fingerAnchorY - itemView.getTop(); fingerY = fingerAnchorY; selectedDragItemPos = rv.getChildLayoutPosition(itemView); debugLog("selectedDragItemPos = " + selectedDragItemPos); return true; } } return false; }