From 7fea9b963905981df58db5d57d0c7ae9b2c2f6f9 Mon Sep 17 00:00:00 2001 From: Lionel Mamane Date: Fri, 6 Oct 2023 10:42:35 +0200 Subject: [PATCH] debugging traces --- .../widget/CalendarAppWidgetModel.java | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/app/src/main/java/com/android/calendar/widget/CalendarAppWidgetModel.java b/app/src/main/java/com/android/calendar/widget/CalendarAppWidgetModel.java index a8b720720..c3aab16c8 100644 --- a/app/src/main/java/com/android/calendar/widget/CalendarAppWidgetModel.java +++ b/app/src/main/java/com/android/calendar/widget/CalendarAppWidgetModel.java @@ -48,10 +48,13 @@ class CalendarAppWidgetModel { private boolean mShowTZ; public CalendarAppWidgetModel(Context context, String timeZone) { + Log.d(TAG, "CAWM: timeZone=" + timeZone); mNow = System.currentTimeMillis(); Time time = new Time(timeZone); time.set(mNow); // This is needed for gmtoff to be set mTodayJulianDay = Time.getJulianDay(mNow, time.getGmtOffset()); + Log.d(TAG, "CAWM: time.gGO=" + time.getGmtOffset()); + Log.d(TAG, "CAWM: mTJD=" + mTodayJulianDay); mMaxJulianDay = mTodayJulianDay + CalendarAppWidgetService.MAX_DAYS - 1; mEventInfos = new ArrayList(50); mRowInfos = new ArrayList(50); @@ -60,6 +63,7 @@ public CalendarAppWidgetModel(Context context, String timeZone) { } public void buildFromCursor(Cursor cursor, String timeZone) { + Log.d(TAG, "bFC: timeZone=" + timeZone); final Time recycle = new Time(timeZone); final ArrayList> mBuckets = new ArrayList>(CalendarAppWidgetService.MAX_DAYS); @@ -203,12 +207,25 @@ private EventInfo populateEventInfo(long eventId, boolean allDay, long start, lo } private DayInfo populateDayInfo(int julianDay, Time recycle) { + Log.d(TAG, "pDI: jD=" + julianDay); + Log.d(TAG, "pDI: r.gTZ=" + recycle.getTimezone()); + final int EPOCH_JULIAN_DAY = 2440588; + final long HOUR_IN_MILLIS = 60 * 60 * 1000; + final long DAY_IN_MILLIS = 24 * HOUR_IN_MILLIS; + long millis = recycle.setJulianDay(julianDay); int flags = + DateUtils.FORMAT_UTC | DateUtils.FORMAT_ABBREV_ALL | DateUtils.FORMAT_SHOW_DATE | DateUtils.FORMAT_SHOW_WEEKDAY; + Log.d(TAG, "pDI: millis=" + millis); + long tmpMillis = (julianDay - EPOCH_JULIAN_DAY) * DAY_IN_MILLIS; + Log.d(TAG, "pDI: tmpMillis=" + tmpMillis); + Log.d(TAG, "pDI: gjD(tmpMillis, recycle.gGO)=" + Time.getJulianDay(tmpMillis, recycle.getGmtOffset())); + Log.d(TAG, "pDI: monthDay correction: =" + (julianDay - Time.getJulianDay(tmpMillis, recycle.getGmtOffset()))); + String label; if (julianDay == mTodayJulianDay + 1) { label = mContext.getString(R.string.agenda_tomorrow, @@ -216,6 +233,7 @@ private DayInfo populateDayInfo(int julianDay, Time recycle) { } else { label = Utils.formatDateRange(mContext, millis, millis, flags); } + Log.d(TAG, "pDI: label is '" + label + "'"); return new DayInfo(julianDay, label); }