Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit a0851795 authored by Svetoslav's avatar Svetoslav
Browse files

CalendarView header not updated on year change.

The calendar view was updating its header only if the focused
month changes. Removed the check whether the displayed month
changed before setting it since the setter is carefully called
only in cases when there is a change. Hence, now if the year
or the month change, we update the header. This is the safest
and least intrusive fix.

bug:9167305

Change-Id: I98200bb57580f6416abd30c6c25454d4474add64
parent ed8f94fc
Loading
Loading
Loading
Loading
+8 −11
Original line number Diff line number Diff line
@@ -1248,9 +1248,7 @@ public class CalendarView extends FrameLayout {
     * @param calendar A day in the new focus month.
     */
    private void setMonthDisplayed(Calendar calendar) {
        final int newMonthDisplayed = calendar.get(Calendar.MONTH);
        if (mCurrentMonthDisplayed != newMonthDisplayed) {
            mCurrentMonthDisplayed = newMonthDisplayed;
        mCurrentMonthDisplayed = calendar.get(Calendar.MONTH);
        mAdapter.setFocusMonth(mCurrentMonthDisplayed);
        final int flags = DateUtils.FORMAT_SHOW_DATE | DateUtils.FORMAT_NO_MONTH_DAY
                | DateUtils.FORMAT_SHOW_YEAR;
@@ -1259,7 +1257,6 @@ public class CalendarView extends FrameLayout {
        mMonthName.setText(newMonthName);
        mMonthName.invalidate();
    }
    }

    /**
     * @return Returns the number of weeks between the current <code>date</code>