From 7e98b76c43b3300e683844f1c6c9607fc82b8383 Mon Sep 17 00:00:00 2001 From: Sam Bosley Date: Thu, 13 Dec 2012 13:58:09 -0800 Subject: [PATCH] Prefs fix --- .../astrid/utility/AstridPreferences.java | 40 +++++++++++-------- 1 file changed, 24 insertions(+), 16 deletions(-) diff --git a/astrid/src/com/todoroo/astrid/utility/AstridPreferences.java b/astrid/src/com/todoroo/astrid/utility/AstridPreferences.java index 893252923..70b2c16d2 100644 --- a/astrid/src/com/todoroo/astrid/utility/AstridPreferences.java +++ b/astrid/src/com/todoroo/astrid/utility/AstridPreferences.java @@ -87,15 +87,19 @@ public class AstridPreferences { Preferences.setIfUnset(prefs, editor, r, R.string.p_calendar_reminders, true); - SharedPreferences publicPrefs = getPublicPrefs(context); - if (publicPrefs != null) { - Editor edit = publicPrefs.edit(); - if (edit != null) { - edit.putInt(SortHelper.PREF_SORT_FLAGS, SortHelper.FLAG_DRAG_DROP); - edit.putInt(SortHelper.PREF_SORT_SORT, SortHelper.SORT_AUTO); - edit.commit(); - Preferences.setInt(P_SUBTASKS_HELP, 1); + String dragDropTestInitialized = "android_drag_drop_initialized"; //$NON-NLS-1$ + if (!Preferences.getBoolean(dragDropTestInitialized, false)) { + SharedPreferences publicPrefs = getPublicPrefs(context); + if (publicPrefs != null) { + Editor edit = publicPrefs.edit(); + if (edit != null) { + edit.putInt(SortHelper.PREF_SORT_FLAGS, SortHelper.FLAG_DRAG_DROP); + edit.putInt(SortHelper.PREF_SORT_SORT, SortHelper.SORT_AUTO); + edit.commit(); + Preferences.setInt(P_SUBTASKS_HELP, 1); + } } + Preferences.setBoolean(dragDropTestInitialized, true); } if ("white-blue".equals(Preferences.getStringValue(R.string.p_theme))) { //$NON-NLS-1$ migrate from when white-blue wasn't the default @@ -152,15 +156,19 @@ public class AstridPreferences { Preferences.setIfUnset(prefs, editor, r, R.string.p_show_list_members, false); - SharedPreferences publicPrefs = getPublicPrefs(context); - if (publicPrefs != null) { - Editor edit = publicPrefs.edit(); - if (edit != null) { - edit.putInt(SortHelper.PREF_SORT_FLAGS, SortHelper.FLAG_DRAG_DROP); - edit.putInt(SortHelper.PREF_SORT_SORT, SortHelper.SORT_AUTO); - edit.commit(); - Preferences.setInt(P_SUBTASKS_HELP, 1); + String dragDropTestInitialized = "android_drag_drop_initialized"; //$NON-NLS-1$ + if (!Preferences.getBoolean(dragDropTestInitialized, false)) { + SharedPreferences publicPrefs = getPublicPrefs(context); + if (publicPrefs != null) { + Editor edit = publicPrefs.edit(); + if (edit != null) { + edit.putInt(SortHelper.PREF_SORT_FLAGS, SortHelper.FLAG_DRAG_DROP); + edit.putInt(SortHelper.PREF_SORT_SORT, SortHelper.SORT_AUTO); + edit.commit(); + Preferences.setInt(P_SUBTASKS_HELP, 1); + } } + Preferences.setBoolean(dragDropTestInitialized, true); } BeastModePreferences.setDefaultLiteModeOrder(context);