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);
}
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);
}
}
}
}
}
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);
}
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;
}
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);
}
Aggregations