當前位置: 首頁>>代碼示例>>Java>>正文


Java BodyAnswer.VALID屬性代碼示例

本文整理匯總了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;
}
 
開發者ID:ResearchStack,項目名稱:ResearchStack,代碼行數:18,代碼來源:DecimalAnswerFormat.java

示例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;
    }
 
開發者ID:ResearchStack,項目名稱:ResearchStack,代碼行數:22,代碼來源:IntegerAnswerFormat.java

示例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;
}
 
開發者ID:ResearchStack,項目名稱:ResearchStack,代碼行數:15,代碼來源:DateAnswerFormat.java

示例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;
}
 
開發者ID:ResearchStack,項目名稱:ResearchStack,代碼行數:15,代碼來源:BirthDateAnswerFormat.java


注:本文中的org.researchstack.backbone.ui.step.body.BodyAnswer.VALID屬性示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。