@@ -0,0 +1,2059 @@
+package com.mokelab.libs.recyclerview;%0A%0Aimport android.support.v7.widget.RecyclerView;%0A%0A/**%0A * Adapter that supports sectioning feature%0A */%0Apublic abstract class SectionedAdapter extends RecyclerView.Adapter%3CBaseViewHolder%3E %7B%0A    @Override%0A    public void onBindViewHolder(BaseViewHolder holder, int position) %7B%0A        int sectionCount = getSectionCount();%0A        for (int section = 0 ; section %3C sectionCount ; ++section) %7B%0A            if (position == 0) %7B%0A                onBindSectionHeaderViewHolder(holder, section);%0A                return;%0A            %7D%0A            --position;%0A            int itemCount = getItemCount(section);%0A            if (position %3C itemCount) %7B%0A                onBindViewHolder(holder, section, position);%0A                return;%0A            %7D%0A            position -= itemCount;%0A        %7D%0A    %7D%0A%0A    @Override%0A    public int getItemCount() %7B%0A        int count = 0;%0A        int numSection = getSectionCount();%0A        for (int i = 0 ; i %3C numSection ; ++i) %7B%0A            count += (1 + getItemCount(i));%0A        %7D%0A        return count;%0A    %7D%0A%0A    @Override%0A    public int getItemViewType(int position) %7B%0A        int sectionCount = getSectionCount();%0A        for (int section = 0 ; section %3C sectionCount ; ++section) %7B%0A            if (position == 0) %7B%0A                return getSectionHeaderViewType(section);%0A            %7D%0A            --position;%0A            int itemCount = getItemCount(section);%0A            if (position %3C itemCount) %7B%0A                return getItemViewType(section, position);%0A            %7D%0A            position -= itemCount;%0A        %7D%0A        return 0;%0A    %7D%0A%0A    public abstract int getSectionCount();%0A%0A    public abstract int getItemCount(int section);%0A%0A    protected abstract int getSectionHeaderViewType(int section);%0A%0A    protected abstract int getItemViewType(int section, int positionInSection);%0A%0A    protected abstract void onBindSectionHeaderViewHolder(BaseViewHolder holder, int section);%0A%0A    protected abstract void onBindViewHolder(BaseViewHolder holder, int section, int positionInSection);%0A%7D%0A

Implement sectioned adapter