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

Commit 87879e8e authored by Brian Muramatsu's avatar Brian Muramatsu
Browse files

Fix Incorrect Times in TimePickerDialog

Bug 3414311

TimePicker#setCurrentHour subtracts 12 from the given hour if
is24HourView returns false. TimePickerDialog calls setCurrentHour before
setIs24HourView, so the 12 will always be substracted from the time.
Reorder the statements so that TimePickerDialog sets is24HourView,
before setting the hour and time.

Change-Id: Ib997397b04dbdd767e67806aea7614426019e938
parent 22ad6243
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -107,9 +107,9 @@ public class TimePickerDialog extends AlertDialog
        mTimePicker = (TimePicker) view.findViewById(R.id.timePicker);

        // initialize state
        mTimePicker.setIs24HourView(mIs24HourView);
        mTimePicker.setCurrentHour(mInitialHourOfDay);
        mTimePicker.setCurrentMinute(mInitialMinute);
        mTimePicker.setIs24HourView(mIs24HourView);
        mTimePicker.setOnTimeChangedListener(this);
    }

@@ -144,8 +144,8 @@ public class TimePickerDialog extends AlertDialog
        super.onRestoreInstanceState(savedInstanceState);
        int hour = savedInstanceState.getInt(HOUR);
        int minute = savedInstanceState.getInt(MINUTE);
        mTimePicker.setIs24HourView(savedInstanceState.getBoolean(IS_24_HOUR));
        mTimePicker.setCurrentHour(hour);
        mTimePicker.setCurrentMinute(minute);
        mTimePicker.setIs24HourView(savedInstanceState.getBoolean(IS_24_HOUR));
    }
}