use of com.wdullaer.materialdatetimepicker.date.DatePickerDialog in project android-client by GenesisVision.
the class DateRangeBottomSheetFragment method showDateFromPicker.
public void showDateFromPicker(Boolean showTo) {
DateTime dateFrom = dateRange.getFrom();
if (dateRange.getSelectedRange().equals(DateRange.DateRangeEnum.ALL_TIME)) {
dateFrom = dateRange.getTo();
}
DatePickerDialog dpd = DatePickerDialog.newInstance((view, year, monthOfYear, dayOfMonth) -> {
setFrom(new DateTime(year, monthOfYear + 1, dayOfMonth, 0, 0, 0));
if (showTo) {
showDateToPicker();
}
}, dateFrom.getYear(), dateFrom.getMonthOfYear() - 1, dateFrom.getDayOfMonth());
dpd.setTitle(getString(R.string.from));
dpd.setMaxDate(dateRange.getTo().toCalendar(Locale.getDefault()));
if (getActivity() != null) {
dpd.show(getActivity().getFragmentManager(), "DateFromPickerDialog");
}
}
use of com.wdullaer.materialdatetimepicker.date.DatePickerDialog in project mVax by mVax-app.
the class ReportsFragment method promptForDate.
private void promptForDate(int vaccineDatabaseId, int vaccinationDatabaseId) {
mVaccineDatabaseId = vaccineDatabaseId;
mVaccinationDatabaseId = vaccinationDatabaseId;
Calendar cal = Calendar.getInstance();
DatePickerDialog datePicker = DatePickerDialog.newInstance(ReportsFragment.this, cal.get(Calendar.YEAR), cal.get(Calendar.MONTH), cal.get(Calendar.DAY_OF_MONTH));
int dukeBlue = ContextCompat.getColor(getContext(), R.color.dukeBlue);
datePicker.setAccentColor(dukeBlue);
datePicker.show(getActivity().getFragmentManager(), "reportDatePicker");
}
use of com.wdullaer.materialdatetimepicker.date.DatePickerDialog in project mVax by mVax-app.
the class DateDetail method getValueViewListener.
@Override
public void getValueViewListener(Activity activity, WatcherEditText valueView) {
mValueView = valueView;
Calendar cal = Calendar.getInstance();
int day = cal.get(Calendar.DAY_OF_MONTH);
int month = cal.get(Calendar.MONTH);
int year = cal.get(Calendar.YEAR);
if (getValue() != null) {
final LocalDate date = new LocalDate(getValue());
day = date.getDayOfMonth();
month = date.getMonthOfYear() - 1;
year = date.getYear();
}
DatePickerDialog datePicker = DatePickerDialog.newInstance(DateDetail.this, year, month, day);
final int dukeBlue = ContextCompat.getColor(valueView.getContext(), R.color.dukeBlue);
datePicker.setAccentColor(dukeBlue);
datePicker.show(activity.getFragmentManager(), "datePicker");
}
use of com.wdullaer.materialdatetimepicker.date.DatePickerDialog in project UltimateAndroid by cymcsg.
the class MaterialDataTimePickerActivity method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.material_data_time_picker_activity_main);
// Find our View instances
timeTextView = (TextView) findViewById(R.id.time_textview);
dateTextView = (TextView) findViewById(R.id.date_textview);
Button timeButton = (Button) findViewById(R.id.time_button);
Button dateButton = (Button) findViewById(R.id.date_button);
mode24Hours = (CheckBox) findViewById(R.id.mode_24_hours);
modeDarkTime = (CheckBox) findViewById(R.id.mode_dark_time);
modeDarkDate = (CheckBox) findViewById(R.id.mode_dark_date);
// Show a timepicker when the timeButton is clicked
timeButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Calendar now = Calendar.getInstance();
TimePickerDialog tpd = TimePickerDialog.newInstance(MaterialDataTimePickerActivity.this, now.get(Calendar.HOUR_OF_DAY), now.get(Calendar.MINUTE), mode24Hours.isChecked());
tpd.setThemeDark(modeDarkTime.isChecked());
tpd.setOnCancelListener(new DialogInterface.OnCancelListener() {
@Override
public void onCancel(DialogInterface dialogInterface) {
Log.d("TimePicker", "Dialog was cancelled");
}
});
tpd.show(getFragmentManager(), "Timepickerdialog");
}
});
// Show a datepicker when the dateButton is clicked
dateButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Calendar now = Calendar.getInstance();
DatePickerDialog dpd = DatePickerDialog.newInstance(MaterialDataTimePickerActivity.this, now.get(Calendar.YEAR), now.get(Calendar.MONTH), now.get(Calendar.DAY_OF_MONTH));
dpd.setThemeDark(modeDarkDate.isChecked());
dpd.show(getFragmentManager(), "Datepickerdialog");
}
});
}
use of com.wdullaer.materialdatetimepicker.date.DatePickerDialog in project CoCoin by Nightonke.
the class AccountBookListViewActivity method onDateSet.
@Override
public void onDateSet(DatePickerDialog view, int year, int monthOfYear, int dayOfMonth) {
if (isFrom) {
fromYear = year;
fromMonth = monthOfYear + 1;
fromDay = dayOfMonth;
Calendar now = Calendar.getInstance();
DatePickerDialog dpd = DatePickerDialog.newInstance(this, now.get(Calendar.YEAR), now.get(Calendar.MONTH), now.get(Calendar.DAY_OF_MONTH));
dpd.setTitle(mContext.getResources().getString(R.string.set_right_calendar));
dpd.show(((Activity) mContext).getFragmentManager(), "Datepickerdialog");
isFrom = false;
} else {
from.set(fromYear, fromMonth - 1, fromDay, 0, 0, 0);
from.add(Calendar.SECOND, 0);
to.set(year, monthOfYear, dayOfMonth, 23, 59, 59);
to.add(Calendar.SECOND, 0);
if (to.before(from)) {
CoCoinUtil.showToast(mContext, mContext.getResources().getString(R.string.from_invalid), SuperToast.Background.RED);
} else {
LEFT_CALENDAR = (Calendar) from.clone();
RIGHT_CALENDAR = (Calendar) to.clone();
setConditions();
}
}
}
Aggregations