use of android.support.v7.widget.RecyclerView.ViewHolder in project SwipeRecyclerView by yanzhenjie.
the class SwipeMenuRecyclerView method smoothOpenMenu.
/**
* open menu.
*
* @param position position.
* @param direction use {@link #LEFT_DIRECTION}, {@link #RIGHT_DIRECTION}.
* @param duration time millis.
*/
public void smoothOpenMenu(int position, @DirectionMode int direction, int duration) {
if (mOldSwipedLayout != null) {
if (mOldSwipedLayout.isMenuOpen()) {
mOldSwipedLayout.smoothCloseMenu();
}
}
ViewHolder vh = findViewHolderForAdapterPosition(position);
if (vh != null) {
View itemView = getSwipeMenuView(vh.itemView);
if (itemView instanceof SwipeMenuLayout) {
mOldSwipedLayout = (SwipeMenuLayout) itemView;
if (direction == RIGHT_DIRECTION) {
mOldTouchedPosition = position;
mOldSwipedLayout.smoothOpenRightMenu(duration);
} else if (direction == LEFT_DIRECTION) {
mOldTouchedPosition = position;
mOldSwipedLayout.smoothOpenLeftMenu(duration);
}
}
}
}
use of android.support.v7.widget.RecyclerView.ViewHolder in project MagicCamera by wuhaoyu1990.
the class FilterAdapter method onCreateViewHolder.
@Override
public FilterHolder onCreateViewHolder(ViewGroup arg0, int arg1) {
if (arg1 != -1) {
View view = mInflater.inflate(R.layout.filter_item_layout, arg0, false);
FilterHolder viewHolder = new FilterHolder(view);
viewHolder.thumbImage = (ImageView) view.findViewById(R.id.filter_thumb_image);
viewHolder.filterName = (TextView) view.findViewById(R.id.filter_thumb_name);
viewHolder.filterRoot = (FrameLayout) view.findViewById(R.id.filter_root);
viewHolder.thumbSelected = (FrameLayout) view.findViewById(R.id.filter_thumb_selected);
viewHolder.filterFavourite = (FrameLayout) view.findViewById(R.id.filter_thumb_favorite_layout);
viewHolder.thumbSelected_bg = (View) view.findViewById(R.id.filter_thumb_selected_bg);
return viewHolder;
} else {
View view = mInflater.inflate(R.layout.filter_division_layout, arg0, false);
FilterHolder viewHolder = new FilterHolder(view);
return viewHolder;
}
}
use of android.support.v7.widget.RecyclerView.ViewHolder in project LookLook by xinghongfei.
the class GridItemDividerDecoration method onDrawOver.
@Override
public void onDrawOver(Canvas canvas, RecyclerView parent, RecyclerView.State state) {
if (parent.isAnimating())
return;
final int childCount = parent.getChildCount();
final RecyclerView.LayoutManager lm = parent.getLayoutManager();
for (int i = 0; i < childCount; i++) {
final View child = parent.getChildAt(i);
RecyclerView.ViewHolder viewHolder = parent.getChildViewHolder(child);
if (requiresDivider(viewHolder)) {
final int right = lm.getDecoratedRight(child);
final int bottom = lm.getDecoratedBottom(child);
// draw the bottom divider
canvas.drawRect(lm.getDecoratedLeft(child), bottom - dividerSize, right, bottom, paint);
// draw the right edge divider
canvas.drawRect(right - dividerSize, lm.getDecoratedTop(child), right, bottom - dividerSize, paint);
}
}
}
use of android.support.v7.widget.RecyclerView.ViewHolder in project vlayout by alibaba.
the class VirtualLayoutManager method detachAndScrapAttachedViews.
@Override
public void detachAndScrapAttachedViews(RecyclerView.Recycler recycler) {
int childCount = this.getChildCount();
for (int i = childCount - 1; i >= 0; --i) {
View v = this.getChildAt(i);
RecyclerView.ViewHolder holder = getChildViewHolder(v);
if (holder instanceof CacheViewHolder && ((CacheViewHolder) holder).needCached()) {
// mark not invalid, ignore DataSetChange(), make the ViewHolder itself to maitain the data
ViewHolderWrapper.setFlags(holder, 0, FLAG_INVALID | FLAG_UPDATED);
}
}
super.detachAndScrapAttachedViews(recycler);
}
use of android.support.v7.widget.RecyclerView.ViewHolder in project MaterializeYourApp by antoniolg.
the class RecyclerViewAdapter method onCreateViewHolder.
@Override
public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
View v = LayoutInflater.from(parent.getContext()).inflate(R.layout.item_recycler, parent, false);
v.setOnClickListener(this);
return new ViewHolder(v);
}
Aggregations