projects
/
fw
/
altos
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge branch 'master' of ssh://git.gag.com/scm/git/fw/altos
[fw/altos]
/
altosdroid
/
src
/
org
/
altusmetrum
/
AltosDroid
/
AltosDroidPreferencesBackend.java
diff --git
a/altosdroid/src/org/altusmetrum/AltosDroid/AltosDroidPreferencesBackend.java
b/altosdroid/src/org/altusmetrum/AltosDroid/AltosDroidPreferencesBackend.java
index be41ae7cf35b345b157d11127730c73971618bdc..bc5300fdc36a3fd3cf0466f5939a368813500eb9 100644
(file)
--- a/
altosdroid/src/org/altusmetrum/AltosDroid/AltosDroidPreferencesBackend.java
+++ b/
altosdroid/src/org/altusmetrum/AltosDroid/AltosDroidPreferencesBackend.java
@@
-22,8
+22,9
@@
import java.util.Map;
import android.content.Context;
import android.content.SharedPreferences;
import android.os.Environment;
import android.content.Context;
import android.content.SharedPreferences;
import android.os.Environment;
+import android.util.*;
-import org.altusmetrum.altoslib_
5
.*;
+import org.altusmetrum.altoslib_
6
.*;
public class AltosDroidPreferencesBackend implements AltosPreferencesBackend {
public final static String NAME = "org.altusmetrum.AltosDroid";
public class AltosDroidPreferencesBackend implements AltosPreferencesBackend {
public final static String NAME = "org.altusmetrum.AltosDroid";
@@
-71,6
+72,16
@@
public class AltosDroidPreferencesBackend implements AltosPreferencesBackend {
return prefs.getString(key, def);
}
return prefs.getString(key, def);
}
+ public byte[] getBytes(String key, byte[] def) {
+ String save = prefs.getString(key, null);
+
+ if (save == null)
+ return def;
+
+ byte[] bytes = Base64.decode(save, Base64.DEFAULT);
+ return bytes;
+ }
+
public void putBoolean(String key, boolean value) {
editor.putBoolean(key, value);
}
public void putBoolean(String key, boolean value) {
editor.putBoolean(key, value);
}
@@
-87,6
+98,11
@@
public class AltosDroidPreferencesBackend implements AltosPreferencesBackend {
editor.putString(key, value);
}
editor.putString(key, value);
}
+ public void putBytes(String key, byte[] bytes) {
+ String save = Base64.encodeToString(bytes, Base64.DEFAULT);
+ editor.putString(key, save);
+ }
+
public void remove(String key) {
editor.remove(key);
}
public void remove(String key) {
editor.remove(key);
}