List of usage examples for android.app DatePickerDialog DatePickerDialog
public DatePickerDialog(@NonNull Context context, @Nullable OnDateSetListener listener, int year, int month, int dayOfMonth)
From source file:org.svij.taskwarriorapp.ui.DatePickerFragment.java
public Dialog onCreateDialog(Bundle savedInstanceState) { final Calendar cal = Calendar.getInstance(); if (timestamp != 0) { cal.setTime(new Date(timestamp)); }/*from ww w . ja va 2 s.c o m*/ int year = cal.get(Calendar.YEAR); int month = cal.get(Calendar.MONTH); int day = cal.get(Calendar.DAY_OF_MONTH); return new DatePickerDialog(getActivity(), onDateSet, year, month, day); }
From source file:com.leinardi.ubuntucountdownwidget.ui.dialogs.DatePickerFragment.java
@Override public Dialog onCreateDialog(Bundle savedInstanceState) { mSharedPreferences = PreferenceManager.getDefaultSharedPreferences(getContext()); // Use the current date as the default date in the picker final Calendar c = this.getPersitendCalendar(DEFAULT_VALUE); int year = c.get(Calendar.YEAR); int month = c.get(Calendar.MONTH); int day = c.get(Calendar.DAY_OF_MONTH); // Create a new instance of DatePickerDialog and return it return new DatePickerDialog(getActivity(), this, year, month, day); }
From source file:com.pos.libs.DatePickerDialogFragment.java
public Dialog onCreateDialog(Bundle savedInstanceState) { final Calendar c = Calendar.getInstance(); if (isDatePicker) { int year = c.get(Calendar.YEAR); int month = c.get(Calendar.MONTH); int day = c.get(Calendar.DAY_OF_MONTH); return new DatePickerDialog(getActivity(), this, year, month, day); } else {//from w ww .j a v a 2 s .co m int hours = c.get(Calendar.HOUR_OF_DAY); int minutes = c.get(Calendar.MINUTE); return new TimePickerDialog(getActivity(), this, hours, minutes, true); } }
From source file:com.firsttry.mumbaiparking.helpers.DatePickerHelper.java
@Override public Dialog onCreateDialog(Bundle savedInstanceState) { prefs = getActivity().getSharedPreferences("Reminders", 0); int year, monthOfYear, dayOfMonth; year = dayOfMonth = monthOfYear = 0; //The tag value will decide which values ie:puc,insurance,license will be set as default if (getTag().equals("PUC")) { year = prefs.getInt("PUC_YEAR", 0); monthOfYear = prefs.getInt("PUC_MONTH", 0); dayOfMonth = prefs.getInt("PUC_DATE", 0); } else if (getTag().equals("INSURANCE")) { year = prefs.getInt("INSURANCE_YEAR", 0); monthOfYear = prefs.getInt("INSURANCE_MONTH", 0); dayOfMonth = prefs.getInt("INSURANCE_DATE", 0); } else if (getTag().equals("LICENSE")) { year = prefs.getInt("LICENSE_YEAR", 0); monthOfYear = prefs.getInt("LICENSE_MONTH", 0); dayOfMonth = prefs.getInt("LICENSE_DATE", 0); }//from w w w. jav a2 s.com return new DatePickerDialog(getActivity(), this, year, monthOfYear, dayOfMonth); }
From source file:com.hyperaware.conference.android.fragment.DatePickerDialogFragment.java
@NonNull @Override/*ww w . j a va2s . c o m*/ public Dialog onCreateDialog(Bundle savedInstanceState) { return new DatePickerDialog(getActivity(), this, year, month, dayOfMonth); }
From source file:com.jaspersoft.android.jaspermobile.dialog.DateDialogFragment.java
@NonNull @Override//w ww . j a v a2 s . co m public Dialog onCreateDialog(Bundle savedInstanceState) { if (type == DATE) { return new DatePickerDialog(getActivity(), new DateChangeListener(), activeDate.get(Calendar.YEAR), activeDate.get(Calendar.MONTH), activeDate.get(Calendar.DAY_OF_MONTH)); } else { return new TimePickerDialog(getActivity(), new TimeChangeListener(), activeDate.get(Calendar.HOUR_OF_DAY), activeDate.get(Calendar.MINUTE), true); } }
From source file:com.simplaapliko.trips.presentation.fragment.SelectDateDialog.java
@NonNull @Override//w ww . ja v a2s .c o m public Dialog onCreateDialog(Bundle savedInstanceState) { final DatePickerDialog pickerDialog = new DatePickerDialog(getActivity(), this, mCalendar.get(Calendar.YEAR), mCalendar.get(Calendar.MONTH), mCalendar.get(Calendar.DATE)); if (Build.VERSION.SDK_INT < Build.VERSION_CODES.N) { pickerDialog.getDatePicker().setCalendarViewShown(false); } pickerDialog.setOnKeyListener((dialog, keyCode, event) -> { switch (keyCode) { case KeyEvent.KEYCODE_BACK: dialog.cancel(); dialog.dismiss(); return true; default: return false; } }); return pickerDialog; }
From source file:com.kylebeal.datedialogfragment.DateDialogFragment.java
@Override public Dialog onCreateDialog(Bundle savedInstanceState) { return new DatePickerDialog(sContext, dateSetListener, sDate.get(Calendar.YEAR), sDate.get(Calendar.MONTH), sDate.get(Calendar.DAY_OF_MONTH)); }
From source file:nz.al4.airclock.DatePickerFragment.java
@Override public Dialog onCreateDialog(Bundle savedInstanceState) { mCallback = (OnDatePickedListener) getActivity(); // Use the current date as the default date in the picker final Calendar c = Calendar.getInstance(); int year = c.get(Calendar.YEAR); int month = c.get(Calendar.MONTH); int day = c.get(Calendar.DAY_OF_MONTH); // Create a new instance of DatePickerDialog and return it return new DatePickerDialog(getActivity(), this, year, month, day); }
From source file:org.gnucash.android.ui.DatePickerDialogFragment.java
/** * Creates and returns an Android {@link DatePickerDialog} *//* ww w. j av a 2 s.c o m*/ public Dialog onCreateDialog(Bundle savedInstanceState) { Calendar cal = mDate == null ? Calendar.getInstance() : mDate; return new DatePickerDialog(getActivity(), mDateSetListener, cal.get(Calendar.YEAR), cal.get(Calendar.MONTH), cal.get(Calendar.DAY_OF_MONTH)); }