Example usage for android.widget ListView getFooterViewsCount

List of usage examples for android.widget ListView getFooterViewsCount

Introduction

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

Prototype

@Override
    public int getFooterViewsCount() 

Source Link

Usage

From source file:Main.java

public static int getAllListViewSectionCounts(ListView lv, List dataSource) {
    if (null == lv || dataSource == null || dataSource.isEmpty()) {
        return 0;
    }//from w w  w.j  a  v  a 2 s  .  c om
    return dataSource.size() + lv.getHeaderViewsCount() + lv.getFooterViewsCount();
}

From source file:Main.java

public static boolean isLastMessageVisible(ListView messageListView) {
    if (messageListView == null || messageListView.getAdapter() == null) {
        return false;
    }/*  www  .j a  v  a  2s .  com*/

    if (messageListView.getLastVisiblePosition() >= messageListView.getAdapter().getCount() - 1
            - messageListView.getFooterViewsCount()) {
        return true;
    } else {
        return false;
    }
}

From source file:eu.trentorise.smartcampus.eb.fragments.experience.EditExpFragment.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    returnView = inflater.inflate(R.layout.exp_form, container, false);
    ListView list = (ListView) returnView.findViewById(R.id.exp_contents);
    registerForContextMenu(list);/*from w  w  w. j a  v  a 2  s .  c o  m*/
    if (list.getFooterViewsCount() == 0) {
        View footer = getSherlockActivity().getLayoutInflater().inflate(R.layout.exp_form_footer, null);
        list.addFooterView(footer, null, false);
    }
    if (list.getHeaderViewsCount() == 0) {
        View header = getSherlockActivity().getLayoutInflater().inflate(R.layout.exp_form_header, null);
        list.addHeaderView(header, null, false);
        mTitleSwitch = new TextEditSwitch(returnView, R.id.title_switcher, R.id.title_tv, R.id.title, this);
        mTitleSwitch.setValue(exp.getTitle());
        mDescrSwitch = new TextEditSwitch(returnView, R.id.descr_switcher, R.id.description_tv,
                R.id.description, this);
        mDescrSwitch.setValue(exp.getDescription());
    }
    adapter = new ExpContentAdapter(getSherlockActivity(), R.layout.exp_contents_row, exp.getContents());
    list.setAdapter(adapter);
    list.setOnItemClickListener(new OnItemClickListener() {
        @Override
        public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
            if (position <= exp.getContents().size() && position > 0) {
                ContentRenderer.renderExternal(getActivity(), exp.getContents().get(position - 1));
            }
        }

    });

    updateCollectionTV();
    if (exp.getId() == null) {
        new LoadAddressTask().execute();
    } else {
        updateFooterTV(exp.getAddress(), exp.getCreationTime());
    }
    if (exp.getTags() != null) {
        ((TextView) returnView.findViewById(R.id.tags_tv)).setText(Concept.toSimpleString(exp.getTags()));
    }

    ((TextView) returnView.findViewById(R.id.tags_tv)).setOnClickListener(new OnClickListener() {
        @Override
        public void onClick(View v) {
            TaggingDialogFragment taggingDialog = new TaggingDialogFragment();
            taggingDialog.setArguments(TaggingDialogFragment.prepare(Concept.convertToSS(exp.getTags())));
            taggingDialog.show(getActivity().getSupportFragmentManager(), "tags");
        }
    });

    returnView.findViewById(R.id.place_box).setOnClickListener(new OnClickListener() {
        @Override
        public void onClick(View v) {
            DialogFragment textFragment = new EditPositionFragment();
            textFragment.setArguments(
                    EditPositionFragment.prepare(exp.getAddress() == null ? "" : exp.getAddress()));
            textFragment.show(getActivity().getSupportFragmentManager(), "exp_position");
        }
    });

    return returnView;
}

From source file:com.simas.vc.MainActivity.java

@Override
public void onNavigationDrawerItemSelected(int position) {
    ListView lv = mNavDrawerFragment.getListView();

    if (position == ListView.INVALID_POSITION || position < lv.getHeaderViewsCount()
            || position >= lv.getCount() - lv.getFooterViewsCount()) {
        // Skip headers and footers
        //noinspection UnnecessaryReturnStatement
        return;//from w  w w.j av a 2 s  .c  om
    } else {
        // Check the item in the drawer
        lv.setItemChecked(position, true);

        Object checkedItem = lv.getItemAtPosition(lv.getCheckedItemPosition());
        // Make sure the item is not already selected in the current EditorFragment
        if (lv.getChoiceMode() == ListView.CHOICE_MODE_SINGLE && getEditorFragment() != null
                && getEditorFragment().getItem() != checkedItem) {
            // Select item in pager
            int itemPosInPager = position - lv.getHeaderViewsCount() + 1; // +1 for empty item
            mViewPager.setCurrentItem(itemPosInPager);

            // Close drawer
            mNavDrawerFragment.setDrawerOpen(false);
        }
    }
}