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, int themeResId, OnTimeSetListener listener, int hourOfDay, int minute,
        boolean is24HourView) 

Source Link

Document

Creates a new time picker dialog with the specified theme.

Usage

From source file:com.dycody.android.idealnote.utils.date.TimePickerFragment.java

@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {

    Calendar cal = DateUtils.getCalendar(defaultTime);
    int hour = cal.get(Calendar.HOUR_OF_DAY);
    int minute = cal.get(Calendar.MINUTE);

    // Create a new instance of TimePickerDialog and return it
    boolean is24HourMode = DateUtils.is24HourMode(mActivity);
    TimePickerDialog tpd = new TimePickerDialog(mActivity,
            com.dycody.android.idealnote.R.style.Theme_AppCompat_Dialog_NoBackgroundOrDim, mListener, hour,
            minute, is24HourMode);//from  www . j  av  a  2  s.  c  o m
    tpd.setTitle("");
    return tpd;
}

From source file:it.feio.android.omninotes.utils.date.TimePickerFragment.java

@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {

    Calendar cal = DateUtils.getCalendar(defaultTime);
    int hour = cal.get(Calendar.HOUR_OF_DAY);
    int minute = cal.get(Calendar.MINUTE);

    // Create a new instance of TimePickerDialog and return it
    boolean is24HourMode = DateUtils.is24HourMode(mActivity);
    TimePickerDialog tpd = new TimePickerDialog(mActivity, R.style.Theme_AppCompat_Dialog_NoBackgroundOrDim,
            mListener, hour, minute, is24HourMode);
    tpd.setTitle("");
    return tpd;//from   ww w .j  a v a  2s .co m
}

From source file:org.schabi.terminightor.AlarmItemDetailFragment.java

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setHasOptionsMenu(true);//from w w w  . ja va 2 s.  c  om

    dbHandler = AlarmDBOpenHelper.getAlarmDBOpenHelper(getActivity());

    timePickerDialog = new TimePickerDialog(getActivity(), R.style.AppTheme_Timepicker,
            new TimePickerDialog.OnTimeSetListener() {
                @Override
                public void onTimeSet(TimePicker view, int hourOfDay, int minute) {
                    try {
                        alarm.setHour(hourOfDay);
                        alarm.setMinute(minute);
                    } catch (Exception e) {
                        e.printStackTrace();
                    }
                    setAlarmTimeView.setText(alarm.getTimeString(use24Hours));
                    setAlarmAMPMView.setText(alarm.getAMPMSuffix(use24Hours));
                    timeValueSet = true;
                }
            }, 0, 0, true);

    use24Hours = PreferenceManager.getDefaultSharedPreferences(getActivity())
            .getBoolean(this.getString(R.string.use24Hours), false);
}

From source file:com.fastbootmobile.encore.app.MainActivity.java

private void showSleepTimerPicker() {
    TimePickerDialog dlg;//from   w ww.j a va2 s  . c  o m
    if (Utils.hasLollipop()) {
        dlg = new TimePickerDialog(this, R.style.TimePickerAppDialog, this, 0, 0, true);
    } else {
        dlg = new TimePickerDialog(this, this, 0, 0, true);
    }
    dlg.show();
}

From source file:com.fastbootmobile.encore.app.MainActivity.java

private void showSleepTimerPicker(int hour, int minute) {
    TimePickerDialog dlg;//w  w  w  .  j  av  a  2  s  .c  o m
    if (Utils.hasLollipop()) {
        dlg = new TimePickerDialog(this, R.style.TimePickerAppDialog, this, hour, minute, true);
    } else {
        dlg = new TimePickerDialog(this, this, hour, minute, true);
    }
    dlg.show();
}