本文整理匯總了Java中org.researchstack.backbone.ui.step.body.BodyAnswer.VALID屬性的典型用法代碼示例。如果您正苦於以下問題:Java BodyAnswer.VALID屬性的具體用法?Java BodyAnswer.VALID怎麽用?Java BodyAnswer.VALID使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在類org.researchstack.backbone.ui.step.body.BodyAnswer
的用法示例。
在下文中一共展示了BodyAnswer.VALID屬性的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: validateAnswer
public BodyAnswer validateAnswer(String inputString) {
// If no answer is recorded
if (inputString == null || TextUtils.isEmpty(inputString)) {
return BodyAnswer.INVALID;
} else {
// Parse value from editText
Float floatAnswer = Float.valueOf(inputString);
if (floatAnswer < minValue) {
return new BodyAnswer(false,
R.string.rsb_invalid_answer_integer_under, String.valueOf(getMinValue()));
} else if (floatAnswer > maxValue) {
return new BodyAnswer(false,
R.string.rsb_invalid_answer_integer_over, String.valueOf(getMaxValue()));
}
}
return BodyAnswer.VALID;
}
示例2: validateAnswer
public BodyAnswer validateAnswer(String inputString) {
// If no answer is recorded
if (TextUtils.isEmpty(inputString)) {
return BodyAnswer.INVALID;
} else {
// Parse value from editText
Integer intAnswer = Integer.valueOf(inputString);
if (intAnswer < getMinValue()) {
return new BodyAnswer(false,
R.string.rsb_invalid_answer_integer_under,
String.valueOf(getMinValue()));
} else if (intAnswer > getMaxValue()) {
return new BodyAnswer(false,
R.string.rsb_invalid_answer_integer_over,
String.valueOf(getMaxValue()));
}
}
return BodyAnswer.VALID;
}
示例3: validateAnswer
public BodyAnswer validateAnswer(Date resultDate) {
if (minimumDate != null && resultDate.getTime() < minimumDate.getTime()) {
return new BodyAnswer(false,
R.string.rsb_invalid_answer_date_under,
FormatHelper.SIMPLE_FORMAT_DATE.format(minimumDate));
}
if (maximumDate != null && resultDate.getTime() > maximumDate.getTime()) {
return new BodyAnswer(false,
R.string.rsb_invalid_answer_date_over,
FormatHelper.SIMPLE_FORMAT_DATE.format(maximumDate));
}
return BodyAnswer.VALID;
}
示例4: validateAnswer
@Override
public BodyAnswer validateAnswer(Date resultDate) {
Date minDate = getMinimumDate();
Date maxDate = getMaximumDate();
if (minDate != null && isOnOrBefore(resultDate, minDate)) {
return new BodyAnswer(false, R.string.rsb_birth_date_too_old, String.valueOf(maxAge));
}
if (maxDate != null && !isOnOrBefore(resultDate, maxDate)) {
return new BodyAnswer(false, R.string.rsb_birth_date_too_young, String.valueOf(minAge));
}
return BodyAnswer.VALID;
}