Java Code Examples for android.app.TimePickerDialog#setCanceledOnTouchOutside()
The following examples show how to use
android.app.TimePickerDialog#setCanceledOnTouchOutside() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: OBSystemsManager.java From GLEXP-Team-onebillion with Apache License 2.0 | 6 votes |
public Dialog createTimeSetDialog(OBUtils.RunLambda completionBlock, final OBUtils.RunLambda cancelCompletionBlock) { timeSetCompletionBlock = completionBlock; final Calendar calendar = Calendar.getInstance(); TimePickerDialog d = new TimePickerDialog(MainActivity.mainActivity, this, calendar.get(Calendar.HOUR_OF_DAY), calendar.get(Calendar.MINUTE), DateFormat.is24HourFormat(MainActivity.mainActivity)); d.setCancelable(false); d.setCanceledOnTouchOutside(false); d.setButton(DatePickerDialog.BUTTON_NEGATIVE, "Back", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { OBUtils.runOnMainThread(cancelCompletionBlock); } }); d.setMessage("Please set the current time.\n"); return d; }
Example 2
Source File: OCM_ChildMenu.java From GLEXP-Team-onebillion with Apache License 2.0 | 6 votes |
void showPickTimeDialog (final TimePickerDialog.OnTimeSetListener listener) { final DatePickerDialog.OnDateSetListener dateListener = (DatePickerDialog.OnDateSetListener) listener; final Calendar calendar = Calendar.getInstance(); TimePickerDialog d = new TimePickerDialog(MainActivity.mainActivity, listener, calendar.get(Calendar.HOUR_OF_DAY), calendar.get(Calendar.MINUTE), DateFormat.is24HourFormat(MainActivity.mainActivity)); // d.setCancelable(false); d.setCanceledOnTouchOutside(false); // d.setButton(DatePickerDialog.BUTTON_NEGATIVE, "Back", new DialogInterface.OnClickListener() { @Override public void onClick (DialogInterface dialog, int which) { showPickDateDialog(dateListener, null); } }); // LinearLayout linearLayout = new LinearLayout(MainActivity.mainActivity.getApplicationContext()); d.requestWindowFeature(Window.FEATURE_NO_TITLE); d.setCustomTitle(linearLayout); // d.show(); }
Example 3
Source File: OBSetupMenu.java From GLEXP-Team-onebillion with Apache License 2.0 | 5 votes |
void showPickTimeDialog (final TimePickerDialog.OnTimeSetListener listener) { final DatePickerDialog.OnDateSetListener dateListener = (DatePickerDialog.OnDateSetListener) listener; final Calendar calendar = Calendar.getInstance(); TimePickerDialog d = new TimePickerDialog(MainActivity.mainActivity, listener, calendar.get(Calendar.HOUR_OF_DAY), calendar.get(Calendar.MINUTE), DateFormat.is24HourFormat(MainActivity.mainActivity)); // d.setCancelable(false); d.setCanceledOnTouchOutside(false); // d.setButton(DatePickerDialog.BUTTON_NEGATIVE, "Back", new DialogInterface.OnClickListener() { @Override public void onClick (DialogInterface dialog, int which) { if (screenType == ScreenType.SET_DATE_SCREEN) { showPickDateDialog(dateListener, null); } else { MainActivity.log("OBSetupMenu:showPickTimeDialog:cancelled!"); } } }); // LinearLayout linearLayout = new LinearLayout(MainActivity.mainActivity.getApplicationContext()); d.requestWindowFeature(Window.FEATURE_NO_TITLE); d.setCustomTitle(linearLayout); // d.show(); }
Example 4
Source File: TimePickerProxy.java From TiDialogs with MIT License | 4 votes |
private TimePickerDialog getDialog() { TimePickerDialog picker = new TimePickerDialog(this.proxy.getActivity(), new TimePickerDialog.OnTimeSetListener() { @Override public void onTimeSet(TimePicker selectedTime, int selectedHour, int selectedMinute) { // TODO Auto-generated method stub hour = selectedHour; minute = selectedMinute; KrollDict data = new KrollDict(); Calendar calendar = Calendar.getInstance(); calendar.set(Calendar.HOUR_OF_DAY, hour); calendar.set(Calendar.MINUTE, minute); Date value = calendar.getTime(); data.put("value", value); data.put("hour", hour); data.put("minute", minute); fireEvent("click", data); } }, hour, minute, DateFormat.is24HourFormat(this.proxy .getActivity())); picker.setCanceledOnTouchOutside(false); picker.setButton(DialogInterface.BUTTON_POSITIVE, okButtonTitle, picker); picker.setButton(DialogInterface.BUTTON_NEGATIVE, cancelButtonTitle, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { fireEvent("cancel", new KrollDict()); } }); return picker; }