Search in sources :

Example 1 with InnerRecycledViewPool

use of com.alibaba.android.vlayout.extend.InnerRecycledViewPool 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());
    }
}
Also used : InternalErrorSupport(com.tmall.wireless.tangram.support.InternalErrorSupport) InnerRecycledViewPool(com.alibaba.android.vlayout.extend.InnerRecycledViewPool) RecyclerView(android.support.v7.widget.RecyclerView) ChildDrawingOrderCallback(android.support.v7.widget.RecyclerView.ChildDrawingOrderCallback)

Example 2 with InnerRecycledViewPool

use of com.alibaba.android.vlayout.extend.InnerRecycledViewPool 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());
    }
}
Also used : InternalErrorSupport(com.tmall.wireless.tangram3.support.InternalErrorSupport) InnerRecycledViewPool(com.alibaba.android.vlayout.extend.InnerRecycledViewPool) RecyclerView(android.support.v7.widget.RecyclerView) ChildDrawingOrderCallback(android.support.v7.widget.RecyclerView.ChildDrawingOrderCallback)

Aggregations

RecyclerView (android.support.v7.widget.RecyclerView)2 ChildDrawingOrderCallback (android.support.v7.widget.RecyclerView.ChildDrawingOrderCallback)2 InnerRecycledViewPool (com.alibaba.android.vlayout.extend.InnerRecycledViewPool)2 InternalErrorSupport (com.tmall.wireless.tangram.support.InternalErrorSupport)1 InternalErrorSupport (com.tmall.wireless.tangram3.support.InternalErrorSupport)1