public static ViewHolder create(ViewGroup viewHolder, int type) { switch (type) { case VIEW_HOLDER_HEADER: return ViewHolderHeader.create(viewHolder); case VIEW_HOLDER_LABEL: return ViewHolderLabel.create(viewHolder); case VIEW_HOLDER_LOGIN: return ViewHolderLogin.create(viewHolder); case VIEW_HOLDER_DOWNLOAD: return ViewHolderChoice.create(viewHolder); default: return null; } }
@Override public void onBindViewHolder(ViewHolder holder, int position) { if (holder instanceof ViewHolderHeader) { ((ViewHolderHeader) holder).setTitle(titleIndexs.get(position)); } }
@Override protected void onBindHeaderViewHolder(RecyclerView.ViewHolder holder, int position) { HeaderObject headerObject = getHeader(); ViewHolderHeader holderHeader = (ViewHolderHeader) holder; holderHeader.render(headerObject); }