Skip to content

DateTimePickerEx is an extension of DatePicker and TimePicker for Android.

License

Notifications You must be signed in to change notification settings

recruit-mtl/DateTimePickerEx

Repository files navigation

DateTimePickerEx

DateTimePickerEx is an extension of DatePicker and TimePicker for Android.

sample_screenshot

Usage

layout.xml

        <jp.co.recruit.mtl.datetimepickerex.DatePickerEx
            android:id="@+id/event_date_picker"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:calendarViewShown="false"
            android:datePickerMode="spinner"  />

        <jp.co.recruit.mtl.datetimepickerex.TimePickerEx
            android:id="@+id/event_time_picker"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:timePickerMode="spinner" />

Java

    private EventDatePickerListener mEventDatePickerListener;
    
    final DatePickerEx datePicker = (DatePickerEx) this.findViewById(R.id.event_date_picker);
    final TimePickerEx timePicker = (TimePickerEx) this.findViewById(R.id.event_time_picker);
    
    datePicker.init(year, monthOfYear, dayOfMonth, new DatePicker.OnDateChangedListener() {
        @Override
        public void onDateChanged(DatePicker datePicker, int year, int month, int day) {
            if (mEventDatePickerListener != null) {
                mEventDatePickerListener.onDateChanged(year, month, day, timePicker.getCurrentHour(), timePicker.getCurrentMinute());
            }
        }
    });
        
    timePicker.setOnTimeChangedListener(new TimePicker.OnTimeChangedListener() {
        @Override
        public void onTimeChanged(TimePicker timePicker, int hour, int minute) {
            if (mEventDatePickerListener != null) {
                mEventDatePickerListener.onDateChanged(datePicker.getYear(), datePicker.getMonth(), datePicker.getDayOfMonth(), hour, minute);
            }
        }
    });

Download

clone or copy this file

License

DateTimePickerEx is available under the MIT license. See the LICENSE file for more info.

About

DateTimePickerEx is an extension of DatePicker and TimePicker for Android.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages