use of org.eyeseetea.malariacare.data.database.model.Value in project pictureapp by EyeSeeTea.
the class DynamicTabAdapter method goToLastQuestion.
private void goToLastQuestion() {
navigationController.first();
Value value = null;
do {
next();
Question question = navigationController.getCurrentQuestion();
value = question.getValueBySession();
skipReminder();
} while (value != null && !isDone(value));
notifyDataSetChanged();
}
use of org.eyeseetea.malariacare.data.database.model.Value in project pictureapp by EyeSeeTea.
the class DynamicTabAdapter method next.
/**
* Changes the current question moving forward
*/
private void next() {
Question question = navigationController.getCurrentQuestion();
Value value = question.getValueBySession();
if (isDone(value)) {
navigationController.isMovingToForward = false;
return;
}
navigationController.next(value != null ? value.getOption() : null);
notifyDataSetChanged();
hideKeyboard(PreferencesState.getInstance().getContext());
question = navigationController.getCurrentQuestion();
if (value != null && !readOnly && navigationController.getCurrentTotalPages() < question.getTotalQuestions()) {
navigationController.setTotalPages(question.getTotalQuestions());
}
navigationController.isMovingToForward = false;
isClicked = false;
}
use of org.eyeseetea.malariacare.data.database.model.Value in project pictureapp by EyeSeeTea.
the class DynamicTabAdapter method finishOrNext.
/**
* Advance to the next question with delay applied or finish survey according to question and
* value.
*/
public void finishOrNext() {
try {
System.out.println(Session.getMalariaSurvey().getValuesFromDB().toString());
System.out.println(Session.getStockSurvey().getValuesFromDB().toString());
} catch (Exception e) {
}
if (Validation.hasErrors()) {
Validation.showErrors();
isClicked = false;
return;
}
if (navigationController.getCurrentQuestion().hasCompulsoryNotAnswered()) {
UIMessagesStrategy.getInstance().showCompulsoryUnansweredToast();
isClicked = false;
return;
}
final Handler handler = new Handler();
handler.postDelayed(new Runnable() {
@Override
public void run() {
Question question = navigationController.getCurrentQuestion();
Value value = question.getValueBySession();
if (isDone(value)) {
navigationController.isMovingToForward = false;
if (!wasPatientTested() || !BuildConfig.reviewScreen) {
surveyShowDone();
} else {
DashboardActivity.dashboardActivity.showReviewFragment();
hideKeyboard(PreferencesState.getInstance().getContext());
isClicked = false;
}
return;
}
next();
}
}, 750);
}
use of org.eyeseetea.malariacare.data.database.model.Value in project pictureapp by EyeSeeTea.
the class DynamicTabAdapter method saveOptionValue.
public void saveOptionValue(View view, Option selectedOption, Question question, boolean moveToNextQuestion) {
Option answeredOption = (question != null) ? question.getAnsweredOption() : null;
Value value = question.getValueBySession();
if (goingBackwardAndModifiedValues(value, answeredOption, selectedOption)) {
navigationController.setTotalPages(question.getTotalQuestions());
isBackward = false;
}
question.saveValuesDDL(selectedOption, value);
if (question.getOutput().equals(Constants.IMAGE_3_NO_DATAELEMENT) || question.getOutput().equals(Constants.IMAGE_RADIO_GROUP_NO_DATAELEMENT)) {
switchHiddenMatches(question, selectedOption);
}
if (moveToNextQuestion) {
navigationController.isMovingToForward = true;
finishOrNext();
} else {
showOrHideChildren(question);
}
}
use of org.eyeseetea.malariacare.data.database.model.Value in project pictureapp by EyeSeeTea.
the class ReviewScreenAdapter method getView.
@Override
public View getView(final int position, View convertView, ViewGroup parent) {
// Get the row layout
Value value = (Value) getItem(position);
TableRow rowView = (TableRow) this.lInflater.inflate(getRecordLayout(), parent, false);
ReviewFragmentStrategy reviewFragmentStrategy = new ReviewFragmentStrategy();
return reviewFragmentStrategy.createViewRow(rowView, value);
}
Aggregations