use of com.tmall.wireless.tangram3.core.adapter.GroupBasicAdapter in project Tangram-Android by alibaba.
the class BannerCell method initAdapter.
public void initAdapter() {
if (mBannerAdapter == null) {
if (serviceManager != null) {
GroupBasicAdapter adapter = serviceManager.getService(GroupBasicAdapter.class);
RecyclerView.RecycledViewPool pool = serviceManager.getService(RecyclerView.RecycledViewPool.class);
mBannerAdapter = new BannerAdapter(adapter, pool);
}
}
if (mBannerWrapper == null) {
mBannerWrapper = new UltraViewPagerAdapter(mBannerAdapter);
}
}
use of com.tmall.wireless.tangram3.core.adapter.GroupBasicAdapter in project Tangram-Android by alibaba.
the class BaseTangramEngine method bindView.
/**
* Bind a recyclerView to Tangram. After calling this, {@link GroupBasicAdapter}, {@link VirtualLayoutManager} are auto binded.
*
* @param view A plain recyclerView with no adapter or layoutManager binded.
*/
public void bindView(@NonNull final RecyclerView view) {
// noinspection ConstantConditions
Preconditions.checkArgument(view != null, "view must not be null");
if (mContentView != null) {
mContentView.setAdapter(null);
mContentView.setLayoutManager(null);
}
this.mContentView = view;
this.mContentView.setLayoutManager(mLayoutManager);
mLayoutManager.setPerformanceMonitor(mPerformanceMonitor);
if (mGroupBasicAdapter == null) {
this.mGroupBasicAdapter = mAdapterBuilder.newAdapter(mContext, mLayoutManager, this);
mGroupBasicAdapter.setPerformanceMonitor(mPerformanceMonitor);
mGroupBasicAdapter.setErrorSupport(getService(InternalErrorSupport.class));
}
if (mContentView.getRecycledViewPool() != null) {
mContentView.setRecycledViewPool(new InnerRecycledViewPool(mContentView.getRecycledViewPool()));
}
register(GroupBasicAdapter.class, mGroupBasicAdapter);
register(RecyclerView.RecycledViewPool.class, mContentView.getRecycledViewPool());
this.mContentView.setAdapter(mGroupBasicAdapter);
if (VERSION.SDK_INT < 21) {
this.mContentView.setChildDrawingOrderCallback(new DrawingOrderCallback());
}
}
use of com.tmall.wireless.tangram3.core.adapter.GroupBasicAdapter 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.GroupBasicAdapter 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;
}
use of com.tmall.wireless.tangram3.core.adapter.GroupBasicAdapter in project Tangram-Android by alibaba.
the class BannerView method getFooterViewFromRecycler.
private View getFooterViewFromRecycler(@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);
mFooterViewHolders.add(holder);
return holder.itemView;
}
Aggregations