Awesome Open Source
Awesome Open Source

RxDateTimePicker

RxJava wrapper for date and time pickers.

||||

Installation

Download

dependencies {
    implementation 'com.sha.kamel:rx_date_time_picker:[email protected]'
}

Usage:

RxDatePicker

RxTimePicker.newInstance()  
        .show(getSupportFragmentManager())  
        .asObservable()  
        .subscribe(timeInfo -> {  
            String msg = timeMessage(timeInfo);  
            tv_date.setText(msg);  
  });

RxTimePicker

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

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


Get A Weekly Email With Trending Projects For These Topics
No Spam. Unsubscribe easily at any time.
Java (696,382
Android (41,557
Java 8 (3,600
Android Library (3,345
Rxjava2 (1,349
Date (1,012
Datetime (655
Datepicker (628
Datetimepicker (159
Timepicker (157
Related Projects