Example usage for android.widget ListView addFooterView

List of usage examples for android.widget ListView addFooterView

Introduction

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

Prototype

public void addFooterView(View v, Object data, boolean isSelectable) 

Source Link

Document

Add a fixed view to appear at the bottom of the list.

Usage

From source file:edu.mit.mobile.android.livingpostcards.CardListFragment.java

@Override
public void onViewCreated(View view, Bundle savedInstanceState) {
    view.findViewById(R.id.new_card).setOnClickListener(this);

    // add a footer so that there's enough room for the content even with the red button at the
    // bottom/*from  www . j  a va 2  s  .c  o  m*/
    final ListView lv = getListView();
    lv.addFooterView(getLayoutInflater(savedInstanceState).inflate(R.layout.scroll_footer, lv, false), null,
            false);
    super.onViewCreated(view, savedInstanceState);
}

From source file:at.ac.uniklu.mobile.sportal.CalendarFragment.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View v = inflater.inflate(R.layout.calendar_fragment, container, false);
    mProgressView = v.findViewById(R.id.progress);
    mFooterView = inflater.inflate(R.layout.list_footer_loadingindicator, null);

    ListView listView = (ListView) v.findViewById(android.R.id.list);
    listView.addFooterView(mFooterView, null, false);
    listView.setOnScrollListener(this);

    /* change reference to inner progress indicator since hiding the footer 
       * container itself doesn't resize the layout (black box stays visible) */
    mFooterView = mFooterView.findViewById(R.id.list_progress);

    return v;/*from w  w w  . j  a  va 2 s  .  c o m*/
}

From source file:com.battlelancer.seriesguide.ui.FixGetGlueCheckInActivity.java

@Override
protected void onCreate(Bundle args) {
    super.onCreate(args);
    setContentView(R.layout.activity_fix_get_glue);
    setupActionBar();//from w  ww.  j  a  va  2 s  . c  o  m

    setupViews();

    // do not check for null, we want to crash if so
    mShowId = getIntent().getExtras().getString(InitBundle.SHOW_TVDB_ID);

    mAdapter = new GetGlueObjectAdapter(this);
    ListView list = (ListView) findViewById(R.id.listViewGetGlueResults);
    list.addHeaderView(mHeaderView, null, false);
    list.addFooterView(mFooterView, null, false);
    list.setAdapter(mAdapter);
    list.setOnItemClickListener(this);

    // query for show title
    final Cursor show = getContentResolver().query(Shows.buildShowUri(mShowId),
            new String[] { Shows._ID, Shows.TITLE, Shows.GETGLUEID }, null, null, null);
    if (show != null) {
        if (show.moveToFirst()) {
            String glueId = show.getString(2);
            if (!TextUtils.isEmpty(glueId)) {
                mSelectedValue.setText(glueId);
            }

            String query = show.getString(1);

            Bundle loaderArgs = new Bundle();
            loaderArgs.putString("query", query);

            getSupportLoaderManager().initLoader(0, loaderArgs, this);
        }

        show.close();
    }

}

From source file:org.schabi.terminightor.AlarmItemListFragment.java

@Override
public void onViewCreated(View view, Bundle savedInstanceState) {
    super.onViewCreated(view, savedInstanceState);

    // Restore the previously serialized activated item position.
    if (savedInstanceState != null && savedInstanceState.containsKey(STATE_ACTIVATED_POSITION)) {
        setActivatedPosition(savedInstanceState.getInt(STATE_ACTIVATED_POSITION));
    }/*from w  ww .  j  a v  a 2s .  c  o m*/

    ListView list = getListView();
    View footerView = ((LayoutInflater) getActivity().getSystemService(Context.LAYOUT_INFLATER_SERVICE))
            .inflate(R.layout.list_footer_view, null, false);
    list.addFooterView(footerView, null, false);
}

From source file:com.redwoodsystems.android.apps.LightingListFragment.java

private void setupScenesList() {
    Log.d(TAG, "setupScenesList called");
    ListView listView = (ListView) getActivity().findViewById(android.R.id.list);
    TextView dummy = new TextView(getActivity());
    ImageView dummy2 = new ImageView(getActivity());
    listView.addFooterView(dummy, null, true);
    listView.setFooterDividersEnabled(true);
    listView.addHeaderView(dummy2, null, true);
    listView.setHeaderDividersEnabled(true);
    int[] colors = { 0, 0xFFF47836, 0 }; // Pantone172 for the example
    listView.setDivider(new GradientDrawable(Orientation.RIGHT_LEFT, colors));
    listView.setDividerHeight(1);/*w w w  .  ja v a 2  s  . co  m*/

    //TODO: set Empty Text inside View
    //setEmptyText("No Scenes found");

    mSceneAdapter = new SceneAdapter(getActivity(), R.layout.scene_item_layout, R.id.sceneText);

    setListAdapter(mSceneAdapter);

    Uri dummyUri = null;
    Bundle params = new Bundle();
    Bundle args = new Bundle();
    args.putParcelable(ARGS_URI, dummyUri);
    args.putParcelable(ARGS_PARAMS, params);

    // Initialize the Loader.
    Log.d(TAG, "calling initLoader..");
    getActivity().getSupportLoaderManager().initLoader(LOADER_SCENES, null, this);

}

From source file:net.primeranks.fs_viewer.fs_replay.EntryPointActivity.java

public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.entry_point);

    ListView listView = getListView();
    listView.setOnItemClickListener(this);

    // Add a back to top button on the bottom       - Create the item
    backToTop_footer = (Button) getLayoutInflater().inflate(R.layout.user_footer, null);
    backToTop_footer.setCompoundDrawablesWithIntrinsicBounds(
            getResources().getDrawable(android.R.drawable.ic_menu_upload), null, null, null);
    backToTop_footer.setVisibility(View.INVISIBLE); // While empty do not show it
    headerUser = getLayoutInflater().inflate(R.layout.user_header, null);
    listView.addFooterView(backToTop_footer, null, true); // Add it to the bottom
    listView.addHeaderView(headerUser, null, false);

    userList = new ArrayList<User>(); // Start with an empty one
    this.userAdapter = new UserAdapter(this, userList);
    listView.setAdapter(this.userAdapter);
    listView.setItemsCanFocus(false);//  www  . jav a2s  .  c om

    connectionReceiver = new ConnectionChangedBroadcastReceiver();
    registerReceiver(connectionReceiver, new IntentFilter(ConnectivityManager.CONNECTIVITY_ACTION));
}

From source file:com.nadmm.airports.tfr.TfrListFragment.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View view = super.onCreateView(inflater, container, savedInstanceState);

    final ListView listView = getListView();
    View footer = inflater.inflate(R.layout.tfr_list_footer_view, listView, false);
    footer.setLayoutParams(/*from   www  .ja va  2s .  com*/
            new ListView.LayoutParams(ListView.LayoutParams.MATCH_PARENT, ListView.LayoutParams.WRAP_CONTENT));
    TextView tv = (TextView) footer.findViewById(R.id.tfr_warning_text);
    tv.setText("Depicted TFR data may not be a complete listing. Pilots should not use "
            + "the information for flight planning purposes. For the latest information, "
            + "call your local Flight Service Station at 1-800-WX-BRIEF.");
    listView.addFooterView(footer, null, false);
    listView.setFooterDividersEnabled(true);

    return view;
}

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  ww w .  java  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.meiste.greg.ptw.tab.Standings.java

@Override
public View onCreateView(final LayoutInflater inflater, final ViewGroup container,
        final Bundle savedInstanceState) {
    mSetupNeeded = GAE.isAccountSetupNeeded(getActivity());
    mChanged = false;//www . java 2  s.  c om
    mAccountSetupTime = Util.getAccountSetupTime(getActivity());
    setRetainInstance(true);

    final IntentFilter filter = new IntentFilter(PTW.INTENT_ACTION_STANDINGS);
    getActivity().registerReceiver(mBroadcastReceiver, filter);

    if (mSetupNeeded)
        return Util.getAccountSetupView(getActivity(), inflater, container);
    else if (mFailedConnect) {
        mFailedConnect = false;
        final View v = inflater.inflate(R.layout.no_connection, container, false);

        final Button retry = (Button) v.findViewById(R.id.retry);
        retry.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(final View v) {
                mChanged = true;
                notifyChanged();
            }
        });

        return v;
    } else if (!isStandingsPresent() || mConnecting) {
        if (!mConnecting) {
            mConnecting = true;
            GAE.getInstance(getActivity()).getPage(this, "standings");
        }
        return inflater.inflate(R.layout.connecting, container, false);
    }

    final View v = inflater.inflate(R.layout.list, container, false);
    mSwipeRefreshWidget = (SwipeRefreshLayout) v.findViewById(R.id.swipe_refresh_widget);
    mSwipeRefreshWidget.setOnRefreshListener(this);
    mSwipeRefreshWidget.setColorSchemeResources(R.color.refresh1, R.color.refresh2, R.color.refresh3,
            R.color.refresh4);

    final ListView lv = (ListView) v.findViewById(R.id.content);
    final View header = inflater.inflate(R.layout.standings_header, lv, false);
    mAdapter = new PlayerAdapter(getActivity());
    mAfterRace = (TextView) header.findViewById(R.id.after);
    mAfterRace.setText(getRaceAfterText(getActivity()));
    lv.addHeaderView(header, null, false);
    final View footer = inflater.inflate(R.layout.standings_footer, lv, false);
    mFooter = (TextView) footer.findViewById(R.id.standings_footer);
    mFooter.setText(getFooterText(getActivity()));
    lv.addFooterView(footer, null, false);
    lv.setAdapter(mAdapter);

    lv.setOnItemClickListener(new OnItemClickListener() {
        @Override
        public void onItemClick(final AdapterView<?> parent, final View v, final int pos, final long id) {
            final Player player = (Player) parent.getItemAtPosition(pos);
            if (mAdapter.isSelf(player)) {
                Util.log("Opening privacy dialog");
                if (mPrivacyDialog == null) {
                    mPrivacyDialog = new PrivacyDialog(getActivity(), Standings.this);
                }
                mPrivacyDialog.show(mAdapter.getPlayerName());
            } else {
                Util.log("Opening friend action dialog");
                if (mFriendActionDialog == null) {
                    mFriendActionDialog = new FriendActionDialog(getActivity(), Standings.this);
                }
                mFriendActionDialog.show(player);
            }
        }
    });

    final ImageView iv = (ImageView) v.findViewById(R.id.add_friend);
    iv.setOnClickListener(new OnClickListener() {
        @Override
        public void onClick(final View v) {
            if ((NfcAdapter.getDefaultAdapter(getActivity()) != null)
                    && (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN)
                    && mAdapter.getPlayer().isIdentifiable() && Gcm.isRegistered(getActivity())) {
                Util.log("NFC available. Need to ask user add method.");
                if (mFriendMethodDialog == null) {
                    mFriendMethodDialog = new FriendMethodDialog(getActivity(), Standings.this);
                }
                mFriendMethodDialog.reset();
                mFriendMethodDialog.show();
            } else {
                Util.log("NFC not available. Adding friend via username.");
                showFriendPlayerDialog();
            }
        }
    });

    if (mCheckName) {
        if ((mPrivacyDialog.getNewName() != null)
                && !mPrivacyDialog.getNewName().equals(mAdapter.getPlayerName())) {
            Toast.makeText(getActivity(), R.string.name_taken, Toast.LENGTH_SHORT).show();
        }
        mCheckName = false;
    }

    return v;
}