Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,13 @@ public void beforeTextChanged(CharSequence s, int start, int count, int after) {

@Override
public void onTextChanged(CharSequence s, int start, int before, int count) {
if(s.length() == 2 || s.length() == 5)
int counter = 0;
for( int i=0; i < s.length(); i++ ) {
if( s.charAt(i) == '/' ) {
counter++;
}
}
if((s.length() == 2 || s.length() == 5) && (dateEntry.getText().toString().indexOf('/') < 0 || counter < 2 ))
{
dateEntry.setText(s+"/",TextView.BufferType.EDITABLE);
dateEntry.setSelection(s.length()+1, s.length()+1);
Expand Down Expand Up @@ -263,9 +269,9 @@ else if (numberEntry.getText().toString().trim().equals(""))
{
numberEntry.setError("Number cannot be blank");
}
else if (dateEntry.getText().toString().trim().equals(""))
else if (!dateEntry.getText().toString().matches("^([0-2][0-9]||3[0-1])/(0[0-9]||1[0-2])/([0-9][0-9])?[0-9][0-9]$"))
{
dateEntry.setError("Date cannot be blank");
dateEntry.setError("Date is in incorrect format.\nMM/DD/YYYY");
}
else if (yearEntry.getText().toString().trim().equals(""))
{
Expand Down