X-Git-Url: https://git.gag.com/?a=blobdiff_plain;f=altosdroid%2Fsrc%2Forg%2Faltusmetrum%2FAltosDroid%2FAltosDroidPreferences.java;h=c7cdc961729aad7e385633ac539f792e82cd9fb7;hb=1085ec5d57e0ed5d132f2bbdac1a0b6a32c0ab4a;hp=dd86c818b06b5822af48335ca465e23ec69c7fdf;hpb=d81f94fd5339d513de9bde5a2e19f8eca526344f;p=fw%2Faltos diff --git a/altosdroid/src/org/altusmetrum/AltosDroid/AltosDroidPreferences.java b/altosdroid/src/org/altusmetrum/AltosDroid/AltosDroidPreferences.java index dd86c818..c7cdc961 100644 --- a/altosdroid/src/org/altusmetrum/AltosDroid/AltosDroidPreferences.java +++ b/altosdroid/src/org/altusmetrum/AltosDroid/AltosDroidPreferences.java @@ -3,7 +3,8 @@ * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; version 2 of the License. + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of @@ -21,7 +22,7 @@ import java.util.*; import java.text.*; import android.content.Context; -import org.altusmetrum.altoslib_10.*; +import org.altusmetrum.altoslib_11.*; public class AltosDroidPreferences extends AltosPreferences { @@ -57,8 +58,13 @@ public class AltosDroidPreferences extends AltosPreferences { public static void set_active_device(DeviceAddress address) { synchronized(backend) { active_device_address = address; - backend.putString(activeDeviceAddressPreference, active_device_address.address); - backend.putString(activeDeviceNamePreference, active_device_address.name); + if (active_device_address != null) { + backend.putString(activeDeviceAddressPreference, active_device_address.address); + backend.putString(activeDeviceNamePreference, active_device_address.name); + } else { + backend.remove(activeDeviceAddressPreference); + backend.remove(activeDeviceNamePreference); + } flush_preferences(); } }