diff options
author | Christopher Baines <cbaines8@gmail.com> | 2012-02-02 18:39:00 +0000 |
---|---|---|
committer | Christopher Baines <cbaines8@gmail.com> | 2012-02-02 18:39:00 +0000 |
commit | 6fe849cc34a06a3f5d7662ea6a4566a870b3edfa (patch) | |
tree | b8a3afd2adff9341932f540801e1c80151d55de9 /src/net/cbaines/suma/PreferencesActivity.java | |
parent | b47ae24a17925619029500a56998860496ce308f (diff) | |
download | southamptonuniversitymap-6fe849cc34a06a3f5d7662ea6a4566a870b3edfa.tar southamptonuniversitymap-6fe849cc34a06a3f5d7662ea6a4566a870b3edfa.tar.gz |
Improvements to the Preference management, begin allowing more bus data, need to rethink the data storage and retreval, perhaps using more semantic web stuff...
Diffstat (limited to 'src/net/cbaines/suma/PreferencesActivity.java')
-rw-r--r-- | src/net/cbaines/suma/PreferencesActivity.java | 23 |
1 files changed, 21 insertions, 2 deletions
diff --git a/src/net/cbaines/suma/PreferencesActivity.java b/src/net/cbaines/suma/PreferencesActivity.java index d5df6a1..0d61c6d 100644 --- a/src/net/cbaines/suma/PreferencesActivity.java +++ b/src/net/cbaines/suma/PreferencesActivity.java @@ -19,15 +19,34 @@ package net.cbaines.suma; +import android.content.SharedPreferences; +import android.content.SharedPreferences.Editor; import android.os.Bundle; import android.preference.PreferenceActivity; +import android.preference.PreferenceManager; -public class PreferencesActivity extends PreferenceActivity { +public class PreferencesActivity extends PreferenceActivity implements Preferences { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); + + final SharedPreferences sharedPrefs = PreferenceManager.getDefaultSharedPreferences(this); + final Editor editor = sharedPrefs.edit(); + if (!sharedPrefs.contains(GPS_ENABLED)) { + editor.putBoolean(GPS_ENABLED, GPS_ENABLED_BY_DEFAULT); + } + if (!sharedPrefs.contains(UNI_LINK_BUS_TIMES)) { + editor.putBoolean(UNI_LINK_BUS_TIMES, UNI_LINK_BUS_TIMES_ENABLED_BY_DEFAULT); + } + if (!sharedPrefs.contains(NON_UNI_LINK_BUS_TIMES)) { + editor.putBoolean(NON_UNI_LINK_BUS_TIMES, NON_UNI_LINK_BUS_TIMES_ENABLED_BY_DEFAULT); + } + if (!sharedPrefs.contains(NON_UNI_LINK_BUS_STOPS)) { + editor.putBoolean(NON_UNI_LINK_BUS_STOPS, NON_UNI_LINK_BUS_STOPS_ENABLED_BY_DEFAULT); + } + editor.commit(); + addPreferencesFromResource(R.xml.preferences); } - }
\ No newline at end of file |