當前位置: 首頁>>代碼示例>>Java>>正文


Java DatePickerDialog類代碼示例

本文整理匯總了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");
}
 
開發者ID:pooi,項目名稱:Nearby,代碼行數:21,代碼來源:EditMyInfoNurseActivity.java

示例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());

}
 
開發者ID:SpeedPromise,項目名稱:L-Assistant,代碼行數:24,代碼來源:ZhihuDailyFragment.java

示例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());

}
 
開發者ID:SpeedPromise,項目名稱:L-Assistant,代碼行數:22,代碼來源:DoubanMomentFragment.java

示例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");
}
 
開發者ID:pooi,項目名稱:Nearby,代碼行數:21,代碼來源:EditMyInfoNurseActivity.java

示例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");
}
 
開發者ID:pooi,項目名稱:Nearby,代碼行數:21,代碼來源:ManagePatientRegisterInfoActivity.java

示例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");
}
 
開發者ID:pooi,項目名稱:Nearby,代碼行數:21,代碼來源:RegisterPatientActivity.java

示例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");
}
 
開發者ID:pooi,項目名稱:Nearby,代碼行數:21,代碼來源:RegisterPatientActivity.java

示例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");
}
 
開發者ID:pooi,項目名稱:Nearby,代碼行數:20,代碼來源:RegisterPatientActivity.java

示例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");
}
 
開發者ID:pooi,項目名稱:Nearby,代碼行數:22,代碼來源:AddPatientMedicineActivity.java

示例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");
}
 
開發者ID:pooi,項目名稱:Nearby,代碼行數:21,代碼來源:AddPatientMedicineActivity.java

示例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);
}
 
開發者ID:LewisVo,項目名稱:Minitask,代碼行數:23,代碼來源:AddTodoItem.java

示例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);
        }
    });
}
 
開發者ID:graviton57,項目名稱:TVGuide,代碼行數:23,代碼來源:MainActivity.java

示例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();
}
 
開發者ID:graviton57,項目名稱:TVGuide,代碼行數:13,代碼來源:MainActivity.java

示例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");
}
 
開發者ID:Karim94,項目名稱:IIFYM,代碼行數:17,代碼來源:FragmentProfile.java

示例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");
}
 
開發者ID:Karim94,項目名稱:IIFYM,代碼行數:17,代碼來源:ActivityRegisterProfile.java


注:本文中的com.wdullaer.materialdatetimepicker.date.DatePickerDialog類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。