summaryrefslogtreecommitdiff
path: root/altoslib
diff options
context:
space:
mode:
authorKeith Packard <keithp@keithp.com>2016-04-19 23:18:46 -0400
committerKeith Packard <keithp@keithp.com>2016-04-19 23:21:30 -0400
commit09acb6821ab490d69f679a195e70acb4a71ba342 (patch)
tree50a7a13fff52f75b6c25a8892b7a70667f2af335 /altoslib
parent49c3e3dffe748d0d155d4876efcaf7d39e1cc8e3 (diff)
altoslib: switch from keySet() to keys() in altos map tiles
Android appears to not have the keySet() API in the same way that regular java does, so use the alternate older keys() api instead. Signed-off-by: Keith Packard <keithp@keithp.com>
Diffstat (limited to 'altoslib')
-rw-r--r--altoslib/AltosMap.java11
1 files changed, 9 insertions, 2 deletions
diff --git a/altoslib/AltosMap.java b/altoslib/AltosMap.java
index 6c08f2d7..c79e5229 100644
--- a/altoslib/AltosMap.java
+++ b/altoslib/AltosMap.java
@@ -308,7 +308,11 @@ public class AltosMap implements AltosMapTileListener, AltosMapStoreListener {
upper_left = floor(transform.screen_point(new AltosPointInt(0, 0)));
lower_right = floor(transform.screen_point(new AltosPointInt(width(), height())));
}
- for (AltosPointInt point : tiles.keySet()) {
+
+ Enumeration<AltosPointInt> keyEnumeration = tiles.keys();
+
+ while (keyEnumeration.hasMoreElements()) {
+ AltosPointInt point = keyEnumeration.nextElement();
if (point.x < upper_left.x || lower_right.x < point.x ||
point.y < upper_left.y || lower_right.y < point.y) {
tiles.remove(point);
@@ -377,7 +381,10 @@ public class AltosMap implements AltosMapTileListener, AltosMapStoreListener {
/* AltosMapTileListener methods */
public synchronized void notify_tile(AltosMapTile tile, int status) {
- for (AltosPointInt point : tiles.keySet()) {
+ Enumeration<AltosPointInt> keyEnumeration = tiles.keys();
+
+ while (keyEnumeration.hasMoreElements()) {
+ AltosPointInt point = keyEnumeration.nextElement();
if (tile == tiles.get(point)) {
AltosPointInt screen = transform.screen(point);
repaint(screen.x, screen.y, AltosMap.px_size, AltosMap.px_size);