-import android.content.SharedPreferences;
-import org.altusmetrum.AltosLib.*;
-
-public class AltosDroidPreferences implements AltosPreferencesBackend {
- public final static String NAME = "org.altusmetrum.AltosDroid";
- private Context context = null;
- private SharedPreferences prefs = null;
- private SharedPreferences.Editor editor = null;
-
- public AltosDroidPreferences(Context in_context) {
- this(in_context, NAME);
- }
-
- public AltosDroidPreferences(Context in_context, String in_prefs) {
- context = in_context;
- prefs = context.getSharedPreferences(in_prefs, 0);
- editor = prefs.edit();
- }
-
- public AltosPreferencesBackend node(String key) {
- return new AltosDroidPreferences(context, key);
- }
-
- public void flush() {
- editor.apply();
- }
-
- public String[] keys() {
- Map<String, ?> all = prefs.getAll();
- return (String[])all.keySet().toArray();
- }