An open API service indexing awesome lists of open source software.

https://github.com/lopspower/lazydatepicker

LazyDatePicker an alternative to the native Android Date Picker 📅
https://github.com/lopspower/lazydatepicker

android datepicker lazydatepicker

Last synced: 3 months ago
JSON representation

LazyDatePicker an alternative to the native Android Date Picker 📅

Awesome Lists containing this project

README

          

LazyDatePicker
=================

sample

[![Platform](https://img.shields.io/badge/platform-android-green.svg)](http://developer.android.com/index.html)
[![API](https://img.shields.io/badge/API-16%2B-brightgreen.svg?style=flat)](https://android-arsenal.com/api?level=16)
[![Maven Central](https://img.shields.io/maven-central/v/com.mikhaellopez/lazydatepicker.svg?label=Maven%20Central)](https://search.maven.org/artifact/com.mikhaellopez/lazydatepicker)


[![Android Weekly](https://img.shields.io/badge/Android%20Weekly-%23317-orange.svg)](https://androidweekly.net/issues/issue-317)
[![Twitter](https://img.shields.io/badge/Twitter-@LopezMikhael-blue.svg?style=flat)](http://twitter.com/lopezmikhael)

This is an Android project to offer an alternative to the native Android Date Picker.


Android app on Google Play

USAGE
-----

To make a lazy date picker add LazyDatePicker in your layout XML and add LazyDatePicker library in your project or you can also grab it via Gradle:

```groovy
implementation 'com.mikhaellopez:lazydatepicker:1.1.0'
```

XML
-----

```xml

```

You must use the following properties in your XML to change your LazyDatePicker.

| Properties | Type | Default |
| ----------------------- | -------------------------| ---------- |
| `app:ldp_text_color` | color | BLACK |
| `app:ldp_hint_color` | color | GRAY |
| `app:ldp_date_format` | mm-dd-yyyy or dd-mm-yyyy | mm-dd-yyyy |
| `app:ldp_show_full_date`| boolean | true |

KOTLIN
-----

```kotlin
lazyDatePicker.setDateFormat(LazyDatePicker.DateFormat.MM_DD_YYYY)
lazyDatePicker.setMinDate(minDate)
lazyDatePicker.setMaxDate(maxDate)

// The date when is selected
lazyDatePicker.setOnDatePickListener { dateSelected ->
//...
}

// True or false when date is selected
lazyDatePicker.setOnDateSelectedListener { dateSelected ->
//...
}
```

JAVA
-----

```java
LazyDatePicker lazyDatePicker = findViewById(R.id.lazyDatePicker);
lazyDatePicker.setDateFormat(LazyDatePicker.DateFormat.MM_DD_YYYY);
lazyDatePicker.setMinDate(minDate);
lazyDatePicker.setMaxDate(maxDate);

lazyDatePicker.setOnDatePickListener(new LazyDatePicker.OnDatePickListener() {
@Override
public void onDatePick(Date dateSelected) {
//...
}
});

lazyDatePicker.setOnDateSelectedListener(new LazyDatePicker.OnDateSelectedListener() {
@Override
public void onDateSelected(Boolean dateSelected) {
//...
}
});
```

[LOCAL DATE](https://github.com/JakeWharton/ThreeTenABP)
-----

You can used `LazyLocalDatePicker` instead of `LazyDatePicker` to have all method with `LocalDate` instead of `Date`.

### XML:

```xml

```

### KOTLIN:

```kotlin
lazyLocalDatePicker.setDateFormat(LazyDatePicker.DateFormat.MM_DD_YYYY)
lazyLocalDatePicker.setMinLocalDate(minDate)
lazyLocalDatePicker.setMaxLocalDate(maxDate)

// The localdate when is selected
lazyLocalDatePicker.setOnLocalDatePickListener { localDateSelected ->
//...
}

// True or false when date is selected
lazyLocalDatePicker.setOnLocalDateSelectedListener { dateSelected ->
//...
}
```

OVERRIDE
-----

You can override day, month & year if you want like this in your `strings.xml`:

```xml

D
M
Y

```

You can also change the design of the picker by changing the dimensions like this in your `dimens.xml`:

```xml

12dp
2.5dp
1dp
6dp

```

And to finish you can also completely redefine the layout by keeping the same name `layout_lazy_date_picker.xml` and keep all the ids. You can find the default one here: [**layout_lazy_date_picker.xml**](/lazydatepicker/src/main/res/layout/layout_lazy_date_picker.xml)

SUPPORT ❤️
-----

Find this library useful? Support it by joining [**stargazers**](https://github.com/lopspower/LazyDatePicker/stargazers) for this repository ⭐️


And [**follow me**](https://github.com/lopspower?tab=followers) for my next creations 👍

LICENCE
-----

LazyDatePicker by [Lopez Mikhael](http://mikhaellopez.com/) is licensed under a [Apache License 2.0](http://www.apache.org/licenses/LICENSE-2.0).