use of org.eyeseetea.malariacare.domain.exception.InvalidPositiveNumberException in project pictureapp by EyeSeeTea.
the class PositiveNumberSingleQuestionView method validateAnswer.
private void validateAnswer(Context context) {
try {
PositiveNumber positiveNumber = PositiveNumber.parse(numberPicker.getText().toString());
hideKeyboard(numberPicker);
notifyAnswerChanged(String.valueOf(positiveNumber.getValue()));
Validation.getInstance().removeInputError(numberPicker);
} catch (InvalidPositiveNumberException e) {
Validation.getInstance().addinvalidInput(numberPicker, context.getString(R.string.dynamic_error_age));
numberPicker.setError(context.getString(R.string.dynamic_error_age));
}
}
use of org.eyeseetea.malariacare.domain.exception.InvalidPositiveNumberException in project pictureapp by EyeSeeTea.
the class PositiveNumberMultiQuestionView method init.
private void init(final Context context) {
inflate(context, R.layout.multi_question_tab_positive_int_row, this);
header = (CustomTextView) findViewById(R.id.row_header_text);
numberPicker = (CustomEditText) findViewById(R.id.answer);
Validation.getInstance().addInput(numberPicker);
numberPicker.addTextChangedListener(new TextWatcher() {
@Override
public void afterTextChanged(Editable s) {
try {
positiveNumber = PositiveNumber.parse(numberPicker.getText().toString());
notifyAnswerChanged(String.valueOf(positiveNumber.getValue()));
Validation.getInstance().removeInputError(numberPicker);
} catch (InvalidPositiveNumberException e) {
Validation.getInstance().addinvalidInput(numberPicker, context.getString(R.string.dynamic_error_age));
}
}
@Override
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
}
@Override
public void onTextChanged(CharSequence s, int start, int before, int count) {
}
});
}
Aggregations