Skip to content

This Library is a date picker for Android to pick a date and only supports a year from the day you open the app.

Notifications You must be signed in to change notification settings

behkha/Persian-Horizontal-Date-Picker

Repository files navigation

Persian Horizontal Date Picker

This Library is a date picker for Android to pick a date and only supports a year from the day you open the app.

Demo

persian_horizontal-date-picker

Usage

First add jitpack to your projects build.gradle file

allprojects {
   	repositories {
   		...
   		maven { url "https://jitpack.io" }
   	}
}

Then add the dependency in your android app module's build.gradle file.

dependencies {
    implementation 'com.github.Behkha:Persian-Horizontal-Date-Picker:1.1.0'
}

Then use the view in your layouts:

<com.ratintech.behkha.persiandatepicker.PersianDatePicker
        android:id="@+id/persian_date_picker"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        >

Setup

PersianDatePicker persianDatePicker = findViewById(R.id.persian_date_picker);
        persianDatePicker.setYearMonths( new Calendar( new PersianCalendar().getPersianLongDate()).getYearMonths() )
                .setDefaultItemBackgroundColor(R.color.defaultBackgroundColor)  // background color of non-selected item
                .setDefaultItemTextColor(R.color.defaultTextColor)  // text color of non-selected item
                .setSelectedItemBackgroundColor(R.color.colorPrimary) // background color of selected item
                .setSelectedItemTextColor(R.color.selectText)   // text color of selected item
                .setListener(new PersianDatePicker.OnDaySelectListener() {
                    @Override
                    public void onDaySelect(YearMonth yearMonth, Day day) {
                        // right your code here when item is selected 
                    }
                })
                .setItemElevation( 4f )  // default is 0
                .setItemRadius( 2f )  // default is 0
                .hasAnimation(true) // Animation for item selection . default is false 
                .load();

About

This Library is a date picker for Android to pick a date and only supports a year from the day you open the app.

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages