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

Commit da7cc2d2 authored by Alan Viverette's avatar Alan Viverette
Browse files

Add temporary logging to SimpleMonthView

We can remove this once we figure out why the dates are messed up.

Bug: 27310206
Change-Id: I34fff5251124cc0867955255189ed323dc7170c1
parent 366e137c
Loading
Loading
Loading
Loading
+22 −0
Original line number Diff line number Diff line
@@ -33,6 +33,7 @@ import android.text.TextPaint;
import android.text.format.DateFormat;
import android.util.AttributeSet;
import android.util.IntArray;
import android.util.Log;
import android.util.MathUtils;
import android.util.StateSet;
import android.view.KeyEvent;
@@ -69,6 +70,9 @@ class SimpleMonthView extends View {

    private static final int SELECTED_HIGHLIGHT_ALPHA = 0xB0;

    /** Temporary until we figure out why the date gets messed up. */
    private static final boolean DEBUG_WRONG_DATE = true;

    private final TextPaint mMonthPaint = new TextPaint();
    private final TextPaint mDayOfWeekPaint = new TextPaint();
    private final TextPaint mDayPaint = new TextPaint();
@@ -189,6 +193,12 @@ class SimpleMonthView extends View {
    }

    private void updateDayOfWeekLabels() {
        if (DEBUG_WRONG_DATE) {
            Log.d(LOG_TAG, "enter updateDayOfWeekLabels()", new Exception());
            Log.d(LOG_TAG, "mLocale => " + mLocale);
            Log.d(LOG_TAG, "mWeekStart => " + mWeekStart);
        }

        final Calendar calendar = Calendar.getInstance(mLocale);
        calendar.setFirstDayOfWeek(mWeekStart);

@@ -197,6 +207,10 @@ class SimpleMonthView extends View {
            calendar.set(Calendar.DAY_OF_WEEK, i);
            mDayOfWeekLabels[i] = formatter.format(calendar.getTime());
        }

        if (DEBUG_WRONG_DATE) {
            Log.d(LOG_TAG, "mDayOfWeekLabels <= " + Arrays.toString(mDayOfWeekLabels));
        }
    }

    /**
@@ -760,12 +774,20 @@ class SimpleMonthView extends View {
     *                  {@link Calendar#SUNDAY} through {@link Calendar#SATURDAY}
     */
    public void setFirstDayOfWeek(int weekStart) {
        if (DEBUG_WRONG_DATE) {
            Log.d(LOG_TAG, "enter setFirstDayOfWeek(" + weekStart + ")", new Exception());
        }

        if (isValidDayOfWeek(weekStart)) {
            mWeekStart = weekStart;
        } else {
            mWeekStart = mCalendar.getFirstDayOfWeek();
        }

        if (DEBUG_WRONG_DATE) {
            Log.d(LOG_TAG, "mWeekStart <=" + mWeekStart);
        }

        updateDayOfWeekLabels();

        // Invalidate cached accessibility information.