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:com.matthewmitchell.wakeifyplus.TimePickerFragment.java

@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {

    // Create a new instance of TimePickerDialog and return it
    return new TimePickerDialog(getActivity(), (OnTimeSetListener) activity, hour, minute,
            DateFormat.is24HourFormat(getActivity()));
}

From source file:org.libreoffice.impressremote.fragment.TimerSettingDialog.java

@Override
public Dialog onCreateDialog(Bundle aSavedInstanceState) {
    TimePickerDialog aDialog = new TimePickerDialog(getActivity(), this, INITIAL_HOUR, INITIAL_MINUTE,
            IS_24_HOUR_VIEW);/*from  ww w  .j a  va  2 s  . c o m*/

    aDialog.setTitle(R.string.title_timer);

    aDialog.setButton(DialogInterface.BUTTON_POSITIVE, getString(R.string.button_start), this);

    return aDialog;
}

From source file:com.googlecode.android_scripting.facade.ui.TimePickerDialogTask.java

@Override
public void onCreate() {
    super.onCreate();
    mDialog = new TimePickerDialog(getActivity(), new TimePickerDialog.OnTimeSetListener() {
        public void onTimeSet(TimePicker view, int hour, int minute) {
            JSONObject result = new JSONObject();
            try {
                result.put("which", "positive");
                result.put("hour", hour);
                result.put("minute", minute);
                setResult(result);/*  w  w w.  ja  va2 s.c o  m*/
            } catch (JSONException e) {
                throw new AndroidRuntimeException(e);
            }
        }
    }, mHour, mMinute, mIs24Hour);
    mDialog.setOnCancelListener(new DialogInterface.OnCancelListener() {
        public void onCancel(DialogInterface view) {
            JSONObject result = new JSONObject();
            try {
                result.put("which", "neutral");
                result.put("hour", mHour);
                result.put("minute", mMinute);
                setResult(result);
            } catch (JSONException e) {
                throw new AndroidRuntimeException(e);
            }
        }
    });
    mDialog.setOnDismissListener(new DialogInterface.OnDismissListener() {
        public void onDismiss(DialogInterface dialog) {
            JSONObject result = new JSONObject();
            try {
                result.put("which", "negative");
                result.put("hour", mHour);
                result.put("minute", mMinute);
                setResult(result);
            } catch (JSONException e) {
                throw new AndroidRuntimeException(e);
            }
        }
    });
    mDialog.show();
    mShowLatch.countDown();
}

From source file:com.kyleszombathy.sms_scheduler.TimePickerFragment.java

@NonNull
@Override//from w ww  .  j a v a  2  s .c  om
public Dialog onCreateDialog(Bundle savedInstanceState) {
    // Use the current time as the default values for the picker
    final Calendar c = Calendar.getInstance();
    int hour = c.get(Calendar.HOUR_OF_DAY);
    int minute = c.get(Calendar.MINUTE);

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

From source file:com.ferid.app.classroom.date_time_pickers.TimePickerFragment.java

@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
    dateBackListener = (DateBackListener) getActivity();

    // Use the current time as the default values for the picker
    final Calendar c = Calendar.getInstance();
    int hour = c.get(Calendar.HOUR_OF_DAY);
    int minute = c.get(Calendar.MINUTE);

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

From source file:in.darbose.classroom.date_time_pickers.TimePickerFragment.java

@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
    backNavigationListener = (BackNavigationListener) getActivity();

    // Use the current time as the default values for the picker
    final Calendar c = Calendar.getInstance();
    int hour = c.get(Calendar.HOUR_OF_DAY);
    int minute = c.get(Calendar.MINUTE);

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

From source file:com.jefftharris.passwdsafe.view.TimePickerDialogFragment.java

@NonNull
@Override// www  .ja  v  a2s  .  c om
public Dialog onCreateDialog(Bundle savedInstanceState) {
    Bundle args = getArguments();
    Calendar now = Calendar.getInstance();
    int hourOfDay = args.getInt("hourOfDay", now.get(Calendar.HOUR_OF_DAY));
    int minute = args.getInt("minute", now.get(Calendar.MINUTE));

    return new TimePickerDialog(getContext(), this, hourOfDay, minute, DateFormat.is24HourFormat(getContext()));
}

From source file:net.alexjf.tmm.fragments.TimePickerFragment.java

@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
    if (savedInstanceState != null) {
        String savedTime = savedInstanceState.getString(KEY_CURRENTTIME);
        try {/*from w ww.j  ava2 s  .  c  o m*/
            time.setTime(timeFormat.parse(savedTime));
        } catch (ParseException e) {
            Log.e("TMM", "Unable to parse saved time", e);
        }
    }
    // Use the current time as the default time in the picker
    int hours = getHours();
    int minutes = getMinutes();

    // Create a new instance of TimePickerDialog and return it
    return new TimePickerDialog(getActivity(), listener, hours, minutes, true);
}

From source file:org.hancel.adapters.customUi.TimePickerFragment.java

@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
    // Use the current time as the default values for the picker
    if (!isCustomDate) {
        calendar = Calendar.getInstance();
    }/* w w w .  jav a  2s .co m*/

    int hour = calendar.get(Calendar.HOUR_OF_DAY);
    int minute = calendar.get(Calendar.MINUTE);

    // Create a new instance of TimePickerDialog and return it
    return new TimePickerDialog(getActivity(), (TrackDialog) getActivity(), hour, minute,
            DateFormat.is24HourFormat(getActivity()));
}

From source file:com.fullmeadalchemist.mustwatch.ui.common.TimePickerFragment.java

@NonNull
@Override/* w w  w  .  ja  v  a2 s . c o m*/
public Dialog onCreateDialog(Bundle savedInstanceState) {
    // Use the current time as the default values for the picker
    final Calendar c = Calendar.getInstance();
    int hour = c.get(Calendar.HOUR_OF_DAY);
    int minute = c.get(Calendar.MINUTE);

    boolean is24HourFormat = DateFormat.is24HourFormat(getActivity());
    return new TimePickerDialog(getActivity(), this, hour, minute, is24HourFormat);
}