Ecosyste.ms: Awesome

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

Awesome Lists | Featured Topics | Projects

https://github.com/malekkamel/rxdatetimepicker


https://github.com/malekkamel/rxdatetimepicker

android android-library date datepicker datetime datetimepicker java java-8 rxjava2 timepicker

Last synced: about 1 month ago
JSON representation

Awesome Lists containing this project

README

        

# RxDateTimePicker

## RxJava wrapper for date and time pickers.

||||

# Installation

[ ![Download](https://api.bintray.com/packages/shabankamel/android/rxdatetimepicker/images/download.svg) ](https://bintray.com/shabankamel/android/rxdatetimepicker/_latestVersion)

```gradle
dependencies {
implementation 'com.sha.kamel:rx_date_time_picker:1.0.0@aar'
}
```

# Usage:
## RxDatePicker
```java
RxTimePicker.newInstance()
.show(getSupportFragmentManager())
.asObservable()
.subscribe(timeInfo -> {
String msg = timeMessage(timeInfo);
tv_date.setText(msg);
});
```

## RxTimePicker
```java
RxDatePicker.newInstance()
.minDate(System.currentTimeMillis() - (4 * 24 * 60 * 60 * 1000)) // 4 days
.maxDate(System.currentTimeMillis() + (4 * 24 * 60 * 60 * 1000))
.show(getSupportFragmentManager())
.asObservable()
.subscribe(dateInfo -> {
String msg = dateMessage(dateInfo);
tv_time.setText(msg);
});
```

## RxDateTimePicker
```java
RxDateTimePicker.newInstance()
.minDate(System.currentTimeMillis() - (4 * 24 * 60 * 60 * 1000)) // 4 days
.maxDate(System.currentTimeMillis() + (4 * 24 * 60 * 60 * 1000))
.show(getSupportFragmentManager())
.asObservable()
.subscribe(dateTimeInfo -> {
String msg = new StringBuilder()
.append(dateMessage(dateTimeInfo.getDateInfo()))
.append("\n")
.append(timeMessage(dateTimeInfo.getTimeInfo()))
.toString();
tv_dateTime.setText(msg);});
```

### See 'app' module for the full code.

# License

## Apache license 2.0