package gt.twsample.simplemcal;

import android.app.Dialog;
import android.os.Bundle;
import android.support.v4.app.DialogFragment;
import android.app.DatePickerDialog;
import android.widget.DatePicker;

import java.util.Calendar;
import java.util.GregorianCalendar;

import gt.twsample.simplemcal.util.CalUtil;
import gt.twsample.simplemcal.util.McalDate;

/**
 * Created by takashi.watanabe on 2017/02/08.
 */

public class DatePickerDialogFragment extends DialogFragment
        implements DatePickerDialog.OnDateSetListener {

    static DatePickerDialogFragment newInstance(McalDate mDate) {
        DatePickerDialogFragment f = new DatePickerDialogFragment();
        Bundle b = new Bundle();
        Calendar cal = mDate.getCal();
        b.putInt("year", cal.get(Calendar.YEAR));
        b.putInt("month", cal.get(Calendar.MONTH));
        b.putInt("day", cal.get(Calendar.DATE));
        f.setArguments(b);
        return f;
    }
    @Override
    public Dialog onCreateDialog(Bundle savedInstanceState){
        int year  = getArguments().getInt("year");
        int month = getArguments().getInt("month");
        int day   = getArguments().getInt("day");
        return new DatePickerDialog(getActivity(), this, year, month, day);
    }
    @Override
    public void onDateSet(DatePicker view, int year, int month, int dayOfMonth) {
        final Calendar cal = new GregorianCalendar(year, month, dayOfMonth);
        CalUtil.updateCalToNoon(cal);
        MainActivity ma = (MainActivity)getActivity();
        ma.updateMcal(cal);
        ma.setInputFreeDate(cal);
    }
}

@@ -1235,32 +1235,96 @@
 th, day);%0A    %7D%0A
+    // %E3%82%AB%E3%83%AC%E3%83%B3%E3%83%80%E3%83%BC%E3%81%8B%E3%82%89%E6%88%BB%E3%81%A3%E3%81%9F%E6%99%82%0A    // %E8%A1%A8%E7%A4%BA%E3%81%AE%E6%97%A5%E4%BB%98%E3%82%92%E6%9B%B4%E6%96%B0%E3%81%99%E3%82%8B%0A    // %E4%B8%8B%E9%83%A8%E3%81%AE%E3%83%86%E3%82%AD%E3%82%B9%E3%83%88%E3%83%9C%E3%83%83%E3%82%AF%E3%82%B9%E3%81%AE%E6%97%A5%E4%BB%98%E3%82%92%E6%9B%B4%E6%96%B0%E3%81%99%E3%82%8B%0A
     @Override%0A  

add coments