+ public static void register_position_listener(AltosPositionListener l) {
+ synchronized(backend) {
+ position_listeners.add(l);
+ }
+ }
+
+ public static void unregister_position_listener(AltosPositionListener l) {
+ synchronized (backend) {
+ position_listeners.remove(l);
+ }
+ }
+
+ public static void set_position(int new_position) {
+ synchronized (backend) {
+ position = new_position;
+ backend.putInt(positionPreference, position);
+ flush_preferences();
+ for (AltosPositionListener l : position_listeners)
+ l.position_changed(position);
+ }
+ }
+
+ public static int position() {
+ synchronized (backend) {
+ return position;
+ }
+ }
+
+ public static void register_map_cache_listener(AltosUIMapCacheListener l) {
+ synchronized(backend) {
+ map_cache_listeners.add(l);
+ }
+ }
+
+ public static void unregister_map_cache_listener(AltosUIMapCacheListener l) {
+ synchronized (backend) {
+ map_cache_listeners.remove(l);
+ }
+ }
+
+ public static void set_map_cache(int new_map_cache) {
+ synchronized(backend) {
+ map_cache = new_map_cache;
+ backend.putInt(mapCachePreference, map_cache);
+ flush_preferences();
+ for (AltosUIMapCacheListener l: map_cache_listeners)
+ l.map_cache_changed(map_cache);
+ }
+ }
+
+ public static int map_cache() {
+ synchronized(backend) {
+ return map_cache;
+ }
+ }