use of org.eyeseetea.malariacare.layout.adapters.survey.DynamicTabAdapter in project pictureapp by EyeSeeTea.
the class SurveyFragment method showSurvey.
private void showSurvey() {
try {
LayoutInflater inflater = LayoutInflater.from(getActivity().getApplicationContext());
dynamicTabAdapter = new DynamicTabAdapter(getActivity(), mReviewMode);
View viewContent = inflater.inflate(dynamicTabAdapter.getLayout(), content, false);
content.removeAllViews();
content.addView(viewContent);
ListView listViewTab = (ListView) llLayout.findViewById(R.id.listView);
dynamicTabAdapter.addOnSwipeListener(listViewTab);
listViewTab.setAdapter(dynamicTabAdapter);
hideProgress();
} catch (NullPointerException e) {
new LoadingSurveyException(e);
}
}
use of org.eyeseetea.malariacare.layout.adapters.survey.DynamicTabAdapter in project pictureapp by EyeSeeTea.
the class SurveyFragment method findOptionByText.
/**
* Finds the option from the current answer associated with the given text.
* Only for dynamicTabAdapter, required for automated testing.
*/
public Option findOptionByText(String text) {
try {
//Find adapter
Tab tabZero = this.tabsList.get(0);
DynamicTabAdapter tabAdapter = (DynamicTabAdapter) this.tabAdaptersCache.findAdapter(tabZero);
//Get options from question
List<Option> options = tabAdapter.navigationController.getCurrentQuestion().getAnswer().getOptions();
//Return proper option if possible
for (Option option : options) {
if (option.getName().equals(text)) {
return option;
}
}
} catch (Exception ex) {
return null;
}
return null;
}
Aggregations