当前位置: 首页>>代码示例>>Java>>正文


Java RecyclerViewDragDropManager.STATE_FLAG_IS_IN_RANGE属性代码示例

本文整理汇总了Java中com.h6ah4i.android.widget.advrecyclerview.draggable.RecyclerViewDragDropManager.STATE_FLAG_IS_IN_RANGE属性的典型用法代码示例。如果您正苦于以下问题:Java RecyclerViewDragDropManager.STATE_FLAG_IS_IN_RANGE属性的具体用法?Java RecyclerViewDragDropManager.STATE_FLAG_IS_IN_RANGE怎么用?Java RecyclerViewDragDropManager.STATE_FLAG_IS_IN_RANGE使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在com.h6ah4i.android.widget.advrecyclerview.draggable.RecyclerViewDragDropManager的用法示例。


在下文中一共展示了RecyclerViewDragDropManager.STATE_FLAG_IS_IN_RANGE属性的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: correctItemDragStateFlags

private void correctItemDragStateFlags(RecyclerView.ViewHolder holder, int groupPosition, int childPosition) {
    if (!(holder instanceof DraggableItemViewHolder)) {
        return;
    }

    final DraggableItemViewHolder holder2 = (DraggableItemViewHolder) holder;

    final boolean groupRangeSpecified =
            (mDraggingItemGroupRangeStart != RecyclerView.NO_POSITION) &&
            (mDraggingItemGroupRangeEnd != RecyclerView.NO_POSITION);
    final boolean childRangeSpecified =
            (mDraggingItemChildRangeStart != RecyclerView.NO_POSITION) &&
            (mDraggingItemChildRangeEnd != RecyclerView.NO_POSITION);
    final boolean isInGroupRange =
                    (groupPosition >= mDraggingItemGroupRangeStart) &&
                    (groupPosition <= mDraggingItemGroupRangeEnd);
    final boolean isInChildRange =
            (groupPosition != RecyclerView.NO_POSITION) &&
            (childPosition >= mDraggingItemChildRangeStart) &&
                    (childPosition <= mDraggingItemChildRangeEnd);

    final int flags = holder2.getDragStateFlags();
    boolean needCorrection = false;

    if (((flags & RecyclerViewDragDropManager.STATE_FLAG_DRAGGING) != 0) &&
            ((flags & RecyclerViewDragDropManager.STATE_FLAG_IS_IN_RANGE) == 0)) {
        if (!groupRangeSpecified || isInGroupRange) {
            if (!childRangeSpecified || (childRangeSpecified && isInChildRange)) {
                needCorrection = true;
            }
        }
    }

    if (needCorrection) {
        holder2.setDragStateFlags(
                flags | RecyclerViewDragDropManager.STATE_FLAG_IS_IN_RANGE |
                        RecyclerViewDragDropManager.STATE_FLAG_IS_UPDATED);
    }
}
 
开发者ID:WriterOfAlicrow,项目名称:OpenCVTour,代码行数:39,代码来源:ExpandableRecyclerViewWrapperAdapter.java

示例2: onBindItemGroupViewHolder

private void onBindItemGroupViewHolder(MyGroupViewHolder holder, int groupPosition) {
    // group item
    final AbstractExpandableDataProvider.GroupData item = mProvider.getGroupItem(groupPosition);

    // set text
    holder.mTextView.setText(item.getText());

    // set background resource (target view ID: container)
    final int dragState = holder.getDragStateFlags();
    final int expandState = holder.getExpandStateFlags();

    if (((dragState & RecyclerViewDragDropManager.STATE_FLAG_IS_UPDATED) != 0) ||
            ((expandState & RecyclerViewExpandableItemManager.STATE_FLAG_IS_UPDATED) != 0)) {
        int bgResId;
        boolean isExpanded;

        if ((dragState & RecyclerViewDragDropManager.STATE_FLAG_IS_ACTIVE) != 0) {
            bgResId = R.drawable.bg_group_item_dragging_active_state;

            // need to clear drawable state here to get correct appearance of the dragging item.
            DrawableUtils.clearState(holder.mContainer.getForeground());
        } else if (((dragState & RecyclerViewDragDropManager.STATE_FLAG_DRAGGING) != 0) &&
                ((dragState & RecyclerViewDragDropManager.STATE_FLAG_IS_IN_RANGE) != 0)) {
            bgResId = R.drawable.bg_group_item_dragging_state;
        } else if ((expandState & RecyclerViewExpandableItemManager.STATE_FLAG_IS_EXPANDED) != 0) {
            bgResId = R.drawable.bg_group_item_expanded_state;
        } else {
            bgResId = R.drawable.bg_group_item_normal_state;
        }

        if ((expandState & RecyclerViewExpandableItemManager.STATE_FLAG_IS_EXPANDED) != 0) {
            isExpanded = true;
        } else {
            isExpanded = false;
        }

        holder.mContainer.setBackgroundResource(bgResId);
        holder.mIndicator.setExpandedState(isExpanded, true);
    }
}
 
开发者ID:pczhu,项目名称:android-advancedrecyclerview-master,代码行数:40,代码来源:MyExpandableDraggableWithSectionItemAdapter.java

示例3: onBindChildViewHolder

@Override
public void onBindChildViewHolder(MyChildViewHolder holder, int groupPosition, int childPosition, int viewType) {
    // child item
    final AbstractExpandableDataProvider.ChildData item = mProvider.getChildItem(groupPosition, childPosition);

    // set text
    holder.mTextView.setText(item.getText());

    final int dragState = holder.getDragStateFlags();

    if (((dragState & RecyclerViewDragDropManager.STATE_FLAG_IS_UPDATED) != 0)) {
        int bgResId;

        if ((dragState & RecyclerViewDragDropManager.STATE_FLAG_IS_ACTIVE) != 0) {
            bgResId = R.drawable.bg_item_dragging_active_state;

            // need to clear drawable state here to get correct appearance of the dragging item.
            DrawableUtils.clearState(holder.mContainer.getForeground());
        } else if (((dragState & RecyclerViewDragDropManager.STATE_FLAG_DRAGGING) != 0) &&
                ((dragState & RecyclerViewDragDropManager.STATE_FLAG_IS_IN_RANGE) != 0)) {
            bgResId = R.drawable.bg_item_dragging_state;
        } else {
            bgResId = R.drawable.bg_item_normal_state;
        }

        holder.mContainer.setBackgroundResource(bgResId);
    }
}
 
开发者ID:pczhu,项目名称:android-advancedrecyclerview-master,代码行数:28,代码来源:MyExpandableDraggableWithSectionItemAdapter.java

示例4: onBindSectionItemViewHolder

private void onBindSectionItemViewHolder(MyViewHolder holder, int position) {
    final AbstractDataProvider.Data item = mProvider.getItem(position);

    // set text
    holder.mTextView.setText(item.getText());

    // set background resource (target view ID: container)
    final int dragState = holder.getDragStateFlags();

    if (((dragState & RecyclerViewDragDropManager.STATE_FLAG_IS_UPDATED) != 0)) {
        int bgResId;

        if ((dragState & RecyclerViewDragDropManager.STATE_FLAG_IS_ACTIVE) != 0) {
            bgResId = R.drawable.bg_item_dragging_active_state;

            // need to clear drawable state here to get correct appearance of the dragging item.
            DrawableUtils.clearState(holder.mContainer.getForeground());
        } else if (
                ((dragState & RecyclerViewDragDropManager.STATE_FLAG_DRAGGING) != 0) &&
                ((dragState & RecyclerViewDragDropManager.STATE_FLAG_IS_IN_RANGE) != 0)) {
            bgResId = R.drawable.bg_item_dragging_state;
        } else {
            bgResId = R.drawable.bg_item_normal_state;
        }

        holder.mContainer.setBackgroundResource(bgResId);
    }
}
 
开发者ID:pczhu,项目名称:android-advancedrecyclerview-master,代码行数:28,代码来源:MyDraggableWithSectionItemAdapter.java


注:本文中的com.h6ah4i.android.widget.advrecyclerview.draggable.RecyclerViewDragDropManager.STATE_FLAG_IS_IN_RANGE属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。