Merge "Add temporary logging to SimpleMonthView" into nyc-dev
am: d969cc6856
* commit 'd969cc68560bbec8d17c610b9330155ea8c65624':
Add temporary logging to SimpleMonthView
This commit is contained in:
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user