// Path: app/src/main/java/top/soyask/calendarii/utils/DayUtils.java
// public class DayUtils {
//     /**
//      * @param month 传入实际的月份
//      * @param year
//      * @return
//      */
//     public static int getMonthDayCount(int month, int year) {
//         month = month - 1;
//         switch (month) {
//             case Calendar.JANUARY:
//             case Calendar.MARCH:
//             case Calendar.MAY:
//             case Calendar.JULY:
//             case Calendar.AUGUST:
//             case Calendar.OCTOBER:
//             case Calendar.DECEMBER:
//                 return 31;
//             case Calendar.APRIL:
//             case Calendar.JUNE:
//             case Calendar.SEPTEMBER:
//             case Calendar.NOVEMBER:
//                 return 30;
//             case Calendar.FEBRUARY:
//                 return (year % 4 == 0 && year % 100 != 0) || (year % 400 == 0) ? 29 : 28;
//             default:
//                 throw new IllegalArgumentException("Didn't find this month(未找到该月份):" + month);
//         }
// 
//     }
// 
//     public static int getPrevMonthDayCount(int month, int year) {
//         if (month > 1) {
//             month--;
//         } else {
//             year--;
//         }
//         return getMonthDayCount(month, year);
//     }
// 
// 
//     public static int getDayForWeek(Calendar calendar) {
//         int date = calendar.get(Calendar.DAY_OF_MONTH);
//         if (date < 1 || date > 31) {
//             return 1;
//         }
//         return calendar.get(Calendar.DAY_OF_WEEK) - 1;
//     }
// 
//     public static int getWeekForMonth(Calendar calendar) {
//         int date = calendar.get(Calendar.DAY_OF_MONTH);
//         if (date < 1 || date > 31) {
//             return 1;
//         }
//         return calendar.get(Calendar.WEEK_OF_MONTH);
//     }
// }


import android.content.DialogInterface;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.design.widget.BottomSheetDialogFragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.NumberPicker;
import java.lang.reflect.Method;
import top.soyask.calendarii.R;
import top.soyask.calendarii.utils.DayUtils;
    public void onDestroy() {
        super.onDestroy();
    }

    private void setupNumberPicker() {
        mNpYear =  mContentView.findViewById(R.id.np_year);
        mNpMonth =  mContentView.findViewById(R.id.np_month);
        mNpDay =  mContentView.findViewById(R.id.np_day);

        mNpYear.setMinValue(1910);
        mNpYear.setMaxValue(2100);
        mNpYear.setValue(mYear);
        mNpYear.setOnValueChangedListener(this);
        mNpYear.setDescendantFocusability(ViewGroup.FOCUS_BLOCK_DESCENDANTS);

        mNpMonth.setDescendantFocusability(ViewGroup.FOCUS_BLOCK_DESCENDANTS);
        mNpMonth.setMinValue(1);
        mNpMonth.setMaxValue(12);
        mNpMonth.setFormatter(value -> value + "月");
        mNpMonth.setValue(mMonth);
        mNpMonth.setOnValueChangedListener(this);
        try {
            Method method = mNpMonth.getClass().getDeclaredMethod("changeValueByOne", boolean.class);
            method.setAccessible(true);
            method.invoke(mNpMonth, true);
        } catch (Exception e) {
            e.printStackTrace();
        }

        mNpDay.setMinValue(1);
// Path: app/src/main/java/top/soyask/calendarii/utils/DayUtils.java
// public class DayUtils {
//     /**
//      * @param month 传入实际的月份
//      * @param year
//      * @return
//      */
//     public static int getMonthDayCount(int month, int year) {
//         month = month - 1;
//         switch (month) {
//             case Calendar.JANUARY:
//             case Calendar.MARCH:
//             case Calendar.MAY:
//             case Calendar.JULY:
//             case Calendar.AUGUST:
//             case Calendar.OCTOBER:
//             case Calendar.DECEMBER:
//                 return 31;
//             case Calendar.APRIL:
//             case Calendar.JUNE:
//             case Calendar.SEPTEMBER:
//             case Calendar.NOVEMBER:
//                 return 30;
//             case Calendar.FEBRUARY:
//                 return (year % 4 == 0 && year % 100 != 0) || (year % 400 == 0) ? 29 : 28;
//             default:
//                 throw new IllegalArgumentException("Didn't find this month(未找到该月份):" + month);
//         }
// 
//     }
// 
//     public static int getPrevMonthDayCount(int month, int year) {
//         if (month > 1) {
//             month--;
//         } else {
//             year--;
//         }
//         return getMonthDayCount(month, year);
//     }
// 
// 
//     public static int getDayForWeek(Calendar calendar) {
//         int date = calendar.get(Calendar.DAY_OF_MONTH);
//         if (date < 1 || date > 31) {
//             return 1;
//         }
//         return calendar.get(Calendar.DAY_OF_WEEK) - 1;
//     }
// 
//     public static int getWeekForMonth(Calendar calendar) {
//         int date = calendar.get(Calendar.DAY_OF_MONTH);
//         if (date < 1 || date > 31) {
//             return 1;
//         }
//         return calendar.get(Calendar.WEEK_OF_MONTH);
//     }
// }


// Path: app/src/main/java/top/soyask/calendarii/ui/fragment/dialog/DateSelectDialog.java
import android.content.DialogInterface;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.design.widget.BottomSheetDialogFragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.NumberPicker;
import java.lang.reflect.Method;
import top.soyask.calendarii.R;
import top.soyask.calendarii.utils.DayUtils;

    public void onDestroy() {
        super.onDestroy();
    }

    private void setupNumberPicker() {
        mNpYear =  mContentView.findViewById(R.id.np_year);
        mNpMonth =  mContentView.findViewById(R.id.np_month);
        mNpDay =  mContentView.findViewById(R.id.np_day);

        mNpYear.setMinValue(1910);
        mNpYear.setMaxValue(2100);
        mNpYear.setValue(mYear);
        mNpYear.setOnValueChangedListener(this);
        mNpYear.setDescendantFocusability(ViewGroup.FOCUS_BLOCK_DESCENDANTS);

        mNpMonth.setDescendantFocusability(ViewGroup.FOCUS_BLOCK_DESCENDANTS);
        mNpMonth.setMinValue(1);
        mNpMonth.setMaxValue(12);
        mNpMonth.setFormatter(value -> value + "月");
        mNpMonth.setValue(mMonth);
        mNpMonth.setOnValueChangedListener(this);
        try {
            Method method = mNpMonth.getClass().getDeclaredMethod("changeValueByOne", boolean.class);
            method.setAccessible(true);
            method.invoke(mNpMonth, true);
        } catch (Exception e) {
            e.printStackTrace();
        }

        mNpDay.setMinValue(1);
        mNpDay.setMaxValue(30);