Search in sources :

Example 46 with Question

use of org.eyeseetea.malariacare.data.database.model.Question in project pictureapp by EyeSeeTea.

the class AQuestionAnswerChangedListener method saveValue.

protected void saveValue(View view, Option option) {
    Question question = (Question) view.findViewById(R.id.answer).getTag();
    question.saveValuesDDL(option, question.getValueBySession());
    showOrHideChildren(question);
}
Also used : Question(org.eyeseetea.malariacare.data.database.model.Question)

Example 47 with Question

use of org.eyeseetea.malariacare.data.database.model.Question in project pictureapp by EyeSeeTea.

the class AQuestionAnswerChangedListener method showOrHideChildren.

/**
     * Hide or show the children question from a given question,  if is necessary  it reloads the
     * children questions values or refreshing the children questions answer component
     *
     * TODO: Duplicate code in DynamicTabAdapter line 1094
     * code in DynamicTabAdapter will be delete when DynamicTabAdapter refactoring will be
     * completed
     *
     * @param question is the parent question
     */
protected void showOrHideChildren(Question question) {
    if (!question.hasChildren()) {
        return;
    }
    for (int i = 0, j = mTableLayout.getChildCount(); i < j; i++) {
        View view = mTableLayout.getChildAt(i);
        if (view instanceof TableRow) {
            TableRow row = (TableRow) view;
            View answerView = view.findViewById(R.id.answer);
            if (answerView == null) {
                continue;
            }
            Question rowQuestion = (Question) answerView.getTag();
            if (rowQuestion == null) {
                continue;
            }
            List<Question> questionChildren = question.getChildren();
            if (questionChildren != null && questionChildren.size() > 0) {
                for (Question childQuestion : questionChildren) {
                    //if the table row question is child of the modified question...
                    toggleChild(row, rowQuestion, childQuestion);
                }
            }
        }
    }
}
Also used : TableRow(android.widget.TableRow) Question(org.eyeseetea.malariacare.data.database.model.Question) View(android.view.View)

Example 48 with Question

use of org.eyeseetea.malariacare.data.database.model.Question in project pictureapp by EyeSeeTea.

the class AQuestionAnswerChangedListener method saveValue.

protected void saveValue(View view, String newValue) {
    Question question = (Question) view.findViewById(R.id.answer).getTag();
    question.saveValuesText(newValue);
    showOrHideChildren(question);
}
Also used : Question(org.eyeseetea.malariacare.data.database.model.Question)

Example 49 with Question

use of org.eyeseetea.malariacare.data.database.model.Question in project pictureapp by EyeSeeTea.

the class BaseLayoutUtils method getNumberOfQuestionParentsHeader.

public static int getNumberOfQuestionParentsHeader(Header header) {
    int result = 0;
    List<Question> list = header.getQuestions();
    for (Question question : list) {
        if (question.hasChildren()) {
            result = result + 1;
        }
    }
    return result;
}
Also used : Question(org.eyeseetea.malariacare.data.database.model.Question)

Example 50 with Question

use of org.eyeseetea.malariacare.data.database.model.Question in project pictureapp by EyeSeeTea.

the class NavigationBuilder method annotateWarning.

/**
     * Annotates  the questions involved in this warning
     */
private void annotateWarning(QuestionNode warningNode) {
    //Not a warning -> done
    if (warningNode.getQuestion().getOutput() != Constants.WARNING) {
        return;
    }
    WarningStatusChecker warningStatusChecker = (WarningStatusChecker) warningNode.getStatusChecker();
    Question questionWithThreshold = warningStatusChecker.getQuestionToSubscribeFromThreshold();
    Question questionWithOption = warningStatusChecker.getQuestionToSubscribeFromOption();
    addWarning(questionWithThreshold, warningNode);
    addWarning(questionWithOption, warningNode);
}
Also used : Question(org.eyeseetea.malariacare.data.database.model.Question) WarningStatusChecker(org.eyeseetea.malariacare.layout.adapters.survey.navigation.status.WarningStatusChecker)

Aggregations

Question (org.eyeseetea.malariacare.data.database.model.Question)58 Option (org.eyeseetea.malariacare.data.database.model.Option)15 Value (org.eyeseetea.malariacare.data.database.model.Value)15 CSVReader (com.opencsv.CSVReader)11 InputStreamReader (java.io.InputStreamReader)11 ArrayList (java.util.ArrayList)7 QuestionOption (org.eyeseetea.malariacare.data.database.model.QuestionOption)7 View (android.view.View)6 Answer (org.eyeseetea.malariacare.data.database.model.Answer)5 Match (org.eyeseetea.malariacare.data.database.model.Match)5 ImageRadioButtonOption (org.eyeseetea.malariacare.views.option.ImageRadioButtonOption)5 AOptionQuestionView (org.eyeseetea.malariacare.views.question.AOptionQuestionView)5 IQuestionView (org.eyeseetea.malariacare.views.question.IQuestionView)5 DynamicStockImageRadioButtonSingleQuestionView (org.eyeseetea.malariacare.views.question.singlequestion.DynamicStockImageRadioButtonSingleQuestionView)5 TableRow (android.widget.TableRow)4 TreatmentMatch (org.eyeseetea.malariacare.data.database.model.TreatmentMatch)4 IImageQuestionView (org.eyeseetea.malariacare.views.question.IImageQuestionView)4 IMultiQuestionView (org.eyeseetea.malariacare.views.question.IMultiQuestionView)4 NumberRadioButtonMultiquestionView (org.eyeseetea.malariacare.views.question.multiquestion.NumberRadioButtonMultiquestionView)4 ImageRadioButtonSingleQuestionView (org.eyeseetea.malariacare.views.question.singlequestion.ImageRadioButtonSingleQuestionView)4