Skip to content

Instantly share code, notes, and snippets.

@quanturium
Last active December 17, 2015 01:39
Show Gist options
  • Save quanturium/5529738 to your computer and use it in GitHub Desktop.
Save quanturium/5529738 to your computer and use it in GitHub Desktop.

Revisions

  1. quanturium revised this gist Dec 29, 2013. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion sectionsWithDates.java
    Original file line number Diff line number Diff line change
    @@ -11,7 +11,7 @@ protected SortedMap<Integer, Object> initializeSections(Cursor c)

    if (!sections.containsValue(eventDate))
    {
    sections.put(offset + i, value);
    sections.put(offset + i, eventDate);
    offset++;
    }
    i++;
  2. quanturium renamed this gist May 7, 2013. 1 changed file with 0 additions and 0 deletions.
    File renamed without changes.
  3. quanturium created this gist May 7, 2013.
    21 changes: 21 additions & 0 deletions sectionsWithDates
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,21 @@
    @Override
    protected SortedMap<Integer, Object> initializeSections(Cursor c)
    {
    TreeMap<Integer, Object> sections = new TreeMap<Integer, Object>();
    int offset = 0, i = 0;  

    while (c.moveToNext())
    {
    SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
    String eventDate = sdf.format(new Date((long) c.getInt(c.getColumnIndex(EventsDatabase.COL_FROM_DATE)) * 1000));

    if (!sections.containsValue(eventDate))
    {
    sections.put(offset + i, value);
    offset++;
    }
    i++;
    }

    return sections;
    }