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


Java BodyAnswer類代碼示例

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

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

示例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);

    }
}
 
開發者ID:ResearchStack,項目名稱:MoleMapperAndroid,代碼行數:14,代碼來源:MoleMapperInitialTask.java

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

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

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


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