X-Git-Url: https://git.gag.com/?a=blobdiff_plain;f=altosdroid%2Fsrc%2Forg%2Faltusmetrum%2FAltosDroid%2FAltosDroidPreferences.java;h=dd86c818b06b5822af48335ca465e23ec69c7fdf;hb=c5f49d0ac254047f13c6c1ecfb5520eff72109ac;hp=02defbcb6aac4492d3d53ea423adc4604333eb7a;hpb=7041c386cdf37716f8daf0bc1a9204db620e3de9;p=fw%2Faltos diff --git a/altosdroid/src/org/altusmetrum/AltosDroid/AltosDroidPreferences.java b/altosdroid/src/org/altusmetrum/AltosDroid/AltosDroidPreferences.java index 02defbcb..dd86c818 100644 --- a/altosdroid/src/org/altusmetrum/AltosDroid/AltosDroidPreferences.java +++ b/altosdroid/src/org/altusmetrum/AltosDroid/AltosDroidPreferences.java @@ -16,8 +16,12 @@ */ package org.altusmetrum.AltosDroid; +import java.io.*; +import java.util.*; +import java.text.*; + import android.content.Context; -import org.altusmetrum.altoslib_9.*; +import org.altusmetrum.altoslib_10.*; public class AltosDroidPreferences extends AltosPreferences { @@ -65,12 +69,19 @@ public class AltosDroidPreferences extends AltosPreferences { } } + static LinkedList map_source_listeners; + public static void set_map_source(int map_source) { synchronized(backend) { AltosDroidPreferences.map_source = map_source; backend.putInt(mapSourcePreference, map_source); flush_preferences(); } + if (map_source_listeners != null) { + for (AltosDroidMapSourceListener l : map_source_listeners) { + l.map_source_changed(map_source); + } + } } public static int map_source() { @@ -78,4 +89,18 @@ public class AltosDroidPreferences extends AltosPreferences { return map_source; } } + + public static void register_map_source_listener(AltosDroidMapSourceListener l) { + synchronized(backend) { + if (map_source_listeners == null) + map_source_listeners = new LinkedList(); + map_source_listeners.add(l); + } + } + + public static void unregister_map_source_listener(AltosDroidMapSourceListener l) { + synchronized(backend) { + map_source_listeners.remove(l); + } + } }