Search in sources :

Example 51 with ListView

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();
}
Also used : ListView(android.widget.ListView) View(android.view.View) ListView(android.widget.ListView) Test(org.junit.Test)

Example 52 with ListView

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);
}
Also used : ListView(android.widget.ListView) View(android.view.View) ListView(android.widget.ListView) Test(org.junit.Test)

Example 53 with ListView

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;
}
Also used : Context(android.content.Context) AbsListView(android.widget.AbsListView) ListView(android.widget.ListView) OptionsQuizAdapter(com.google.samples.apps.topeka.adapter.OptionsQuizAdapter) AdapterView(android.widget.AdapterView) AbsListView(android.widget.AbsListView) View(android.view.View) AdapterView(android.widget.AdapterView) ListView(android.widget.ListView) SuppressLint(android.annotation.SuppressLint)

Example 54 with ListView

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;
}
Also used : AbsListView(android.widget.AbsListView) ListView(android.widget.ListView) OptionsQuizAdapter(com.google.samples.apps.topeka.adapter.OptionsQuizAdapter) AdapterView(android.widget.AdapterView) AbsListView(android.widget.AbsListView) View(android.view.View) AdapterView(android.widget.AdapterView) ListView(android.widget.ListView) SuppressLint(android.annotation.SuppressLint) CompoundButton(android.widget.CompoundButton)

Example 55 with ListView

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);
        }
    });
}
Also used : ListView(android.widget.ListView) AdapterView(android.widget.AdapterView) View(android.view.View) AdapterView(android.widget.AdapterView) ListView(android.widget.ListView) CompoundButton(android.widget.CompoundButton)

Aggregations

ListView (android.widget.ListView)1139 View (android.view.View)739 AdapterView (android.widget.AdapterView)444 TextView (android.widget.TextView)389 ImageView (android.widget.ImageView)167 Intent (android.content.Intent)148 AbsListView (android.widget.AbsListView)135 OnItemClickListener (android.widget.AdapterView.OnItemClickListener)97 ArrayAdapter (android.widget.ArrayAdapter)97 ArrayList (java.util.ArrayList)81 ViewGroup (android.view.ViewGroup)75 ListAdapter (android.widget.ListAdapter)71 OnClickListener (android.view.View.OnClickListener)65 LayoutInflater (android.view.LayoutInflater)63 Bundle (android.os.Bundle)57 Button (android.widget.Button)55 LinearLayout (android.widget.LinearLayout)50 SuppressLint (android.annotation.SuppressLint)34 DialogInterface (android.content.DialogInterface)34 ScrollView (android.widget.ScrollView)31