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

Commit 1f2ea06f authored by Philip P. Moltmann's avatar Philip P. Moltmann Committed by Android (Google) Code Review
Browse files

Merge "Deal with daylight savings time in battery chart."

parents e8244399 99b78b3e
Loading
Loading
Loading
Loading
+6 −1
Original line number Diff line number Diff line
@@ -1118,8 +1118,13 @@ public class BatteryHistoryChart extends View {
                if (startRoundTime < endRoundTime) {
                    addDateLabel(calStart, mLevelLeft, mLevelRight, isDayFirst);
                    Calendar calMid = Calendar.getInstance();
                    calMid.setTimeInMillis(startRoundTime + ((endRoundTime - startRoundTime) / 2));

                    // The middle between two beginnings of days can be anywhere between -1 to 13
                    // after the beginning of the "median" day.
                    calMid.setTimeInMillis(startRoundTime + ((endRoundTime - startRoundTime) / 2)
                                           + 2 * 60 * 60 * 1000);
                    calMid.set(Calendar.HOUR_OF_DAY, 0);
                    calMid.set(Calendar.MINUTE, 0);
                    long calMidMillis = calMid.getTimeInMillis();
                    if (calMidMillis > startRoundTime && calMidMillis < endRoundTime) {
                        addDateLabel(calMid, mLevelLeft, mLevelRight, isDayFirst);