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..c4881a2c6e2ea02fb9e19643229883e8f2e3d8b7 |
--- /dev/null |
+++ b/content/public/android/java/src/org/chromium/content/browser/input/WeekPickerDialog.java |
@@ -0,0 +1,66 @@ |
+// Copyright (c) 2012 The Chromium Authors. All rights reserved. |
+// 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; |
+ |
+public class WeekPickerDialog extends BaseDatePickerDialog { |
+ |
+ /** |
+ * @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) { |
+ this(context, 0, callBack, year, weekOfYear); |
+ } |
+ |
+ /** |
+ * @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) { |
+ super(context, theme, callBack, year, weekOfYear); |
+ } |
+ |
+ @Override |
+ protected BaseDatePicker createPicker(Context context) { |
+ return new WeekPicker(context); |
+ } |
+ |
+ @Override |
+ protected void tryNotifyDateSet() { |
+ if (mCallBack != null) { |
+ WeekPicker picker = getWeekPicker(); |
+ picker.clearFocus(); |
+ mCallBack.onWeekSet(picker, picker.getYear(), picker.getWeek()); |
+ } |
+ } |
+ |
+ @Override |
+ public void onWeekChanged(WeekPicker view, int year, int week) { |
+ mPicker.init(year, week, null); |
+ } |
+ |
+ /** |
+ * Gets the {@link WeekPicker} contained in this dialog. |
+ * |
+ * @return The calendar view. |
+ */ |
+ public WeekPicker getWeekPicker() { |
+ return (WeekPicker) mPicker; |
+ } |
+} |