use of com.google.samples.apps.topeka.adapter.OptionsQuizAdapter in project android-topeka by googlesamples.
the class SelectItemQuizView method createQuizContentView.
@Override
protected View createQuizContentView() {
Context context = getContext();
mListView = new ListView(context);
mListView.setDivider(null);
mListView.setSelector(R.drawable.selector_button);
mListView.setAdapter(new OptionsQuizAdapter(getQuiz().getOptions(), R.layout.item_answer_start, context, true));
mListView.setChoiceMode(AbsListView.CHOICE_MODE_SINGLE);
mListView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
allowAnswer();
toggleAnswerFor(position);
}
});
return mListView;
}
use of com.google.samples.apps.topeka.adapter.OptionsQuizAdapter in project android-topeka by googlesamples.
the class ToggleTranslateQuizView method createQuizContentView.
@Override
protected View createQuizContentView() {
mListView = new ListView(getContext());
mListView.setDivider(null);
mListView.setSelector(R.drawable.selector_button);
mListView.setAdapter(new OptionsQuizAdapter(getQuiz().getReadableOptions(), R.layout.item_answer));
mListView.setChoiceMode(AbsListView.CHOICE_MODE_MULTIPLE);
mListView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
toggleAnswerFor(position);
if (view instanceof CompoundButton) {
((CompoundButton) view).setChecked(mAnswers[position]);
}
allowAnswer();
}
});
return mListView;
}
use of com.google.samples.apps.topeka.adapter.OptionsQuizAdapter in project android-topeka by googlesamples.
the class FourQuarterQuizView method createQuizContentView.
@Override
protected View createQuizContentView() {
mAnswerView = new GridView(getContext());
mAnswerView.setSelector(R.drawable.selector_button);
mAnswerView.setNumColumns(2);
mAnswerView.setAdapter(new OptionsQuizAdapter(getQuiz().getOptions(), R.layout.item_answer));
mAnswerView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
allowAnswer();
mAnswered = position;
}
});
return mAnswerView;
}
use of com.google.samples.apps.topeka.adapter.OptionsQuizAdapter in project android-topeka by googlesamples.
the class MultiSelectQuizView method createQuizContentView.
@Override
protected View createQuizContentView() {
mListView = new ListView(getContext());
mListView.setAdapter(new OptionsQuizAdapter(getQuiz().getOptions(), android.R.layout.simple_list_item_multiple_choice));
mListView.setChoiceMode(AbsListView.CHOICE_MODE_MULTIPLE);
mListView.setItemsCanFocus(false);
mListView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
allowAnswer();
}
});
return mListView;
}
Aggregations