@Test public void getItemTypeForTag_h5() { assertEquals(ArticleAdapter.TYPE_HEADER_5, adapter.getItemTypeForTag("h5")); }
@VisibleForTesting int getItemTypeForTag(String tag) { switch(tag) { case "p": return TYPE_PARAGRAPH; case "h1": return TYPE_HEADER_1; case "h2": return TYPE_HEADER_2; case "h3": return TYPE_HEADER_3; case "h4": return TYPE_HEADER_4; case "h5": return TYPE_HEADER_5; case "h6": return TYPE_HEADER_6; case "img": return TYPE_INLINE_IMAGE; case "blockquote": return TYPE_BLOCKQUOTE; case "pre": return TYPE_PRE; case "ul.li": return TYPE_UNORDERED_LIST_ITEM; case "ol.li": return TYPE_ORDERED_LIST_ITEM; default: return TYPE_OTHER; } }
ArticleAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> { @VisibleForTesting int getItemTypeForTag(String tag) { switch(tag) { case "p": return TYPE_PARAGRAPH; case "h1": return TYPE_HEADER_1; case "h2": return TYPE_HEADER_2; case "h3": return TYPE_HEADER_3; case "h4": return TYPE_HEADER_4; case "h5": return TYPE_HEADER_5; case "h6": return TYPE_HEADER_6; case "img": return TYPE_INLINE_IMAGE; case "blockquote": return TYPE_BLOCKQUOTE; case "pre": return TYPE_PRE; case "ul.li": return TYPE_UNORDERED_LIST_ITEM; case "ol.li": return TYPE_ORDERED_LIST_ITEM; default: return TYPE_OTHER; } } }
ArticleAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> { @VisibleForTesting int getItemTypeForTag(String tag) { switch(tag) { case "p": return TYPE_PARAGRAPH; case "h1": return TYPE_HEADER_1; case "h2": return TYPE_HEADER_2; case "h3": return TYPE_HEADER_3; case "h4": return TYPE_HEADER_4; case "h5": return TYPE_HEADER_5; case "h6": return TYPE_HEADER_6; case "img": return TYPE_INLINE_IMAGE; case "blockquote": return TYPE_BLOCKQUOTE; case "pre": return TYPE_PRE; case "ul.li": return TYPE_UNORDERED_LIST_ITEM; case "ol.li": return TYPE_ORDERED_LIST_ITEM; default: return TYPE_OTHER; } } ArticleAdapter(Article article, int accentColor, int textSize, int theme); }
ArticleAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> { @VisibleForTesting int getItemTypeForTag(String tag) { switch(tag) { case "p": return TYPE_PARAGRAPH; case "h1": return TYPE_HEADER_1; case "h2": return TYPE_HEADER_2; case "h3": return TYPE_HEADER_3; case "h4": return TYPE_HEADER_4; case "h5": return TYPE_HEADER_5; case "h6": return TYPE_HEADER_6; case "img": return TYPE_INLINE_IMAGE; case "blockquote": return TYPE_BLOCKQUOTE; case "pre": return TYPE_PRE; case "ul.li": return TYPE_UNORDERED_LIST_ITEM; case "ol.li": return TYPE_ORDERED_LIST_ITEM; default: return TYPE_OTHER; } } ArticleAdapter(Article article, int accentColor, int textSize, int theme); @Override RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType); @Override void onBindViewHolder(RecyclerView.ViewHolder holder, int position); @Override int getItemViewType(int position); @Override int getItemCount(); @Override void onAttachedToRecyclerView(RecyclerView recyclerView); }
ArticleAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> { @VisibleForTesting int getItemTypeForTag(String tag) { switch(tag) { case "p": return TYPE_PARAGRAPH; case "h1": return TYPE_HEADER_1; case "h2": return TYPE_HEADER_2; case "h3": return TYPE_HEADER_3; case "h4": return TYPE_HEADER_4; case "h5": return TYPE_HEADER_5; case "h6": return TYPE_HEADER_6; case "img": return TYPE_INLINE_IMAGE; case "blockquote": return TYPE_BLOCKQUOTE; case "pre": return TYPE_PRE; case "ul.li": return TYPE_UNORDERED_LIST_ITEM; case "ol.li": return TYPE_ORDERED_LIST_ITEM; default: return TYPE_OTHER; } } ArticleAdapter(Article article, int accentColor, int textSize, int theme); @Override RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType); @Override void onBindViewHolder(RecyclerView.ViewHolder holder, int position); @Override int getItemViewType(int position); @Override int getItemCount(); @Override void onAttachedToRecyclerView(RecyclerView recyclerView);  }