Search in sources :

Example 6 with TimePickerDialog

use of android.app.TimePickerDialog in project android_frameworks_base by ParanoidAndroid.

the class TimeDialogActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    FrameLayout layout = new FrameLayout(this);
    Button b = new Button(this);
    b.setLayoutParams(new FrameLayout.LayoutParams(FrameLayout.LayoutParams.WRAP_CONTENT, FrameLayout.LayoutParams.WRAP_CONTENT, Gravity.CENTER));
    b.setText("Show dialog");
    b.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            new TimePickerDialog(TimeDialogActivity.this, null, 12, 12, true).show();
        }
    });
    layout.addView(b);
    setContentView(layout);
}
Also used : Button(android.widget.Button) FrameLayout(android.widget.FrameLayout) TimePickerDialog(android.app.TimePickerDialog) View(android.view.View)

Example 7 with TimePickerDialog

use of android.app.TimePickerDialog in project Etar-Calendar by Etar-Group.

the class OtherPreferences method onCreate.

@Override
public void onCreate(Bundle icicle) {
    super.onCreate(icicle);
    PreferenceManager manager = getPreferenceManager();
    manager.setSharedPreferencesName(SHARED_PREFS_NAME);
    SharedPreferences prefs = manager.getSharedPreferences();
    addPreferencesFromResource(R.xml.other_preferences);
    mCopyDb = findPreference(KEY_OTHER_COPY_DB);
    mSkipReminders = (ListPreference) findPreference(KEY_OTHER_REMINDERS_RESPONDED);
    String skipPreferencesValue = null;
    if (mSkipReminders != null) {
        skipPreferencesValue = mSkipReminders.getValue();
        mSkipReminders.setOnPreferenceChangeListener(this);
    }
    updateSkipRemindersSummary(skipPreferencesValue);
    Activity activity = getActivity();
    if (activity == null) {
        Log.d(TAG, "Activity was null");
    }
    mIs24HourMode = DateFormat.is24HourFormat(activity);
    mQuietHours = (CheckBoxPreference) findPreference(KEY_OTHER_QUIET_HOURS);
    int startHour = prefs.getInt(KEY_OTHER_QUIET_HOURS_START_HOUR, QUIET_HOURS_DEFAULT_START_HOUR);
    int startMinute = prefs.getInt(KEY_OTHER_QUIET_HOURS_START_MINUTE, QUIET_HOURS_DEFAULT_START_MINUTE);
    mQuietHoursStart = findPreference(KEY_OTHER_QUIET_HOURS_START);
    mQuietHoursStartListener = new TimeSetListener(START_LISTENER);
    mQuietHoursStartDialog = new TimePickerDialog(activity, mQuietHoursStartListener, startHour, startMinute, mIs24HourMode);
    mQuietHoursStart.setSummary(formatTime(startHour, startMinute));
    int endHour = prefs.getInt(KEY_OTHER_QUIET_HOURS_END_HOUR, QUIET_HOURS_DEFAULT_END_HOUR);
    int endMinute = prefs.getInt(KEY_OTHER_QUIET_HOURS_END_MINUTE, QUIET_HOURS_DEFAULT_END_MINUTE);
    mQuietHoursEnd = findPreference(KEY_OTHER_QUIET_HOURS_END);
    mQuietHoursEndListener = new TimeSetListener(END_LISTENER);
    mQuietHoursEndDialog = new TimePickerDialog(activity, mQuietHoursEndListener, endHour, endMinute, mIs24HourMode);
    mQuietHoursEnd.setSummary(formatTime(endHour, endMinute));
}
Also used : SharedPreferences(android.content.SharedPreferences) Activity(android.app.Activity) TimePickerDialog(android.app.TimePickerDialog) PreferenceManager(android.preference.PreferenceManager)

Example 8 with TimePickerDialog

use of android.app.TimePickerDialog in project Resurrection_packages_apps_Settings by ResurrectionRemix.

the class NightDisplaySettings method onCreateDialog.

@Override
public Dialog onCreateDialog(final int dialogId) {
    if (dialogId == DIALOG_START_TIME || dialogId == DIALOG_END_TIME) {
        final NightDisplayController.LocalTime initialTime;
        if (dialogId == DIALOG_START_TIME) {
            initialTime = mController.getCustomStartTime();
        } else {
            initialTime = mController.getCustomEndTime();
        }
        final Context context = getContext();
        final boolean use24HourFormat = android.text.format.DateFormat.is24HourFormat(context);
        return new TimePickerDialog(context, new TimePickerDialog.OnTimeSetListener() {

            @Override
            public void onTimeSet(TimePicker view, int hourOfDay, int minute) {
                final NightDisplayController.LocalTime time = new NightDisplayController.LocalTime(hourOfDay, minute);
                if (dialogId == DIALOG_START_TIME) {
                    mController.setCustomStartTime(time);
                } else {
                    mController.setCustomEndTime(time);
                }
            }
        }, initialTime.hourOfDay, initialTime.minute, use24HourFormat);
    }
    return super.onCreateDialog(dialogId);
}
Also used : NightDisplayController(com.android.internal.app.NightDisplayController) Context(android.content.Context) TimePicker(android.widget.TimePicker) TimePickerDialog(android.app.TimePickerDialog)

Example 9 with TimePickerDialog

use of android.app.TimePickerDialog in project Resurrection_packages_apps_Settings by ResurrectionRemix.

the class DateTimeSettings method onCreateDialog.

@Override
public Dialog onCreateDialog(int id) {
    final Calendar calendar = Calendar.getInstance();
    switch(id) {
        case DIALOG_DATEPICKER:
            DatePickerDialog d = new DatePickerDialog(getActivity(), this, calendar.get(Calendar.YEAR), calendar.get(Calendar.MONTH), calendar.get(Calendar.DAY_OF_MONTH));
            configureDatePicker(d.getDatePicker());
            return d;
        case DIALOG_TIMEPICKER:
            return new TimePickerDialog(getActivity(), this, calendar.get(Calendar.HOUR_OF_DAY), calendar.get(Calendar.MINUTE), DateFormat.is24HourFormat(getActivity()));
        default:
            throw new IllegalArgumentException();
    }
}
Also used : DatePickerDialog(android.app.DatePickerDialog) Calendar(java.util.Calendar) TimePickerDialog(android.app.TimePickerDialog)

Example 10 with TimePickerDialog

use of android.app.TimePickerDialog in project Etar-Calendar by Etar-Group.

the class SnoozeDelayActivity method onCreateDialog.

@Override
protected Dialog onCreateDialog(int id) {
    if (id == DIALOG_DELAY) {
        TimePickerDialog d = new TimePickerDialog(this, this, 0, 0, true);
        d.setTitle(R.string.snooze_delay_dialog_title);
        d.setCancelable(true);
        d.setOnCancelListener(this);
        return d;
    }
    return super.onCreateDialog(id);
}
Also used : TimePickerDialog(android.app.TimePickerDialog)

Aggregations

TimePickerDialog (android.app.TimePickerDialog)20 View (android.view.View)6 DatePickerDialog (android.app.DatePickerDialog)5 Button (android.widget.Button)5 FrameLayout (android.widget.FrameLayout)5 Calendar (java.util.Calendar)5 TimePicker (android.widget.TimePicker)4 DialogInterface (android.content.DialogInterface)3 AlertDialog (android.app.AlertDialog)2 Context (android.content.Context)2 Intent (android.content.Intent)2 SimpleDateFormat (java.text.SimpleDateFormat)2 SuppressLint (android.annotation.SuppressLint)1 Activity (android.app.Activity)1 Dialog (android.app.Dialog)1 ProgressDialog (android.app.ProgressDialog)1 OnTimeSetListener (android.app.TimePickerDialog.OnTimeSetListener)1 SharedPreferences (android.content.SharedPreferences)1 PreferenceManager (android.preference.PreferenceManager)1 AlertDialog (android.support.v7.app.AlertDialog)1