當前位置: 首頁>>代碼示例>>Java>>正文


Java CustomRecyclerViewUtils.getDecorationOffsets方法代碼示例

本文整理匯總了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);
}
 
開發者ID:WriterOfAlicrow,項目名稱:OpenCVTour,代碼行數:11,代碼來源:SwapTargetItemOperator.java

示例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);
}
 
開發者ID:WriterOfAlicrow,項目名稱:OpenCVTour,代碼行數:30,代碼來源:SwapTargetItemOperator.java

示例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


注:本文中的com.h6ah4i.android.widget.advrecyclerview.utils.CustomRecyclerViewUtils.getDecorationOffsets方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。