TonicArtos / StickyGridHeaders

This project has been superseded by SuperSLiM, a layout manager for RecyclerView. I strongly recommend using SuperSLiM and not StickyGridHeaders.
http://tonicartos.com
Apache License 2.0
1.47k stars 441 forks source link

Implement a Filter #106

Closed ghost closed 6 years ago

ghost commented 10 years ago

Hi,

How would I go to implement a Filter in my StickyGridHeader, as I have both views and headerviews? Any sample code would be appreciated,

Thanks!

crafter commented 9 years ago
@Override
public long getHeaderId(int i) {
    return set_headerId(i);
}

You need to return different header id for your each header I'm trying to do date filter for headers i hope this helps.

 public int set_headerId(int position){

    int Id = 0;
    int year = Integer.parseInt(arrayListForAdapterSpending.get(position).getDate().substring(0,4));

    Log.d("Date"," = " + arrayListForAdapterSpending.get(position).getDate());
    Log.d("Year"," = " + arrayListForAdapterSpending.get(position).getDate().substring(0,4));
    Log.d("Month"," = " + arrayListForAdapterSpending.get(position).getDate().substring(5,6));

    Id = year + getHighNumberMonth(position);

    Log.d("Last","Id = " + Id);

    return Id;
}