Chromium Code Reviews| 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/WeekPickerDialog.java b/content/public/android/java/src/org/chromium/content/browser/input/WeekPickerDialog.java |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..555987c8529b4049b6b3affa69672e8ab48a1d8f |
| --- /dev/null |
| +++ b/content/public/android/java/src/org/chromium/content/browser/input/WeekPickerDialog.java |
| @@ -0,0 +1,65 @@ |
| +// Copyright (c) 2012 The Chromium Authors. All rights reserved. |
|
Miguel Garcia
2013/06/11 13:02:52
nit 2013
keishi
2013/06/12 13:23:07
Done.
|
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +package org.chromium.content.browser.input; |
| + |
| +import android.content.Context; |
| + |
| +import org.chromium.content.R; |
| + |
| +public class WeekPickerDialog extends TwoFieldDatePickerDialog { |
| + |
| + /** |
| + * @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 weekOfYear The initial week of the dialog. |
| + */ |
| + public WeekPickerDialog(Context context, |
| + OnMonthOrWeekSetListener callBack, |
| + int year, int weekOfYear, |
| + long minValue, long maxValue) { |
| + this(context, 0, callBack, year, weekOfYear, minValue, maxValue); |
| + } |
| + |
| + /** |
| + * @param context The context the dialog is to run in. |
| + * @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 weekOfYear The initial week of the dialog. |
| + */ |
| + public WeekPickerDialog(Context context, |
| + int theme, |
| + OnMonthOrWeekSetListener callBack, |
| + int year, |
| + int weekOfYear, |
| + long minValue, long maxValue) { |
| + super(context, theme, callBack, year, weekOfYear, minValue, maxValue); |
| + setTitle(R.string.week_picker_dialog_title); |
| + } |
| + |
| + @Override |
| + protected TwoFieldDatePicker createPicker(Context context, long minValue, long maxValue) { |
| + return new WeekPicker(context, minValue, maxValue); |
| + } |
| + |
| + @Override |
| + protected void tryNotifyDateSet() { |
| + if (mCallBack != null) { |
| + WeekPicker picker = getWeekPicker(); |
| + picker.clearFocus(); |
| + mCallBack.onWeekSet(picker, picker.getYear(), picker.getWeek()); |
| + } |
| + } |
| + |
| + /** |
| + * Gets the {@link WeekPicker} contained in this dialog. |
| + * |
| + * @return The calendar view. |
| + */ |
| + public WeekPicker getWeekPicker() { |
| + return (WeekPicker) mPicker; |
| + } |
| +} |