diff options
author | Michael Chan <mchan@android.com> | 2010-02-03 17:44:37 -0800 |
---|---|---|
committer | Michael Chan <mchan@android.com> | 2010-02-03 17:44:37 -0800 |
commit | 45efa09d6e06f5569b2c0ae0dae0436dbfe6cb28 (patch) | |
tree | 238ba05c00118bdf1d33978e291ca6fd795f8b81 /src/com/android/calendar/Utils.java | |
parent | dab026ce047a346c56a795d7d34877f8a9475188 (diff) | |
download | android_packages_apps_Calendar-45efa09d6e06f5569b2c0ae0dae0436dbfe6cb28.tar.gz android_packages_apps_Calendar-45efa09d6e06f5569b2c0ae0dae0436dbfe6cb28.tar.bz2 android_packages_apps_Calendar-45efa09d6e06f5569b2c0ae0dae0436dbfe6cb28.zip |
Save the last calendar used for event creation as the default for creating the next event.
This was done to remove the google dependency.
Change-Id: I14051f1098d3e78ffa76ef2890b9595809c5d186
Diffstat (limited to 'src/com/android/calendar/Utils.java')
-rw-r--r-- | src/com/android/calendar/Utils.java | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/src/com/android/calendar/Utils.java b/src/com/android/calendar/Utils.java index 019cecb3..55cbfba9 100644 --- a/src/com/android/calendar/Utils.java +++ b/src/com/android/calendar/Utils.java @@ -21,7 +21,6 @@ import static android.provider.Calendar.EVENT_BEGIN_TIME; import android.content.Context; import android.content.Intent; import android.content.SharedPreferences; -import android.content.res.Resources; import android.preference.PreferenceManager; import android.text.format.Time; import android.view.animation.AlphaAnimation; @@ -40,6 +39,18 @@ public class Utils { context.startActivity(intent); } + static String getSharedPreference(Context context, String key, String defaultValue) { + SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context); + return prefs.getString(key, defaultValue); + } + + static void setSharedPreference(Context context, String key, String value) { + SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context); + SharedPreferences.Editor editor = prefs.edit(); + editor.putString(key, value); + editor.commit(); + } + static void setDefaultView(Context context, int viewId) { String activityString = CalendarApplication.ACTIVITY_NAMES[viewId]; |