Not hooked up yet.
Signed-off-by: Keith Packard <keithp@keithp.com>
<item android:id="@+id/map_type"
android:icon="@android:drawable/ic_menu_mapmode"
android:title="@string/map_type" />
+ <item android:id="@+id/map_source"
+ android:icon="@android:drawable/ic_menu_mapmode"
+ android:title="@string/map_source" />
<item android:id="@+id/select_tracker"
android:icon="@android:drawable/ic_menu_view"
android:title="@string/select_tracker"/>
<string name="select_tracker">Select Tracker</string>
<string name="delete_track">Delete Track</string>
<string name="map_type">Map Type</string>
+ <string name="map_source">Toggle Online/Offline maps</string>
<!-- MapTypeActivity -->
<string name="map_type">Map Type</string>
return tab_view;
}
+ public void set_map_source() {
+ }
+
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
AltosDebug.init(this);
AltosDebug.debug("+++ ON CREATE +++");
+ // Initialise preferences
+ AltosDroidPreferences.init(this);
+
fm = getSupportFragmentManager();
// Set up the window layout
serverIntent = new Intent(this, MapTypeActivity.class);
startActivityForResult(serverIntent, REQUEST_MAP_TYPE);
return true;
+ case R.id.map_source:
+ int source = AltosDroidPreferences.map_source();
+ int new_source = source == AltosDroidPreferences.MAP_SOURCE_ONLINE ? AltosDroidPreferences.MAP_SOURCE_OFFLINE : AltosDroidPreferences.MAP_SOURCE_ONLINE;
+ AltosDroidPreferences.set_map_source(new_source);
+ set_map_source();
+ return true;
case R.id.select_tracker:
if (serials != null) {
String[] trackers = new String[serials.length];
static DeviceAddress active_device_address;
+ /* Map source preference name */
+ final static String mapSourcePreference = "MAP-SOURCE";
+
+ static final int MAP_SOURCE_OFFLINE = 0;
+ static final int MAP_SOURCE_ONLINE = 1;
+
+ static int map_source;
+
public static void init(Context context) {
if (backend != null)
return;
if (address != null && name != null)
active_device_address = new DeviceAddress (address, name);
+
+ map_source = backend.getInt(mapSourcePreference, MAP_SOURCE_ONLINE);
}
public static void set_active_device(DeviceAddress address) {
return active_device_address;
}
}
+
+ public static void set_map_source(int map_source) {
+ synchronized(backend) {
+ AltosDroidPreferences.map_source = map_source;
+ backend.putInt(mapSourcePreference, map_source);
+ flush_preferences();
+ }
+ }
+
+ public static int map_source() {
+ synchronized(backend) {
+ return map_source;
+ }
+ }
}
Toast.makeText(this, "Bluetooth is not available", Toast.LENGTH_LONG).show();
}
- // Initialise preferences
- AltosDroidPreferences.init(this);
-
telemetry_state = new TelemetryState();
// Create a reference to the NotificationManager so that we can update our notifcation text later