diff options
| author | Keith Packard <keithp@keithp.com> | 2016-04-26 21:01:44 -0400 |
|---|---|---|
| committer | Keith Packard <keithp@keithp.com> | 2016-04-26 21:02:40 -0400 |
| commit | d81f94fd5339d513de9bde5a2e19f8eca526344f (patch) | |
| tree | 25d8261d6ddb6b8217b4e92690997d59a0a06285 /altosdroid/src/org/altusmetrum/AltosDroid/TabMap.java | |
| parent | 204ae5142702044eb8ad2697a55028e904067958 (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/TabMap.java')
| -rw-r--r-- | altosdroid/src/org/altusmetrum/AltosDroid/TabMap.java | 19 |
1 files changed, 7 insertions, 12 deletions
diff --git a/altosdroid/src/org/altusmetrum/AltosDroid/TabMap.java b/altosdroid/src/org/altusmetrum/AltosDroid/TabMap.java index de74420f..19ce86c9 100644 --- a/altosdroid/src/org/altusmetrum/AltosDroid/TabMap.java +++ b/altosdroid/src/org/altusmetrum/AltosDroid/TabMap.java @@ -32,7 +32,7 @@ import android.widget.*; import android.location.Location; import android.content.*; -public class TabMap extends AltosDroidTab { +public class TabMap extends AltosDroidTab implements AltosDroidMapSourceListener { AltosLatLon here; @@ -74,7 +74,8 @@ public class TabMap extends AltosDroidTab { map_offline.onCreateView(altos_droid); map_online = new AltosMapOnline(view.getContext()); map_online.onCreateView(altos_droid); - set_map_source(AltosDroidPreferences.map_source()); + map_source_changed(AltosDroidPreferences.map_source()); + AltosDroidPreferences.register_map_source_listener(this); return view; } @@ -88,6 +89,9 @@ public class TabMap extends AltosDroidTab { @Override public void onDestroyView() { super.onDestroyView(); + map_offline.onDestroyView(); + map_online.onDestroyView(); + AltosDroidPreferences.unregister_map_source_listener(this); } public String tab_name() { return AltosDroid.tab_map_name; } @@ -144,16 +148,7 @@ public class TabMap extends AltosDroidTab { } } - @Override - public void set_map_type(int map_type) { - if (map_offline != null) - map_offline.set_map_type(map_type); - if (map_online != null) - map_online.set_map_type(map_type); - } - - @Override - public void set_map_source(int map_source) { + public void map_source_changed(int map_source) { this.map_source = map_source; if (map_source == AltosDroidPreferences.MAP_SOURCE_OFFLINE) { if (map_online != null) |
