Skip to content

Ganeshkumar1010/DatePicker

 
 

Repository files navigation

DatePicker&TimePicker

Datepicker is an IOS datepicker widget-like date and time picker library.

The library has many different feature options to customize your widget.

Recent Article 0

Features


DarkMode Support


Usage

Date Picker

        DatePicker datePicker = findViewById(R.id.datepicker);
        datePicker.setOffset(3);
        datePicker.setTextSize(19);
        datePicker.setPickerMode(DatePicker.DAY_ON_FIRST);
        datePicker.setMaxDate(/*long time*/);
        datePicker.setDate(/*long time*/);
        datePicker.setMinDate(/*long time*/);
        
        datePicker.setDataSelectListener(new DatePicker.DataSelectListener() {
            @Override
            public void onDateSelected(long date, int day, int month, int year) {
               
            }
        });
    <com.ozcanalasalvar.library.view.datePicker.DatePicker
            android:id="@+id/datepicker"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            app:offset="3"
            app:pickerMode="dayFirst"
            app:textSize="19" />
Popup Usage
        datePickerPopup = new DatePickerPopup.Builder()
                .from(/*context*/)
                .offset(3)
                .pickerMode(DatePicker.MONTH_ON_FIRST)
                .textSize(19)
                .endDate(/*long time*/)
                .currentDate(/*long time*/)
                .startDate(/*long time*/)
                .listener(new DatePickerPopup.OnDateSelectListener() {
                    @Override
                    public void onDateSelected(DatePicker dp, long date, int day, int month, int year) {
                        
                    }
                })
                .build();

Time Picker

        TimePicker timePicker = findViewById(R.id.timepicker);
        timePicker.setOffset(2);
        timePicker.setTextSize(19);
        timePicker.setHour(/*hour*/);
        timePicker.setMinute(/*minute*/);
        timePicker.setTimeSelectListener(new TimePicker.TimeSelectListener() {
            @Override
            public void onTimeSelected(int hour, int minute) {
                
            }
        });
    <com.ozcanalasalvar.library.view.timePicker.TimePicker
            android:id="@+id/timepicker"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            app:offset="2"
            app:textSize="17" />
Popup Usage
       timePickerPopup = new TimePickerPopup.Builder()
                .from(this)
                .offset(3)
                .textSize(17)
                .setTime(/*hour*/, /*minute*/)
                .listener(new TimePickerPopup.OnTimeSelectListener() {
                    @Override
                    public void onTimeSelected(TimePicker timePicker, int hour, int minute) {
                        
                    }
                })
                .build();

Implementation Gradle

Add it in your root build.gradle at the end of repositories
    repositories {
        maven { url 'https://jitpack.io' }
    }
Add the dependency
    dependencies {
	    implementation 'com.github.OzcanAlasalvar:DatePicker:1.0.4'
	}

About

Date and time picker like IOS

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Java 100.0%