MaterialDateRangePicker


Source link: https://github.com/borax12/MaterialDateRangePicker

Material Date and Time Picker with Range Selection

Credit to the original amazing material date picker library by wdullaer - https://github.com/wdullaer/MaterialDateTimePicker

##Adding to your project

Add the jcenter repository information in your build.gradle file like this

repositories {

jcenter() 
}

dependencies {

compile 'com.borax12.materialdaterangepicker:library:1.9' 
}
 

##Update --added highlighted range selection method --added portuguese translation --add end time selection in TimePicker

##Date Selection

##Time Selection

Support for Android 4.0 and up.

From the original library documentation -

You may also add the library as an Android Library to your project. All the library files live in library.

Using the Pickers

  1. Implement an OnDateSetListener or OnTimeSetListener
  2. Create a ``DatePickerDialog` using the supplied factory

Implement an OnDateSetListener

In order to receive the date set in the picker, you will need to implement the OnDateSetListener interfaces. Typically this will be the Activity or Fragment that creates the Pickers.

or

Implement an OnTimeSetListener

In order to receive the time set in the picker, you will need to implement the OnTimeSetListener interfaces. Typically this will be the Activity or Fragment that creates the Pickers.

//new onDateSet @Override public void onDateSet(DatePickerDialog view, int year, int monthOfYear, int dayOfMonth,int yearEnd, int monthOfYearEnd, int dayOfMonthEnd) {
  
}
  @Override public void onTimeSet(DatePickerDialog view, int year, int monthOfYear, int dayOfMonth,int yearEnd, int monthOfYearEnd, int dayOfMonthEnd) {

String hourString = hourOfDay < 10 ? "0"+hourOfDay : ""+hourOfDay;

String minuteString = minute < 10 ? "0"+minute : ""+minute;

String hourStringEnd = hourOfDayEnd < 10 ? "0"+hourOfDayEnd : ""+hourOfDayEnd;

String minuteStringEnd = minuteEnd < 10 ? "0"+minuteEnd : ""+minuteEnd;

String time = "You picked the following time: From - "+hourString+"h"+minuteString+" To - "+hourStringEnd+"h"+minuteStringEnd;

 timeTextView.setText(time);
  
}

Create a DatePickerDialog` using the supplied factory

You will need to create a new instance of DatePickerDialog using the static newInstance() method, supplying proper default values and a callback. Once the dialogs are configured, you can call show().

Calendar now = Calendar.getInstance();
 DatePickerDialog dpd = DatePickerDialog.newInstance(
MainActivity.this,
now.get(Calendar.YEAR),
now.get(Calendar.MONTH),
now.get(Calendar.DAY_OF_MONTH) );
 dpd.show(getFragmentManager(), "Datepickerdialog");

Create a TimePickerDialog` using the supplied factory

You will need to create a new instance of TimePickerDialog using the static newInstance() method, supplying proper default values and a callback. Once the dialogs are configured, you can call show().

Calendar now = Calendar.getInstance();
 TimePickerDialog tpd = TimePickerDialog.newInstance(

 MainActivity.this,

 now.get(Calendar.HOUR_OF_DAY),

 now.get(Calendar.MINUTE),

 false

  );
 tpd.show(getFragmentManager(), "Timepickerdialog");

For other documentation regarding theming , handling orientation changes , and callbacks - check out the original documentation - https://github.com/wdullaer/MaterialDateTimePicker

TODO

  1. Custom Colors in Date and Time Picker - including indicators

Resources

A library for Android TV that extends the Leanback library capabilities by offering a set of more powerful features.

j2j

Convert any file.json to the corresponding mapped java files

This is a helper for releasing libraries to bintray. It is intended to help configuring stuff related to maven and bintray. At the moment it works with Android Library projects, plain Java and plain Groovy projects.

The View makes Animation the state of play.

This project allows to easily setup a vertical menu for Android.

This project created to help developer to have better experience in using Realm-Java

Topics


2D Engines   3D Engines   9-Patch   Action Bars   Activities   ADB   Advertisements   Analytics   Animations   ANR   AOP   API   APK   APT   Architecture   Audio   Autocomplete   Background Processing   Backward Compatibility   Badges   Bar Codes   Benchmarking   Bitmaps   Bluetooth   Blur Effects   Bread Crumbs   BRMS   Browser Extensions   Build Systems   Bundles   Buttons   Caching   Camera   Canvas   Cards   Carousels   Changelog   Checkboxes   Cloud Storages   Color Analysis   Color Pickers   Colors   Comet/Push   Compass Sensors   Conferences   Content Providers   Continuous Integration   Crash Reports   Credit Cards   Credits   CSV   Curl/Flip   Data Binding   Data Generators   Data Structures   Database   Database Browsers   Date &   Debugging   Decompilers   Deep Links   Dependency Injections   Design   Design Patterns   Dex   Dialogs   Distributed Computing   Distribution Platforms   Download Managers   Drawables   Emoji   Emulators   EPUB   Equalizers &   Event Buses   Exception Handling   Face Recognition   Feedback &   File System   File/Directory   Fingerprint   Floating Action   Fonts   Forms   Fragments   FRP   FSM   Functional Programming   Gamepads   Games   Geocaching   Gestures   GIF   Glow Pad   Gradle Plugins   Graphics   Grid Views   Highlighting   HTML   HTTP Mocking   Icons   IDE   IDE Plugins   Image Croppers   Image Loaders   Image Pickers   Image Processing   Image Views   Instrumentation   Intents   Job Schedulers   JSON   Keyboard   Kotlin   Layouts   Library Demos   List View   List Views   Localization   Location   Lock Patterns   Logcat   Logging   Mails   Maps   Markdown   Mathematics   Maven Plugins   MBaaS   Media   Menus   Messaging   MIME   Mobile Web   Native Image   Navigation   NDK   Networking   NFC   NoSQL   Number Pickers   OAuth   Object Mocking   OCR Engines   OpenGL   ORM   Other Pickers   Parallax List   Parcelables   Particle Systems   Password Inputs   PDF   Permissions   Physics Engines   Platforms   Plugin Frameworks   Preferences   Progress Indicators   ProGuard   Properties   Protocol Buffer   Pull To   Purchases   Push/Pull   QR Codes   Quick Return   Radio Buttons   Range Bars   Ratings   Recycler Views   Resources   REST   Ripple Effects   RSS   Screenshots   Scripting   Scroll Views   SDK   Search Inputs   Security   Sensors   Services   Showcase Views   Signatures   Sliding Panels   Snackbars   SOAP   Social Networks   Spannable   Spinners   Splash Screens   SSH   Static Analysis   Status Bars   Styling   SVG   System   Tags   Task Managers   TDD &   Template Engines   Testing   Testing Tools   Text Formatting   Text Views   Text Watchers   Text-to   Toasts   Toolkits For   Tools   Tooltips   Trainings   TV   Twitter   Updaters   USB   User Stories   Utils   Validation   Video   View Adapters   View Pagers   Views   Watch Face   Wearable Data   Wearables   Weather   Web Tools   Web Views   WebRTC   WebSockets   Wheel Widgets   Wi-Fi   Widgets   Windows   Wizards   XML   XMPP   YAML   ZIP Codes