| Index: content/public/android/java/src/org/chromium/content/browser/input/WeekPickerDialog.java
|
| diff --git a/content/public/android/java/src/org/chromium/content/browser/input/MonthPickerDialog.java b/content/public/android/java/src/org/chromium/content/browser/input/WeekPickerDialog.java
|
| similarity index 57%
|
| copy from content/public/android/java/src/org/chromium/content/browser/input/MonthPickerDialog.java
|
| copy to content/public/android/java/src/org/chromium/content/browser/input/WeekPickerDialog.java
|
| index 354810e5e429662ca400284a90d5dcc54cf3a054..7c64b455fcea6b7289aa259cf63cad43cb45aa3b 100644
|
| --- a/content/public/android/java/src/org/chromium/content/browser/input/MonthPickerDialog.java
|
| +++ b/content/public/android/java/src/org/chromium/content/browser/input/WeekPickerDialog.java
|
| @@ -12,43 +12,43 @@ import android.os.Build;
|
| import android.os.Bundle;
|
| import android.view.View;
|
|
|
| -import org.chromium.content.browser.input.MonthPicker.OnMonthChangedListener;
|
| +import org.chromium.content.browser.input.WeekPicker.OnWeekChangedListener;
|
| import org.chromium.content.R;
|
|
|
| -public class MonthPickerDialog extends AlertDialog implements OnClickListener,
|
| - OnMonthChangedListener {
|
| +public class WeekPickerDialog extends AlertDialog implements OnClickListener,
|
| + OnWeekChangedListener {
|
|
|
| private static final String YEAR = "year";
|
| - private static final String MONTH = "month";
|
| + private static final String WEEK = "week";
|
|
|
| - private final MonthPicker mMonthPicker;
|
| - private final OnMonthSetListener mCallBack;
|
| + private final WeekPicker mWeekPicker;
|
| + private final OnWeekSetListener mCallBack;
|
|
|
| /**
|
| * The callback used to indicate the user is done filling in the date.
|
| */
|
| - public interface OnMonthSetListener {
|
| + public interface OnWeekSetListener {
|
|
|
| /**
|
| * @param view The view associated with this listener.
|
| * @param year The year that was set.
|
| - * @param monthOfYear The month that was set (0-11) for compatibility
|
| + * @param weekOfYear The week in year.
|
| * with {@link java.util.Calendar}.
|
| */
|
| - void onMonthSet(MonthPicker view, int year, int monthOfYear);
|
| + void onWeekSet(WeekPicker view, int year, int weekOfYear);
|
| }
|
|
|
| /**
|
| * @param context The context the dialog is to run in.
|
| * @param callBack How the parent is notified that the date is set.
|
| * @param year The initial year of the dialog.
|
| - * @param monthOfYear The initial month of the dialog.
|
| + * @param weekOfYear The initial week of the dialog.
|
| */
|
| - public MonthPickerDialog(Context context,
|
| - OnMonthSetListener callBack,
|
| + public WeekPickerDialog(Context context,
|
| + OnWeekSetListener callBack,
|
| int year,
|
| - int monthOfYear) {
|
| - this(context, 0, callBack, year, monthOfYear);
|
| + int weekOfYear) {
|
| + this(context, 0, callBack, year, weekOfYear);
|
| }
|
|
|
| /**
|
| @@ -56,13 +56,13 @@ public class MonthPickerDialog extends AlertDialog implements OnClickListener,
|
| * @param theme the theme to apply to this dialog
|
| * @param callBack How the parent is notified that the date is set.
|
| * @param year The initial year of the dialog.
|
| - * @param monthOfYear The initial month of the dialog.
|
| + * @param weekOfYear The initial week of the dialog.
|
| */
|
| - public MonthPickerDialog(Context context,
|
| + public WeekPickerDialog(Context context,
|
| int theme,
|
| - OnMonthSetListener callBack,
|
| + OnWeekSetListener callBack,
|
| int year,
|
| - int monthOfYear) {
|
| + int weekOfYear) {
|
| super(context, theme);
|
|
|
| mCallBack = callBack;
|
| @@ -72,23 +72,23 @@ public class MonthPickerDialog extends AlertDialog implements OnClickListener,
|
| setButton(BUTTON_NEGATIVE, context.getText(android.R.string.cancel),
|
| (OnClickListener) null);
|
| setIcon(0);
|
| - setTitle(R.string.month_picker_dialog_title);
|
| + setTitle(R.string.week_picker_dialog_title);
|
|
|
| - mMonthPicker = new MonthPicker(context);
|
| - setView(mMonthPicker);
|
| - mMonthPicker.init(year, monthOfYear, this);
|
| + mWeekPicker = new WeekPicker(context);
|
| + setView(mWeekPicker);
|
| + mWeekPicker.init(year, weekOfYear, this);
|
| }
|
|
|
| @Override
|
| public void onClick(DialogInterface dialog, int which) {
|
| - tryNotifyMonthSet();
|
| + tryNotifyWeekSet();
|
| }
|
|
|
| - private void tryNotifyMonthSet() {
|
| + private void tryNotifyWeekSet() {
|
| if (mCallBack != null) {
|
| - mMonthPicker.clearFocus();
|
| - mCallBack.onMonthSet(mMonthPicker, mMonthPicker.getYear(),
|
| - mMonthPicker.getMonth());
|
| + mWeekPicker.clearFocus();
|
| + mCallBack.onWeekSet(mWeekPicker, mWeekPicker.getYear(),
|
| + mWeekPicker.getWeek());
|
| }
|
| }
|
|
|
| @@ -99,40 +99,40 @@ public class MonthPickerDialog extends AlertDialog implements OnClickListener,
|
| // Dismissing a dialog (by pressing back for example)
|
| // applies the chosen date. This code is added here so that the custom
|
| // pickers behave the same as the internal DatePickerDialog.
|
| - tryNotifyMonthSet();
|
| + tryNotifyWeekSet();
|
| }
|
| super.onStop();
|
| }
|
|
|
| @Override
|
| - public void onMonthChanged(MonthPicker view, int year, int month) {
|
| - mMonthPicker.init(year, month, null);
|
| + public void onWeekChanged(WeekPicker view, int year, int week) {
|
| + mWeekPicker.init(year, week, null);
|
| }
|
|
|
| /**
|
| - * Gets the {@link MonthPicker} contained in this dialog.
|
| + * Gets the {@link WeekPicker} contained in this dialog.
|
| *
|
| * @return The calendar view.
|
| */
|
| - public MonthPicker getMonthPicker() {
|
| - return mMonthPicker;
|
| + public WeekPicker getWeekPicker() {
|
| + return mWeekPicker;
|
| }
|
|
|
| /**
|
| * Sets the current date.
|
| *
|
| - * @param year The date year.
|
| - * @param monthOfYear The date month.
|
| + * @param year The date week year.
|
| + * @param weekOfYear The date week.
|
| */
|
| - public void updateDate(int year, int monthOfYear) {
|
| - mMonthPicker.updateMonth(year, monthOfYear);
|
| + public void updateDate(int year, int weekOfYear) {
|
| + mWeekPicker.updateWeek(year, weekOfYear);
|
| }
|
|
|
| @Override
|
| public Bundle onSaveInstanceState() {
|
| Bundle state = super.onSaveInstanceState();
|
| - state.putInt(YEAR, mMonthPicker.getYear());
|
| - state.putInt(MONTH, mMonthPicker.getMonth());
|
| + state.putInt(YEAR, mWeekPicker.getYear());
|
| + state.putInt(WEEK, mWeekPicker.getWeek());
|
| return state;
|
| }
|
|
|
| @@ -140,7 +140,7 @@ public class MonthPickerDialog extends AlertDialog implements OnClickListener,
|
| public void onRestoreInstanceState(Bundle savedInstanceState) {
|
| super.onRestoreInstanceState(savedInstanceState);
|
| int year = savedInstanceState.getInt(YEAR);
|
| - int month = savedInstanceState.getInt(MONTH);
|
| - mMonthPicker.init(year, month, this);
|
| + int week = savedInstanceState.getInt(WEEK);
|
| + mWeekPicker.init(year, week, this);
|
| }
|
| }
|
|
|