Skip to content
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,9 @@ public void beforeTextChanged(CharSequence s, int start, int count, int after) {

@Override
public void afterTextChanged(Editable s) {
if (mEditText.hasFocus()) {
isEdited = true;
}
}

@Override
Expand Down Expand Up @@ -233,6 +236,9 @@ public void afterTextChanged(Editable s) {
mEditText.addTextChangedListener(this);
}
}
if (mEditText.hasFocus()) {
isEdited = true;
}
}

/*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public abstract class AbstractWidget {
public boolean isEdited = false;

public AbstractWidget(@Nullable Field field, @NonNull WidgetEventListener listener,
@Nullable String defaultValue, @NonNull View defaultFocusView) {
@Nullable String defaultValue, @NonNull View defaultFocusView) {
mField = field;
mListener = listener;
mDefaultValue = defaultValue;
Expand All @@ -64,8 +64,7 @@ public void showValidationError() {
public boolean isValid() {
if (mField == null) {
return true;
}
else if(!isEdited && mField.isFieldValueMasked()) {
} else if (!isEdited && mField.isFieldValueMasked()) {
return true;
}
return !isInvalidEmptyValue() && !isInvalidLength() && !isInvalidRegex();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,9 @@ public void onTextChanged(CharSequence s, int start, int before, int count) {

@Override
public void afterTextChanged(Editable s) {
if (editText.hasFocus()) {
isEdited = true;
}
}
});

Expand Down