本文整理匯總了Java中org.researchstack.backbone.ui.step.body.BodyAnswer類的典型用法代碼示例。如果您正苦於以下問題:Java BodyAnswer類的具體用法?Java BodyAnswer怎麽用?Java BodyAnswer使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
BodyAnswer類屬於org.researchstack.backbone.ui.step.body包,在下文中一共展示了BodyAnswer類的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: validateAnswer
import org.researchstack.backbone.ui.step.body.BodyAnswer; //導入依賴的package包/類
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
import org.researchstack.backbone.ui.step.body.BodyAnswer; //導入依賴的package包/類
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
import org.researchstack.backbone.ui.step.body.BodyAnswer; //導入依賴的package包/類
@Override
public BodyAnswer validateAnswer(String inputString)
{
if(inputString != null && inputString.length() == 5)
{
return super.validateAnswer(inputString);
}
else
{
return new BodyAnswer(false, R.string.zip_invalid);
}
}
示例4: validateAnswer
import org.researchstack.backbone.ui.step.body.BodyAnswer; //導入依賴的package包/類
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;
}
示例5: validateAnswer
import org.researchstack.backbone.ui.step.body.BodyAnswer; //導入依賴的package包/類
@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;
}
示例6: onNextClicked
import org.researchstack.backbone.ui.step.body.BodyAnswer; //導入依賴的package包/類
protected void onNextClicked() {
BodyAnswer bodyAnswer = stepBody.getBodyAnswerState();
if (bodyAnswer == null || !bodyAnswer.isValid()) {
Toast.makeText(getContext(),
bodyAnswer == null
? BodyAnswer.INVALID.getString(getContext())
: bodyAnswer.getString(getContext()),
Toast.LENGTH_SHORT).show();
} else {
callbacks.onSaveStep(StepCallbacks.ACTION_NEXT,
getStep(),
stepBody.getStepResult(false));
}
}