本文整理匯總了Java中com.h6ah4i.android.widget.advrecyclerview.utils.CustomRecyclerViewUtils.findChildViewHolderUnderWithTranslation方法的典型用法代碼示例。如果您正苦於以下問題:Java CustomRecyclerViewUtils.findChildViewHolderUnderWithTranslation方法的具體用法?Java CustomRecyclerViewUtils.findChildViewHolderUnderWithTranslation怎麽用?Java CustomRecyclerViewUtils.findChildViewHolderUnderWithTranslation使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.h6ah4i.android.widget.advrecyclerview.utils.CustomRecyclerViewUtils
的用法示例。
在下文中一共展示了CustomRecyclerViewUtils.findChildViewHolderUnderWithTranslation方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: handleActionDown
import com.h6ah4i.android.widget.advrecyclerview.utils.CustomRecyclerViewUtils; //導入方法依賴的package包/類
private void handleActionDown(RecyclerView rv, MotionEvent e) {
final RecyclerView.ViewHolder holder = CustomRecyclerViewUtils.findChildViewHolderUnderWithTranslation(rv, e.getX(), e.getY());
mInitialTouchX = (int) (e.getX() + 0.5f);
mInitialTouchY = (int) (e.getY() + 0.5f);
if (holder instanceof ExpandableItemViewHolder) {
mTouchedItemId = holder.getItemId();
} else {
mTouchedItemId = RecyclerView.NO_ID;
}
}
開發者ID:fabricethilaw,項目名稱:expandable-recyclerview-with-gridlayout,代碼行數:13,代碼來源:RecyclerViewExpandableItemManager.java
示例2: handleActionDown
import com.h6ah4i.android.widget.advrecyclerview.utils.CustomRecyclerViewUtils; //導入方法依賴的package包/類
private boolean handleActionDown(RecyclerView rv, MotionEvent e) {
final RecyclerView.Adapter adapter = rv.getAdapter();
final RecyclerView.ViewHolder holder = CustomRecyclerViewUtils.findChildViewHolderUnderWithTranslation(rv, e.getX(), e.getY());
if (!(holder instanceof SwipeableItemViewHolder)) {
return false;
}
final int itemPosition = CustomRecyclerViewUtils.getSynchronizedPosition(holder);
// verify the touched item is valid state
if (!(itemPosition >= 0 && itemPosition < adapter.getItemCount())) {
return false;
}
if (holder.getItemId() != adapter.getItemId(itemPosition)) {
return false;
}
final int touchX = (int) (e.getX() + 0.5f);
final int touchY = (int) (e.getY() + 0.5f);
final View view = holder.itemView;
final int translateX = (int) (ViewCompat.getTranslationX(view) + 0.5f);
final int translateY = (int) (ViewCompat.getTranslationY(view) + 0.5f);
final int viewX = touchX - (view.getLeft() + translateX);
final int viewY = touchY - (view.getTop() + translateY);
final int reactionType = mAdapter.getSwipeReactionType(holder, itemPosition, viewX, viewY);
if (reactionType == 0) {
return false;
}
mInitialTouchX = touchX;
mInitialTouchY = touchY;
mCheckingTouchSlop = holder.getItemId();
mSwipingItemReactionType = reactionType;
return true;
}
示例3: handleActionMoveWhileNotSwiping
import com.h6ah4i.android.widget.advrecyclerview.utils.CustomRecyclerViewUtils; //導入方法依賴的package包/類
private boolean handleActionMoveWhileNotSwiping(RecyclerView rv, MotionEvent e) {
if (mCheckingTouchSlop == RecyclerView.NO_ID) {
return false;
}
if (Math.abs(e.getY() - mInitialTouchY) > mTouchSlop) {
// scrolling occurred
mCheckingTouchSlop = RecyclerView.NO_ID;
return false;
}
if (Math.abs(e.getX() - mInitialTouchX) <= mTouchSlop) {
return false;
}
final RecyclerView.ViewHolder holder = CustomRecyclerViewUtils.findChildViewHolderUnderWithTranslation(rv, e.getX(), e.getY());
if (holder == null || holder.getItemId() != mCheckingTouchSlop) {
mCheckingTouchSlop = RecyclerView.NO_ID;
return false;
}
final int itemPosition = CustomRecyclerViewUtils.getSynchronizedPosition(holder);
if (itemPosition == RecyclerView.NO_POSITION) {
return false;
}
if (LOCAL_LOGD) {
Log.d(TAG, "swiping started");
}
startSwiping(rv, e, holder, itemPosition);
return true;
}
示例4: handleActionDown
import com.h6ah4i.android.widget.advrecyclerview.utils.CustomRecyclerViewUtils; //導入方法依賴的package包/類
private boolean handleActionDown(RecyclerView rv, MotionEvent e) {
final RecyclerView.Adapter adapter = rv.getAdapter();
final RecyclerView.ViewHolder holder = CustomRecyclerViewUtils.findChildViewHolderUnderWithTranslation(rv, e.getX(), e.getY());
if (!(holder instanceof SwipeableItemViewHolder)) {
return false;
}
final int itemPosition = CustomRecyclerViewUtils.getSynchronizedPosition(holder);
// verify the touched item is valid state
if (!(itemPosition >= 0 && itemPosition < adapter.getItemCount())) {
return false;
}
if (holder.getItemId() != adapter.getItemId(itemPosition)) {
return false;
}
final int touchX = (int) (e.getX() + 0.5f);
final int touchY = (int) (e.getY() + 0.5f);
final View view = holder.itemView;
final int translateX = (int) (ViewCompat.getTranslationX(view) + 0.5f);
final int translateY = (int) (ViewCompat.getTranslationY(view) + 0.5f);
final int viewX = touchX - (view.getLeft() + translateX);
final int viewY = touchY - (view.getTop() + translateY);
final int reactionType = mAdapter.getSwipeReactionType(holder, itemPosition, viewX, viewY);
if (reactionType == 0) {
return false;
}
mInitialTouchX = touchX;
mInitialTouchY = touchY;
mCheckingTouchSlop = holder.getItemId();
mSwipingItemReactionType = reactionType;
if ((reactionType & REACTION_START_SWIPE_ON_LONG_PRESS) != 0) {
mHandler.startLongPressDetection(e, mLongPressTimeout);
}
return true;
}
開發者ID:fabricethilaw,項目名稱:expandable-recyclerview-with-gridlayout,代碼行數:45,代碼來源:RecyclerViewSwipeManager.java
示例5: handleActionMoveWhileNotSwiping
import com.h6ah4i.android.widget.advrecyclerview.utils.CustomRecyclerViewUtils; //導入方法依賴的package包/類
private boolean handleActionMoveWhileNotSwiping(RecyclerView rv, MotionEvent e) {
if (mCheckingTouchSlop == RecyclerView.NO_ID) {
return false;
}
final int dx = (int) (e.getX() + 0.5f) - mInitialTouchX;
final int dy = (int) (e.getY() + 0.5f) - mInitialTouchY;
final int scrollAxisDelta;
final int swipeAxisDelta;
if (mSwipeHorizontal) {
scrollAxisDelta = dy;
swipeAxisDelta = dx;
} else {
scrollAxisDelta = dx;
swipeAxisDelta = dy;
}
if (Math.abs(scrollAxisDelta) > mTouchSlop) {
// scrolling occurred
mCheckingTouchSlop = RecyclerView.NO_ID;
return false;
}
if (Math.abs(swipeAxisDelta) <= mTouchSlop) {
return false;
}
// check swipeable direction mask
boolean dirMasked;
if (mSwipeHorizontal) {
if (swipeAxisDelta < 0) {
dirMasked = ((mSwipingItemReactionType & REACTION_MASK_START_SWIPE_LEFT) != 0);
} else {
dirMasked = ((mSwipingItemReactionType & REACTION_MASK_START_SWIPE_RIGHT) != 0);
}
} else {
if (swipeAxisDelta < 0) {
dirMasked = ((mSwipingItemReactionType & REACTION_MASK_START_SWIPE_UP) != 0);
} else {
dirMasked = ((mSwipingItemReactionType & REACTION_MASK_START_SWIPE_DOWN) != 0);
}
}
if (dirMasked) {
// masked
mCheckingTouchSlop = RecyclerView.NO_ID;
return false;
}
final RecyclerView.ViewHolder holder = CustomRecyclerViewUtils.findChildViewHolderUnderWithTranslation(rv, e.getX(), e.getY());
if (holder == null || holder.getItemId() != mCheckingTouchSlop) {
mCheckingTouchSlop = RecyclerView.NO_ID;
return false;
}
return checkConditionAndStartSwiping(e, holder);
}
開發者ID:fabricethilaw,項目名稱:expandable-recyclerview-with-gridlayout,代碼行數:61,代碼來源:RecyclerViewSwipeManager.java
示例6: handleActionUpOrCancel
import com.h6ah4i.android.widget.advrecyclerview.utils.CustomRecyclerViewUtils; //導入方法依賴的package包/類
private boolean handleActionUpOrCancel(RecyclerView rv, MotionEvent e) {
final long touchedItemId = mTouchedItemId;
final int initialTouchX = mInitialTouchX;
final int initialTouchY = mInitialTouchY;
mTouchedItemId = RecyclerView.NO_ID;
mInitialTouchX = 0;
mInitialTouchY = 0;
if (!((touchedItemId != RecyclerView.NO_ID) && (MotionEventCompat.getActionMasked(e) == MotionEvent.ACTION_UP))) {
return false;
}
final int touchX = (int) (e.getX() + 0.5f);
final int touchY = (int) (e.getY() + 0.5f);
final int diffX = touchX - initialTouchX;
final int diffY = touchY - initialTouchY;
if (!((Math.abs(diffX) < mTouchSlop) && (Math.abs(diffY) < mTouchSlop))) {
return false;
}
final RecyclerView.ViewHolder holder = CustomRecyclerViewUtils.findChildViewHolderUnderWithTranslation(rv, e.getX(), e.getY());
if (!((holder != null) && (holder.getItemId() == touchedItemId))) {
return false;
}
final int position = CustomRecyclerViewUtils.getSynchronizedPosition(holder);
if (position == RecyclerView.NO_POSITION) {
return false;
}
final View view = holder.itemView;
final int translateX = (int) (ViewCompat.getTranslationX(view) + 0.5f);
final int translateY = (int) (ViewCompat.getTranslationY(view) + 0.5f);
final int viewX = touchX - (view.getLeft() + translateX);
final int viewY = touchY - (view.getTop() + translateY);
return mAdapter.onTapItem(holder, position, viewX, viewY);
}
開發者ID:fabricethilaw,項目名稱:expandable-recyclerview-with-gridlayout,代碼行數:44,代碼來源:RecyclerViewExpandableItemManager.java