summaryrefslogtreecommitdiff
path: root/altosdroid/src/org/altusmetrum/AltosDroid/AltosMapOffline.java
diff options
context:
space:
mode:
authorKeith Packard <keithp@keithp.com>2016-04-26 21:01:44 -0400
committerKeith Packard <keithp@keithp.com>2016-04-26 21:02:40 -0400
commitd81f94fd5339d513de9bde5a2e19f8eca526344f (patch)
tree25d8261d6ddb6b8217b4e92690997d59a0a06285 /altosdroid/src/org/altusmetrum/AltosDroid/AltosMapOffline.java
parent204ae5142702044eb8ad2697a55028e904067958 (diff)
altosdroid: Split setup functions to separate dialog
Remove them from the options menu, handle all preferences through listeners. Signed-off-by: Keith Packard <keithp@keithp.com>
Diffstat (limited to 'altosdroid/src/org/altusmetrum/AltosDroid/AltosMapOffline.java')
-rw-r--r--altosdroid/src/org/altusmetrum/AltosDroid/AltosMapOffline.java11
1 files changed, 8 insertions, 3 deletions
diff --git a/altosdroid/src/org/altusmetrum/AltosDroid/AltosMapOffline.java b/altosdroid/src/org/altusmetrum/AltosDroid/AltosMapOffline.java
index 6edc87a5..bde80cfc 100644
--- a/altosdroid/src/org/altusmetrum/AltosDroid/AltosMapOffline.java
+++ b/altosdroid/src/org/altusmetrum/AltosDroid/AltosMapOffline.java
@@ -79,7 +79,7 @@ class Rocket implements Comparable {
}
}
-public class AltosMapOffline extends View implements ScaleGestureDetector.OnScaleGestureListener, AltosMapInterface, AltosDroidMapInterface {
+public class AltosMapOffline extends View implements ScaleGestureDetector.OnScaleGestureListener, AltosMapInterface, AltosDroidMapInterface, AltosMapTypeListener {
ScaleGestureDetector scale_detector;
boolean scaling;
AltosMap map;
@@ -493,7 +493,8 @@ public class AltosMapOffline extends View implements ScaleGestureDetector.OnScal
public void onCreateView(AltosDroid altos_droid) {
this.altos_droid = altos_droid;
map = new AltosMap(this);
- map.set_maptype(altos_droid.map_type);
+ AltosPreferences.register_map_type_listener(this);
+ map.set_maptype(AltosPreferences.map_type());
pad_bitmap = BitmapFactory.decodeResource(getResources(), R.drawable.pad);
/* arrow at the bottom of the launchpad image */
@@ -511,7 +512,11 @@ public class AltosMapOffline extends View implements ScaleGestureDetector.OnScal
here_off_y = here_bitmap.getHeight() / 2;
}
- public void set_map_type(int map_type) {
+ public void onDestroyView() {
+ AltosPreferences.unregister_map_type_listener(this);
+ }
+
+ public void map_type_changed(int map_type) {
if (map != null)
map.set_maptype(map_type);
}