本文整理汇总了Java中com.wdullaer.materialdatetimepicker.date.DatePickerDialog.newInstance方法的典型用法代码示例。如果您正苦于以下问题:Java DatePickerDialog.newInstance方法的具体用法?Java DatePickerDialog.newInstance怎么用?Java DatePickerDialog.newInstance使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.wdullaer.materialdatetimepicker.date.DatePickerDialog
的用法示例。
在下文中一共展示了DatePickerDialog.newInstance方法的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: 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");
}
示例12: 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");
}
示例13: createDialog
import com.wdullaer.materialdatetimepicker.date.DatePickerDialog; //导入方法依赖的package包/类
/**
* Creates a {@link DatePickerDialog} instance with the <code>localDate</code> selected.
*
* @param localDate the selected start localDate
* @param listener to be triggered when the user selects a localDate
* @param clock to get the current date
* @return the {@link DatePickerDialog} created instance
*/
@NonNull
public static DatePickerDialog createDialog(@Nullable LocalDate localDate, @Nullable Consumer<LocalDate> listener,
@NonNull Clock clock) {
localDate = Optional.ofNullable(localDate)
.orElse(LocalDate.now(clock));
DatePickerDialog.OnDateSetListener dialogCallBack = (view, year, monthOfYear, dayOfMonth) -> {
LocalDate date = LocalDate.of(year, monthOfYear + 1, dayOfMonth);
Optional.ofNullable(listener)
.ifPresent(theListener -> theListener.accept(date));
};
DatePickerDialog datePickerDialog = DatePickerDialog.newInstance(
dialogCallBack,
localDate.getYear(),
localDate.getMonthValue() - 1,
localDate.getDayOfMonth()
);
datePickerDialog.dismissOnPause(true);
return datePickerDialog;
}
示例14: showDateDialog
import com.wdullaer.materialdatetimepicker.date.DatePickerDialog; //导入方法依赖的package包/类
/**
* 时间选择
*/
@OnClick(R.id.birthday_layout)
void showDateDialog() {
Calendar now = Calendar.getInstance();
Date time = now.getTime();
time.setTime(time.getTime());
DatePickerDialog dpd = DatePickerDialog.newInstance(
this,
now.get(Calendar.YEAR),
now.get(Calendar.MONTH),
now.get(Calendar.DAY_OF_MONTH)
);
now.setTime(time);
dpd.setMaxDate(now);
dpd.setAccentColor(accentColor);
dpd.show(getActivity().getFragmentManager(), "Datepickerdialog");
}
示例15: showDateDialog
import com.wdullaer.materialdatetimepicker.date.DatePickerDialog; //导入方法依赖的package包/类
private void showDateDialog() {
Calendar now = Calendar.getInstance();
Date time = now.getTime();
long currentTime = time.getTime();
time.setTime(currentTime + 24 * 60 * 60);
DatePickerDialog dpd = DatePickerDialog.newInstance(
ActReleaseProductActivity.this,
now.get(Calendar.YEAR),
now.get(Calendar.MONTH),
now.get(Calendar.DAY_OF_MONTH)
);
now.setTime(time);
dpd.setMinDate(now);
dpd.show(getFragmentManager(), "Datepickerdialog");
}