本文整理汇总了Java中com.wdullaer.materialdatetimepicker.date.DatePickerDialog类的典型用法代码示例。如果您正苦于以下问题:Java DatePickerDialog类的具体用法?Java DatePickerDialog怎么用?Java DatePickerDialog使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
DatePickerDialog类属于com.wdullaer.materialdatetimepicker.date包,在下文中一共展示了DatePickerDialog类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: dobDatePick
import com.wdullaer.materialdatetimepicker.date.DatePickerDialog; //导入依赖的package包/类
private void dobDatePick(){
Calendar now = Calendar.getInstance();
now.setTimeInMillis(date_of_Birth);
DatePickerDialog dpd = DatePickerDialog.newInstance(
new DatePickerDialog.OnDateSetListener() {
@Override
public void onDateSet(DatePickerDialog view, int year, int monthOfYear, int dayOfMonth) {
date_of_Birth = AdditionalFunc.getMilliseconds(year, monthOfYear+1, dayOfMonth);
isSelectDob = true;
setDateText(dob, AdditionalFunc.getDateString(date_of_Birth));
}
},
now.get(Calendar.YEAR),
now.get(Calendar.MONTH),
now.get(Calendar.DAY_OF_MONTH)
);
dpd.setTitle(getString(R.string.dob));
dpd.setVersion(DatePickerDialog.Version.VERSION_2);
dpd.show(getFragmentManager(), "Datepickerdialog");
}
示例2: showDatePickerDialog
import com.wdullaer.materialdatetimepicker.date.DatePickerDialog; //导入依赖的package包/类
public void showDatePickerDialog() {
Calendar c = Calendar.getInstance();
c.set(mYear, mMonth, mDay);
DatePickerDialog dialog = DatePickerDialog.newInstance((datePickerDialog, year, monthOfYear, dayOfMonth) -> {
mYear = year;
mMonth = monthOfYear;
mDay = dayOfMonth;
c.set(mYear, monthOfYear, mDay);
mPresenter.loadNews(true, true, c.getTimeInMillis());
}, c.get(Calendar.YEAR), c.get(Calendar.MONTH), c.get(Calendar.DAY_OF_MONTH));
dialog.setMaxDate(Calendar.getInstance());
Calendar minDate = Calendar.getInstance();
minDate.set(2013, 5, 20);
dialog.setMinDate(minDate);
dialog.vibrate(false);
dialog.show(getActivity().getFragmentManager(), ZhihuDailyFragment.class.getSimpleName());
}
示例3: showDatePickerDialog
import com.wdullaer.materialdatetimepicker.date.DatePickerDialog; //导入依赖的package包/类
public void showDatePickerDialog() {
DatePickerDialog dialog = DatePickerDialog.newInstance((datePickerDialog, year, monthOfYear, dayOfMonth) -> {
mYear = year;
mMonth = monthOfYear;
mDay = dayOfMonth;
Calendar c = Calendar.getInstance();
c.set(mYear, mMonth, mDay);
mPresenter.load(true, true, c.getTimeInMillis());
}, mYear, mMonth, mDay);
dialog.setMaxDate(Calendar.getInstance());
Calendar minDate = Calendar.getInstance();
minDate.set(2014, 5, 12);
dialog.setMinDate(minDate);
dialog.vibrate(false);
dialog.show(getActivity().getFragmentManager(), DoubanMomentFragment.class.getSimpleName());
}
示例4: startDatePick
import com.wdullaer.materialdatetimepicker.date.DatePickerDialog; //导入依赖的package包/类
private void startDatePick(){
Calendar now = Calendar.getInstance();
now.setTimeInMillis(start_Date);
DatePickerDialog dpd = DatePickerDialog.newInstance(
new DatePickerDialog.OnDateSetListener() {
@Override
public void onDateSet(DatePickerDialog view, int year, int monthOfYear, int dayOfMonth) {
start_Date = AdditionalFunc.getMilliseconds(year, monthOfYear+1, dayOfMonth);
isSelectStartDate = true;
setDateText(startdate, AdditionalFunc.getDateString(start_Date));
}
},
now.get(Calendar.YEAR),
now.get(Calendar.MONTH),
now.get(Calendar.DAY_OF_MONTH)
);
dpd.setTitle(getString(R.string.location_start_date));
dpd.setVersion(DatePickerDialog.Version.VERSION_2);
dpd.show(getFragmentManager(), "Datepickerdialog");
}
示例5: startDatePick
import com.wdullaer.materialdatetimepicker.date.DatePickerDialog; //导入依赖的package包/类
private void startDatePick(){
Calendar now = Calendar.getInstance();
now.setTimeInMillis(start_Date);
DatePickerDialog dpd = DatePickerDialog.newInstance(
new DatePickerDialog.OnDateSetListener() {
@Override
public void onDateSet(DatePickerDialog view, int year, int monthOfYear, int dayOfMonth) {
start_Date = AdditionalFunc.getMilliseconds(year, monthOfYear+1, dayOfMonth);
isSelectStartDate = true;
setDateText(startdate, AdditionalFunc.getDateString(start_Date));
}
},
now.get(Calendar.YEAR),
now.get(Calendar.MONTH),
now.get(Calendar.DAY_OF_MONTH)
);
dpd.setTitle(getString(R.string.startdate));
dpd.setVersion(DatePickerDialog.Version.VERSION_2);
dpd.show(getFragmentManager(), "Datepickerdialog");
}
示例6: startDatePick
import com.wdullaer.materialdatetimepicker.date.DatePickerDialog; //导入依赖的package包/类
private void startDatePick(){
Calendar now = Calendar.getInstance();
DatePickerDialog dpd = DatePickerDialog.newInstance(
new DatePickerDialog.OnDateSetListener() {
@Override
public void onDateSet(DatePickerDialog view, int year, int monthOfYear, int dayOfMonth) {
start_Date = AdditionalFunc.getMilliseconds(year, monthOfYear+1, dayOfMonth);
isSelectStartDate = true;
setDateText(startdate, AdditionalFunc.getDateString(start_Date));
registerDatePick();
}
},
now.get(Calendar.YEAR),
now.get(Calendar.MONTH),
now.get(Calendar.DAY_OF_MONTH)
);
dpd.setTitle(getString(R.string.startdate));
dpd.setVersion(DatePickerDialog.Version.VERSION_2);
dpd.show(getFragmentManager(), "Datepickerdialog");
}
示例7: registerDatePick
import com.wdullaer.materialdatetimepicker.date.DatePickerDialog; //导入依赖的package包/类
private void registerDatePick(){
Calendar now = Calendar.getInstance();
DatePickerDialog dpd = DatePickerDialog.newInstance(
new DatePickerDialog.OnDateSetListener() {
@Override
public void onDateSet(DatePickerDialog view, int year, int monthOfYear, int dayOfMonth) {
register_Date = AdditionalFunc.getMilliseconds(year, monthOfYear+1, dayOfMonth);
isSelectRegisterDate = true;
setDateText(registerdate, AdditionalFunc.getDateString(register_Date));
dobDatePick();
}
},
now.get(Calendar.YEAR),
now.get(Calendar.MONTH),
now.get(Calendar.DAY_OF_MONTH)
);
dpd.setTitle(getString(R.string.registerdate));
dpd.setVersion(DatePickerDialog.Version.VERSION_2);
dpd.show(getFragmentManager(), "Datepickerdialog");
}
示例8: dobDatePick
import com.wdullaer.materialdatetimepicker.date.DatePickerDialog; //导入依赖的package包/类
private void dobDatePick(){
Calendar now = Calendar.getInstance();
DatePickerDialog dpd = DatePickerDialog.newInstance(
new DatePickerDialog.OnDateSetListener() {
@Override
public void onDateSet(DatePickerDialog view, int year, int monthOfYear, int dayOfMonth) {
date_of_Birth = AdditionalFunc.getMilliseconds(year, monthOfYear+1, dayOfMonth);
isSelectDob = true;
setDateText(dob, AdditionalFunc.getDateString(date_of_Birth));
}
},
now.get(Calendar.YEAR),
now.get(Calendar.MONTH),
now.get(Calendar.DAY_OF_MONTH)
);
dpd.setTitle(getString(R.string.dob));
dpd.setVersion(DatePickerDialog.Version.VERSION_2);
dpd.show(getFragmentManager(), "Datepickerdialog");
}
示例9: selectStartPeriod
import com.wdullaer.materialdatetimepicker.date.DatePickerDialog; //导入依赖的package包/类
private void selectStartPeriod(){
Calendar now = Calendar.getInstance();
DatePickerDialog dpd = DatePickerDialog.newInstance(
new DatePickerDialog.OnDateSetListener() {
@Override
public void onDateSet(DatePickerDialog view, int year, int monthOfYear, int dayOfMonth) {
startDate = AdditionalFunc.getMilliseconds(year, monthOfYear+1, dayOfMonth);
isSelectStartDate = true;
setDateText(startPeriodBtn, AdditionalFunc.getDateString(startDate));
checkSaveBtn();
selectFinishPeriod();
}
},
now.get(Calendar.YEAR),
now.get(Calendar.MONTH),
now.get(Calendar.DAY_OF_MONTH)
);
dpd.setTitle(getString(R.string.take_period_start_srt));
dpd.setVersion(DatePickerDialog.Version.VERSION_2);
dpd.show(getFragmentManager(), "Datepickerdialog");
}
示例10: selectFinishPeriod
import com.wdullaer.materialdatetimepicker.date.DatePickerDialog; //导入依赖的package包/类
private void selectFinishPeriod(){
Calendar now = Calendar.getInstance();
DatePickerDialog dpd = DatePickerDialog.newInstance(
new DatePickerDialog.OnDateSetListener() {
@Override
public void onDateSet(DatePickerDialog view, int year, int monthOfYear, int dayOfMonth) {
finishDate = AdditionalFunc.getMilliseconds(year, monthOfYear+1, dayOfMonth);
isSelectFinishDate = true;
setDateText(finishPeriodBtn, AdditionalFunc.getDateString(finishDate));
checkSaveBtn();
}
},
now.get(Calendar.YEAR),
now.get(Calendar.MONTH),
now.get(Calendar.DAY_OF_MONTH)
);
dpd.setTitle(getString(R.string.take_period_finish_srt));
dpd.setVersion(DatePickerDialog.Version.VERSION_2);
dpd.show(getFragmentManager(), "Datepickerdialog");
}
示例11: onDateSet
import com.wdullaer.materialdatetimepicker.date.DatePickerDialog; //导入依赖的package包/类
@Override
public void onDateSet(DatePickerDialog view, int year, int monthOfYear, int dayOfMonth) {
// if the date is in the past tell user to choose again
if (dateTimeUtils.checkInvalidDate(year, monthOfYear, dayOfMonth)){
AlertDialog alertDialog = new AlertDialog.Builder(AddTodoItem.this).create();
alertDialog.setTitle("Date not valid!");
alertDialog.setIcon(R.drawable.ic_warning_black_24dp);
alertDialog.setMessage("You are selecting a time a point of time in the past!");
alertDialog.setButton(AlertDialog.BUTTON_NEUTRAL, "OK", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
dialog.dismiss();
}
});
alertDialog.show();
return;
}
// set date value to the value user selected and change the text
date = dateTimeUtils.dateToString(year, monthOfYear, dayOfMonth);
reminderText.setText(getString(R.string.reminder_set_at) + " " + date + " " + time);
}
示例12: setupCalendarFab
import com.wdullaer.materialdatetimepicker.date.DatePickerDialog; //导入依赖的package包/类
private void setupCalendarFab() {
selectDateButton = (FloatingActionButton) findViewById(R.id.fab_date_picker);
selectDateButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
final Calendar currentDate = Calendar.getInstance();
final Calendar futureDate = Calendar.getInstance();
datePickerDialog = DatePickerDialog.newInstance( MainActivity.this,
currentDate.get(Calendar.YEAR), currentDate.get(Calendar.MONTH),
currentDate.get(Calendar.DAY_OF_MONTH));
datePickerDialog.setFirstDayOfWeek(Calendar.MONDAY);
datePickerDialog.showYearPickerFirst(false);
datePickerDialog.setMinDate(currentDate);
int countOfDays = Integer.parseInt(preferencesHelper
.getScheduleDaysCount(getString(R.string.pref_schedule_days_count_key)));
futureDate.add(Calendar.DAY_OF_YEAR, countOfDays - 1);
datePickerDialog.setMaxDate(futureDate);
datePickerDialog.setTitle(getString(R.string.date_picker_dialog_title));
datePickerDialog.show(getFragmentManager(), DATE_PICKER_DIALOG_TAG);
}
});
}
示例13: onDateSet
import com.wdullaer.materialdatetimepicker.date.DatePickerDialog; //导入依赖的package包/类
@Override
public void onDateSet(DatePickerDialog view, int year, int monthOfYear,
int dayOfMonth) {
Calendar calendar = Calendar.getInstance();
calendar.set(Calendar.YEAR, year);
calendar.set(Calendar.MONTH, monthOfYear);
calendar.set(Calendar.DAY_OF_MONTH, dayOfMonth);
Date date = calendar.getTime();
preferencesHelper.setCurProgramsDate(getString(R.string.pref_program_date_key), date.getTime());
getContentResolver().notifyChange(TvContract.ChannelEntry.CONTENT_URI, null);
updateChannelView();
}
示例14: showDatePicker
import com.wdullaer.materialdatetimepicker.date.DatePickerDialog; //导入依赖的package包/类
private void showDatePicker() {
String ageArr[] = dob.split("-");
GregorianCalendar cal = new GregorianCalendar();
cal.set(Integer.parseInt(ageArr[2]),
Integer.parseInt(ageArr[1]) - 1,
Integer.parseInt(ageArr[0]));
DatePickerDialog dpd = DatePickerDialog.newInstance(
this,
cal.get(Calendar.YEAR),
cal.get(Calendar.MONTH),
cal.get(Calendar.DAY_OF_MONTH)
);
dpd.setVersion(DatePickerDialog.Version.VERSION_1);
dpd.showYearPickerFirst(true);
dpd.show(getFragmentManager(), "Datepickerdialog");
}
示例15: showDatePicker
import com.wdullaer.materialdatetimepicker.date.DatePickerDialog; //导入依赖的package包/类
private void showDatePicker() {
String ageArr[] = etxtDateOfBirth.getText().toString().split("-");
GregorianCalendar cal = new GregorianCalendar();
cal.set(Integer.parseInt(ageArr[2]),
Integer.parseInt(ageArr[1]) - 1,
Integer.parseInt(ageArr[0]));
DatePickerDialog dpd = DatePickerDialog.newInstance(
this,
cal.get(Calendar.YEAR),
cal.get(Calendar.MONTH),
cal.get(Calendar.DAY_OF_MONTH)
);
dpd.setVersion(DatePickerDialog.Version.VERSION_1);
dpd.showYearPickerFirst(true);
dpd.show(getSupportFragmentManager(), "Datepickerdialog");
}