From a43792464b061659574539d051a757367c6ca392 Mon Sep 17 00:00:00 2001 From: Alexander Sytnyk Date: Sat, 17 Mar 2018 12:55:04 +0200 Subject: [PATCH] Remove unused code from MapMarkersHelper; add small refactoring --- .../src/net/osmand/plus/MapMarkersHelper.java | 57 +++---------------- 1 file changed, 7 insertions(+), 50 deletions(-) diff --git a/OsmAnd/src/net/osmand/plus/MapMarkersHelper.java b/OsmAnd/src/net/osmand/plus/MapMarkersHelper.java index 4bec2d094e..e9640efcfa 100644 --- a/OsmAnd/src/net/osmand/plus/MapMarkersHelper.java +++ b/OsmAnd/src/net/osmand/plus/MapMarkersHelper.java @@ -97,8 +97,7 @@ public class MapMarkersHelper { public FavouritePoint favouritePoint; public String mapObjectName; - public MapMarker(LatLon point, PointDescription name, int colorIndex, - boolean selected, int index) { + public MapMarker(LatLon point, PointDescription name, int colorIndex, boolean selected, int index) { this.point = point; this.pointDescription = name; this.colorIndex = colorIndex; @@ -107,8 +106,7 @@ public class MapMarkersHelper { } public PointDescription getPointDescription(Context ctx) { - return new PointDescription(POINT_TYPE_MAP_MARKER, ctx.getString(R.string.map_marker), - getOnlyName()); + return new PointDescription(POINT_TYPE_MAP_MARKER, ctx.getString(R.string.map_marker), getOnlyName()); } public String getName(Context ctx) { @@ -159,9 +157,7 @@ public class MapMarkersHelper { MapMarker mapMarker = (MapMarker) o; - if (colorIndex != mapMarker.colorIndex) return false; - return point.equals(mapMarker.point); - + return colorIndex == mapMarker.colorIndex && point.equals(mapMarker.point); } @Override @@ -241,10 +237,6 @@ public class MapMarkersHelper { return type; } - public Set getWptCategories() { - return wptCategories; - } - public String getWptCategoriesString() { if (wptCategories != null) { return Algorithms.encodeStringSet(wptCategories); @@ -479,10 +471,6 @@ public class MapMarkersHelper { syncGroupAsync(group, true, null); } - public void syncGroupAsync(@NonNull MarkersSyncGroup group, boolean enabled) { - syncGroupAsync(group, enabled, null); - } - public void syncGroupAsync(@NonNull MarkersSyncGroup group, @Nullable OnGroupSyncedListener groupSyncedListener) { syncGroupAsync(group, true, groupSyncedListener); } @@ -841,7 +829,7 @@ public class MapMarkersHelper { reorderActiveMarkersIfNeeded(); } - public List getActiveMarkersLatLon() { + private List getActiveMarkersLatLon() { List list = new ArrayList<>(); for (MapMarker m : this.mapMarkers) { list.add(m.point); @@ -859,7 +847,7 @@ public class MapMarkersHelper { return list; } - public List getMarkersHistoryLatLon() { + private List getMarkersHistoryLatLon() { List list = new ArrayList<>(); for (MapMarker m : this.mapMarkersHistory) { list.add(m.point); @@ -889,14 +877,6 @@ public class MapMarkersHelper { refresh(); } - public void removeMarkersHistory() { - cancelAddressRequests(); - markersDbHelper.clearAllMarkersHistory(); - mapMarkersHistory = new ArrayList<>(); - refresh(); - removeHistoryMarkersFromGroups(); - } - public void addMarkersSyncGroup(MarkersSyncGroup group) { if (group != null) { if (markersDbHelper.getGroup(group.getId()) == null) { @@ -918,7 +898,7 @@ public class MapMarkersHelper { } } - public void removeDisabledGroups() { + private void removeDisabledGroups() { markersDbHelper.removeDisabledGroups(); } @@ -952,7 +932,7 @@ public class MapMarkersHelper { refresh(); } - public void removeActiveMarkersFromSyncGroup(String syncGroupId) { + private void removeActiveMarkersFromSyncGroup(String syncGroupId) { if (syncGroupId != null) { markersDbHelper.removeActiveMarkersFromSyncGroup(syncGroupId); List copyList = new ArrayList<>(mapMarkers); @@ -1151,19 +1131,6 @@ public class MapMarkersHelper { return fout.getAbsolutePath(); } - private void removeHistoryMarkersFromGroups() { - for (MapMarkersGroup markersGroup : mapMarkersGroups) { - List activeMarkers = new ArrayList<>(); - for (MapMarker marker : markersGroup.getMarkers()) { - if (!marker.history) { - activeMarkers.add(marker); - } - } - markersGroup.setMarkers(activeMarkers); - updateGroup(markersGroup); - } - } - private void removeActiveMarkersFromGroup(String groupId) { MapMarkersGroup group = getMapMarkerGroupByKey(groupId); if (group != null) { @@ -1199,7 +1166,6 @@ public class MapMarkersHelper { } else if (historyMarkersCount > 0) { showHideHistoryButton = new ShowHideHistoryButton(); showHideHistoryButton.setShowHistory(false); - showHideHistoryButton.setMarkerGroup(mapMarkersGroup); mapMarkersGroup.setShowHideHistoryButton(showHideHistoryButton); } } @@ -1493,7 +1459,6 @@ public class MapMarkersHelper { public static class ShowHideHistoryButton { private boolean showHistory; - private MapMarkersGroup group; public boolean isShowHistory() { return showHistory; @@ -1502,14 +1467,6 @@ public class MapMarkersHelper { public void setShowHistory(boolean showHistory) { this.showHistory = showHistory; } - - public MapMarkersGroup getMapMarkerGroup() { - return group; - } - - public void setMarkerGroup(MapMarkersGroup group) { - this.group = group; - } } public static class GroupHeader {