StickyGridHeaders, but its not working as it should, or at least as I want.
So I got this list with other lists inside, and with that i create a header list(I use the original list) and a full items list (all the subitems), and the call the adapter like so:
List<CalendarDate.CalendarTvShowEpisode> lista=new LinkedList<CalendarDate.CalendarTvShowEpisode>();
for(CalendarDate l:response){
lista.addAll(l.episodes);
}
setListAdapter(new WeekCalendarAdapter(getActivity(), weekCalendar,lista));
Then i have my Adapter:
public class WeekCalendarAdapter extends BaseAdapter implements StickyGridHeadersBaseAdapter {
private final List<CalendarDate> mListHeaders;
private final List<CalendarDate.CalendarTvShowEpisode> lista;
private LayoutInflater inflater;
public WeekCalendarAdapter(Context context, List<CalendarDate> mList, List<CalendarDate.CalendarTvShowEpisode> lista) {
this.mListHeaders = mList;
this.lista=lista;
inflater = LayoutInflater.from(context);
}
@Override
public int getCount() {
return lista.size();
}
@Override
public Object getItem(int i) {
return lista.get(i);
}
@Override
public long getItemId(int i) {
return lista.get(i).episode.firstAired.getDay();
}
@Override
public View getView(int position, View convertView, ViewGroup parent) {
if (convertView == null) {
convertView = inflater.inflate(R.layout.calendarweek_item_episode, parent, false);
}
AQuery aq= new AQuery(convertView);
aq.id(R.id.imageViewCalendarEpisodeBackdrop).image(lista.get(position).episode.images.screen);
aq.id(R.id.textViewCalendartext).text(lista.get(position).episode.firstAired.getDay()+"");
return convertView;
}
@Override
public int getCountForHeader(int header) {
return mListHeaders.get(header).episodes.size();
}
@Override
public int getNumHeaders() {
return mListHeaders.size();
}
@Override
public View getHeaderView(int position, View convertView, ViewGroup parent) {
if (convertView == null) {
convertView = inflater.inflate(R.layout.calendarweek_item, parent, false);
}
AQuery aq = new AQuery(convertView);
SimpleDateFormat format = new SimpleDateFormat("E MM dd, yyyy");
aq.id(R.id.textViewCalendarWeekDay).text(format.format(mListHeaders.get(position).date) + "");
return convertView;
}
The result I get is just a normal listview with all items ordered on below another, no gridview nor header. What I'm a doing wrong?