本文整理汇总了Java中com.h6ah4i.android.widget.advrecyclerview.utils.CustomRecyclerViewUtils.getDecorationOffsets方法的典型用法代码示例。如果您正苦于以下问题:Java CustomRecyclerViewUtils.getDecorationOffsets方法的具体用法?Java CustomRecyclerViewUtils.getDecorationOffsets怎么用?Java CustomRecyclerViewUtils.getDecorationOffsets使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.h6ah4i.android.widget.advrecyclerview.utils.CustomRecyclerViewUtils
的用法示例。
在下文中一共展示了CustomRecyclerViewUtils.getDecorationOffsets方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: SwapTargetItemOperator
import com.h6ah4i.android.widget.advrecyclerview.utils.CustomRecyclerViewUtils; //导入方法依赖的package包/类
public SwapTargetItemOperator(RecyclerView recyclerView, RecyclerView.ViewHolder draggingItem, ItemDraggableRange range, DraggingItemInfo draggingItemInfo) {
super(recyclerView, draggingItem);
mDraggingItemInfo = draggingItemInfo;
mRange = range;
CustomRecyclerViewUtils.getDecorationOffsets(
mRecyclerView.getLayoutManager(), mDraggingItemViewHolder.itemView, mDraggingItemDecorationOffsets);
}
开发者ID:fabricethilaw,项目名称:expandable-recyclerview-with-gridlayout,代码行数:10,代码来源:SwapTargetItemOperator.java
示例2: SwapTargetItemOperator
import com.h6ah4i.android.widget.advrecyclerview.utils.CustomRecyclerViewUtils; //导入方法依赖的package包/类
public SwapTargetItemOperator(RecyclerView recyclerView, RecyclerView.ViewHolder draggingItem, ItemDraggableRange range) {
super(recyclerView, draggingItem);
mDraggingItemId = mDraggingItem.getItemId();
mRange = range;
CustomRecyclerViewUtils.getLayoutMargins(mDraggingItem.itemView, mDraggingItemMargins);
CustomRecyclerViewUtils.getDecorationOffsets(
mRecyclerView.getLayoutManager(), mDraggingItem.itemView, mDraggingItemDecorationOffsets);
}
示例3: calculateTranslationPhase
import com.h6ah4i.android.widget.advrecyclerview.utils.CustomRecyclerViewUtils; //导入方法依赖的package包/类
private float calculateTranslationPhase(RecyclerView.ViewHolder draggingItem, RecyclerView.ViewHolder swapTargetItem) {
final View swapItemView = swapTargetItem.itemView;
final int pos1 = draggingItem.getLayoutPosition();
final int pos2 = swapTargetItem.getLayoutPosition();
CustomRecyclerViewUtils.getDecorationOffsets(
mRecyclerView.getLayoutManager(), swapItemView, mSwapTargetDecorationOffsets);
CustomRecyclerViewUtils.getLayoutMargins(swapItemView, mSwapTargetItemMargins);
final Rect m2 = mSwapTargetItemMargins;
final Rect d2 = mSwapTargetDecorationOffsets;
final int h2 = swapItemView.getHeight() + m2.top + m2.bottom + d2.top + d2.bottom;
final float offsetPx = draggingItem.itemView.getTop() - mTranslationY; // == -(ViewCompat.getTranslationY(draggingItem.itemView)
final float phase = (h2 != 0) ? (offsetPx / h2) : 0.0f;
float translationPhase;
if (pos1 > pos2) {
// dragging item moving to upward
translationPhase = phase;
} else {
// dragging item moving to downward
translationPhase = 1.0f + phase;
}
return Math.min(Math.max(translationPhase, 0.0f), 1.0f);
}
示例4: calculateTranslationPhase
import com.h6ah4i.android.widget.advrecyclerview.utils.CustomRecyclerViewUtils; //导入方法依赖的package包/类
private float calculateTranslationPhase(RecyclerView.ViewHolder draggingItem, RecyclerView.ViewHolder swapTargetItem) {
final View swapItemView = swapTargetItem.itemView;
final int pos1 = draggingItem.getLayoutPosition();
final int pos2 = swapTargetItem.getLayoutPosition();
CustomRecyclerViewUtils.getDecorationOffsets(
mRecyclerView.getLayoutManager(), swapItemView, mSwapTargetDecorationOffsets);
CustomRecyclerViewUtils.getLayoutMargins(swapItemView, mSwapTargetItemMargins);
final Rect m2 = mSwapTargetItemMargins;
final Rect d2 = mSwapTargetDecorationOffsets;
final int h2 = swapItemView.getHeight() + m2.top + m2.bottom + d2.top + d2.bottom;
final int w2 = swapItemView.getWidth() + m2.left + m2.right + d2.left + d2.right;
final float offsetXPx = draggingItem.itemView.getLeft() - mTranslationX; // == -(ViewCompat.getTranslationY(draggingItem.itemView)
final float phaseX = (w2 != 0) ? (offsetXPx / w2) : 0.0f;
final float offsetYPx = draggingItem.itemView.getTop() - mTranslationY; // == -(ViewCompat.getTranslationY(draggingItem.itemView)
final float phaseY = (h2 != 0) ? (offsetYPx / h2) : 0.0f;
float translationPhase = 0.0f;
if (CustomRecyclerViewUtils.getOrientation(mRecyclerView) == CustomRecyclerViewUtils.ORIENTATION_VERTICAL) {
if (pos1 > pos2) {
// dragging item moving to upward
translationPhase = phaseY;
} else {
// dragging item moving to downward
translationPhase = 1.0f + phaseY;
}
} else if (CustomRecyclerViewUtils.getOrientation(mRecyclerView) == CustomRecyclerViewUtils.ORIENTATION_HORIZONTAL) {
if (pos1 > pos2) {
// dragging item moving to upward
translationPhase = phaseX;
} else {
// dragging item moving to downward
translationPhase = 1.0f + phaseX;
}
}
return Math.min(Math.max(translationPhase, 0.0f), 1.0f);
}
开发者ID:fabricethilaw,项目名称:expandable-recyclerview-with-gridlayout,代码行数:44,代码来源:SwapTargetItemOperator.java