use of org.eyeseetea.sdk.presentation.views.CustomEditText in project pictureapp by EyeSeeTea.
the class AQuestionAnswerChangedListener method showDefaultValue.
/**
* when a question is shown this method set the correct value.
*
* @param rowQuestion is the question in the view
*/
private void showDefaultValue(TableRow tableRow, Question rowQuestion) {
if (rowQuestion.getValueBySession() != null) {
return;
}
switch(rowQuestion.getOutput()) {
case Constants.PHONE:
case Constants.POSITIVE_INT:
case Constants.INT:
case Constants.LONG_TEXT:
case Constants.SHORT_TEXT:
final CustomEditText editCard = (CustomEditText) tableRow.findViewById(R.id.answer);
editCard.setText("");
break;
case Constants.DROPDOWN_LIST:
case Constants.DROPDOWN_OU_LIST:
Spinner dropdown = (Spinner) tableRow.findViewById(R.id.answer);
dropdown.setSelection(0);
break;
case Constants.SWITCH_BUTTON:
Switch switchView = (Switch) tableRow.findViewById(R.id.answer);
Option selectedOption = rowQuestion.getOptionBySession();
if (selectedOption == null) {
//the 0 option is the left option and is false in the switch, the 1 option is
// the right option and is true
boolean isChecked = false;
if (rowQuestion.getAnswer().getOptions().get(1).getOptionAttribute().getDefaultOption() == 1) {
isChecked = true;
}
saveSwitchOption(rowQuestion, isChecked);
switchView.setChecked(isChecked);
break;
}
switchView.setChecked(findSwitchBoolean(rowQuestion));
break;
}
}
use of org.eyeseetea.sdk.presentation.views.CustomEditText in project pictureapp by EyeSeeTea.
the class DynamicTabAdapter method showDefaultValue.
private void showDefaultValue(TableRow tableRow, Question rowQuestion) {
if (rowQuestion.getValueBySession() != null) {
return;
}
switch(rowQuestion.getOutput()) {
case Constants.PHONE:
case Constants.POSITIVE_INT:
case Constants.POSITIVE_OR_ZERO_INT:
case Constants.INT:
case Constants.LONG_TEXT:
case Constants.SHORT_TEXT:
final CustomEditText editCard = (CustomEditText) tableRow.findViewById(R.id.answer);
editCard.setText("");
break;
case Constants.DROPDOWN_LIST:
case Constants.DROPDOWN_OU_LIST:
Spinner dropdown = (Spinner) tableRow.findViewById(R.id.answer);
dropdown.setSelection(0);
break;
case Constants.SWITCH_BUTTON:
Switch switchView = (Switch) tableRow.findViewById(R.id.answer);
Option selectedOption = rowQuestion.getOptionBySession();
if (selectedOption == null) {
//the 0 option is the left option and is false in the switch, the 1 option is
// the right option and is true
boolean isChecked = false;
if (rowQuestion.getAnswer().getOptions().get(1).getOptionAttribute().getDefaultOption() == 1) {
isChecked = true;
}
saveSwitchOption(rowQuestion, isChecked);
switchView.setChecked(isChecked);
break;
}
switchView.setChecked(findSwitchBoolean(rowQuestion));
break;
}
}
Aggregations