Backout cset b2ccdc82053d (bug 809018) for wrong user

This commit is contained in:
Jim Chen 2013-01-23 21:43:53 -05:00
parent 9524840843
commit a90bf31a2b
2 changed files with 13 additions and 72 deletions

View File

@ -131,17 +131,6 @@
android:focusableInTouchMode="true" android:focusableInTouchMode="true"
/> />
<!-- AMPM -->
<android.widget.NumberPicker
android:id="@+id/ampm"
android:layout_width="60dip"
android:layout_height="wrap_content"
android:layout_marginLeft="1dip"
android:layout_marginRight="1dip"
android:focusable="true"
android:focusableInTouchMode="true"
/>
</LinearLayout> </LinearLayout>
</LinearLayout> </LinearLayout>

View File

@ -58,7 +58,6 @@ public class DateTimePicker extends FrameLayout {
private boolean mHourEnabled = true; private boolean mHourEnabled = true;
private boolean mMinuteEnabled = true; private boolean mMinuteEnabled = true;
private boolean mCalendarEnabled = false; private boolean mCalendarEnabled = false;
private boolean mIs12HourMode;
// Size of the screen in inches; // Size of the screen in inches;
private int mScreenWidth; private int mScreenWidth;
private int mScreenHeight; private int mScreenHeight;
@ -73,7 +72,6 @@ public class DateTimePicker extends FrameLayout {
private final NumberPicker mYearSpinner; private final NumberPicker mYearSpinner;
private final NumberPicker mHourSpinner; private final NumberPicker mHourSpinner;
private final NumberPicker mMinuteSpinner; private final NumberPicker mMinuteSpinner;
private final NumberPicker mAMPMSpinner;
private final CalendarView mCalendar; private final CalendarView mCalendar;
private final EditText mDaySpinnerInput; private final EditText mDaySpinnerInput;
private final EditText mMonthSpinnerInput; private final EditText mMonthSpinnerInput;
@ -81,10 +79,8 @@ public class DateTimePicker extends FrameLayout {
private final EditText mYearSpinnerInput; private final EditText mYearSpinnerInput;
private final EditText mHourSpinnerInput; private final EditText mHourSpinnerInput;
private final EditText mMinuteSpinnerInput; private final EditText mMinuteSpinnerInput;
private final EditText mAMPMSpinnerInput;
private Locale mCurrentLocale; private Locale mCurrentLocale;
private String[] mShortMonths; private String[] mShortMonths;
private String[] mShortAMPMs;
private int mNumberOfMonths; private int mNumberOfMonths;
private Calendar mTempDate; private Calendar mTempDate;
private Calendar mMinDate; private Calendar mMinDate;
@ -125,15 +121,9 @@ public class DateTimePicker extends FrameLayout {
mTempDate.getActualMaximum(Calendar.DAY_OF_MONTH)); mTempDate.getActualMaximum(Calendar.DAY_OF_MONTH));
} }
} else if (picker == mHourSpinner && mHourEnabled) { } else if (picker == mHourSpinner && mHourEnabled) {
if (mIs12HourMode) {
setTempDate(Calendar.HOUR, oldVal, newVal, 1, 12);
} else {
setTempDate(Calendar.HOUR_OF_DAY, oldVal, newVal, 0, 23); setTempDate(Calendar.HOUR_OF_DAY, oldVal, newVal, 0, 23);
}
} else if (picker == mMinuteSpinner && mMinuteEnabled) { } else if (picker == mMinuteSpinner && mMinuteEnabled) {
setTempDate(Calendar.MINUTE, oldVal, newVal, 0, 59); setTempDate(Calendar.MINUTE, oldVal, newVal, 0, 59);
} else if (picker == mAMPMSpinner && mHourEnabled) {
mTempDate.set(Calendar.AM_PM,newVal);
} else { } else {
throw new IllegalArgumentException(); throw new IllegalArgumentException();
} }
@ -159,15 +149,9 @@ public class DateTimePicker extends FrameLayout {
mTempDate.getActualMaximum(Calendar.DAY_OF_MONTH)); mTempDate.getActualMaximum(Calendar.DAY_OF_MONTH));
} }
} else if (picker == mHourSpinner && mHourEnabled){ } else if (picker == mHourSpinner && mHourEnabled){
if (mIs12HourMode) {
mTempDate.set(Calendar.HOUR, newVal);
} else {
mTempDate.set(Calendar.HOUR_OF_DAY, newVal); mTempDate.set(Calendar.HOUR_OF_DAY, newVal);
}
} else if (picker == mMinuteSpinner && mMinuteEnabled){ } else if (picker == mMinuteSpinner && mMinuteEnabled){
mTempDate.set(Calendar.MINUTE, newVal); mTempDate.set(Calendar.MINUTE, newVal);
} else if (picker == mAMPMSpinner && mHourEnabled) {
mTempDate.set(Calendar.AM_PM, newVal);
} else { } else {
throw new IllegalArgumentException(); throw new IllegalArgumentException();
} }
@ -212,7 +196,6 @@ public class DateTimePicker extends FrameLayout {
private void displayPickers() { private void displayPickers() {
setWeekShown(false); setWeekShown(false);
set12HourShown(mIs12HourMode);
if (mState == pickersState.DATETIME) { if (mState == pickersState.DATETIME) {
return; return;
} }
@ -327,18 +310,7 @@ public class DateTimePicker extends FrameLayout {
DEFAULT_END_YEAR); DEFAULT_END_YEAR);
mYearSpinnerInput = (EditText) mYearSpinner.getChildAt(1); mYearSpinnerInput = (EditText) mYearSpinner.getChildAt(1);
mAMPMSpinner = setupSpinner(R.id.ampm, 0, 1);
mAMPMSpinner.setFormatter(TWO_DIGIT_FORMATTER);
if (mIs12HourMode) {
mHourSpinner = setupSpinner(R.id.hour, 1, 12);
mAMPMSpinnerInput = (EditText) mAMPMSpinner.getChildAt(1);
mAMPMSpinner.setDisplayedValues(mShortAMPMs);
} else {
mHourSpinner = setupSpinner(R.id.hour, 0, 23); mHourSpinner = setupSpinner(R.id.hour, 0, 23);
mAMPMSpinnerInput = null;
}
mHourSpinner.setFormatter(TWO_DIGIT_FORMATTER); mHourSpinner.setFormatter(TWO_DIGIT_FORMATTER);
mHourSpinnerInput = (EditText) mHourSpinner.getChildAt(1); mHourSpinnerInput = (EditText) mHourSpinner.getChildAt(1);
@ -470,14 +442,8 @@ public class DateTimePicker extends FrameLayout {
} }
if (mHourEnabled) { if (mHourEnabled) {
if (mIs12HourMode) {
mHourSpinner.setValue(mCurrentDate.get(Calendar.HOUR));
mAMPMSpinner.setValue(mCurrentDate.get(Calendar.AM_PM));
mAMPMSpinner.setDisplayedValues(mShortAMPMs);
} else {
mHourSpinner.setValue(mCurrentDate.get(Calendar.HOUR_OF_DAY)); mHourSpinner.setValue(mCurrentDate.get(Calendar.HOUR_OF_DAY));
} }
}
if (mMinuteEnabled) { if (mMinuteEnabled) {
mMinuteSpinner.setValue(mCurrentDate.get(Calendar.MINUTE)); mMinuteSpinner.setValue(mCurrentDate.get(Calendar.MINUTE));
} }
@ -561,21 +527,12 @@ public class DateTimePicker extends FrameLayout {
} }
} }
private void set12HourShown(boolean shown) {
if (shown) {
mAMPMSpinner.setVisibility(VISIBLE);
} else {
mAMPMSpinner.setVisibility(GONE);
}
}
private void setHourShown(boolean shown) { private void setHourShown(boolean shown) {
if (shown) { if (shown) {
mHourSpinner.setVisibility(VISIBLE); mHourSpinner.setVisibility(VISIBLE);
mHourEnabled= true; mHourEnabled= true;
} else { } else {
mHourSpinner.setVisibility(GONE); mHourSpinner.setVisibility(GONE);
mAMPMSpinner.setVisibility(GONE);
mTimeSpinners.setVisibility(GONE); mTimeSpinners.setVisibility(GONE);
mHourEnabled = false; mHourEnabled = false;
} }
@ -599,18 +556,13 @@ public class DateTimePicker extends FrameLayout {
} }
mCurrentLocale = locale; mCurrentLocale = locale;
mIs12HourMode = !DateFormat.is24HourFormat(getContext());
mTempDate = getCalendarForLocale(mTempDate, locale); mTempDate = getCalendarForLocale(mTempDate, locale);
mMinDate = getCalendarForLocale(mMinDate, locale); mMinDate = getCalendarForLocale(mMinDate, locale);
mMaxDate = getCalendarForLocale(mMaxDate, locale); mMaxDate = getCalendarForLocale(mMaxDate, locale);
mCurrentDate = getCalendarForLocale(mCurrentDate, locale); mCurrentDate = getCalendarForLocale(mCurrentDate, locale);
mNumberOfMonths = mTempDate.getActualMaximum(Calendar.MONTH) + 1; mNumberOfMonths = mTempDate.getActualMaximum(Calendar.MONTH) + 1;
mShortAMPMs = new String[2];
mShortAMPMs[0] = DateUtils.getAMPMString(Calendar.AM);
mShortAMPMs[1] = DateUtils.getAMPMString(Calendar.PM);
mShortMonths = new String[mNumberOfMonths]; mShortMonths = new String[mNumberOfMonths];
for (int i = 0; i < mNumberOfMonths; i++) { for (int i = 0; i < mNumberOfMonths; i++) {
mShortMonths[i] = DateUtils.getMonthString(Calendar.JANUARY + i, mShortMonths[i] = DateUtils.getMonthString(Calendar.JANUARY + i,