Example usage for android.app TimePickerDialog TimePickerDialog

List of usage examples for android.app TimePickerDialog TimePickerDialog

Introduction

In this page you can find the example usage for android.app TimePickerDialog TimePickerDialog.

Prototype

public TimePickerDialog(Context context, OnTimeSetListener listener, int hourOfDay, int minute,
        boolean is24HourView) 

Source Link

Document

Creates a new time picker dialog.

Usage

From source file:planets.position.DateTimeDialog.java

@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
    int id = getArguments().getInt("id");
    int hour = getArguments().getInt("hour");
    int min = getArguments().getInt("min");
    int month = getArguments().getInt("month");
    int day = getArguments().getInt("day");
    int year = getArguments().getInt("year");

    if (id == 0) {
        // time dialog
        return new TimePickerDialog(getActivity(), mTimeSetListener, hour, min, false);
    } else {/*from   w ww  .j  a v  a 2 s.  c  o m*/
        // date dialog
        return new DatePickerDialog(getActivity(), mDateSetListener, year, month, day);
    }
}

From source file:com.mvcoding.financius.feature.TimeDialogFragment.java

@NonNull
@Override//w  w w.j a  v a 2s  .c o  m
public Dialog onCreateDialog(Bundle savedInstanceState) {
    final int hourOfDay = getArguments().getInt(ARG_HOUR_OF_DAY);
    final int minuteOfHour = getArguments().getInt(ARG_MINUTE_OF_HOUR);

    return new TimePickerDialog(getActivity(), this, hourOfDay, minuteOfHour, true);
}

From source file:com.easyquite.ui.dialogs.fragments.EndTimeFragmentDialog.java

@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {

    TimePickerDialog timePickerDialog = new TimePickerDialog(getTargetFragment().getActivity(), timerPickerEnd,
            dateAndTime.get(Calendar.HOUR_OF_DAY), dateAndTime.get(Calendar.MINUTE), true);
    return timePickerDialog;
}

From source file:org.videolan.vlc.gui.dialogs.TimePickerDialogFragment.java

@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
    setStyle(STYLE_NO_FRAME, R.attr.advanced_options_style);
    action = getArguments().getInt("action");
    boolean is24 = true;
    int hour = 0;
    int minute = 0;
    if (action == ACTION_SLEEP) {
        // Use the current time as the default values for the picker
        final Calendar c = VLCApplication.sPlayerSleepTime != null ? VLCApplication.sPlayerSleepTime
                : Calendar.getInstance();
        hour = c.get(Calendar.HOUR_OF_DAY);
        minute = c.get(Calendar.MINUTE);
        is24 = DateFormat.is24HourFormat(getActivity());
    }//from  www  .j  a va 2  s .  c  o  m

    // Create a new instance of TimePickerDialog and return it
    return new TimePickerDialog(getActivity(), this, hour, minute, is24);
}

From source file:com.easyquite.ui.dialogs.fragments.StartTimeFragmentDialog.java

/**
 * Constructor with one parameter/*from  w  w w  .  j  a  v a2s. c  o m*/
 * 
 * @param activity
 */
public Dialog onCreateDialog(Bundle savedInstanceState) {

    TimePickerDialog timePickerDialog = new TimePickerDialog(getTargetFragment().getActivity(),
            timerPickerStart, dateAndTime.get(Calendar.HOUR_OF_DAY), dateAndTime.get(Calendar.MINUTE), true);

    return timePickerDialog;
}

From source file:com.ezac.gliderlogs.TimePickerDialogFragment.java

@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {

    // Creating a bundle object to pass currently set time to the fragment
    Bundle b = getArguments();/*from ww w . j a v  a 2s . co m*/
    mHour = b.getInt("set_hour");
    mMinute = b.getInt("set_minute");

    TimePickerDialog.OnTimeSetListener listener = new TimePickerDialog.OnTimeSetListener() {
        @Override
        public void onTimeSet(TimePicker view, int hourOfDay, int minute) {
            mHour = hourOfDay;
            mMinute = minute;
            // Creating a bundle object to pass currently set time to the fragment
            Bundle b = new Bundle();
            // Adding currently set time to bundle object
            b.putInt("set_hour", mHour);
            b.putInt("set_minute", mMinute);
            // Adding Current time in a string to bundle object
            b.putString("set_time", "Set Time : " + Integer.toString(mHour) + ":" + Integer.toString(mMinute));
            // Creating an instance of Message
            Message m = new Message();
            // Setting bundle object on the message object m
            m.setData(b);
            // Message m is sending using the message handler instantiated in MainActivity class
            mHandler.sendMessage(m);
        }
    };
    // Opening the TimePickerDialog window
    return new TimePickerDialog(getActivity(), listener, mHour, mMinute, true);
}

From source file:com.polyvi.xface.extension.XCalendarExt.java

/**
 * ??/*from   w w  w  .  ja v  a  2s . c  o  m*/
 *
 * @param hour
 *            ??
 * @param minute
 *            ?
 * */
private void getTime(final int hour, final int minute, final XCallbackContext callbackCtx) {
    mExtensionContext.getSystemContext().runOnUiThread(new Runnable() {
        @Override
        public void run() {
            new TimePickerDialog(getContext(), new TimePickerDialog.OnTimeSetListener() {
                @Override
                public void onTimeSet(TimePicker view, int hourOfDay, int minute) {
                    setTime(hourOfDay, minute, callbackCtx);
                }
            }, hour, minute, true).show();
        }
    });
}

From source file:com.polyvi.xface.extension.calendar.XCalendarExt.java

/**
 * ??/*from ww w  . j av  a 2  s. co m*/
 *
 * @param hour
 *            ??
 * @param minute
 *            ?
 */
private void getTime(final int hour, final int minute) {
    ((Activity) cordova.getActivity()).runOnUiThread(new Runnable() {
        @Override
        public void run() {
            new TimePickerDialog(cordova.getActivity(), new TimePickerDialog.OnTimeSetListener() {
                @Override
                public void onTimeSet(TimePicker view, int hourOfDay, int minute) {
                    setTime(hourOfDay, minute);
                }
            }, hour, minute, true).show();
        }
    });
}

From source file:org.alfresco.mobile.android.application.ui.form.picker.TimePickerFragment.java

@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
    // Use the current date as the default date in the picker
    final Calendar c = Calendar.getInstance();
    int hourOfDay = c.get(Calendar.HOUR_OF_DAY);
    int minute = c.get(Calendar.MINUTE);
    if (getArguments() != null && getArguments().containsKey(ARGUMENT_DATE)) {
        calendar = (GregorianCalendar) getArguments().get(ARGUMENT_DATE);
    }//from  w  w w  .  j a va2s  .  c om

    final TimePickerDialog picker = new TimePickerDialog(getActivity(), mListener, hourOfDay, minute, true);

    picker.setButton(DialogInterface.BUTTON_POSITIVE, getActivity().getString(android.R.string.ok),
            new DialogInterface.OnClickListener() {
                @Override
                public void onClick(DialogInterface dialog, int which) {
                    dismiss();
                }
            });
    picker.setButton(DialogInterface.BUTTON_NEUTRAL, getActivity().getString(R.string.clear),
            new DialogInterface.OnClickListener() {
                @Override
                public void onClick(DialogInterface dialog, int which) {
                    clearValue = true;
                    dismiss();
                }
            });
    picker.setButton(DialogInterface.BUTTON_NEGATIVE, getActivity().getString(R.string.cancel),
            new DialogInterface.OnClickListener() {
                @Override
                public void onClick(DialogInterface dialog, int which) {
                    isCancelled = true;
                    dismiss();
                }
            });
    return picker;

}

From source file:com.activiti.android.ui.fragments.form.picker.TimePickerFragment.java

@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
    // Use the current date as the default date in the picker
    final Calendar c = Calendar.getInstance();
    int hourOfDay = c.get(Calendar.HOUR_OF_DAY);
    int minute = c.get(Calendar.MINUTE);
    if (getArguments() != null && getArguments().containsKey(ARGUMENT_DATE)) {
        calendar = (GregorianCalendar) getArguments().get(ARGUMENT_DATE);
    }//from   w  ww.ja  v  a2s .c om

    final TimePickerDialog picker = new TimePickerDialog(getActivity(), mListener, hourOfDay, minute, true);

    picker.setButton(DialogInterface.BUTTON_POSITIVE, getActivity().getString(android.R.string.ok),
            new DialogInterface.OnClickListener() {
                @Override
                public void onClick(DialogInterface dialog, int which) {
                    dismiss();
                }
            });
    picker.setButton(DialogInterface.BUTTON_NEUTRAL, getActivity().getString(R.string.clear),
            new DialogInterface.OnClickListener() {
                @Override
                public void onClick(DialogInterface dialog, int which) {
                    clearValue = true;
                    dismiss();
                }
            });
    picker.setButton(DialogInterface.BUTTON_NEGATIVE, getActivity().getString(R.string.general_action_cancel),
            new DialogInterface.OnClickListener() {
                @Override
                public void onClick(DialogInterface dialog, int which) {
                    isCancelled = true;
                    dismiss();
                }
            });
    return picker;

}