package com.wd.workoffice.util;

import android.content.Context;

import com.bigkoo.pickerview.builder.TimePickerBuilder;
import com.bigkoo.pickerview.listener.OnTimeSelectListener;
import com.bigkoo.pickerview.view.TimePickerView;

import java.util.Calendar;

public class PickTimeUtils {

    public static TimePickerView showPick(Context ctx, OnTimeSelectListener listener) {
//        Calendar startDate = Calendar.getInstance();
//        Calendar endDate = Calendar.getInstance();

        //正确设置方式 原因：注意事项有说明
        TimePickerBuilder pvTime = new TimePickerBuilder(ctx, listener);
        pvTime.setType(new boolean[]{true, true, true, true, true, true}).setTitleSize(14).setContentTextSize(14).setSubCalSize(14);
//                .setRangDate(startDate, endDate);
        return pvTime.build();
    }

    public static TimePickerView showPickThree(Context ctx, OnTimeSelectListener listener) {
//        TimePickerBuilder pvTime = new TimePickerBuilder(ctx, listener);
//        pvTime.setType(new boolean[]{true, true, true, false, false, false}).setTitleSize(16).setContentTextSize(16).
//                setSubCalSize(16);
////                .setRangDate(startDate, endDate);
        return showPickThree(ctx,listener,true);
    }

    public static TimePickerView showPickThree(Context ctx, OnTimeSelectListener listener, boolean todayStart) {
        TimePickerBuilder pvTime = new TimePickerBuilder(ctx, listener);
        if (todayStart) {
            pvTime.setRangDate(Calendar.getInstance(), null);
        }
        pvTime.setType(new boolean[]{true, true, true, false, false, false}).setTitleSize(16).setContentTextSize(16).
                setSubCalSize(16);
//                .setRangDate(startDate, endDate);
        return pvTime.build();
    }

    public static TimePickerView showPickTwo(Context ctx, OnTimeSelectListener listener,boolean todayEnd) {
        TimePickerBuilder pvTime = new TimePickerBuilder(ctx, listener);
        pvTime.setType(new boolean[]{true, true, false, false, false, false}).setTitleSize(16).setContentTextSize(16).
                setSubCalSize(16);
        if (todayEnd) {
            pvTime.setRangDate(null, Calendar.getInstance());
        }
        return pvTime.build();
    }
    public static TimePickerView showPickTwo(Context ctx, OnTimeSelectListener listener) {
        TimePickerBuilder pvTime = new TimePickerBuilder(ctx, listener);
        pvTime.setType(new boolean[]{true, true, false, false, false, false}).setTitleSize(16).setContentTextSize(16).
                setSubCalSize(16);
        return pvTime.build();
    }
}
