Java Code Examples for com.zhy.adapter.recyclerview.base.ViewHolder#createViewHolder()

The following examples show how to use com.zhy.adapter.recyclerview.base.ViewHolder#createViewHolder() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: EmptyWrapper.java    From likequanmintv with Apache License 2.0 6 votes vote down vote up
@Override
public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType)
{
    if (isEmpty())
    {
        ViewHolder holder;
        if (mEmptyView != null)
        {
            holder = ViewHolder.createViewHolder(parent.getContext(), mEmptyView);
        } else
        {
            holder = ViewHolder.createViewHolder(parent.getContext(), parent, mEmptyLayoutId);
        }
        return holder;
    }
    return mInnerAdapter.onCreateViewHolder(parent, viewType);
}
 
Example 2
Source File: LoadMoreWrapper.java    From likequanmintv with Apache License 2.0 6 votes vote down vote up
@Override
public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType)
{
    if (viewType == ITEM_TYPE_LOAD_MORE)
    {
        ViewHolder holder;
        if (mLoadMoreView != null)
        {
            holder = ViewHolder.createViewHolder(parent.getContext(), mLoadMoreView);
        } else
        {
            holder = ViewHolder.createViewHolder(parent.getContext(), parent, mLoadMoreLayoutId);
        }
        return holder;
    }
    return mInnerAdapter.onCreateViewHolder(parent, viewType);
}
 
Example 3
Source File: LoadMoreCommonAdapter.java    From likequanmintv with Apache License 2.0 6 votes vote down vote up
@Override
    public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType)
    {
//        Log.d("LoadMoreCommonAdapter","onCreateViewHolder");
        if (viewType == ITEM_TYPE_LOAD_MORE)
        {
            ViewHolder holder;
            if (mLoadMoreView != null)
            {
                holder = ViewHolder.createViewHolder(parent.getContext(), mLoadMoreView);
            } else
            {
                holder = ViewHolder.createViewHolder(parent.getContext(), parent, mLoadMoreLayoutId);
            }
            return holder;
        }
        return super.onCreateViewHolder(parent, viewType);
    }
 
Example 4
Source File: EmptyWrapper.java    From baseAdapter with Apache License 2.0 6 votes vote down vote up
@Override
public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType)
{
    if (isEmpty())
    {
        ViewHolder holder;
        if (mEmptyView != null)
        {
            holder = ViewHolder.createViewHolder(parent.getContext(), mEmptyView);
        } else
        {
            holder = ViewHolder.createViewHolder(parent.getContext(), parent, mEmptyLayoutId);
        }
        return holder;
    }
    return mInnerAdapter.onCreateViewHolder(parent, viewType);
}
 
Example 5
Source File: LoadmoreWrapper.java    From baseAdapter with Apache License 2.0 6 votes vote down vote up
@Override
public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType)
{
    if (viewType == ITEM_TYPE_LOAD_MORE)
    {
        ViewHolder holder;
        if (mLoadMoreView != null)
        {
            holder = ViewHolder.createViewHolder(parent.getContext(), mLoadMoreView);
        } else
        {
            holder = ViewHolder.createViewHolder(parent.getContext(), parent, mLoadMoreLayoutId);
        }
        return holder;
    }
    return mInnerAdapter.onCreateViewHolder(parent, viewType);
}
 
Example 6
Source File: MultiItemTypeAdapter.java    From likequanmintv with Apache License 2.0 5 votes vote down vote up
@Override
public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
    ItemViewDelegate itemViewDelegate = mItemViewDelegateManager.getItemViewDelegate(viewType);
    int layoutId = itemViewDelegate.getItemViewLayoutId();
    ViewHolder holder = ViewHolder.createViewHolder(mContext, parent, layoutId);
    onViewHolderCreated(holder,holder.getConvertView());
    setListener(parent, holder, viewType);
    return holder;
}
 
Example 7
Source File: MultiItemTypeAdapter.java    From baseAdapter with Apache License 2.0 5 votes vote down vote up
@Override
public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
    ItemViewDelegate itemViewDelegate = mItemViewDelegateManager.getItemViewDelegate(viewType);
    int layoutId = itemViewDelegate.getItemViewLayoutId();
    ViewHolder holder = ViewHolder.createViewHolder(mContext, parent, layoutId);
    onViewHolderCreated(holder,holder.getConvertView());
    setListener(parent, holder, viewType);
    return holder;
}