From 877e5e84460afa8da001ffaf68cba53cce48711e Mon Sep 17 00:00:00 2001 From: PavelRatushny Date: Tue, 19 Sep 2017 19:00:43 +0300 Subject: [PATCH] Refactor groups adapter --- .../adapters/MapMarkersGroupsAdapter.java | 123 +++++++++--------- 1 file changed, 58 insertions(+), 65 deletions(-) diff --git a/OsmAnd/src/net/osmand/plus/mapmarkers/adapters/MapMarkersGroupsAdapter.java b/OsmAnd/src/net/osmand/plus/mapmarkers/adapters/MapMarkersGroupsAdapter.java index df26d5d1ac..33dc6abfa8 100644 --- a/OsmAnd/src/net/osmand/plus/mapmarkers/adapters/MapMarkersGroupsAdapter.java +++ b/OsmAnd/src/net/osmand/plus/mapmarkers/adapters/MapMarkersGroupsAdapter.java @@ -70,7 +70,7 @@ public class MapMarkersGroupsAdapter extends RecyclerView.Adapter groupMarkers = group.getMapMarkers(); + List groupMarkers = group.getActiveMarkers(); for (int j = 0; j < groupMarkers.size(); j++) { MapMarker marker = groupMarkers.get(j); markerCalendar.setTimeInMillis(marker.creationDate); @@ -106,14 +106,13 @@ public class MapMarkersGroupsAdapter extends RecyclerView.Adapter 0) { ShowHideHistoryButton showHideHistoryButton = new ShowHideHistoryButton(); showHideHistoryButton.setShowHistory(false); @@ -142,7 +141,7 @@ public class MapMarkersGroupsAdapter extends RecyclerView.Adapter markers = group.getMapMarkers(); + List markers = group.getActiveMarkers(); int index = -1; for (MapMarker marker : markers) { int markerIndex = items.indexOf(marker); @@ -442,7 +435,7 @@ public class MapMarkersGroupsAdapter extends RecyclerView.Adapter mapMarkers = new ArrayList<>(); + private List activeMarkers = new ArrayList<>(); private List historyMarkers = new ArrayList<>(); private long creationDate; private ShowHideHistoryButton showHideHistoryButton; @@ -451,6 +444,10 @@ public class MapMarkersGroupsAdapter extends RecyclerView.Adapter getActiveMarkers() { + return activeMarkers; } - public List getMapMarkers() { - return mapMarkers; - } - - public void setMapMarkers(List mapMarkers) { - this.mapMarkers = mapMarkers; + public void setActiveMarkers(List activeMarkers) { + this.activeMarkers = activeMarkers; } public List getHistoryMarkers() { @@ -526,17 +519,17 @@ public class MapMarkersGroupsAdapter extends RecyclerView.Adapter