use of com.tmall.wireless.tangram3.core.adapter.BinderViewHolder in project Tangram-Android by alibaba.
the class BannerView method recyclerView.
private void recyclerView(List<BinderViewHolder> cache) {
if (!cache.isEmpty()) {
RecyclerView.RecycledViewPool pool = cell.serviceManager.getService(RecyclerView.RecycledViewPool.class);
for (int i = 0, size = cache.size(); i < size; i++) {
BinderViewHolder viewHolder = cache.get(i);
viewHolder.unbind();
removeView(viewHolder.itemView);
pool.putRecycledView(viewHolder);
}
cache.clear();
}
}
use of com.tmall.wireless.tangram3.core.adapter.BinderViewHolder in project Tangram-Android by alibaba.
the class LinearScrollView method recycleView.
private void recycleView(@NonNull BaseCell cell) {
if (!mViewHolders.isEmpty()) {
RecyclerView.RecycledViewPool pool = cell.serviceManager.getService(RecyclerView.RecycledViewPool.class);
for (int i = 0, size = mViewHolders.size(); i < size; i++) {
BinderViewHolder viewHolder = mViewHolders.get(i);
viewHolder.unbind();
removeView(viewHolder.itemView);
pool.putRecycledView(viewHolder);
}
mViewHolders.clear();
}
}
use of com.tmall.wireless.tangram3.core.adapter.BinderViewHolder in project Tangram-Android by alibaba.
the class PojoGroupBasicAdapter method onBindViewHolder.
@Override
public void onBindViewHolder(BinderViewHolder<BaseCell, ? extends View> holder, int position) {
super.onBindViewHolder(holder, position);
int idx = findCardIdxFor(position);
if (idx >= 0) {
Pair<Range<Integer>, Card> pair = mCards.get(idx);
pair.second.onBindCell(position - pair.first.getLower(), position, mLastBindPosition < 0 || mLastBindPosition < position);
PageDetectorSupport pageDetectorSupport = pair.second.serviceManager.getService(PageDetectorSupport.class);
if (pageDetectorSupport != null) {
pageDetectorSupport.onBindItem(position, mLastBindPosition < 0 || mLastBindPosition < position, getItemByPosition(position));
}
}
mLastBindPosition = position;
}
use of com.tmall.wireless.tangram3.core.adapter.BinderViewHolder in project Tangram-Android by alibaba.
the class LinearScrollView method getViewFromRecycler.
private View getViewFromRecycler(@NonNull BaseCell cell) {
GroupBasicAdapter adapter = cell.serviceManager.getService(GroupBasicAdapter.class);
RecyclerView.RecycledViewPool pool = cell.serviceManager.getService(RecyclerView.RecycledViewPool.class);
int itemViewType = adapter.getItemType(cell);
BinderViewHolder holder = (BinderViewHolder) pool.getRecycledView(itemViewType);
if (holder == null) {
holder = (BinderViewHolder) adapter.createViewHolder(this, itemViewType);
}
holder.bind(cell);
mViewHolders.add(holder);
return holder.itemView;
}
use of com.tmall.wireless.tangram3.core.adapter.BinderViewHolder in project Tangram-Android by alibaba.
the class BannerView method getHeaderViewFromRecycler.
private View getHeaderViewFromRecycler(@NonNull BaseCell cell) {
GroupBasicAdapter adapter = cell.serviceManager.getService(GroupBasicAdapter.class);
RecyclerView.RecycledViewPool pool = cell.serviceManager.getService(RecyclerView.RecycledViewPool.class);
int itemViewType = adapter.getItemType(cell);
BinderViewHolder holder = (BinderViewHolder) pool.getRecycledView(itemViewType);
if (holder == null) {
holder = (BinderViewHolder) adapter.createViewHolder(this, itemViewType);
}
holder.bind(cell);
mHeaderViewHolders.add(holder);
return holder.itemView;
}
Aggregations