Example usage for android.widget ListView getHeaderViewsCount

List of usage examples for android.widget ListView getHeaderViewsCount

Introduction

In this page you can find the example usage for android.widget ListView getHeaderViewsCount.

Prototype

@Override
    public int getHeaderViewsCount() 

Source Link

Usage

From source file:org.mariotaku.twidere.fragment.TrendsFragment.java

@Override
public void onListItemClick(final ListView l, final View v, final int position, final long id) {
    if (mApplication.isMultiSelectActive())
        return;//from  w  ww .  ja va  2  s  .  co m
    final Cursor cur = (Cursor) mTrendsAdapter.getItem(position - l.getHeaderViewsCount());
    if (cur == null)
        return;
    openTweetSearch(getActivity(), mAccountId, cur.getString(cur.getColumnIndex(CachedTrends.NAME)));
}

From source file:org.getlantern.firetweet.fragment.support.TrendsSuggectionsFragment.java

@Override
public void onListItemClick(final ListView l, final View v, final int position, final long id) {
    if (mMultiSelectManager.isActive())
        return;/*from   ww w . j a  v  a 2s  .  c o m*/
    final String trend = mTrendsAdapter.getItem(position - l.getHeaderViewsCount());
    if (trend == null)
        return;
    openTweetSearch(getActivity(), mAccountId, trend);
}

From source file:org.eyeseetea.malariacare.fragments.PlannedPerOrgUnitFragment.java

/**
 * Initializes the listview component, adding a listener for swiping right
 *//*from www.  j  a  va  2 s . c  om*/
private void initListView() {
    LayoutInflater inflater = LayoutInflater
            .from(PreferencesState.getInstance().getContext().getApplicationContext());
    View header = inflater.inflate(this.adapter.getHeaderLayout(), null, false);
    ListView listView = getListView();
    listView.setBackgroundColor(getResources().getColor(R.color.feedbackDarkBlue));
    if (listView.getHeaderViewsCount() == 0)
        listView.addHeaderView(header);
    setListAdapter((BaseAdapter) adapter);
    Session.listViewSent = listView;
}

From source file:de.vanita5.twittnuker.fragment.support.TrendsSuggectionsFragment.java

@Override
public void onListItemClick(final ListView l, final View v, final int position, final long id) {
    if (mMultiSelectManager.isActive())
        return;//from w  ww.java2s .c  o  m
    final Cursor cur = (Cursor) mTrendsAdapter.getItem(position - l.getHeaderViewsCount());
    if (cur == null)
        return;
    openTweetSearch(getActivity(), mAccountId, cur.getString(cur.getColumnIndex(CachedTrends.NAME)));
}

From source file:can.yrt.onebusaway.MySearchRoutesFragment.java

private String getId(ListView l, int position) {
    ListAdapter adapter = l.getAdapter();
    ObaRoute route = (ObaRoute) adapter.getItem(position - l.getHeaderViewsCount());
    return route.getId();
}

From source file:can.yrt.onebusaway.MySearchRoutesFragment.java

private String getUrl(ListView l, int position) {
    ListAdapter adapter = l.getAdapter();
    ObaRoute route = (ObaRoute) adapter.getItem(position - l.getHeaderViewsCount());
    return route.getUrl();
}

From source file:can.yrt.onebusaway.MyRouteListFragmentBase.java

@Override
public void onListItemClick(ListView l, View v, int position, long id) {

    // Get the cursor and fetch the stop ID from that.
    SimpleCursorAdapter cursorAdapter = (SimpleCursorAdapter) l.getAdapter();
    Cursor c = cursorAdapter.getCursor();
    c.moveToPosition(position - l.getHeaderViewsCount());
    final String routeId = c.getString(COL_ID);
    final String routeName = c.getString(COL_SHORTNAME);

    if (isShortcutMode()) {
        final Intent shortcut = UIHelp.makeShortcut(getActivity(), routeName,
                RouteInfoActivity.makeIntent(getActivity(), routeId));

        Activity activity = getActivity();
        activity.setResult(Activity.RESULT_OK, shortcut);
        activity.finish();/*from  w ww .  j a v a 2s .c  o  m*/

    } else {
        RouteInfoActivity.start(getActivity(), routeId);
    }
}

From source file:can.yrt.onebusaway.MyStopListFragmentBase.java

protected StopData getStopData(ListView l, int position) {
    // Get the cursor and fetch the stop ID from that.
    SimpleCursorAdapter cursorAdapter = (SimpleCursorAdapter) l.getAdapter();
    return new StopData(cursorAdapter.getCursor(), position - l.getHeaderViewsCount());
}

From source file:org.onebusaway.android.ui.MyRouteListFragmentBase.java

@Override
public void onListItemClick(ListView l, View v, int position, long id) {

    // Get the cursor and fetch the route ID from that.
    SimpleCursorAdapter cursorAdapter = (SimpleCursorAdapter) l.getAdapter();
    Cursor c = cursorAdapter.getCursor();
    c.moveToPosition(position - l.getHeaderViewsCount());
    final String routeId = c.getString(COL_ID);
    final String routeName = c.getString(COL_SHORTNAME);

    if (isShortcutMode()) {
        final Intent shortcut = UIUtils.makeShortcut(getActivity(), routeName,
                RouteInfoActivity.makeIntent(getActivity(), routeId));

        Activity activity = getActivity();
        activity.setResult(Activity.RESULT_OK, shortcut);
        activity.finish();/*from w  ww  .  jav  a  2s  . c  o  m*/

    } else {
        RouteInfoActivity.start(getActivity(), routeId);
    }
}

From source file:can.yrt.onebusaway.MyStopListFragmentBase.java

private void showOnMap(ListView l, int position) {
    // Get the cursor and fetch the stop ID from that.
    SimpleCursorAdapter cursorAdapter = (SimpleCursorAdapter) l.getAdapter();
    Cursor c = cursorAdapter.getCursor();
    c.moveToPosition(position - l.getHeaderViewsCount());
    final String stopId = c.getString(COL_ID);
    final double lat = c.getDouble(COL_LATITUDE);
    final double lon = c.getDouble(COL_LONGITUDE);

    HomeActivity.start(getActivity(), stopId, lat, lon);
}