Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

review all uses of convertAlldayUtcToLocal #1470

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions app/src/main/java/com/android/calendar/AllInOneActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -1363,10 +1363,13 @@ public void handleEvent(EventInfo event) {
if (event.startTime != null && event.endTime != null) {
// Event is all day , adjust the goto time to local time
if (event.isAllDay()) {
Utils.convertAlldayUtcToLocal(
event.startTime, event.startTime.toMillis(), mTimeZone);
Utils.convertAlldayUtcToLocal(
event.endTime, event.endTime.toMillis(), mTimeZone);
final Time t = new Time();
event.startTime.set(
Copy link
Author

@lmamane lmamane Oct 6, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This one I'm less certain of; I'm not sure what exactly the rest of the code makes with event.startTime and event.endTime; maybe that bit of code should instead be:

long millis = Utils.convertAlldayUtcToLocal(
                                t, event.startTime.toMillis(), mTimeZone);
event.startTime.setTimeZone(mTimeZone);
event.startTime.set(millis);

and the same for event.endTime

Utils.convertAlldayUtcToLocal(
t, event.startTime.toMillis(), mTimeZone));
event.endTime.set(
Utils.convertAlldayUtcToLocal(
t, event.endTime.toMillis(), mTimeZone));
}
mController.sendEvent(this, EventType.GO_TO, event.startTime, event.endTime,
event.selectedTime, event.id, ViewType.AGENDA,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -306,8 +306,9 @@ public void calculateDays(DayAdapterInfo dayAdapterInfo) {
long instanceId = cursor.getLong(AgendaWindowAdapter.INDEX_INSTANCE_ID);
boolean allDay = cursor.getInt(AgendaWindowAdapter.INDEX_ALL_DAY) != 0;
if (allDay) {
startTime = Utils.convertAlldayUtcToLocal(tempTime, startTime, mTimeZone);
endTime = Utils.convertAlldayUtcToLocal(tempTime, endTime, mTimeZone);
final Time recycle = new Time();
startTime = Utils.convertAlldayUtcToLocal(recycle, startTime, mTimeZone);
endTime = Utils.convertAlldayUtcToLocal(recycle, endTime, mTimeZone);
}
// Skip over the days outside of the adapter's range
startDay = Math.max(startDay, dayAdapterInfo.start);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ private static void queryNextReminderAndSchedule(Cursor instancesCursor, Context
long localStartTime;
if (allday) {
// Adjust allday to local time.
localStartTime = Utils.convertAlldayUtcToLocal(timeObj, begin,
localStartTime = Utils.convertAlldayUtcToLocal(null, begin,
Utils.getCurrentTimezone());
} else {
localStartTime = begin;
Expand Down