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

Unverified Commit ff1754ae authored by Jonas Häusler's avatar Jonas Häusler Committed by Michael Bestas
Browse files

fix go-to date

setting the week-day here was once necessary when Etar was still using `android.text.format.Time`, where the days where 0-indexed (`java.util.Calendar`s days are 1-indexed).

doing this with `com.android.calendarcommon2.Time` is wrong, and will result in sundays being one week ahead.

additionally, setting the `DAY_OF_WEEK` without updating the `WEEK_OF_MONTH` will result in the old value of `WEEK_OF_MONTH` being used, as `Calendar` expects these to be set in combination when doing the computation: https://github.com/openjdk-mirror/jdk7u-jdk/blob/f4d80957e89a19a29bb9f9807d2a28351ed7f7df/src/share/classes/java/util/Calendar.java#L1729-L1740

Change-Id: I251df84d7576838dea4d9a7a1b351efd38b6e488
parent 429456c3
Loading
Loading
Loading
Loading
+0 −9
Original line number Diff line number Diff line
@@ -942,15 +942,6 @@ public class AllInOneActivity extends AbstractCalendarActivity implements EventH
                    selectedTime.setMonth(monthOfYear);
                    selectedTime.setDay(dayOfMonth);

                    Calendar c = Calendar.getInstance();
                    c.set(year, monthOfYear, dayOfMonth);
                    int weekday = c.get(Calendar.DAY_OF_WEEK);
                    if (weekday == 1) {
                        selectedTime.setWeekDay(7);
                    } else {
                        selectedTime.setWeekDay(weekday - 1);
                    }

                    long extras = CalendarController.EXTRA_GOTO_TIME | CalendarController.EXTRA_GOTO_DATE;
                    mController.sendEvent(this, EventType.GO_TO, selectedTime, null, selectedTime, -1, ViewType.CURRENT, extras, null, null);
                }