本文整理汇总了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