List of usage examples for android.widget ListView getHeaderViewsCount
@Override public int getHeaderViewsCount()
From source file:can.yrt.onebusaway.SearchResponse.java
@Override public void onListItemClick(ListView l, View v, int position, long id) { ListAdapter adapter = l.getAdapter(); ObaElement e = (ObaElement) adapter.getItem(position - l.getHeaderViewsCount()); if (e instanceof ObaRoute) { clickRoute((ObaRoute) e);/*from w ww . j a v a2 s .c om*/ } else if (e instanceof ObaStop) { clickStop((ObaStop) e); } }
From source file:can.yrt.onebusaway.MySearchRoutesFragment.java
@Override public void onListItemClick(ListView l, View v, int position, long id) { // Get the adapter (this may or may not be a SimpleCursorAdapter) ListAdapter adapter = l.getAdapter(); ObaRoute route = (ObaRoute) adapter.getItem(position - l.getHeaderViewsCount()); final String routeId = route.getId(); final String routeName = UIHelp.getRouteDisplayName(route); if (isShortcutMode()) { Intent intent = RouteInfoActivity.makeIntent(getActivity(), routeId); makeShortcut(routeName, intent); } else {/*from w w w . j a v a 2 s . c o m*/ RouteInfoActivity.start(getActivity(), routeId); } }
From source file:org.onebusaway.android.ui.MySearchRoutesFragment.java
@Override public void onListItemClick(ListView l, View v, int position, long id) { // Get the adapter (this may or may not be a SimpleCursorAdapter) ListAdapter adapter = l.getAdapter(); ObaRoute route = (ObaRoute) adapter.getItem(position - l.getHeaderViewsCount()); final String routeId = route.getId(); final String routeName = UIUtils.getRouteDisplayName(route); if (isShortcutMode()) { Intent intent = RouteInfoActivity.makeIntent(getActivity(), routeId); makeShortcut(routeName, intent); } else {// w w w . ja va2 s .com RouteInfoActivity.start(getActivity(), routeId); } }
From source file:de.vanita5.twittnuker.activity.support.UserListSelectorActivity.java
@Override public void onItemClick(final AdapterView<?> view, final View child, final int position, final long id) { final int view_id = view.getId(); final ListView list = (ListView) view; if (view_id == R.id.users_list) { final ParcelableUser user = mUsersAdapter.getItem(position - list.getHeaderViewsCount()); if (user == null) return; if (isSelectingUser()) { final Intent data = new Intent(); data.setExtrasClassLoader(getClassLoader()); data.putExtra(EXTRA_USER, user); setResult(RESULT_OK, data);//from w ww .j a va 2 s.c o m finish(); } else { getUserLists(user.screen_name); } } else if (view_id == R.id.user_lists_list) { final Intent data = new Intent(); data.putExtra(EXTRA_USER_LIST, mUserListsAdapter.getItem(position - list.getHeaderViewsCount())); setResult(RESULT_OK, data); finish(); } }
From source file:org.onebusaway.android.ui.MyRemindersFragment.java
private String[] getIds(ListView l, int position) { // Get the cursor and fetch the stop ID from that. SimpleCursorAdapter cursorAdapter = (SimpleCursorAdapter) l.getAdapter(); final Cursor c = cursorAdapter.getCursor(); c.moveToPosition(position - l.getHeaderViewsCount()); final String[] result = new String[] { c.getString(COL_ID), c.getString(COL_STOP_ID), c.getString(COL_ROUTE_ID) }; return result; }
From source file:org.mariotaku.twidere.fragment.DirectMessagesFragment.java
@Override public void onListItemClick(final ListView l, final View v, final int position, final long id) { if (mApplication.isMultiSelectActive()) return;/*from ww w. jav a 2 s .c o m*/ final long conversation_id = mAdapter.getConversationId(position - l.getHeaderViewsCount()); final long account_id = mAdapter.getAccountId(position - l.getHeaderViewsCount()); if (conversation_id > 0 && account_id > 0) { openDirectMessagesConversation(getActivity(), account_id, conversation_id); } }
From source file:de.vanita5.twittnuker.fragment.support.DirectMessagesFragment.java
@Override public void onListItemClick(final ListView l, final View v, final int position, final long id) { if (mMultiSelectManager.isActive()) return;/*from w ww . j a v a2s . c om*/ final int pos = position - l.getHeaderViewsCount(); final long conversationId = mAdapter.getConversationId(pos); final long accountId = mAdapter.getAccountId(pos); mReadPositions.add(pos); removeUnreadCounts(); if (conversationId > 0 && accountId > 0) { openDirectMessagesConversation(getActivity(), accountId, conversationId); } }
From source file:cz.tomas.StockAnalyze.activity.NewsActivity.java
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); this.setContentView(R.layout.news_layout); this.listView = (PullToRefreshListView) this.findViewById(R.id.listView); listView.setOnRefreshListener(new OnRefreshListener() { @Override/*from w w w. j a v a2s. c o m*/ public void onRefresh() { refresh(); } }); final ListView refreshableView = listView.getRefreshableView(); refreshableView.setTextFilterEnabled(true); refreshableView.setOnItemClickListener(new OnItemClickListener() { @Override public void onItemClick(AdapterView<?> parent, View view, int position, long rowId) { Intent intent = new Intent(NewsActivity.this, NewsDetailActivity.class); intent.putExtra(EXTRA_NEWS_POSITION, position - refreshableView.getHeaderViewsCount()); startActivity(intent); } }); this.adapter = new NewsListAdapter(this, null); refreshableView.setAdapter(this.adapter); this.getSupportLoaderManager().initLoader(0, null, this); }
From source file:org.mariotaku.twidere.fragment.ActivitiesAboutMeFragment.java
@Override public void onListItemClick(final ListView l, final View v, final int position, final long id) { if (mAccountId <= 0) return;//w w w . j a va 2s . c o m final int adapter_pos = position - l.getHeaderViewsCount(); final twitter4j.Activity item = mAdapter.getItem(adapter_pos); final User[] sources = item.getSources(); final Status[] target_statuses = item.getTargetStatuses(); final int sources_length = sources != null ? sources.length : 0; final Action action = item.getAction(); final boolean hires_profile_image = getResources().getBoolean(R.bool.hires_profile_image); if (sources_length > 0) { final Status[] target_objects = item.getTargetObjectStatuses(); switch (action.getActionId()) { case Action.ACTION_FAVORITE: { if (sources_length == 1) { openUserProfile(getActivity(), new ParcelableUser(sources[0], mAccountId, hires_profile_image)); } else { if (target_statuses != null && target_statuses.length > 0) { final Status status = target_statuses[0]; openStatus(getActivity(), new ParcelableStatus(status, mAccountId, false, hires_profile_image)); } } break; } case Action.ACTION_FOLLOW: { if (sources_length == 1) { openUserProfile(getActivity(), new ParcelableUser(sources[0], mAccountId, hires_profile_image)); } else { openUserFollowers(getActivity(), mAccountId, mAccountId, null); } break; } case Action.ACTION_MENTION: { if (target_objects != null && target_objects.length > 0) { final Status status = target_objects[0]; openStatus(getActivity(), new ParcelableStatus(status, mAccountId, false, hires_profile_image)); } break; } case Action.ACTION_REPLY: { if (target_statuses != null && target_statuses.length > 0) { final Status status = target_statuses[0]; openStatus(getActivity(), new ParcelableStatus(status, mAccountId, false, hires_profile_image)); } break; } case Action.ACTION_RETWEET: { if (sources_length == 1) { openUserProfile(getActivity(), new ParcelableUser(sources[0], mAccountId, hires_profile_image)); } else { if (target_objects != null && target_objects.length > 0) { final Status status = target_objects[0]; openStatus(getActivity(), new ParcelableStatus(status, mAccountId, false, hires_profile_image)); } } break; } } } }
From source file:com.roamprocess1.roaming4world.ui.account.AccountsEditListFragment.java
@Override public void onListItemClick(ListView l, View v, int position, long id) { Log.d(THIS_FILE, "Checked " + position + " et " + id); ListView lv = getListView(); lv.setItemChecked(position, true);//from w w w . ja v a 2 s.com curCheckPosition = id; Cursor c = (Cursor) getListAdapter().getItem(position - lv.getHeaderViewsCount()); //showDetails(id, c.getString(c.getColumnIndex(SipProfile.FIELD_WIZARD))); }