Search in sources :

Example 61 with ListView

use of android.widget.ListView in project robolectric by robolectric.

the class ShadowArrayAdapterTest method usesTextViewResourceIdToSetTextWithinListItemView.

@Test
public void usesTextViewResourceIdToSetTextWithinListItemView() throws Exception {
    ListView parent = new ListView(RuntimeEnvironment.application);
    ArrayAdapter<String> arrayAdapter = new ArrayAdapter<>(RuntimeEnvironment.application, R.layout.main, R.id.title, new String[] { "first value" });
    View listItemView = arrayAdapter.getView(0, null, parent);
    TextView titleTextView = (TextView) listItemView.findViewById(R.id.title);
    assertEquals("first value", titleTextView.getText().toString());
}
Also used : ListView(android.widget.ListView) TextView(android.widget.TextView) TextView(android.widget.TextView) View(android.view.View) ListView(android.widget.ListView) ArrayAdapter(android.widget.ArrayAdapter) Test(org.junit.Test)

Example 62 with ListView

use of android.widget.ListView in project realm-java by realm.

the class MainActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    // Setup initial views
    setContentView(R.layout.activity_main);
    ButterKnife.bind(this);
    Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);
    //noinspection ConstantConditions
    getSupportActionBar().setDisplayShowTitleEnabled(false);
    adapter = null;
    listView.setOnItemClickListener(new AdapterView.OnItemClickListener() {

        @Override
        public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
            presenter.listItemSelected(position);
        }
    });
    listView.setEmptyView(getLayoutInflater().inflate(R.layout.common_emptylist, listView, false));
    refreshView.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() {

        @Override
        public void onRefresh() {
            presenter.refreshList();
        }
    });
    progressBar.setVisibility(View.INVISIBLE);
    // After setup, notify presenter
    presenter.onCreate();
}
Also used : AdapterView(android.widget.AdapterView) TextView(android.widget.TextView) View(android.view.View) AdapterView(android.widget.AdapterView) ListView(android.widget.ListView) SwipeRefreshLayout(android.support.v4.widget.SwipeRefreshLayout) Toolbar(android.support.v7.widget.Toolbar)

Example 63 with ListView

use of android.widget.ListView in project xabber-android by redsolution.

the class ContactListFragment method onCreateView.

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View view = inflater.inflate(R.layout.contact_list_fragment, container, false);
    // to avoid strange bug on some 4.x androids
    view.setBackgroundColor(ColorManager.getInstance().getContactListBackgroundColor());
    listView = (ListView) view.findViewById(android.R.id.list);
    listView.setOnItemClickListener(this);
    listView.setItemsCanFocus(true);
    registerForContextMenu(listView);
    adapter = new ContactListAdapter(getActivity(), this, this);
    listView.setAdapter(adapter);
    infoView = view.findViewById(R.id.info);
    connectedView = infoView.findViewById(R.id.connected);
    disconnectedView = infoView.findViewById(R.id.disconnected);
    textView = (TextView) infoView.findViewById(R.id.text);
    buttonView = (Button) infoView.findViewById(R.id.button);
    animation = AnimationUtils.loadAnimation(getActivity(), R.anim.connection);
    accountActionButtonsAdapter = new AccountActionButtonsAdapter(getActivity(), this, (LinearLayout) view.findViewById(R.id.account_action_buttons));
    accountActionButtonsAdapter.onChange();
    actionButtonsContainer = view.findViewById(R.id.account_action_buttons_container);
    scrollToChatsActionButtonContainer = view.findViewById(R.id.fab_up_container);
    scrollToChatsActionButtonContainer.setOnClickListener(this);
    scrollToChatsActionButtonContainer.setVisibility(View.GONE);
    scrollToChatsActionButton = (FloatingActionButton) view.findViewById(R.id.fab_up);
    accountPainter = ColorManager.getInstance().getAccountPainter();
    scrollToChatsActionButton.setColorNormal(accountPainter.getDefaultMainColor());
    scrollToChatsActionButton.setColorPressed(accountPainter.getDefaultDarkColor());
    return view;
}
Also used : AccountActionButtonsAdapter(com.xabber.android.ui.adapter.AccountActionButtonsAdapter) ContactListAdapter(com.xabber.android.ui.adapter.ContactListAdapter) View(android.view.View) AdapterView(android.widget.AdapterView) TextView(android.widget.TextView) ListView(android.widget.ListView) LinearLayout(android.widget.LinearLayout)

Example 64 with ListView

use of android.widget.ListView in project xabber-android by redsolution.

the class BaseListEditor method onCreate.

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    if (isFinishing())
        return;
    onInflate(savedInstanceState);
    if (savedInstanceState != null)
        actionWith = getSavedValue(savedInstanceState, SAVED_ACTION_WITH);
    else
        actionWith = null;
    ListView listView = getListView();
    listView.setOnItemClickListener(this);
    registerForContextMenu(listView);
    adapter = createListAdapter();
    setListAdapter(adapter);
}
Also used : ListView(android.widget.ListView)

Example 65 with ListView

use of android.widget.ListView in project love-android by hagish.

the class Launcher method onCreate.

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.launcher);
    populateGameList();
    ListView gameListView = (ListView) this.findViewById(R.id.gameList);
    gameListView.setAdapter(new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, gameListName));
    gameListView.setTextFilterEnabled(true);
    gameListView.setOnItemClickListener(new OnItemClickListener() {

        public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
            // only launch if path is set, avoid info-entries
            if (gameListPath.get(position).length() > 0) {
                launchGame(gameListName.get(position), gameListPath.get(position));
            }
        }
    });
}
Also used : ListView(android.widget.ListView) OnItemClickListener(android.widget.AdapterView.OnItemClickListener) View(android.view.View) AdapterView(android.widget.AdapterView) ListView(android.widget.ListView)

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