diff --git a/OsmAnd-java/src/main/java/net/osmand/binary/BinaryMapIndexReader.java b/OsmAnd-java/src/main/java/net/osmand/binary/BinaryMapIndexReader.java index f9015ec48d..5e45a893ba 100644 --- a/OsmAnd-java/src/main/java/net/osmand/binary/BinaryMapIndexReader.java +++ b/OsmAnd-java/src/main/java/net/osmand/binary/BinaryMapIndexReader.java @@ -2501,8 +2501,9 @@ public class BinaryMapIndexReader { } } } - for (MapObject e : resMap.keySet()) { - Street s = resMap.get(e); + for (Entry entry : resMap.entrySet()) { + MapObject e = entry.getKey(); + Street s = entry.getValue(); if (e instanceof Building && MapUtils.getDistance(e.getLocation(), lat, lon) < 40) { Building b = (Building) e; System.out.println(b.getName() + " " + s); diff --git a/OsmAnd-java/src/main/java/net/osmand/map/TileSourceManager.java b/OsmAnd-java/src/main/java/net/osmand/map/TileSourceManager.java index 0bdcda71c9..d9924dc9c6 100644 --- a/OsmAnd-java/src/main/java/net/osmand/map/TileSourceManager.java +++ b/OsmAnd-java/src/main/java/net/osmand/map/TileSourceManager.java @@ -518,8 +518,8 @@ public class TileSourceManager { } if (override || !metainfo.exists()) { BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(metainfo))); - for (String key : properties.keySet()) { - writer.write("[" + key + "]\n" + properties.get(key) + "\n"); + for (Map.Entry entry : properties.entrySet()) { + writer.write("[" + entry.getKey() + "]\n" + entry.getValue() + "\n"); } writer.close(); } diff --git a/OsmAnd-java/src/main/java/net/osmand/osm/MapRenderingTypes.java b/OsmAnd-java/src/main/java/net/osmand/osm/MapRenderingTypes.java index d996678e44..bcbcbfc2b0 100644 --- a/OsmAnd-java/src/main/java/net/osmand/osm/MapRenderingTypes.java +++ b/OsmAnd-java/src/main/java/net/osmand/osm/MapRenderingTypes.java @@ -96,8 +96,9 @@ public abstract class MapRenderingTypes { Map common = new HashMap(); String ATTACHED_KEY = "seamark:attached"; String type = ""; - for (String s : tags.keySet()) { - String value = tags.get(s); + for (Entry entry : tags.entrySet()) { + String s = entry.getKey(); + String value = entry.getValue(); if (s.equals("seamark:type")) { type = value; common.put(ATTACHED_KEY, openSeaType(value)); diff --git a/OsmAnd-java/src/main/java/net/osmand/osm/edit/EntityParser.java b/OsmAnd-java/src/main/java/net/osmand/osm/edit/EntityParser.java index 8c3aef8163..9caa54b55c 100644 --- a/OsmAnd-java/src/main/java/net/osmand/osm/edit/EntityParser.java +++ b/OsmAnd-java/src/main/java/net/osmand/osm/edit/EntityParser.java @@ -33,9 +33,10 @@ public class EntityParser { if (mo.getEnName(false).length() == 0) { mo.setEnName(tags.get(OSMTagKey.NAME_EN.getValue())); } - for (String ts : tags.keySet()) { + for (Map.Entry entry : tags.entrySet()) { + String ts = entry.getKey(); if (ts.startsWith("name:") && !ts.equals(OSMTagKey.NAME_EN.getValue())) { - mo.setName(ts.substring(("name:").length()), tags.get(ts)); + mo.setName(ts.substring(("name:").length()), entry.getValue()); } } if (mo.getName().length() == 0) { diff --git a/OsmAnd-java/src/main/java/net/osmand/osm/io/NetworkUtils.java b/OsmAnd-java/src/main/java/net/osmand/osm/io/NetworkUtils.java index 28a1ec3fb9..e3d162826c 100644 --- a/OsmAnd-java/src/main/java/net/osmand/osm/io/NetworkUtils.java +++ b/OsmAnd-java/src/main/java/net/osmand/osm/io/NetworkUtils.java @@ -63,8 +63,8 @@ public class NetworkUtils { URL url; try { boolean firstPrm =!urlText.contains("?"); - for (String key : additionalMapData.keySet()) { - urlText += (firstPrm ? "?" : "&") + key + "=" + URLEncoder.encode(additionalMapData.get(key), "UTF-8"); + for (Map.Entry entry : additionalMapData.entrySet()) { + urlText += (firstPrm ? "?" : "&") + entry.getKey() + "=" + URLEncoder.encode(entry.getValue(), "UTF-8"); firstPrm = false; } log.info("Start uploading file to " + urlText + " " +fileToUpload.getName()); diff --git a/OsmAnd-java/src/main/java/net/osmand/render/RenderingRulesStoragePrinter.java b/OsmAnd-java/src/main/java/net/osmand/render/RenderingRulesStoragePrinter.java index 86d0c2cb73..3e36ae4e71 100644 --- a/OsmAnd-java/src/main/java/net/osmand/render/RenderingRulesStoragePrinter.java +++ b/OsmAnd-java/src/main/java/net/osmand/render/RenderingRulesStoragePrinter.java @@ -152,9 +152,9 @@ public class RenderingRulesStoragePrinter { for (int i = 0; i < 15; i++) { out.println("" + indent + ti + "RenderingRule rule" + i + " = null;"); } - for (String s : storage.renderingAttributes.keySet()) { - generateRenderingRule(storage, out, indent + ti, "rule", 0, storage.renderingAttributes.get(s)); - out.println("" + indent + ti + "storage.renderingAttributes.put(" + javaString(s) + ", rule0);"); + for (Entry entry : storage.renderingAttributes.entrySet()) { + generateRenderingRule(storage, out, indent + ti, "rule", 0, entry.getValue()); + out.println("" + indent + ti + "storage.renderingAttributes.put(" + javaString(entry.getKey()) + ", rule0);"); } out.println(""+indent +"}"); } @@ -242,9 +242,9 @@ public class RenderingRulesStoragePrinter { private void printJavaInitConstants(RenderingRulesStorage storage, PrintStream out, String indent, String ti) { out.println("\n" + indent + "public void initConstants() {"); - for (String s : storage.renderingConstants.keySet()) { - out.println("" + indent + ti + "storage.renderingConstants.put(" + javaString(s) + ", " - + javaString(storage.renderingConstants.get(s)) + ");"); + for (Entry entry : storage.renderingConstants.entrySet()) { + out.println("" + indent + ti + "storage.renderingConstants.put(" + javaString(entry.getKey()) + ", " + + javaString(entry.getValue()) + ");"); } out.println(""+indent +"}"); } diff --git a/OsmAnd-java/src/main/java/net/osmand/util/GeoPointParserUtil.java b/OsmAnd-java/src/main/java/net/osmand/util/GeoPointParserUtil.java index 1383f4ae4a..31605c33a2 100644 --- a/OsmAnd-java/src/main/java/net/osmand/util/GeoPointParserUtil.java +++ b/OsmAnd-java/src/main/java/net/osmand/util/GeoPointParserUtil.java @@ -803,10 +803,10 @@ public class GeoPointParserUtil { if (map.size() > 0) uriString += "?"; int i = 0; - for (String key : map.keySet()) { + for (Map.Entry entry : map.entrySet()) { if (i > 0) uriString += "&"; - uriString += key + "=" + map.get(key); + uriString += entry.getKey() + "=" + entry.getValue(); i++; } return uriString; diff --git a/OsmAnd/src/net/osmand/AndroidNetworkUtils.java b/OsmAnd/src/net/osmand/AndroidNetworkUtils.java index d1ca9aa7ab..f8710927ef 100644 --- a/OsmAnd/src/net/osmand/AndroidNetworkUtils.java +++ b/OsmAnd/src/net/osmand/AndroidNetworkUtils.java @@ -305,8 +305,8 @@ public class AndroidNetworkUtils { try { boolean firstPrm = !urlText.contains("?"); StringBuilder sb = new StringBuilder(urlText); - for (String key : additionalParams.keySet()) { - sb.append(firstPrm ? "?" : "&").append(key).append("=").append(URLEncoder.encode(additionalParams.get(key), "UTF-8")); + for (Map.Entry entry : additionalParams.entrySet()) { + sb.append(firstPrm ? "?" : "&").append(entry.getKey()).append("=").append(URLEncoder.encode(entry.getValue(), "UTF-8")); firstPrm = false; } urlText = sb.toString(); diff --git a/OsmAnd/src/net/osmand/plus/AppVersionUpgradeOnInit.java b/OsmAnd/src/net/osmand/plus/AppVersionUpgradeOnInit.java index 9eeec4542b..1a80997ab3 100644 --- a/OsmAnd/src/net/osmand/plus/AppVersionUpgradeOnInit.java +++ b/OsmAnd/src/net/osmand/plus/AppVersionUpgradeOnInit.java @@ -190,14 +190,15 @@ class AppVersionUpgradeOnInit { migrateEnumPreferences(); SharedPreferences globalSharedPreferences = (SharedPreferences) settings.getGlobalPreferences(); Map globalPrefsMap = globalSharedPreferences.getAll(); - for (String key : globalPrefsMap.keySet()) { + for (Map.Entry entry : globalPrefsMap.entrySet()) { + String key = entry.getKey(); OsmandPreference pref = settings.getPreference(key); if (pref instanceof CommonPreference) { CommonPreference commonPreference = (CommonPreference) pref; if (!commonPreference.isGlobal()) { for (ApplicationMode mode : ApplicationMode.allPossibleValues()) { if (!commonPreference.isSetForMode(mode) && !commonPreference.hasDefaultValueForMode(mode)) { - settings.setPreference(key, globalPrefsMap.get(key), mode); + settings.setPreference(key, entry.getValue(), mode); } } } @@ -205,12 +206,13 @@ class AppVersionUpgradeOnInit { } SharedPreferences defaultProfilePreferences = (SharedPreferences) settings.getProfilePreferences(ApplicationMode.DEFAULT); Map defaultPrefsMap = defaultProfilePreferences.getAll(); - for (String key : defaultPrefsMap.keySet()) { + for (Map.Entry entry : defaultPrefsMap.entrySet()) { + String key = entry.getKey(); OsmandPreference pref = settings.getPreference(key); if (pref instanceof CommonPreference) { CommonPreference commonPreference = (CommonPreference) pref; if (commonPreference.isGlobal() && !commonPreference.isSet()) { - settings.setPreference(key, defaultPrefsMap.get(key)); + settings.setPreference(key, entry.getValue()); } } } diff --git a/OsmAnd/src/net/osmand/plus/FavouritesDbHelper.java b/OsmAnd/src/net/osmand/plus/FavouritesDbHelper.java index c1db6114bc..2cd9a6ab4a 100644 --- a/OsmAnd/src/net/osmand/plus/FavouritesDbHelper.java +++ b/OsmAnd/src/net/osmand/plus/FavouritesDbHelper.java @@ -261,10 +261,11 @@ public class FavouritesDbHelper { private boolean merge(Map source, Map destination) { boolean changed = false; - for (String ks : source.keySet()) { + for (Map.Entry entry : source.entrySet()) { + String ks = entry.getKey(); if (!destination.containsKey(ks)) { changed = true; - destination.put(ks, source.get(ks)); + destination.put(ks, entry.getValue()); } } return changed; @@ -712,9 +713,10 @@ public class FavouritesDbHelper { public boolean isGroupVisible(String name) { String nameLowercase = name.toLowerCase(); - for (String groupName : flatGroups.keySet()) { + for (Map.Entry entry : flatGroups.entrySet()) { + String groupName = entry.getKey(); if (groupName.toLowerCase().equals(nameLowercase) || FavoriteGroup.getDisplayName(context, groupName).equals(name)) { - return flatGroups.get(groupName).isVisible(); + return entry.getValue().isVisible(); } } return false; diff --git a/OsmAnd/src/net/osmand/plus/activities/SavingTrackHelper.java b/OsmAnd/src/net/osmand/plus/activities/SavingTrackHelper.java index 5bf6c2b0a1..8b57c68e49 100644 --- a/OsmAnd/src/net/osmand/plus/activities/SavingTrackHelper.java +++ b/OsmAnd/src/net/osmand/plus/activities/SavingTrackHelper.java @@ -208,11 +208,12 @@ public class SavingTrackHelper extends SQLiteOpenHelper { Map data = collectRecordedData(); // save file - for (final String f : data.keySet()) { + for (final Map.Entry entry : data.entrySet()) { + final String f = entry.getKey(); log.debug("Filename: " + f); File fout = new File(dir, f + IndexConstants.GPX_FILE_EXT); - if (!data.get(f).isEmpty()) { - WptPt pt = data.get(f).findPointToShow(); + if (!entry.getValue().isEmpty()) { + WptPt pt = entry.getValue().findPointToShow(); String fileName = f + "_" + new SimpleDateFormat("HH-mm_EEE", Locale.US).format(new Date(pt.time)); //$NON-NLS-1$ Integer trackStorageDirectory = ctx.getSettings().TRACK_STORAGE_DIRECTORY.get(); if (!OsmandSettings.REC_DIRECTORY.equals(trackStorageDirectory)) { @@ -235,13 +236,13 @@ public class SavingTrackHelper extends SQLiteOpenHelper { } } - Exception warn = GPXUtilities.writeGpxFile(fout, data.get(f)); + Exception warn = GPXUtilities.writeGpxFile(fout, entry.getValue()); if (warn != null) { warnings.add(warn.getMessage()); return new SaveGpxResult(warnings, new ArrayList()); } - GPXFile gpx = data.get(f); + GPXFile gpx = entry.getValue(); GPXTrackAnalysis analysis = gpx.getAnalysis(fout.lastModified()); GpxDataItem item = new GpxDataItem(fout, analysis); ctx.getGpxDbHelper().add(item); diff --git a/OsmAnd/src/net/osmand/plus/api/FileSettingsAPIImpl.java b/OsmAnd/src/net/osmand/plus/api/FileSettingsAPIImpl.java index 6a8b8a1b06..ab30a9a102 100644 --- a/OsmAnd/src/net/osmand/plus/api/FileSettingsAPIImpl.java +++ b/OsmAnd/src/net/osmand/plus/api/FileSettingsAPIImpl.java @@ -25,9 +25,9 @@ public class FileSettingsAPIImpl implements SettingsAPI { Properties props = new Properties(); FileInputStream fis = new FileInputStream(file); props.load(fis); - for (Object key : props.keySet()) { - String k = key.toString(); - map.put(k, props.get(key)); + for (Entry entry : props.entrySet()) { + String k = entry.getKey().toString(); + map.put(k, entry.getValue()); } } } diff --git a/OsmAnd/src/net/osmand/plus/mapmarkers/SelectWptCategoriesBottomSheetDialogFragment.java b/OsmAnd/src/net/osmand/plus/mapmarkers/SelectWptCategoriesBottomSheetDialogFragment.java index d676372223..0c887488b7 100644 --- a/OsmAnd/src/net/osmand/plus/mapmarkers/SelectWptCategoriesBottomSheetDialogFragment.java +++ b/OsmAnd/src/net/osmand/plus/mapmarkers/SelectWptCategoriesBottomSheetDialogFragment.java @@ -81,7 +81,8 @@ public class SelectWptCategoriesBottomSheetDialogFragment extends MenuBottomShee Map> pointsByCategories = gpxFile.getPointsByCategories(); - for (String category : pointsByCategories.keySet()) { + for (Map.Entry> entry : pointsByCategories.entrySet()) { + String category = entry.getKey(); final BottomSheetItemWithCompoundButton[] categoryItem = new BottomSheetItemWithCompoundButton[1]; categoryItem[0] = (BottomSheetItemWithCompoundButton) new BottomSheetItemWithCompoundButton.Builder() .setChecked(!isUpdateMode || (categories != null && categories.contains(category))) @@ -96,7 +97,7 @@ public class SelectWptCategoriesBottomSheetDialogFragment extends MenuBottomShee } }) .setCompoundButtonColorId(activeColorResId) - .setDescription(String.valueOf(pointsByCategories.get(category).size())) + .setDescription(String.valueOf(entry.getValue().size())) .setIcon(getContentIcon(R.drawable.ic_action_folder)) .setTitle(category.equals("") ? getString(R.string.shared_string_waypoints) : category) .setLayoutId(R.layout.bottom_sheet_item_with_descr_and_checkbox_56dp) diff --git a/OsmAnd/src/net/osmand/plus/osmedit/OsmEditsFragment.java b/OsmAnd/src/net/osmand/plus/osmedit/OsmEditsFragment.java index e647c63f8f..380eeb8850 100644 --- a/OsmAnd/src/net/osmand/plus/osmedit/OsmEditsFragment.java +++ b/OsmAnd/src/net/osmand/plus/osmedit/OsmEditsFragment.java @@ -684,9 +684,9 @@ public class OsmEditsFragment extends OsmAndListFragment implements ProgressDial @Override public void uploadEnded(Map loadErrorsMap) { super.uploadEnded(loadErrorsMap); - for (OsmPoint osmPoint : loadErrorsMap.keySet()) { - if (loadErrorsMap.get(osmPoint) == null) { - osmEdits.remove(osmPoint); + for (Map.Entry entry : loadErrorsMap.entrySet()) { + if (entry.getValue() == null) { + osmEdits.remove(entry.getKey()); } } recreateAdapterData(); diff --git a/OsmAnd/src/net/osmand/plus/osmedit/OsmEditsUploadListenerHelper.java b/OsmAnd/src/net/osmand/plus/osmedit/OsmEditsUploadListenerHelper.java index 4b6078265d..cbc37e1ea2 100644 --- a/OsmAnd/src/net/osmand/plus/osmedit/OsmEditsUploadListenerHelper.java +++ b/OsmAnd/src/net/osmand/plus/osmedit/OsmEditsUploadListenerHelper.java @@ -59,8 +59,8 @@ public class OsmEditsUploadListenerHelper implements OsmEditsUploadListener { } int uploaded = 0; int pointsNum = loadErrorsMap.keySet().size(); - for (OsmPoint point : loadErrorsMap.keySet()) { - if (loadErrorsMap.get(point) == null) { + for (String s : loadErrorsMap.values()) { + if (s == null) { uploaded++; } } @@ -200,13 +200,14 @@ public class OsmEditsUploadListenerHelper implements OsmEditsUploadListener { boolean[] hasErrors = new boolean[loadErrorsMap.keySet().size()]; ArrayList pointsWithErrors = new ArrayList<>(); int i = 0; - for (OsmPoint point : loadErrorsMap.keySet()) { + for (Map.Entry entry : loadErrorsMap.entrySet()) { + OsmPoint point = entry.getKey(); pointNames[i] = point.getGroup() == OsmPoint.Group.BUG ? ((OsmNotesPoint) point).getText() : ((OpenstreetmapPoint) point).getName(); pointNames[i] = TextUtils.isEmpty(pointNames[i]) ? "id:" + point.getId() : pointNames[i]; - hasErrors[i] = loadErrorsMap.get(point) != null; + hasErrors[i] = entry.getValue() != null; if (hasErrors[i]) { pointsWithErrors.add(point); } diff --git a/OsmAnd/src/net/osmand/plus/poi/PoiFiltersHelper.java b/OsmAnd/src/net/osmand/plus/poi/PoiFiltersHelper.java index d586516fc5..93871dfca4 100644 --- a/OsmAnd/src/net/osmand/plus/poi/PoiFiltersHelper.java +++ b/OsmAnd/src/net/osmand/plus/poi/PoiFiltersHelper.java @@ -751,14 +751,15 @@ public class PoiFiltersHelper { } Map> types = p.getAcceptedTypes(); SQLiteStatement insertCategories = db.compileStatement("INSERT INTO " + CATEGORIES_NAME + " VALUES (?, ?, ?)"); - for (PoiCategory a : types.keySet()) { - if (types.get(a) == null) { + for (Map.Entry> entry : types.entrySet()) { + PoiCategory a = entry.getKey(); + if (entry.getValue() == null) { insertCategories.bindString(1, p.getFilterId()); insertCategories.bindString(2, a.getKeyName()); insertCategories.bindNull(3); insertCategories.execute(); } else { - for (String s : types.get(a)) { + for (String s : entry.getValue()) { insertCategories.bindString(1, p.getFilterId()); insertCategories.bindString(2, a.getKeyName()); insertCategories.bindString(3, s); diff --git a/OsmAnd/src/net/osmand/plus/poi/PoiUIFilter.java b/OsmAnd/src/net/osmand/plus/poi/PoiUIFilter.java index 6629228696..1d3449640f 100644 --- a/OsmAnd/src/net/osmand/plus/poi/PoiUIFilter.java +++ b/OsmAnd/src/net/osmand/plus/poi/PoiUIFilter.java @@ -535,20 +535,19 @@ public class PoiUIFilter implements SearchPoiTypeFilter, Comparable return getName(); } StringBuilder res = new StringBuilder(); - for (PoiCategory p : acceptedTypes.keySet()) { - LinkedHashSet set = acceptedTypes.get(p); + for (Entry> entry : acceptedTypes.entrySet()) { + LinkedHashSet set = entry.getValue(); if (set == null) { if (res.length() > 0) { res.append(", "); } - res.append(p.getTranslation()); + res.append(entry.getKey().getTranslation()); } if (res.length() > chars) { return res.toString(); } } - for (PoiCategory p : acceptedTypes.keySet()) { - LinkedHashSet set = acceptedTypes.get(p); + for (LinkedHashSet set : acceptedTypes.values()) { if (set != null) { for (String st : set) { if (res.length() > 0) { @@ -616,8 +615,8 @@ public class PoiUIFilter implements SearchPoiTypeFilter, Comparable public boolean areAllTypesAccepted() { if (poiTypes.getCategories(false).size() == acceptedTypes.size()) { - for (PoiCategory a : acceptedTypes.keySet()) { - if (acceptedTypes.get(a) != null) { + for (LinkedHashSet strings : acceptedTypes.values()) { + if (strings != null) { return false; } } @@ -711,8 +710,9 @@ public class PoiUIFilter implements SearchPoiTypeFilter, Comparable } private void putAllAcceptedTypes(Map> types) { - for (PoiCategory category : types.keySet()) { - LinkedHashSet typesSet = types.get(category); + for (Entry> entry : types.entrySet()) { + PoiCategory category = entry.getKey(); + LinkedHashSet typesSet = entry.getValue(); if (acceptedTypes.containsKey(category)) { if (acceptedTypes.get(category) != null && typesSet != null) { acceptedTypes.get(category).addAll(typesSet); diff --git a/OsmAnd/src/net/osmand/plus/render/MapRenderRepositories.java b/OsmAnd/src/net/osmand/plus/render/MapRenderRepositories.java index 8bc8d1b51a..26985faa0a 100644 --- a/OsmAnd/src/net/osmand/plus/render/MapRenderRepositories.java +++ b/OsmAnd/src/net/osmand/plus/render/MapRenderRepositories.java @@ -311,8 +311,9 @@ public class MapRenderRepositories { } boolean containsJapanMapData = false; boolean useLive = context.getSettings().USE_OSM_LIVE_FOR_ROUTING.get(); - for (String mapName : files.keySet()) { - BinaryMapIndexReader fr = files.get(mapName); + for (Map.Entry entry : files.entrySet()) { + String mapName = entry.getKey(); + BinaryMapIndexReader fr = entry.getValue(); if (fr != null && (fr.containsMapData(leftX, topY, rightX, bottomY, zoom) || fr.containsRouteData(leftX, topY, rightX, bottomY, zoom))) { if (!nativeFiles.contains(mapName)) { diff --git a/OsmAnd/src/net/osmand/plus/srtmplugin/TerrainLayer.java b/OsmAnd/src/net/osmand/plus/srtmplugin/TerrainLayer.java index b58dc807a8..4ffab5f7c7 100644 --- a/OsmAnd/src/net/osmand/plus/srtmplugin/TerrainLayer.java +++ b/OsmAnd/src/net/osmand/plus/srtmplugin/TerrainLayer.java @@ -114,12 +114,13 @@ public class TerrainLayer extends MapTileLayer { } private void indexNonCachedResources(Map fileModified, Map rs) { - for(String filename : fileModified.keySet()) { + for(Map.Entry entry : fileModified.entrySet()) { + String filename = entry.getKey(); try { log.info("Indexing " + type + " file " + filename); ContentValues cv = new ContentValues(); cv.put("filename", filename); - cv.put("date_modified", fileModified.get(filename)); + cv.put("date_modified", entry.getValue()); SQLiteTileSource ts = rs.get(filename); QuadRect rt = ts.getRectBoundary(ZOOM_BOUNDARY, 1); if (rt != null) { diff --git a/OsmAnd/src/net/osmand/plus/views/layers/ContextMenuLayer.java b/OsmAnd/src/net/osmand/plus/views/layers/ContextMenuLayer.java index 7a8690fe2d..9ba3ee5f46 100644 --- a/OsmAnd/src/net/osmand/plus/views/layers/ContextMenuLayer.java +++ b/OsmAnd/src/net/osmand/plus/views/layers/ContextMenuLayer.java @@ -232,20 +232,22 @@ public class ContextMenuLayer extends OsmandMapLayer { if (!pressedLatLonSmall.isEmpty() || !pressedLatLonFull.isEmpty()) { textScale = activity.getMyApplication().getSettings().TEXT_SCALE.get(); } - for (LatLon latLon : pressedLatLonSmall.keySet()) { + for (Entry entry : pressedLatLonSmall.entrySet()) { + LatLon latLon = entry.getKey(); int x = (int) box.getPixXFromLatLon(latLon.getLatitude(), latLon.getLongitude()); int y = (int) box.getPixYFromLatLon(latLon.getLatitude(), latLon.getLongitude()); - BackgroundType background = pressedLatLonSmall.get(latLon); + BackgroundType background = entry.getValue(); Bitmap pressedBitmapSmall = background.getTouchBackground(activity, true); Rect destRect = getIconDestinationRect( x, y, pressedBitmapSmall.getWidth(), pressedBitmapSmall.getHeight(), textScale); canvas.drawBitmap(pressedBitmapSmall, null, destRect, paint); } - for (LatLon latLon : pressedLatLonFull.keySet()) { + for (Entry entry : pressedLatLonFull.entrySet()) { + LatLon latLon = entry.getKey(); int x = (int) box.getPixXFromLatLon(latLon.getLatitude(), latLon.getLongitude()); int y = (int) box.getPixYFromLatLon(latLon.getLatitude(), latLon.getLongitude()); - BackgroundType background = pressedLatLonFull.get(latLon); + BackgroundType background = entry.getValue(); Bitmap pressedBitmap = background.getTouchBackground(activity, false); int offsetY = background.getOffsetY(activity, textScale); Rect destRect = getIconDestinationRect( diff --git a/OsmAnd/src/net/osmand/plus/views/layers/MapTextLayer.java b/OsmAnd/src/net/osmand/plus/views/layers/MapTextLayer.java index 991bed0d55..fe9d82fe99 100644 --- a/OsmAnd/src/net/osmand/plus/views/layers/MapTextLayer.java +++ b/OsmAnd/src/net/osmand/plus/views/layers/MapTextLayer.java @@ -61,7 +61,8 @@ public class MapTextLayer extends OsmandMapLayer { @Override public void onPrepareBufferImage(Canvas canvas, RotatedTileBox tileBox, DrawSettings settings) { TIntHashSet set = new TIntHashSet(); - for (OsmandMapLayer l : textObjects.keySet()) { + for (Map.Entry> entry : textObjects.entrySet()) { + OsmandMapLayer l = entry.getKey(); MapTextProvider provider = (MapTextProvider) l; if (!view.isLayerVisible(l) || !provider.isTextVisible()) { continue; @@ -69,7 +70,7 @@ public class MapTextLayer extends OsmandMapLayer { updateTextSize(); paintTextIcon.setFakeBoldText(provider.isFakeBoldText()); - for (Object o : textObjects.get(l)) { + for (Object o : entry.getValue()) { LatLon loc = provider.getTextLocation(o); String name = provider.getText(o); if (loc == null || TextUtils.isEmpty(name)) {