DT @17.11.2015: Added TextValidator
This commit is contained in:
@@ -0,0 +1,34 @@
|
|||||||
|
package org.deke.risk.riskahead.helper;
|
||||||
|
|
||||||
|
import android.text.Editable;
|
||||||
|
import android.text.TextWatcher;
|
||||||
|
import android.widget.TextView;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by Dennis on 17.11.2015.
|
||||||
|
*/
|
||||||
|
public abstract class TextValidator implements TextWatcher {
|
||||||
|
private final TextView textView;
|
||||||
|
|
||||||
|
public TextValidator(TextView textView) {
|
||||||
|
this.textView = textView;
|
||||||
|
}
|
||||||
|
|
||||||
|
public abstract void validate(TextView textView, String text);
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onTextChanged(CharSequence s, int start, int before, int count) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void afterTextChanged(Editable s) {
|
||||||
|
String text = textView.getText().toString();
|
||||||
|
validate(textView, text);
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user