This library simplified the way of get date from user input, Allows the user to enter a date as a text and then verify it based on date format, divider character and min or max date with other options.
implementation 'com.github.salahamassi:android-mask-date-editText:v1.02'
1- Define new DateEdit text inside you layout xml
<com.msa.dateedittext.DateEditText
android:id="@+id/dateEditText"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
2- start listening to user input from your acticity, fragment or any android UI components
dateEditText.listen()
and just that's it!
please download the sample and watch the video to dive more deep.
-
dateFormat
- You can choose between two format "ddMMyyyy" or "MMyy" maybe in the future i will add more, you can add and then make pull request.
-
dividerCharacter
- You can choose between three divider Character "/" or "-" or "."
-
maxDate
- Set the max date which can user enter it as a string from xml and as a Date object from the code.
-
minDate
- Set the min date which can user enter it as a string from xml and as a Date object from the code.
-
autoCorrect
- If you want to show error alert to user if he enters something invalid set autoCorrect = false, if you want autocorrecting to what the user inputing set it to "true".
-
helperTextEnabled
- Show helper text, Used just with TextInputLayout.
-
helperTextHighlightedColor
- Highlighted helper text color for what user inputed.