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);
}
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));
}
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);
}
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();
}
}
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);
}
Aggregations