Skip to content

Commit

Permalink
Updated for use of point (.) as Divider
Browse files Browse the repository at this point in the history
  • Loading branch information
Shaewen-Chronicles authored and Shaewen-Chronicles committed Aug 25, 2021
1 parent 7438dce commit 7dad281
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 18 deletions.
10 changes: 9 additions & 1 deletion .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 0 additions & 12 deletions .idea/runConfigurations.xml

This file was deleted.

2 changes: 1 addition & 1 deletion app/src/main/res/layout/activity_main.xml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
android:imeOptions="actionNext"
app:autoCorrect="false"
app:dateFormat="ddMMyyyy"
app:dividerCharacter="slash"
app:dividerCharacter="point"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toStartOf="parent"
Expand Down
15 changes: 11 additions & 4 deletions dateedittext/src/main/java/com/msa/dateedittext/DateEditText.kt
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ class DateEditText : TextInputEditText {
enum class DividerCharacter(val value: String) {
Minus("-"),
Slash("/"),
Point(".")
}


Expand Down Expand Up @@ -129,10 +130,16 @@ class DateEditText : TextInputEditText {
*/
private fun getDividerCharacter(typedArray: TypedArray) {
val dividerCharacter = typedArray.getInt(R.styleable.DateEditText_dividerCharacter, 0)
if (dividerCharacter == 0) {
this.dividerCharacter = DividerCharacter.Slash
} else if (dividerCharacter == 1) {
this.dividerCharacter = DividerCharacter.Minus
when (dividerCharacter) {
0 -> {
this.dividerCharacter = DividerCharacter.Slash
}
1 -> {
this.dividerCharacter = DividerCharacter.Minus
}
2 -> {
this.dividerCharacter = DividerCharacter.Point
}
}
}

Expand Down
1 change: 1 addition & 0 deletions dateedittext/src/main/res/values/attrs.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
<attr name="dividerCharacter" format="enum">
<enum name="slash" value="0"/>
<enum name="minus" value="1"/>
<enum name="point" value="2"/>
</attr>


Expand Down

0 comments on commit 7dad281

Please sign in to comment.