Java 类android.widget.DatePicker 实例源码

项目:godlibrary    文件:DialogDate.java   
public AlertDialog show(Context context) {
    dialog = new AlertDialog.Builder(context).create();
    dialog.show();
    Window window = dialog.getWindow();
    window.setContentView(R.layout.dialog_date_time);
    window.setGravity(Gravity.CENTER);// 此处可以设置dialog显示的位置
    //window.setWindowAnimations(R.style.in_left_out_right_style);
    window.setBackgroundDrawableResource(R.color.transparent);

    datePicker = (DatePicker) window
            .findViewById(R.id.date_time_datePicker1);
    datePicker.setCalendarViewShown(false);
    timePicker = (TimePicker) window.findViewById(R.id.date_time_timePicker);
    but_ok = (Button) window.findViewById(R.id.date_time_but_ok);
    but_ok.setOnClickListener(this);
    return dialog;
}
项目:android-AutofillFramework    文件:CreditCardExpirationDatePickerView.java   
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
    DatePickerDialog dialog = new DatePickerDialog(getActivity(),
            R.style.CustomDatePickerDialogTheme, this, mParent.mYear, mParent.mMonth, 1);

    DatePicker datePicker = dialog.getDatePicker();

    // Limit range.
    Calendar c = mParent.getCalendar();
    datePicker.setMinDate(c.getTimeInMillis());
    c.set(Calendar.YEAR, mParent.mYear + CC_EXP_YEARS_COUNT - 1);
    datePicker.setMaxDate(c.getTimeInMillis());

    // Remove day.
    datePicker.findViewById(getResources().getIdentifier("day", "id", "android"))
            .setVisibility(View.GONE);
    return dialog;
}
项目:Crammer-HITN17    文件:SelectDate.java   
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_select_date);
    datePicker = (DatePicker) findViewById(R.id.datePicker);
    date = datePicker.getDayOfMonth();
    month = datePicker.getMonth() +1 ;
    year = datePicker.getYear();
    Log.d("date",date+" "+month+" "+year);
    next = (Button) findViewById(R.id.next);
    next.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            date = datePicker.getDayOfMonth();
            month = datePicker.getMonth() + 1;
            year = datePicker.getYear();
            Log.d("date",date+" "+month+" "+year);

            Intent i = new Intent(getApplicationContext(),Message.class);
            startActivity(i);
        }
    });


}
项目:ChenYan    文件:MyInfoActivity.java   
private void showDateDialog(final TextView textView) {
    Calendar calendar = Calendar.getInstance();
    int year = calendar.get(Calendar.YEAR);
    int month = calendar.get(Calendar.MONTH);
    int day = calendar.get(Calendar.DAY_OF_MONTH);
    DatePickerDialog dialog =
            new DatePickerDialog(this, new DatePickerDialog.OnDateSetListener() {
                @Override
                public void onDateSet(DatePicker datePicker, int i, int i1, int i2) {
                    //      birthday = new Date(i,i1,i2);
                    Date date = new Date(i - 1900, i1, i2);

                    textView.setText(formatDate(date));
                }
            }, year, month, day);
    dialog.show();

}
项目:CIA    文件:CreateHabitEventActivity.java   
/** for the date selected
 * @param datePicker : the widget object for selecting a date
 * @param year : the year chosen
 * @param month : the month chosen
 * @param day : the day chosen
 * see: DatePickerFragment
 */
@Override
public void onDateSet(DatePicker datePicker, int year, int month, int day) {
    final Calendar calendar = Calendar.getInstance();

    calendar.set(Calendar.YEAR, year);
    calendar.set(Calendar.MONTH, month);
    calendar.set(Calendar.DAY_OF_MONTH, day);

    Date date = calendar.getTime();
    Date currentDate = new Date();

    // Prevent the event's date from being a date in the future
    if (currentDate.before(date))
        date = currentDate;

    eventDate = date;
    setDateText();
}
项目:OpenHomeAnalysis    文件:OhaEnergyUseBillFragment.java   
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, Bundle savedInstanceState) {

    View view = inflater.inflate(R.layout.fragment_energy_use_bill, container, false);
    this.radioButtonFromDate = (RadioButton) view.findViewById(R.id.radioButtonFromDate);
    this.radioButtonToDate = (RadioButton) view.findViewById(R.id.radioButtonToDate);
    this.editKwhCost = (EditText) view.findViewById(R.id.editKwhCost);
    this.datePicker = (DatePicker) view.findViewById(R.id.datePicker);
    this.toolbar = (Toolbar) view.findViewById(R.id.toolbar);
    this.setTextRadioButtonDate(radioButtonFromDate, this.fromDate);
    this.setTextRadioButtonDate(radioButtonToDate, this.toDate);
    this.setCalendarView();
    this.editKwhCost.setText(OhaHelper.getEditable(this.kwhCost));
    this.radioButtonFromDate.setOnClickListener(this);
    this.radioButtonToDate.setOnClickListener(this);
    this.datePicker.setOnClickListener(this);
    //Remover o date_picker_header do datePicker se o mesmo existir
    View viewDayDatePicker = datePicker.findViewById(Resources.getSystem().getIdentifier("date_picker_header", "id", "android"));
    if (viewDayDatePicker != null) {
        viewDayDatePicker.setVisibility(View.GONE);
    }
    this.toolbar.inflateMenu(R.menu.fragment_energy_use_bill);
    this.toolbar.setOnMenuItemClickListener(this);
    return view;
}
项目:react-native-double-date-picker    文件:DoubleDatePickerDialog.java   
/**
 * 隐藏DatePicker中的日期显示
 *
 * @param mDatePicker
 */
private void hidDay(DatePicker mDatePicker) {
    Field[] datePickerfFields = mDatePicker.getClass().getDeclaredFields();
    for (Field datePickerField : datePickerfFields) {
        if ("mDaySpinner".equals(datePickerField.getName())) {
            datePickerField.setAccessible(true);
            Object dayPicker = new Object();
            try {
                dayPicker = datePickerField.get(mDatePicker);
            } catch (Exception e) {
                mPromise.reject("-1", e);
            }
            ((View) dayPicker).setVisibility(View.GONE);
        }
    }
}
项目:JKCloud    文件:DateUtil.java   
/**
 * 显示时间窗口
 *
 * @param textView
 */
public static void DateDialog(final Context mContext, final TextView textView) {
    LayoutInflater inflater = LayoutInflater.from(mContext);
    View v = inflater.inflate(R.layout.date_picker, null);
    final DatePicker dataPicker = (DatePicker) v.findViewById(R.id.datePicker);
    Calendar c = Calendar.getInstance();
    mYear = c.get(Calendar.YEAR);
    mMonth = c.get(Calendar.MONTH);
    mDay = c.get(Calendar.DAY_OF_MONTH);
    dataPicker.init(mYear, mMonth, mDay, (datePicker, year, month, day) -> {
        mYear = year;
        mMonth = month;
        mDay = day;
    });

    new MaterialDialog.Builder(mContext)
            .customView(v, false)
            .positiveText(android.R.string.ok)
            .negativeText(android.R.string.cancel)
            .onPositive((dialog, which) -> {
                textView.setText(mYear + "-" + (mMonth + 1) + "-" + mDay);
            }).show();
}
项目:Sanxing    文件:OperateTimeLeftActivityBase.java   
@OnClick(R.id.time_left_from_date_content)
void timeLeftStartDateOnClickBehavior() {
    DatePickerDialog.OnDateSetListener date = new DatePickerDialog.OnDateSetListener() {
        @Override
        public void onDateSet(DatePicker view, int year, int monthOfYear, int dayOfMonth) {
            startCalendar.set(Calendar.YEAR, year);
            startCalendar.set(Calendar.MONTH, monthOfYear);
            startCalendar.set(Calendar.DAY_OF_MONTH, dayOfMonth);
            DateFormat sdf = android.text.format.DateFormat.getDateFormat(getBaseContext());
            startDateContent.setText(sdf.format(startCalendar.getTime()));
            setDate1 = true;
        }
    };
    new DatePickerDialog(this, date,
            startCalendar.get(Calendar.YEAR),
            startCalendar.get(Calendar.MONTH),
            startCalendar.get(Calendar.DAY_OF_MONTH)).show();
}
项目:Sanxing    文件:OperateTimeLeftActivityBase.java   
@OnClick(R.id.time_left_due_date_content)
void timeLeftDueDateOnClickBehavior() {
    DatePickerDialog.OnDateSetListener date = new DatePickerDialog.OnDateSetListener() {
        @Override
        public void onDateSet(DatePicker view, int year, int monthOfYear, int dayOfMonth) {
            dueCalendar.set(Calendar.YEAR, year);
            dueCalendar.set(Calendar.MONTH, monthOfYear);
            dueCalendar.set(Calendar.DAY_OF_MONTH, dayOfMonth);
            DateFormat sdf = android.text.format.DateFormat.getDateFormat(getBaseContext());
            dueDateContent.setText(sdf.format(dueCalendar.getTime()));
            setDate2 = true;
        }
    };
    new DatePickerDialog(this, date,
            dueCalendar.get(Calendar.YEAR),
            dueCalendar.get(Calendar.MONTH),
            dueCalendar.get(Calendar.DAY_OF_MONTH)).show();
}
项目:Sanxing    文件:OperateTaskActivityBase.java   
@OnClick(R.id.task_due_date_content)
void taskDueDateOnClickBehavior() {
    DatePickerDialog.OnDateSetListener date = new DatePickerDialog.OnDateSetListener() {
        @Override
        public void onDateSet(DatePicker view, int year, int monthOfYear, int dayOfMonth) {
            dueCalendar.set(Calendar.YEAR, year);
            dueCalendar.set(Calendar.MONTH, monthOfYear);
            dueCalendar.set(Calendar.DAY_OF_MONTH, dayOfMonth);
            DateFormat sdf = android.text.format.DateFormat.getDateFormat(getBaseContext());
            dueDateContent.setText(sdf.format(dueCalendar.getTime()));
            setDate = true;
        }
    };
    new DatePickerDialog(this, date,
            dueCalendar.get(Calendar.YEAR),
            dueCalendar.get(Calendar.MONTH),
            dueCalendar.get(Calendar.DAY_OF_MONTH)).show();
}
项目:Sanxing    文件:HabitCalendarFragment.java   
@OnClick(R.id.habit_calendar_year_month)
void habitCalendarYearMonthOnClickBehavior() {
    DatePickerDialog.OnDateSetListener dateListener = new DatePickerDialog.OnDateSetListener() {
        @Override
        public void onDateSet(DatePicker view, int year, int monthOfYear, int dayOfMonth) {
            selectedCalendar.set(Calendar.YEAR, year);
            selectedCalendar.set(Calendar.MONTH, monthOfYear);
            selectedCalendar.set(Calendar.DAY_OF_MONTH, dayOfMonth);
            habitCalendarView.setCurrentDate(selectedCalendar.getTime());
            updateHabitCalendarYearMonth();
            updateHabitDetails(selectedCalendar.getTime());
        }
    };
    new DatePickerDialog(this.getContext(), dateListener,
            selectedCalendar.get(Calendar.YEAR),
            selectedCalendar.get(Calendar.MONTH),
            selectedCalendar.get(Calendar.DAY_OF_MONTH)).show();
}
项目:quickhybrid-android    文件:UIApi.java   
/**
 * 弹出日期选择对话框
 * <p>
 * 参数:
 * title: 标题
 * datetime: 指定日期 yyyy-MM-dd
 * 返回:
 * date: 格式:yyyy-MM-dd
 */
public static void pickDate(final IQuickFragment webLoader, WebView wv, JSONObject param, final Callback callback) {
    final String title = param.optString("title");
    String date = param.optString("datetime");
    final Calendar calendar = Calendar.getInstance();
    if (!TextUtils.isEmpty(date)) {
        calendar.setTime(DateUtil.convertString2Date(date, "yyyy-MM-dd"));
    }
    wv.post(new Runnable() {
        public void run() {
            DialogUtil.pickDate(webLoader.getPageControl().getActivity(), title, calendar, new DatePickerDialog.OnDateSetListener() {
                @Override
                public void onDateSet(DatePicker view, int year, int monthOfYear, int dayOfMonth) {
                    calendar.set(Calendar.YEAR, year);
                    calendar.set(Calendar.MONTH, monthOfYear);
                    calendar.set(Calendar.DAY_OF_MONTH, dayOfMonth);
                    String chooseDate = DateUtil.convertDate(calendar.getTime(), "yyyy-MM-dd");
                    Map<String, Object> map = new HashMap<>();
                    map.put("date", chooseDate);
                    callback.applySuccess(map);
                }
            });
        }
    });
}
项目:quickhybrid-android    文件:UIApi.java   
/**
 * 弹出年月选择对话框
 * <p>
 * 参数:
 * title: 标题
 * datetime: 指定日期 yyyy-MM
 * 返回:
 * month: 格式:yyyy-MM
 */
public static void pickMonth(final IQuickFragment webLoader, WebView wv, JSONObject param, final Callback callback) {
    String title = param.optString("title");
    String date = param.optString("datetime");
    final Calendar calendar = Calendar.getInstance();
    if (!TextUtils.isEmpty(date)) {
        calendar.setTime(DateUtil.convertString2Date(date, "yyyy-MM"));
    }
    DialogUtil.pickMonth(webLoader.getPageControl().getActivity(), title, calendar, new DatePickerDialog.OnDateSetListener() {
        @Override
        public void onDateSet(DatePicker view, int year, int monthOfYear, int dayOfMonth) {
            calendar.set(Calendar.YEAR, year);
            calendar.set(Calendar.MONTH, monthOfYear);
            calendar.set(Calendar.DAY_OF_MONTH, dayOfMonth);
            String chooseDate = DateUtil.convertDate(calendar.getTime(), "yyyy-MM");
            Map<String, Object> map = new HashMap<>();
            map.put("month", chooseDate);
            callback.applySuccess(map);
        }
    });
}
项目:Veggietizer    文件:DatePickerFragment.java   
@NonNull
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
    // Uses the current date as the default date in the picker
    Calendar c = Calendar.getInstance();
    int year = c.get(Calendar.YEAR);
    int month = c.get(Calendar.MONTH);
    int day = c.get(Calendar.DAY_OF_MONTH);
    DatePickerDialog dialog = new DatePickerDialog(getActivity(), this, year, month, day);
    DatePicker datePicker = dialog.getDatePicker();

    datePicker.setCalendarViewShown(false);
    numOfCalls = 0;

    return dialog;
}
项目:MobileAppForPatient    文件:CalendarDialog.java   
/**
 * Method to display the date picker
 */
public void showDatePicker(){
    Calendar mCalendar = Calendar.getInstance();
    int year = mCalendar.get(Calendar.YEAR);
    mCalendar.set(Calendar.ERA,1);
    int month = mCalendar.get(Calendar.MONTH);
    int day = mCalendar.get(Calendar.DAY_OF_MONTH);
    mCurrentDatePicker = new DatePickerDialog(mActivity,mDatePickerHandler, year, month, day);
    mCurrentDatePicker.setButton(DatePickerDialog.BUTTON_POSITIVE, mActivity.getString(R.string.ok),new DialogInterface.OnClickListener(){
        @Override
        public void onClick(DialogInterface dialog, int which) {
            DatePicker datePicker = mCurrentDatePicker.getDatePicker();
            mDatePickerHandler.onDateSet(datePicker, datePicker.getYear(), datePicker.getMonth(), datePicker.getDayOfMonth());
        }
    });

    mCurrentDatePicker.show();
}
项目:arrispwgen-android    文件:DatePickerFragment.java   
@Override
public void onDateSet(DatePicker view, int year, int month, int dayOfMonth) {
    String tag = getTag();

    MainActivity activity = (MainActivity) getActivity();

    // threeten's LocalDate months are zero-indexed.
    month++;

    switch (tag) {
        case "start_date_picker":
            activity.set_start_date(year, month, dayOfMonth);
            DialogFragment end_date_fragment = new DatePickerFragment();
            end_date_fragment.show(getFragmentManager(), "end_date_picker");
            break;
        case "end_date_picker":
            activity.set_end_date(year, month, dayOfMonth);
            activity.generate_potd_list();
            break;
    }
}
项目:GoalsAndHabits    文件:NewHabitEventActivity.java   
/**
 * Called on activity start. Generates layout and button functionality.
 * @param savedInstanceState
 */
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_new_habit_event);
    Toolbar toolbar = (Toolbar) findViewById(R.id.actionbar);
    toolbar.setTitle("New Habit Event");
    toolbar.setNavigationIcon(R.drawable.ic_close_button);
    setSupportActionBar(toolbar);

    editPhoto = (ImageView) findViewById(R.id.editPhoto);
    editComment = (EditText) findViewById(R.id.editComment);
    editDate = (DatePicker) findViewById(R.id.editDate);
    photoEncoded = "";

    editPhoto.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            dispatchTakePictureIntent();
        }
    });


}
项目:orgzly-android    文件:AgendaFragmentTest.java   
@Test
public void testShiftRepeaterTaskToTomorrow() {
    DateTime tomorrow = DateTime.now().withTimeAtStartOfDay().plusDays(1);

    defaultSetUp();
    openAgenda();
    onListItem(2).perform(swipeRight());
    onListItem(2).onChildView(withId(R.id.item_menu_schedule_btn)).perform(click());
    onView(withId(R.id.dialog_timestamp_date_picker)).perform(click());
    onView(withClassName(equalTo(DatePicker.class.getName())))
            .perform(PickerActions.setDate(
                    tomorrow.getYear(),
                    tomorrow.getMonthOfYear(),
                    tomorrow.getDayOfMonth()));
    onView(withText(R.string.ok)).perform(click());
    onView(withText(R.string.set)).perform(click());
    onView(allOf(withId(android.R.id.list), isDisplayed())).check(matches(listViewItemCount(21)));
}
项目:KTools    文件:KDialogActivity.java   
@OnClick(R.id.btn_choose_date_dialog)
public void onBtnChooseDateDialogClicked() {
    final Calendar calendar = Calendar.getInstance();
    DatePickerDialog dialog = new DatePickerDialog(
            this,
            new DatePickerDialog.OnDateSetListener() {
                @Override
                public void onDateSet(DatePicker view, int year, int month, int dayOfMonth) {
                    calendar.set(Calendar.YEAR, year);
                    calendar.set(Calendar.MONTH, month);
                    calendar.set(Calendar.DAY_OF_MONTH, dayOfMonth);
                    String date = DateFormat.getDateInstance(DateFormat.FULL).format(calendar.getTime());
                    ToastUtils.showShortToast(date);
                }
            }, calendar.get(Calendar.YEAR), calendar.get(Calendar.MONTH), calendar.get(Calendar.DAY_OF_MONTH));
    dialog.show();
}
项目:GitHub    文件:DynamicSettersActivity.java   
@OnClick(R.id.button_min_date)
void onMinClicked() {
    showDatePickerDialog(this, widget.getMinimumDate(), new DatePickerDialog.OnDateSetListener() {
        @Override
        public void onDateSet(DatePicker view, int year, int monthOfYear, int dayOfMonth) {
            widget.state().edit()
                    .setMinimumDate(CalendarDay.from(year, monthOfYear, dayOfMonth))
                    .commit();
        }
    });
}
项目:react-native-datepicker-component-android    文件:RNDatePickerComponentViewManager.java   
/**
 * Create a native date picker from layout file with spinner mode
 * @param reactContext
 * @return Native date picker
 */
@Override
protected DatePicker createViewInstance(ThemedReactContext reactContext) {
    View view = LayoutInflater.from(reactContext).inflate(R.layout.date_picker, null, false);
    DatePicker picker = (DatePicker) view.findViewById(R.id.datepicker);
    ViewGroup viewParent = (ViewGroup) picker.getParent();
    if (viewParent != null) {
        viewParent.removeView(picker);
    }
    return picker;
}
项目:GitHub    文件:DynamicSettersActivity.java   
@OnClick(R.id.button_selected_date)
void onSelectedClicked() {
    showDatePickerDialog(this, widget.getSelectedDate(), new DatePickerDialog.OnDateSetListener() {
        @Override
        public void onDateSet(DatePicker view, int year, int monthOfYear, int dayOfMonth) {
            widget.setSelectedDate(CalendarDay.from(year, monthOfYear, dayOfMonth));
        }
    });
}
项目:Tasks    文件:CalenderFragment.java   
@Override
public void onCreate(Bundle savedInstance){
    super.onCreate(savedInstance);
    ((App)getActivity().getApplication()).getComponent().inject(this);

    taskList = presenter.getNormalTasks();
    DatePicker picker = new DatePicker(getActivity());
    timeInMillSecs = picker.getMaxDate();
}
项目:TrainPonctuality    文件:DateSelectionActivity.java   
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_date_selection);

    Bundle extras = getIntent().getExtras();
    setTitle(extras.getInt("title"));
    //noinspection ConstantConditions
    getSupportActionBar().setBackgroundDrawable(new ColorDrawable(ContextCompat.getColor(this, extras.getInt("color"))));

    dtpDate = (DatePicker) findViewById(R.id.datePicker);
    dateSelection = GregorianCalendar.getInstance();
    dateSelection.setTimeInMillis(extras.getLong("date"));
    dtpDate.updateDate(dateSelection.get(Calendar.YEAR), dateSelection.get(Calendar.MONTH), dateSelection.get(Calendar.DAY_OF_MONTH));
}
项目:wirtualnaApteczka    文件:MedicineDueDateSetListener.java   
@Override
public void onDateSet(DatePicker view, int year, int month, int dayOfMonth) {
    Calendar calendar = Calendar.getInstance();
    calendar.set(year, month, dayOfMonth, 0, 0, 0);

    DateFormat dateFormat = android.text.format.DateFormat.getDateFormat(activity.getApplicationContext());
    String formattedDate = dateFormat.format(calendar.getTime());

    medicineDueDate.setText(formattedDate);

    medicineForUpdate.setDueDate(calendar.getTime());
}
项目:Toodoo    文件:ToodooNote.java   
public void showDatePickerDialog() {
    final Calendar calendar = Calendar.getInstance();
    int mYear = calendar.get(Calendar.YEAR);
    int mMonth = calendar.get(Calendar.MONTH);
    int mDay = calendar.get(Calendar.DAY_OF_MONTH);

    final SimpleDateFormat simpleDateFormat = new SimpleDateFormat("MMM dd, yyyy", Locale.US);
    final SimpleDateFormat simpleDayFormat = new SimpleDateFormat("EEE", Locale.US);
    final String currentDate = simpleDateFormat.format(calendar.getTime());

    final ToodooDatePickerDialog datePickerDialog = new ToodooDatePickerDialog(this, new DatePickerDialog.OnDateSetListener() {
        @Override
        public void onDateSet(DatePicker datePicker, int year, int month, int day) {
            Calendar newCalendar = Calendar.getInstance();
            newCalendar.set(year, month, day);
            selectedDueDateValue = newCalendar.getTime();
            String selectedDate = simpleDateFormat.format(selectedDueDateValue);
            selectedDueDate = simpleDayFormat.format(selectedDueDateValue) + ", " + selectedDate;

            calendar.add(Calendar.DATE, 1);
            if (selectedDate.equals(currentDate)) {
                selectedDueDate = "Today, " + selectedDate;
            } else if (selectedDate.equals(simpleDateFormat.format(calendar.getTime()))) {
                selectedDueDate = "Tomorrow, " + selectedDate;
            }

            ToodooOptionsModel ToodooOptionsModel = toodooOptionsList.get(1);
            ToodooOptionsModel.setOptionValue(selectedDueDate);
            mAdapter.notifyDataSetChanged();
        }
    }, mYear, mMonth, mDay);
    datePickerDialog.getDatePicker().setMinDate(System.currentTimeMillis() - 1000);
    setTitle("Select a date");
    datePickerDialog.show();
}
项目:hyperrail-for-android    文件:DateTimePicker.java   
/**
 * Callback from date dialog
 *
 * @inheritDoc
 */
@Override
public void onDateSet(DatePicker view, int year, int month, int day) {
    this.year = year;
    this.month = month;
    this.day = day;
    pickTime();
}
项目:FamilyLibraryManager    文件:InputFragment.java   
/**
 * 显示时间捡取器
 */
private void showDatePickerDialog() {
    new DatePickerDialog(getActivity(), new DatePickerDialog.OnDateSetListener() {
        @Override
        public void onDateSet(DatePicker view, int year, int monthOfYear, int dayOfMonth) {
            showDate.set(Calendar.YEAR, year);
            showDate.set(Calendar.MONTH, monthOfYear);
            showDate.set(Calendar.DAY_OF_MONTH, dayOfMonth);
            bookDateEditText.setText(DateFormat.format("yyyy-MM-dd", showDate));
        }
    }, showDate.get(Calendar.YEAR), showDate.get(Calendar.MONTH), showDate.get(Calendar.DAY_OF_MONTH)).show();
}
项目:FamilyLibraryManager    文件:SearchFragment.java   
/**
 * 显示时间捡取器
 */
private void showDatePickerDialog() {
    new DatePickerDialog(getActivity(), new DatePickerDialog.OnDateSetListener() {
        @Override
        public void onDateSet(DatePicker view, int year, int monthOfYear, int dayOfMonth) {
            showDate.set(Calendar.YEAR, year);
            showDate.set(Calendar.MONTH, monthOfYear);
            showDate.set(Calendar.DAY_OF_MONTH, dayOfMonth);
            bookDateEditText.setText(DateFormat.format("yyyy-MM-dd", showDate));
        }
    }, showDate.get(Calendar.YEAR), showDate.get(Calendar.MONTH), showDate.get(Calendar.DAY_OF_MONTH)).show();
}
项目:MyFlightbookAndroid    文件:DlgDatePicker.java   
public void onDateChanged(DatePicker vw, int year, int monthOfYear, int dayOfMonth) {
    GregorianCalendar c = getCalendar();
    c.set(year, monthOfYear, dayOfMonth, tpTime.getCurrentHour(), tpTime.getCurrentMinute());

    this.m_Date = c.getTime();

    NotifyDelegate();
}
项目:MoodSwings    文件:EditMoodActivity.java   
@Override
public void onDateSet(DatePicker view, int year, int monthOfYear,
                      int dayOfMonth) {
    myCalendar.set(Calendar.YEAR, year);
    myCalendar.set(Calendar.MONTH, monthOfYear);
    myCalendar.set(Calendar.DAY_OF_MONTH, dayOfMonth);
    moodEvent.setDate(SIMPLE_DATE_FORMAT.format(myCalendar.getTime()));

    new TimePickerDialog(EditMoodActivity.this, time, myCalendar
            .get(Calendar.HOUR_OF_DAY), myCalendar.get(Calendar.MINUTE), false).show();
}
项目:calendarview2    文件:DynamicSettersActivity.java   
@OnClick(R.id.button_min_date)
void onMinClicked() {
    showDatePickerDialog(this, widget.getMinimumDate(), new DatePickerDialog.OnDateSetListener() {
        @Override
        public void onDateSet(DatePicker view, int year, int monthOfYear, int dayOfMonth) {
            widget.state().edit()
                    .setMinimumDate(CalendarDay.from(year, monthOfYear, dayOfMonth))
                    .commit();
        }
    });
}
项目:decoy    文件:UserProfileEditItemActivity.java   
private void openTimePicker() {
    MyDatePickerDialog datePickerDialog = new MyDatePickerDialog(this, new DatePickerDialog.OnDateSetListener() {
        @Override
        public void onDateSet(DatePicker view, int year, int monthOfYear, int dayOfMonth) {
            birthYear = year;
            birthMonth = monthOfYear;
            birthDay = dayOfMonth;
            updateDate();

        }
    }, birthYear, birthMonth, birthDay);
    datePickerDialog.show();
}
项目:MyCalendar    文件:AddEditWeekLessonDialogFragment.java   
@Override
public void onDateSet(DatePicker view, int year, int month, int dayOfMonth) {
    if (mActiveCal != null) {
        mActiveCal.set(Calendar.YEAR, year);
        mActiveCal.set(Calendar.MONTH, month);
        mActiveCal.set(Calendar.DAY_OF_MONTH, dayOfMonth);
        onUpdateDate(mViewId, mActiveCal);
        onAfterShowDatePicker();
    }
}
项目:MyCalendar    文件:AddEditDetailSubjectActivity.java   
@Override
public void onDateSet(DatePicker datePicker, int year, int month, int day, int id_view) {
    Calendar cal = Calendar.getInstance();
    cal.set(Calendar.YEAR, year);
    cal.set(Calendar.MONTH, month);
    cal.set(Calendar.DAY_OF_MONTH, day);
    DateTimeHelper.clearTime(cal);
    onUpdateDate(id_view, cal);
}
项目:GCSApp    文件:AddCaseActivity.java   
public void showDialogDatePicker(){
    AlertDialog.Builder builder = new AlertDialog.Builder(context, R.style.DialogTransBackGround);
    final AlertDialog dialog_date = builder.create();
    dialog_date.show();
    View view_dialog = LayoutInflater.from(context).inflate(R.layout.item_dialog_datepicker, null);
    dialog_date.setContentView(view_dialog);
    DatePicker picker = (DatePicker) view_dialog.findViewById(R.id.date_picker);
    Button bt_yes = (Button) view_dialog.findViewById(R.id.bt_yes);
    Button bt_no = (Button) view_dialog.findViewById(R.id.bt_no);

    Calendar calendar = Calendar.getInstance();
    int int_Year = calendar.get(Calendar.YEAR);
    int int_Month = calendar.get(Calendar.MONTH);
    int int_Day = calendar.get(Calendar.DAY_OF_MONTH);

    time = int_Year + "-" + String.format("%02d", (int_Month + 1)) + "-" + String.format("%02d", int_Day);
    picker.init(int_Year, int_Month, int_Day, new DatePicker.OnDateChangedListener() {
        @Override
        public void onDateChanged(DatePicker datePicker, int i, int i1, int i2) {
            Log.e("aaa", "" + i2);
            time = i + "-" + String.format("%02d", (i1 + 1)) + "-" + String.format("%02d", i2);
        }
    });
    bt_yes.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            et_add_time.setText(time);
            dialog_date.dismiss();
        }
    });
    bt_no.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            dialog_date.dismiss();
        }
    });
}
项目:Moodr    文件:EditMoodActivity.java   
@Override
public void onDateSet(DatePicker datePicker, int year, int month, int day) {
    yearFinal = year;
    monthFinal = month + 1;
    dayFinal = day;

    hour = editDate_copy.getHours();
    minute = editDate_copy.getMinutes();

    TimePickerDialog timePickerDialog = new TimePickerDialog(EditMoodActivity.this, EditMoodActivity.this, hour, minute, DateFormat.is24HourFormat(this));
    timePickerDialog.show();
}
项目:Chore-Manager-App    文件:NewChoreActivity.java   
@Override
public void onDateSet(DatePicker view, int year, int monthofYear, int dayOfMonth) {
dateTime.set(Calendar.YEAR,year);
dateTime.set(Calendar.MONTH,monthofYear);
dateTime.set(Calendar.DAY_OF_MONTH,dayOfMonth);
updateDeadLineText();
updateTime();
}
项目:Chore-Manager-App    文件:EditChoreActivity.java   
@Override
public void onDateSet(DatePicker view, int year, int monthofYear, int dayOfMonth) {
    dateTime.set(Calendar.YEAR,year);
    dateTime.set(Calendar.MONTH,monthofYear);
    dateTime.set(Calendar.DAY_OF_MONTH,dayOfMonth);
    updateDeadLineText();
    updateTime();
}