List of usage examples for android.app DatePickerDialog.OnDateSetListener DatePickerDialog.OnDateSetListener
DatePickerDialog.OnDateSetListener
From source file:it.scoppelletti.mobilepower.widget.DateControl.java
/** * Apre il dialogo di selezione della data. *//*from www .j a v a 2s . com*/ private void onSetClick() { Context ctx; ActivitySupport activity; DatePickerDialogFragment dlg; ctx = getContext(); if (!(ctx instanceof ActivitySupport)) { myLogger.error("Context not implement interface ActivitySupport."); return; } if (StringUtils.isBlank(myDialogTag)) { myLogger.error("Property dialogTag is not set."); return; } dlg = DatePickerDialogFragment.newInstance(myValue); dlg.setOnDateSetListener(new DatePickerDialog.OnDateSetListener() { public void onDateSet(DatePicker view, int year, int month, int day) { doDateSet(year, month, day); } }); activity = (ActivitySupport) ctx; dlg.show(activity.getSupportFragmentManager(), myDialogTag); }
From source file:nl.mpcjanssen.simpletask.Simpletask.java
private void deferTasks(List<Task> tasks, final int dateType) { final List<Task> tasksToDefer = tasks; Dialog d = Util.createDeferDialog(this, dateType, true, new Util.InputDialogListener() { @Override// w w w.j av a 2 s . com public void onClick(@Nullable String selected) { if (selected == null) { Log.w(TAG, "Can't defer, selected is null. This should not happen"); return; } if (selected.equals("pick")) { final DateTime today = DateTime.today(TimeZone.getDefault()); DatePickerDialog dialog = new DatePickerDialog(Simpletask.this, new DatePickerDialog.OnDateSetListener() { @Override public void onDateSet(DatePicker datePicker, int year, int month, int day) { month++; DateTime date = DateTime.forDateOnly(year, month, day); getTaskBag().defer(date.format(Constants.DATE_FORMAT), tasksToDefer, dateType); } }, today.getYear(), today.getMonth() - 1, today.getDay()); boolean showCalendar = m_app.showCalendar(); dialog.getDatePicker().setCalendarViewShown(showCalendar); dialog.getDatePicker().setSpinnersShown(!showCalendar); dialog.show(); } else { getTaskBag().defer(selected, tasksToDefer, dateType); } } }); d.show(); }