@@ -0,0 +1,2022 @@
+package com.bustiblelemons.cthulhator.adapters;%0A%0Aimport android.content.Context;%0Aimport android.view.View;%0Aimport android.view.ViewGroup;%0A%0Aimport com.bustiblelemons.adapters.AbsListAdapter;%0Aimport com.bustiblelemons.cthulhator.R;%0Aimport com.bustiblelemons.holders.impl.ViewHolder;%0A%0Aimport java.util.ArrayList;%0Aimport java.util.Collection;%0Aimport java.util.List;%0A%0Aimport se.emilsjolander.stickylistheaders.StickyListHeadersAdapter;%0A%0A/**%0A * Created by bhm on 29.09.14.%0A */%0Apublic abstract class AbsStickyListAdapter%3CT, H extends ViewHolder%3CT%3E,%0A        S, SH extends ViewHolder%3CS%3E%3E%0A        extends AbsListAdapter%3CT, H%3E%0A        implements StickyListHeadersAdapter %7B%0A    private List%3CS%3E mHeaders;%0A%0A    public AbsStickyListAdapter(Context context) %7B%0A        super(context);%0A    %7D%0A%0A    public AbsStickyListAdapter(Context context, List%3CT%3E data) %7B%0A        super(context, data);%0A    %7D%0A%0A    protected abstract SH getHeaderViewHolder(int position);%0A%0A    @Override%0A    public View getHeaderView(int position, View view, ViewGroup viewGroup) %7B%0A        ViewHolder%3CS%3E holder;%0A        if (view == null) %7B%0A            holder = getHeaderViewHolder(position);%0A            view = getInflater().inflate(holder.getLayoutId(position), viewGroup, false);%0A%0A        %7D else %7B%0A            holder = (ViewHolder%3CS%3E) view.getTag(R.id.tag_holder);%0A        %7D%0A        holder.bindValues(getHeaderItem(position), position);%0A        return view;%0A    %7D%0A%0A    private S getHeaderItem(int location) %7B%0A        if (mHeaders != null) %7B%0A            mHeaders.get(location);%0A        %7D%0A        return null;%0A    %7D%0A%0A    @Override%0A    public long getHeaderId(int i) %7B%0A        return i;%0A    %7D%0A%0A    public void addData(S header, Collection%3CT%3E data) %7B%0A        addHeader(header);%0A        addItems(data);%0A    %7D%0A%0A    private void addHeader(S header) %7B%0A        if (mHeaders == null) %7B%0A            mHeaders = new ArrayList%3CS%3E();%0A        %7D%0A        mHeaders.add(header);%0A    %7D%0A%0A    @Override%0A    public void removeAll() %7B%0A        mHeaders.clear();%0A        super.removeAll();%0A    %7D%0A%7D%0A

implement base sticky list adapter