summaryrefslogtreecommitdiffstats
path: root/src/com
diff options
context:
space:
mode:
authorJames Kung <kingkung@google.com>2013-04-29 22:33:35 -0700
committerAndroid Git Automerger <android-git-automerger@android.com>2013-04-29 22:33:35 -0700
commite6681553bd244e2e297140625546ec62478014f0 (patch)
treef515a65969c218f637c7a95d1411d8a7678b50dd /src/com
parente56b0969c26cd6ed1e8dd01be4729982a7ddc923 (diff)
parent96a36f4cb7803d50ecf47945b6a240926f48e7c3 (diff)
downloadandroid_packages_apps_Calendar-e6681553bd244e2e297140625546ec62478014f0.tar.gz
android_packages_apps_Calendar-e6681553bd244e2e297140625546ec62478014f0.tar.bz2
android_packages_apps_Calendar-e6681553bd244e2e297140625546ec62478014f0.zip
am 96a36f4c: Retain color palette icon on orientation change
* commit '96a36f4cb7803d50ecf47945b6a240926f48e7c3': Retain color palette icon on orientation change
Diffstat (limited to 'src/com')
-rw-r--r--src/com/android/calendar/CalendarEventModel.java1
-rw-r--r--src/com/android/calendar/event/EditEventFragment.java17
-rw-r--r--src/com/android/calendar/event/EditEventView.java21
3 files changed, 31 insertions, 8 deletions
diff --git a/src/com/android/calendar/CalendarEventModel.java b/src/com/android/calendar/CalendarEventModel.java
index ef04368d..8f6507e0 100644
--- a/src/com/android/calendar/CalendarEventModel.java
+++ b/src/com/android/calendar/CalendarEventModel.java
@@ -941,5 +941,4 @@ public class CalendarEventModel implements Serializable {
}
return -1;
}
-
}
diff --git a/src/com/android/calendar/event/EditEventFragment.java b/src/com/android/calendar/event/EditEventFragment.java
index 70c9bc07..6b350b03 100644
--- a/src/com/android/calendar/event/EditEventFragment.java
+++ b/src/com/android/calendar/event/EditEventFragment.java
@@ -81,6 +81,7 @@ public class EditEventFragment extends Fragment implements EventHandler, OnColor
private static final String BUNDLE_KEY_EVENT = "key_event";
private static final String BUNDLE_KEY_READ_ONLY = "key_read_only";
private static final String BUNDLE_KEY_EDIT_ON_LAUNCH = "key_edit_on_launch";
+ private static final String BUNDLE_KEY_SHOW_COLOR_PALETTE = "show_color_palette";
private static final String BUNDLE_KEY_DATE_BUTTON_CLICKED = "date_button_clicked";
@@ -131,6 +132,7 @@ public class EditEventFragment extends Fragment implements EventHandler, OnColor
private boolean mSaveOnDetach = true;
private boolean mIsReadOnly = false;
public boolean mShowModifyDialogOnLaunch = false;
+ private boolean mShowColorPalette = false;
private boolean mTimeSelectedWasStartTime;
private boolean mDateSelectedWasStartDate;
@@ -365,7 +367,16 @@ public class EditEventFragment extends Fragment implements EventHandler, OnColor
if (cursor != null) {
cursor.close();
}
- mView.setColorPickerButtonStates(mModel.getCalendarEventColors());
+
+ // If the account name/type is null, the calendar event colors cannot be
+ // determined, so take the default/savedInstanceState value.
+ if (mModel.mCalendarAccountName == null
+ || mModel.mCalendarAccountType == null) {
+ mView.setColorPickerButtonStates(mShowColorPalette);
+ } else {
+ mView.setColorPickerButtonStates(mModel.getCalendarEventColors());
+ }
+
setModelIfDone(TOKEN_COLORS);
break;
default:
@@ -605,6 +616,9 @@ public class EditEventFragment extends Fragment implements EventHandler, OnColor
mDateSelectedWasStartDate = savedInstanceState.getBoolean(
BUNDLE_KEY_DATE_BUTTON_CLICKED);
}
+ if (savedInstanceState.containsKey(BUNDLE_KEY_SHOW_COLOR_PALETTE)) {
+ mShowColorPalette = savedInstanceState.getBoolean(BUNDLE_KEY_SHOW_COLOR_PALETTE);
+ }
}
}
@@ -928,6 +942,7 @@ public class EditEventFragment extends Fragment implements EventHandler, OnColor
outState.putBoolean(BUNDLE_KEY_EDIT_ON_LAUNCH, mShowModifyDialogOnLaunch);
outState.putSerializable(BUNDLE_KEY_EVENT, mEventBundle);
outState.putBoolean(BUNDLE_KEY_READ_ONLY, mIsReadOnly);
+ outState.putBoolean(BUNDLE_KEY_SHOW_COLOR_PALETTE, mView.isColorPaletteVisible());
outState.putBoolean("EditEventView_timebuttonclicked", mView.mTimeSelectedWasStartTime);
outState.putBoolean(BUNDLE_KEY_DATE_BUTTON_CLICKED, mView.mDateSelectedWasStartDate);
diff --git a/src/com/android/calendar/event/EditEventView.java b/src/com/android/calendar/event/EditEventView.java
index 2ec8f674..09daa0c6 100644
--- a/src/com/android/calendar/event/EditEventView.java
+++ b/src/com/android/calendar/event/EditEventView.java
@@ -1354,8 +1354,8 @@ public class EditEventView implements View.OnClickListener, DialogInterface.OnCa
CalendarsAdapter adapter = new CalendarsAdapter(mActivity,
R.layout.calendars_spinner_item, cursor);
mCalendarsSpinner.setAdapter(adapter);
- mCalendarsSpinner.setSelection(selection);
mCalendarsSpinner.setOnItemSelectedListener(this);
+ mCalendarsSpinner.setSelection(selection);
if (mSaveAfterQueryComplete) {
mLoadingCalendarsDialog.cancel();
@@ -1691,16 +1691,25 @@ public class EditEventView implements View.OnClickListener, DialogInterface.OnCa
updateHomeTime();
}
- public void setColorPickerButtonStates(int[] eventColors) {
- if (eventColors == null || eventColors.length == 0) {
- mColorPickerNewEvent.setVisibility(View.INVISIBLE);
- mColorPickerExistingEvent.setVisibility(View.GONE);
- } else {
+ public void setColorPickerButtonStates(int[] colorArray) {
+ setColorPickerButtonStates(colorArray != null && colorArray.length > 0);
+ }
+
+ public void setColorPickerButtonStates(boolean showColorPalette) {
+ if (showColorPalette) {
mColorPickerNewEvent.setVisibility(View.VISIBLE);
mColorPickerExistingEvent.setVisibility(View.VISIBLE);
+ } else {
+ mColorPickerNewEvent.setVisibility(View.INVISIBLE);
+ mColorPickerExistingEvent.setVisibility(View.GONE);
}
}
+ public boolean isColorPaletteVisible() {
+ return mColorPickerNewEvent.getVisibility() == View.VISIBLE ||
+ mColorPickerExistingEvent.getVisibility() == View.VISIBLE;
+ }
+
@Override
public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
// This is only used for the Calendar spinner in new events, and only fires when the