package kz.arta.synergy.workflow.mobile.android.common.components;

import android.app.Dialog;
import android.app.TimePickerDialog;
import android.os.Bundle;
import android.support.v4.app.DialogFragment;

/**
 * Created by neox on 15.04.14.
 * Диалог выбора времени
 */
public class TimePickerFragment extends DialogFragment {

    /**
     * Часы
     */
    public static final String HOURS = "HH";

    /**
     * Минуты
     */
    public static final String MINUTES = "mm";

    /**
     * CallBack
     */
    private TimePickerDialog.OnTimeSetListener onTimeSet;

    /**
     * Часы
     */
    private int hours;

    /**
     * Минуты
     */
    private int minutes;

    public TimePickerFragment() {
    }

    public void setCallBack(TimePickerDialog.OnTimeSetListener onTime) {
        onTimeSet = onTime;
    }

    @Override
    public void setArguments(Bundle args) {
        super.setArguments(args);
        hours = args.getInt("hour");
        minutes = args.getInt("minutes");
    }

    @Override
    public Dialog onCreateDialog(Bundle savedInstanceState) {
        return new TimePickerDialog(getActivity(), onTimeSet, hours, minutes, true);
    }
}