1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 package org.chromium.content.browser.input;
7 import android.content.Context;
9 import org.chromium.content.R;
11 public class MonthPickerDialog extends TwoFieldDatePickerDialog {
14 * @param context The context the dialog is to run in.
15 * @param callBack How the parent is notified that the date is set.
16 * @param year The initial year of the dialog.
17 * @param monthOfYear The initial month of the dialog.
19 public MonthPickerDialog(Context context, OnValueSetListener callBack,
20 int year, int monthOfYear, long minMonth, long maxMonth) {
21 super(context, callBack, year, monthOfYear, minMonth, maxMonth);
22 setTitle(R.string.month_picker_dialog_title);
26 protected TwoFieldDatePicker createPicker(Context context, long minValue, long maxValue) {
27 return new MonthPicker(context, minValue, maxValue);
31 protected void tryNotifyDateSet() {
32 if (mCallBack != null) {
33 MonthPicker picker = getMonthPicker();
35 mCallBack.onValueSet(picker.getYear(), picker.getMonth());
40 * Gets the {@link MonthPicker} contained in this dialog.
42 * @return The calendar view.
44 public MonthPicker getMonthPicker() {
45 return (MonthPicker) mPicker;