summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorkaiyiz <kaiyiz@codeaurora.org>2013-07-31 12:32:30 +0800
committerAdnan <adnan@cyngn.com>2014-08-25 18:37:27 -0700
commit1044baec3695f1dcbc1070b9e0f958d113d7c055 (patch)
treef56d77864279d34977cd2899ce39f3b3d3c2f55a
parent86b2d7b6d42b5efa595bdc0c582c2f40ca9f66e2 (diff)
downloadandroid_packages_apps_Calendar-1044baec3695f1dcbc1070b9e0f958d113d7c055.tar.gz
android_packages_apps_Calendar-1044baec3695f1dcbc1070b9e0f958d113d7c055.tar.bz2
android_packages_apps_Calendar-1044baec3695f1dcbc1070b9e0f958d113d7c055.zip
Calendar: Selected item should be selected after rotation
It dismiss dialog when activity pause and create a new one when it resume, but didn't save the selected state. Save the selected state, and resotre the state when create the dialog. CRs-Fixed: 428296 Change-Id: Ia6df7cccc3914057f6b1d9e7dced596486b995d3
-rw-r--r--src/com/android/calendar/DeleteEventHelper.java4
-rw-r--r--src/com/android/calendar/EventInfoFragment.java8
2 files changed, 11 insertions, 1 deletions
diff --git a/src/com/android/calendar/DeleteEventHelper.java b/src/com/android/calendar/DeleteEventHelper.java
index c436f5a1..a6d1e7dd 100644
--- a/src/com/android/calendar/DeleteEventHelper.java
+++ b/src/com/android/calendar/DeleteEventHelper.java
@@ -463,4 +463,8 @@ public class DeleteEventHelper {
mAlertDialog.dismiss();
}
}
+
+ public int getWhichDelete() {
+ return mWhichDelete;
+ }
}
diff --git a/src/com/android/calendar/EventInfoFragment.java b/src/com/android/calendar/EventInfoFragment.java
index e73482cf..f72938e7 100644
--- a/src/com/android/calendar/EventInfoFragment.java
+++ b/src/com/android/calendar/EventInfoFragment.java
@@ -130,6 +130,7 @@ public class EventInfoFragment extends DialogFragment implements OnCheckedChange
protected static final String BUNDLE_KEY_END_MILLIS = "key_end_millis";
protected static final String BUNDLE_KEY_IS_DIALOG = "key_fragment_is_dialog";
protected static final String BUNDLE_KEY_DELETE_DIALOG_VISIBLE = "key_delete_dialog_visible";
+ protected static final String BUNDLE_KEY_DELETE_DIALOG_CHOICE = "key_delete_dialog_choice";
protected static final String BUNDLE_KEY_WINDOW_STYLE = "key_window_style";
protected static final String BUNDLE_KEY_CALENDAR_COLOR = "key_calendar_color";
protected static final String BUNDLE_KEY_CALENDAR_COLOR_INIT = "key_calendar_color_init";
@@ -332,6 +333,7 @@ public class EventInfoFragment extends DialogFragment implements OnCheckedChange
private int mNumOfAttendees;
private EditResponseHelper mEditResponseHelper;
private boolean mDeleteDialogVisible = false;
+ private int mDeleteDialogChoice = -1;
private DeleteEventHelper mDeleteHelper;
private int mOriginalAttendeeResponse;
@@ -864,6 +866,7 @@ public class EventInfoFragment extends DialogFragment implements OnCheckedChange
DIALOG_WINDOW_STYLE);
mDeleteDialogVisible =
savedInstanceState.getBoolean(BUNDLE_KEY_DELETE_DIALOG_VISIBLE,false);
+ mDeleteDialogChoice = savedInstanceState.getInt(BUNDLE_KEY_DELETE_DIALOG_CHOICE, -1);
mCalendarColor = savedInstanceState.getInt(BUNDLE_KEY_CALENDAR_COLOR);
mCalendarColorInitialized =
savedInstanceState.getBoolean(BUNDLE_KEY_CALENDAR_COLOR_INIT);
@@ -1164,6 +1167,7 @@ public class EventInfoFragment extends DialogFragment implements OnCheckedChange
outState.putInt(BUNDLE_KEY_CURRENT_COLOR, mCurrentColor);
outState.putBoolean(BUNDLE_KEY_CURRENT_COLOR_INIT, mCurrentColorInitialized);
outState.putInt(BUNDLE_KEY_CURRENT_COLOR_KEY, mCurrentColorKey);
+ outState.putInt(BUNDLE_KEY_DELETE_DIALOG_CHOICE, mDeleteDialogChoice);
// We'll need the temporary response for configuration changes.
outState.putInt(BUNDLE_KEY_TENTATIVE_USER_RESPONSE, mTentativeUserSetResponse);
@@ -2065,6 +2069,7 @@ public class EventInfoFragment extends DialogFragment implements OnCheckedChange
// This is done to get the same behavior on OnResume since the AlertDialog is gone on
// rotation but not if you press the HOME key
if (mDeleteDialogVisible && mDeleteHelper != null) {
+ mDeleteDialogChoice = mDeleteHelper.getWhichDelete();
mDeleteHelper.dismissAlertDialog();
mDeleteHelper = null;
}
@@ -2091,7 +2096,8 @@ public class EventInfoFragment extends DialogFragment implements OnCheckedChange
mContext, mActivity,
!mIsDialog && !mIsTabletConfig /* exitWhenDone */);
mDeleteHelper.setOnDismissListener(createDeleteOnDismissListener());
- mDeleteHelper.delete(mStartMillis, mEndMillis, mEventId, -1, onDeleteRunnable);
+ mDeleteHelper.delete(mStartMillis, mEndMillis,
+ mEventId, mDeleteDialogChoice, onDeleteRunnable);
} else if (mTentativeUserSetResponse != Attendees.ATTENDEE_STATUS_NONE) {
int buttonId = findButtonIdForResponse(mTentativeUserSetResponse);
mResponseRadioGroup.check(buttonId);