use of android.widget.ListView in project androidannotations by androidannotations.
the class ItemClicksHandledActivityTest method handlingListViewItemClickWithParametrizedItem.
@Test
public void handlingListViewItemClickWithParametrizedItem() {
ListView listView = (ListView) activity.findViewById(R.id.listViewWithArgumentWithParameterType);
long itemId = listView.getAdapter().getItemId(TESTED_CLICKED_INDEX);
View view = listView.getChildAt(TESTED_CLICKED_INDEX);
assertThat(activity.listViewParametrizedItemClicked).isFalse();
listView.performItemClick(view, TESTED_CLICKED_INDEX, itemId);
assertThat(activity.listViewParametrizedItemClicked).isTrue();
}
use of android.widget.ListView in project androidannotations by androidannotations.
the class ItemClicksHandledActivityTest method handlingListViewitemClickWithArgument.
@Test
public void handlingListViewitemClickWithArgument() {
ListView listView = (ListView) activity.findViewById(R.id.listViewWithArgument);
long itemId = listView.getAdapter().getItemId(TESTED_CLICKED_INDEX);
View view = listView.getChildAt(TESTED_CLICKED_INDEX);
assertThat(activity.listViewWithArgumentSelectedItem).isNull();
listView.performItemClick(view, TESTED_CLICKED_INDEX, itemId);
assertThat(activity.listViewWithArgumentSelectedItem).isNotNull();
assertThat(activity.listViewWithArgumentSelectedItem).isEqualTo(clickedItem);
}
use of android.widget.ListView 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 android.widget.ListView 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 android.widget.ListView in project picasso by square.
the class PicassoSampleActivity method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
super.setContentView(R.layout.picasso_sample_activity);
sampleContent = (FrameLayout) findViewById(R.id.sample_content);
final ListView activityList = (ListView) findViewById(R.id.activity_list);
final PicassoSampleAdapter adapter = new PicassoSampleAdapter(this);
activityList.setAdapter(adapter);
activityList.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> adapterView, View view, int position, long id) {
adapter.getItem(position).launch(PicassoSampleActivity.this);
}
});
showHide = (ToggleButton) findViewById(R.id.faux_action_bar_control);
showHide.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
activityList.setVisibility(checked ? VISIBLE : GONE);
}
});
}
Aggregations