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


Java RecyclerViewSwipeManager.STATE_FLAG_IS_ACTIVE属性代码示例

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


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

示例1: onBindViewHolder

@Override
public void onBindViewHolder(MyViewHolder holder, int position) {
    final MyItem item = mProvider.get(position);

    // set listeners
    // (if the item is *not pinned*, click event comes to the itemView)
    holder.itemView.setOnClickListener(mItemViewOnClickListener);
    // (if the item is *pinned*, click event comes to the mContainer)
    holder.mContainer.setOnClickListener(mSwipeableViewContainerOnClickListener);

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

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

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

        if ((dragState & RecyclerViewDragDropManager.STATE_FLAG_IS_ACTIVE) != 0) {
            bgResId = R.drawable.bg_item_dragging_active_state;
        } else if ((dragState & RecyclerViewDragDropManager.STATE_FLAG_DRAGGING) != 0) {
            bgResId = R.drawable.bg_item_dragging_state;
        } else if ((swipeState & RecyclerViewSwipeManager.STATE_FLAG_IS_ACTIVE) != 0) {
            bgResId = R.drawable.bg_item_swiping_active_state;
        } else if ((swipeState & RecyclerViewSwipeManager.STATE_FLAG_SWIPING) != 0) {
            bgResId = R.drawable.bg_item_swiping_state;
        } else {
            bgResId = R.drawable.bg_item_normal_state;
        }

        holder.mContainer.setBackgroundResource(bgResId);
    }

    // set swiping properties
    holder.setSwipeItemSlideAmount(
            item.isPinedToSwipeLeft() ? RecyclerViewSwipeManager.OUTSIDE_OF_THE_WINDOW_LEFT : 0);
}
 
开发者ID:hanks-zyh,项目名称:RecylerView,代码行数:40,代码来源:MyDraggableSwipeableItemAdapter.java

示例2: onBindViewHolder

@Override
public void onBindViewHolder(MyViewHolder holder, int position) {


    MyItem item = dataList.get(position);
    holder.textView.setText(item.getContent());

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

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

        if ((dragState & RecyclerViewDragDropManager.STATE_FLAG_IS_ACTIVE) != 0) {
            bgResId = R.drawable.bg_item_dragging_active_state;
        } else if ((dragState & RecyclerViewDragDropManager.STATE_FLAG_DRAGGING) != 0) {
            bgResId = R.drawable.bg_item_dragging_state;
        } else if ((swipeState & RecyclerViewSwipeManager.STATE_FLAG_IS_ACTIVE) != 0) {
            bgResId = R.drawable.bg_item_swiping_active_state;
        } else if ((swipeState & RecyclerViewSwipeManager.STATE_FLAG_SWIPING) != 0) {
            bgResId = R.drawable.bg_item_swiping_state;
        } else {
            bgResId = R.drawable.bg_item_normal_state;
        }

        holder.container.setBackgroundResource(bgResId);
    }

    // set swiping properties
    holder.setSwipeItemSlideAmount(
            item.isPinedToSwipeLeft() ? RecyclerViewSwipeManager.OUTSIDE_OF_THE_WINDOW_LEFT : 0);
}
 
开发者ID:hanks-zyh,项目名称:RecylerView,代码行数:34,代码来源:MyAdapter.java

示例3: onBindViewHolder

@Override
public void onBindViewHolder(MyViewHolder holder, int position) {
    final AbstractDataProvider.Data item = mProvider.getItem(position);

    // set listeners
    // (if the item is *not pinned*, click event comes to the itemView)
    holder.itemView.setOnClickListener(mItemViewOnClickListener);
    // (if the item is *pinned*, click event comes to the mContainer)
    holder.mContainer.setOnClickListener(mSwipeableViewContainerOnClickListener);

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

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

    if ((swipeState & RecyclerViewSwipeManager.STATE_FLAG_IS_UPDATED) != 0) {
        int bgResId;

        if ((swipeState & RecyclerViewSwipeManager.STATE_FLAG_IS_ACTIVE) != 0) {
            bgResId = R.drawable.bg_item_swiping_active_state;
        } else if ((swipeState & RecyclerViewSwipeManager.STATE_FLAG_SWIPING) != 0) {
            bgResId = R.drawable.bg_item_swiping_state;
        } else {
            bgResId = R.drawable.bg_item_normal_state;
        }

        holder.mContainer.setBackgroundResource(bgResId);
    }

    // set swiping properties
    holder.setSwipeItemSlideAmount(
            item.isPinnedToSwipeLeft() ? RecyclerViewSwipeManager.OUTSIDE_OF_THE_WINDOW_LEFT : 0);
}
 
开发者ID:pczhu,项目名称:android-advancedrecyclerview-master,代码行数:34,代码来源:MySwipeableItemAdapter.java

示例4: onBindViewHolder

@Override
public void onBindViewHolder(MyViewHolder holder, int position) {
    final AbstractDataProvider.Data item = mProvider.getItem(position);

    // set listeners
    // (if the item is *pinned*, click event comes to the mContainer)
    holder.mContainer.setOnClickListener(mSwipeableViewContainerOnClickListener);
    holder.mButton.setOnClickListener(mUnderSwipeableViewButtonOnClickListener);

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

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

    if ((swipeState & RecyclerViewSwipeManager.STATE_FLAG_IS_UPDATED) != 0) {
        int bgResId;

        if ((swipeState & RecyclerViewSwipeManager.STATE_FLAG_IS_ACTIVE) != 0) {
            bgResId = R.drawable.bg_item_swiping_active_state;
        } else if ((swipeState & RecyclerViewSwipeManager.STATE_FLAG_SWIPING) != 0) {
            bgResId = R.drawable.bg_item_swiping_state;
        } else {
            bgResId = R.drawable.bg_item_normal_state;
        }

        holder.mContainer.setBackgroundResource(bgResId);
    }

    // set swiping properties
    holder.setMaxLeftSwipeAmount(-0.5f);
    holder.setMaxRightSwipeAmount(0);
    holder.setSwipeItemSlideAmount(
            item.isPinnedToSwipeLeft() ? -0.5f : 0);
}
 
开发者ID:pczhu,项目名称:android-advancedrecyclerview-master,代码行数:35,代码来源:MyUnderSwipeableItemAdapter.java

示例5: onBindViewHolder

@Override
public void onBindViewHolder(MyViewHolder holder, int position) {
    final AbstractDataProvider.Data item = mProvider.getItem(position);

    // set listeners
    // (if the item is *not pinned*, click event comes to the itemView)
    holder.itemView.setOnClickListener(mItemViewOnClickListener);
    // (if the item is *pinned*, click event comes to the mContainer)
    holder.mContainer.setOnClickListener(mSwipeableViewContainerOnClickListener);

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

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

    if (((dragState & RecyclerViewDragDropManager.STATE_FLAG_IS_UPDATED) != 0) ||
            ((swipeState & RecyclerViewSwipeManager.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) {
            bgResId = R.drawable.bg_item_dragging_state;
        } else if ((swipeState & RecyclerViewSwipeManager.STATE_FLAG_IS_ACTIVE) != 0) {
            bgResId = R.drawable.bg_item_swiping_active_state;
        } else if ((swipeState & RecyclerViewSwipeManager.STATE_FLAG_SWIPING) != 0) {
            bgResId = R.drawable.bg_item_swiping_state;
        } else {
            bgResId = R.drawable.bg_item_normal_state;
        }

        holder.mContainer.setBackgroundResource(bgResId);
    }

    // set swiping properties
    holder.setSwipeItemSlideAmount(
            item.isPinnedToSwipeLeft() ? RecyclerViewSwipeManager.OUTSIDE_OF_THE_WINDOW_LEFT : 0);
}
 
开发者ID:pczhu,项目名称:android-advancedrecyclerview-master,代码行数:43,代码来源:MyDraggableSwipeableItemAdapter.java

示例6: onBindGroupViewHolder

@Override
public void onBindGroupViewHolder(MyGroupViewHolder holder, int groupPosition, int viewType) {
    // group item
    final AbstractExpandableDataProvider.GroupData item = mProvider.getGroupItem(groupPosition);

    // set listeners
    holder.itemView.setOnClickListener(mItemViewOnClickListener);

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

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

    if (((dragState & RecyclerViewDragDropManager.STATE_FLAG_IS_UPDATED) != 0) ||
            ((expandState & RecyclerViewExpandableItemManager.STATE_FLAG_IS_UPDATED) != 0) ||
            ((swipeState & RecyclerViewSwipeManager.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) {
            bgResId = R.drawable.bg_group_item_dragging_state;
        } else if ((swipeState & RecyclerViewSwipeManager.STATE_FLAG_IS_ACTIVE) != 0) {
            bgResId = R.drawable.bg_group_item_swiping_active_state;
        } else if ((swipeState & RecyclerViewSwipeManager.STATE_FLAG_SWIPING) != 0) {
            bgResId = R.drawable.bg_group_item_swiping_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);
    }

    // set swiping properties
    holder.setSwipeItemSlideAmount(
            item.isPinnedToSwipeLeft() ? RecyclerViewSwipeManager.OUTSIDE_OF_THE_WINDOW_LEFT : 0);
}
 
开发者ID:pczhu,项目名称:android-advancedrecyclerview-master,代码行数:53,代码来源:MyExpandableDraggableSwipeableItemAdapter.java

示例7: onBindChildViewHolder

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

    // set listeners
    // (if the item is *not pinned*, click event comes to the itemView)
    holder.itemView.setOnClickListener(mItemViewOnClickListener);
    // (if the item is *pinned*, click event comes to the mContainer)
    holder.mContainer.setOnClickListener(mSwipeableViewContainerOnClickListener);

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

    final int dragState = holder.getDragStateFlags();
    final int swipeState = holder.getSwipeStateFlags();

    if (((dragState & RecyclerViewDragDropManager.STATE_FLAG_IS_UPDATED) != 0) ||
            ((swipeState & RecyclerViewSwipeManager.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) {
            bgResId = R.drawable.bg_item_dragging_state;
        } else if ((swipeState & RecyclerViewSwipeManager.STATE_FLAG_IS_ACTIVE) != 0) {
            bgResId = R.drawable.bg_item_swiping_active_state;
        } else if ((swipeState & RecyclerViewSwipeManager.STATE_FLAG_SWIPING) != 0) {
            bgResId = R.drawable.bg_item_swiping_state;
        } else {
            bgResId = R.drawable.bg_item_normal_state;
        }

        holder.mContainer.setBackgroundResource(bgResId);
    }

    // set swiping properties
    holder.setSwipeItemSlideAmount(
            item.isPinnedToSwipeLeft() ? RecyclerViewSwipeManager.OUTSIDE_OF_THE_WINDOW_LEFT : 0);
}
 
开发者ID:pczhu,项目名称:android-advancedrecyclerview-master,代码行数:43,代码来源:MyExpandableDraggableSwipeableItemAdapter.java


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