Fix headers

This commit is contained in:
PavelRatushny 2017-09-08 11:35:29 +03:00
parent 8016888f34
commit bbc7ff9ea0

View file

@ -90,12 +90,15 @@ public class MapMarkersHistoryAdapter extends RecyclerView.Adapter<RecyclerView.
previousHeader = LAST_SEVEN_DAYS_HEADER; previousHeader = LAST_SEVEN_DAYS_HEADER;
} }
items.add(marker); items.add(marker);
} else { } else if (monthsDisplayed < 3) {
if (previousHeader != markerMonth && monthsDisplayed < 3) { if (previousHeader != markerMonth) {
items.add(markerMonth); items.add(markerMonth);
previousHeader = markerMonth; previousHeader = markerMonth;
monthsDisplayed += 1; monthsDisplayed += 1;
} else if (previousHeader != markerMonth && previousHeader != THIS_YEAR_HEADER) { }
items.add(marker);
} else {
if (previousHeader != THIS_YEAR_HEADER) {
items.add(THIS_YEAR_HEADER); items.add(THIS_YEAR_HEADER);
previousHeader = THIS_YEAR_HEADER; previousHeader = THIS_YEAR_HEADER;
} }