/* (C) 2012 Pragmatic Software
   This Source Code Form is subject to the terms of the Mozilla Public
   License, v. 2.0. If a copy of the MPL was not distributed with this
   file, You can obtain one at http://mozilla.org/MPL/2.0/
   */

package com.googlecode.networklog;

import android.app.DatePickerDialog;
import android.app.Dialog;
import android.os.Bundle;

import android.support.v4.app.DialogFragment;

public class DatePickerFragment extends DialogFragment {
  int year;
  int month;
  int day;
  DatePickerDialog.OnDateSetListener listener;

  public DatePickerFragment() {
  }

  public DatePickerFragment(int year, int month, int day, DatePickerDialog.OnDateSetListener listener) {
    this(year, month, day);
    this.listener = listener;
  }

  public DatePickerFragment(int year, int month, int day) {
    this.year = year;
    this.month = month;
    this.day = day;
  }

  public void setListener(DatePickerDialog.OnDateSetListener listener) {
    this.listener = listener;
  }

  @Override
    public Dialog onCreateDialog(Bundle savedInstanceState) {
      return new DatePickerDialog(getActivity(), this.listener, this.year, this.month, this.day);
    }
}


@@ -359,16 +359,44 @@
 undle;%0A%0A
+import java.util.Calendar;%0A%0A
 import a
@@ -607,16 +607,188 @@
 ent() %7B%0A
+    Calendar cal = Calendar.getInstance();%0A    this.year = cal.get(Calendar.YEAR);%0A    this.month = cal.get(Calendar.MONTH);%0A    this.day = cal.get(Calendar.DAY_OF_MONTH);%0A
   %7D%0A%0A  p

Fix issue with DatePicker rotation in FROYO/GINGERBREAD