Skip to content

Commit

Permalink
debugging traces
Browse files Browse the repository at this point in the history
  • Loading branch information
Lionel Mamane committed Oct 6, 2023
1 parent bf48961 commit 7fea9b9
Showing 1 changed file with 18 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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<EventInfo>(50);
mRowInfos = new ArrayList<RowInfo>(50);
Expand All @@ -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<LinkedList<RowInfo>> mBuckets =
new ArrayList<LinkedList<RowInfo>>(CalendarAppWidgetService.MAX_DAYS);
Expand Down Expand Up @@ -203,19 +207,33 @@ 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,
Utils.formatDateRange(mContext, millis, millis, flags));
} else {
label = Utils.formatDateRange(mContext, millis, millis, flags);
}
Log.d(TAG, "pDI: label is '" + label + "'");
return new DayInfo(julianDay, label);
}

Expand Down

0 comments on commit 7fea9b9

Please sign in to comment.