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());
}
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();
}
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;
}
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);
}
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));
}
}
});
}
Aggregations