Pinview
Pinview copied to clipboard
No updated code on maven
Github source has clearValue()
function
public void setValue(@NonNull String value) {
String regex = "[0-9]*"; // Allow empty string to clear the fields
fromSetValue = true;
if (inputType == InputType.NUMBER && !value.matches(regex))
return;
int lastTagHavingValue = -1;
for (int i = 0; i < editTextList.size(); i++) {
if (value.length() > i) {
lastTagHavingValue = i;
editTextList.get(i).setText(((Character) value.charAt(i)).toString());
} else {
editTextList.get(i).setText("");
}
}
if (mPinLength > 0) {
if (lastTagHavingValue < mPinLength - 1) {
currentFocus = editTextList.get(lastTagHavingValue + 1);
} else {
currentFocus = editTextList.get(mPinLength - 1);
if (inputType == InputType.NUMBER || mPassword)
finalNumberPin = true;
if (mListener != null)
mListener.onDataEntered(this, false);
}
currentFocus.requestFocus();
}
fromSetValue = false;
updateEnabledState();
}
And for same method on maven its showing
public void setValue(@NonNull String value) {
String regex = "[0-9]+";
this.fromSetValue = true;
if (this.inputType != Pinview.InputType.NUMBER || value.matches(regex)) {
int lastTagHavingValue = -1;
for(int i = 0; i < this.editTextList.size(); ++i) {
if (value.length() > i) {
lastTagHavingValue = i;
((EditText)this.editTextList.get(i)).setText(Character.valueOf(value.charAt(i)).toString());
} else {
((EditText)this.editTextList.get(i)).setText("");
}
}
if (this.mPinLength > 0) {
if (lastTagHavingValue < this.mPinLength - 1) {
this.currentFocus = (View)this.editTextList.get(lastTagHavingValue + 1);
} else {
this.currentFocus = (View)this.editTextList.get(this.mPinLength - 1);
if (this.inputType == Pinview.InputType.NUMBER || this.mPassword) {
this.finalNumberPin = true;
}
if (this.mListener != null) {
this.mListener.onDataEntered(this, false);
}
}
this.currentFocus.requestFocus();
}
this.fromSetValue = false;
}
}