diff --git a/OsmAnd/src/net/osmand/plus/mapmarkers/adapters/MapMarkersHistoryAdapter.java b/OsmAnd/src/net/osmand/plus/mapmarkers/adapters/MapMarkersHistoryAdapter.java index 4eb319e47b..0ec789cef0 100644 --- a/OsmAnd/src/net/osmand/plus/mapmarkers/adapters/MapMarkersHistoryAdapter.java +++ b/OsmAnd/src/net/osmand/plus/mapmarkers/adapters/MapMarkersHistoryAdapter.java @@ -57,45 +57,28 @@ public class MapMarkersHistoryAdapter extends RecyclerView.Adapter= 2 && currentDay - markerDay <= 8 && previousHeader != LAST_SEVEN_DAYS_HEADER) { + items.add(LAST_SEVEN_DAYS_HEADER); + previousHeader = LAST_SEVEN_DAYS_HEADER; + } else if (currentDay - markerDay > 8 && monthsDisplayed < 3 && previousHeader != markerMonth) { + items.add(markerMonth); + previousHeader = markerMonth; + monthsDisplayed += 1; + } else if (currentMonth - markerMonth >= 4 && previousHeader != THIS_YEAR_HEADER) { + items.add(THIS_YEAR_HEADER); + previousHeader = THIS_YEAR_HEADER; } - } else { - if (previousHeader != markerYear) { - items.add(markerYear); - previousHeader = markerYear; - } - items.add(marker); + } else if (previousHeader != markerYear) { + items.add(markerYear); + previousHeader = markerYear; } + items.add(marker); } }