本文整理汇总了Java中com.h6ah4i.android.widget.advrecyclerview.draggable.RecyclerViewDragDropManager.STATE_FLAG_DRAGGING属性的典型用法代码示例。如果您正苦于以下问题:Java RecyclerViewDragDropManager.STATE_FLAG_DRAGGING属性的具体用法?Java RecyclerViewDragDropManager.STATE_FLAG_DRAGGING怎么用?Java RecyclerViewDragDropManager.STATE_FLAG_DRAGGING使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类com.h6ah4i.android.widget.advrecyclerview.draggable.RecyclerViewDragDropManager
的用法示例。
在下文中一共展示了RecyclerViewDragDropManager.STATE_FLAG_DRAGGING属性的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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);
}
示例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);
}
示例3: onBindViewHolder
@Override
public void onBindViewHolder(ViewHolder holder, int position) {
TourItem item = _items.get(position);
holder._name.setText(item.getName());
holder._description.setText(item.getDescription());
if(item.getDescription().equals(""))
holder._description.setVisibility(View.GONE);
else
holder._description.setVisibility(View.VISIBLE);
if(item.hasMainImage()) {
String image_filepath = item.getMainImageFilepath();
ImageView image_view = holder._thumbnail;
Utilities.loadBitmap(image_view, image_filepath, Utilities.dp_to_px(40), Utilities.dp_to_px(40), getActivity());
} else
holder._thumbnail.setImageResource(R.drawable.default_thumbnail);
// 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;
} else if ((dragState & RecyclerViewDragDropManager.STATE_FLAG_DRAGGING) != 0) {
bgResId = R.drawable.bg_item_dragging_state;
} else {
bgResId = R.drawable.bg_item_normal_state;
}
holder._container.setBackgroundResource(bgResId);
}
}
示例4: 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);
}
}
示例5: 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
示例6: 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
示例7: onBindViewHolder
@Override
public void onBindViewHolder(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) {
bgResId = R.drawable.bg_item_dragging_state;
} else {
bgResId = R.drawable.bg_item_normal_state;
}
holder.mContainer.setBackgroundResource(bgResId);
}
}
示例8: 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
示例9: 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
示例10: 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
示例11: 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