use of android.widget.TimePicker in project RoboBinding by RoboBinding.
the class AbstractTimePickerAttributeTest method initializeViewAndListeners.
@Before
public void initializeViewAndListeners() {
view = new TimePicker(RuntimeEnvironment.application);
viewAddOn = new MockTimePickerAddOn(view);
}
use of android.widget.TimePicker in project k-9 by k9mail.
the class TimePickerPreference method onCreateDialogView.
/*
* (non-Javadoc)
*
* @see android.preference.DialogPreference#onCreateDialogView()
*/
@Override
protected View onCreateDialogView() {
TimePicker tp = new TimePicker(getContext());
tp.setIs24HourView(DateFormat.is24HourFormat(getContext()));
tp.setOnTimeChangedListener(this);
originalHour = getHour();
originalMinute = getMinute();
if (originalHour >= 0 && originalMinute >= 0) {
tp.setCurrentHour(originalHour);
tp.setCurrentMinute(originalMinute);
}
return tp;
}
use of android.widget.TimePicker in project weex-example by KalicyZhou.
the class DatePickerImpl method pickTime.
public static void pickTime(@NonNull Context context, String value, @NonNull final OnPickListener listener) {
Calendar calendar = Calendar.getInstance();
calendar.setTime(parseTime(value));
TimePickerDialog dialog = new TimePickerDialog(context, new TimePickerDialog.OnTimeSetListener() {
@Override
public void onTimeSet(TimePicker view, int hourOfDay, int minute) {
String h = hourOfDay < 10 ? "0" + hourOfDay : String.valueOf(hourOfDay);
String m = minute < 10 ? "0" + minute : String.valueOf(minute);
String result = h + ":" + m;
listener.onPick(true, result);
}
}, calendar.get(Calendar.HOUR_OF_DAY), calendar.get(Calendar.MINUTE), false);
dialog.setOnCancelListener(new DialogInterface.OnCancelListener() {
@Override
public void onCancel(DialogInterface dialog) {
listener.onPick(false, null);
}
});
dialog.show();
}
use of android.widget.TimePicker 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.widget.TimePicker in project cw-omnibus by commonsguy.
the class TimePickerDemoActivity method onCreate.
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
TimePicker picker = (TimePicker) findViewById(R.id.picker);
picker.setOnTimeChangedListener(this);
}
Aggregations