Merge "Fix issues with view not switching using the pull-down menu"
diff --git a/src/com/android/calendar/AllInOneActivity.java b/src/com/android/calendar/AllInOneActivity.java
index 371f6cc..cbe30d2 100644
--- a/src/com/android/calendar/AllInOneActivity.java
+++ b/src/com/android/calendar/AllInOneActivity.java
@@ -695,24 +695,36 @@
if (mActionBar != null && (mActionBar.getSelectedTab() != mAgendaTab)) {
mActionBar.selectTab(mAgendaTab);
}
+ if (mActionBarMenuSpinnerAdapter != null) {
+ mActionBar.setSelectedNavigationItem(CalendarViewAdapter.AGENDA_BUTTON_INDEX);
+ }
frag = new AgendaFragment(timeMillis, false);
break;
case ViewType.DAY:
if (mActionBar != null && (mActionBar.getSelectedTab() != mDayTab)) {
mActionBar.selectTab(mDayTab);
}
+ if (mActionBarMenuSpinnerAdapter != null) {
+ mActionBar.setSelectedNavigationItem(CalendarViewAdapter.DAY_BUTTON_INDEX);
+ }
frag = new DayFragment(timeMillis, 1);
break;
case ViewType.WEEK:
if (mActionBar != null && (mActionBar.getSelectedTab() != mWeekTab)) {
mActionBar.selectTab(mWeekTab);
}
+ if (mActionBarMenuSpinnerAdapter != null) {
+ mActionBar.setSelectedNavigationItem(CalendarViewAdapter.WEEK_BUTTON_INDEX);
+ }
frag = new DayFragment(timeMillis, 7);
break;
case ViewType.MONTH:
if (mActionBar != null && (mActionBar.getSelectedTab() != mMonthTab)) {
mActionBar.selectTab(mMonthTab);
}
+ if (mActionBarMenuSpinnerAdapter != null) {
+ mActionBar.setSelectedNavigationItem(CalendarViewAdapter.MONTH_BUTTON_INDEX);
+ }
frag = new MonthByWeekFragment(timeMillis, false);
if (mShowAgendaWithMonth) {
secFrag = new AgendaFragment(timeMillis, false);
diff --git a/src/com/android/calendar/agenda/AgendaFragment.java b/src/com/android/calendar/agenda/AgendaFragment.java
index 66e60a1..4411c96 100644
--- a/src/com/android/calendar/agenda/AgendaFragment.java
+++ b/src/com/android/calendar/agenda/AgendaFragment.java
@@ -332,10 +332,17 @@
// If the day changed, update the ActionBar
if (mJulianDayOnTop != julianDay) {
mJulianDayOnTop = julianDay;
- Time t = new Time(mTimeZone);
- t.setJulianDay(mJulianDayOnTop);
- mController.sendEvent(this, EventType.UPDATE_TITLE, t, t, null, -1,
- ViewType.CURRENT, 0, null, null);
+ // Cannot sent a message that eventually may change the layout of the views
+ // so instead post a runnable that will run when the layout is done
+ view.post(new Runnable() {
+ @Override
+ public void run() {
+ Time t = new Time(mTimeZone);
+ t.setJulianDay(mJulianDayOnTop);
+ mController.sendEvent(this, EventType.UPDATE_TITLE, t, t, null, -1,
+ ViewType.CURRENT, 0, null, null);
+ }
+ });
}
}
}