List of usage examples for android.widget ListView addFooterView
public void addFooterView(View v)
From source file:com.carlrice.reader.utils.UiUtils.java
static public void addEmptyFooterView(ListView listView, int dp) { View view = new View(listView.getContext()); view.setMinimumHeight(dpToPixel(dp)); view.setClickable(true);/* w w w .java 2 s .c o m*/ listView.addFooterView(view); }
From source file:org.mercycorps.translationcards.activity.translations.TranslationsActivity.java
private void inflateListFooter() { ListView list = (ListView) findViewById(R.id.translations_list); LayoutInflater layoutInflater = getLayoutInflater(); list.addFooterView(layoutInflater.inflate(R.layout.translation_list_footer, list, false)); findViewById(R.id.translations_list_footer).setOnClickListener(null); updateWelcomeInstructionsState();/*from w ww. j a v a 2 s . c om*/ }
From source file:com.maxleap.mall.fragments.MainFragment.java
private void initListView(View view) { mSwipeRefreshLayout = (SwipeRefreshLayout) view.findViewById(R.id.refresh_layout); mSwipeRefreshLayout.setColorSchemeResources(R.color.orange, R.color.green, R.color.blue); mSwipeRefreshLayout.setOnRefreshListener(this); ListView listview = (ListView) view.findViewById(R.id.frag_main_list_view); listview.addHeaderView(getHeadView()); listview.addFooterView(LayoutInflater.from(getActivity()).inflate(R.layout.view_footer, null)); if (mProducts == null) { mProducts = new ArrayList<>(); mComments = new ArrayList<>(); mHandler.postDelayed(mProgressRunnable, 100); }/*from w w w . ja v a 2s. c o m*/ if (mProducts.isEmpty()) { fetchProductData(); } mProductAdapter = new ProductAdapter(mContext, mProducts, mComments); listview.setAdapter(mProductAdapter); listview.setOnItemClickListener(this); }
From source file:org.eyeseetea.malariacare.fragments.DashboardUnsentFragment.java
/** * Initializes the listview component, adding a listener for swiping right *//*from w ww. j av a2 s . co m*/ private void initListView() { LayoutInflater inflater = LayoutInflater.from(getActivity()); View header = DashboardHeaderStrategy.getInstance().loadHeader(this.adapter.getHeaderLayout(), inflater); final View footer = inflater.inflate(this.adapter.getFooterLayout(), null, false); ListView listView = getListView(); if (header != null) { listView.addHeaderView(header); } listView.addFooterView(footer); LayoutUtils.setRowDivider(listView); setListAdapter((BaseAdapter) adapter); // Create a ListView-specific touch listener. ListViews are given special treatment because // by default they handle touches for their list items... i.e. they're in charge of drawing // the pressed state (the list selector), handling list item clicks, etc. SwipeDismissListViewTouchListener touchListener = new SwipeDismissListViewTouchListener(listView, new SwipeDismissListViewTouchListener.DismissCallbacks() { @Override public boolean canDismiss(int position) { return position > 0 && position <= mSurveyDBs.size(); } @Override public void onDismiss(ListView listView, int[] reverseSortedPositions) { for (final int position : reverseSortedPositions) { new AlertDialog.Builder(getActivity()) .setTitle(getActivity().getString(R.string.dialog_title_delete_survey)) .setMessage(getActivity().getString(R.string.dialog_info_delete_survey)) .setPositiveButton(android.R.string.yes, new DialogInterface.OnClickListener() { public void onClick(DialogInterface arg0, int arg1) { ((SurveyDB) adapter.getItem(position - 1)).delete(); //Reload data using service Intent surveysIntent = new Intent(getActivity(), SurveyService.class); surveysIntent.putExtra(SurveyService.SERVICE_METHOD, SurveyService.RELOAD_DASHBOARD_ACTION); getActivity().startService(surveysIntent); } }).setNegativeButton(android.R.string.no, null).create().show(); } } }); listView.setOnTouchListener(touchListener); // Setting this scroll listener is required to ensure that during ListView scrolling, // we don't look for swipes. listView.setOnScrollListener(touchListener.makeScrollListener()); }
From source file:com.example.tony.popularmovie.DetailActivityFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { mTrailerAdapter = new TrailerAdapter(getActivity(), null, 0); View rootView = inflater.inflate(R.layout.fragment_detail, container, false); View headerView = LayoutInflater.from(getActivity()).inflate(R.layout.list_view_header, null); View footerView = LayoutInflater.from(getActivity()).inflate(R.layout.list_view_footer, null); mTitle = (TextView) headerView.findViewById(R.id.movie_title); mReleaseDate = (TextView) headerView.findViewById(R.id.release_date); mRatings = (TextView) headerView.findViewById(R.id.movie_ratings); mOverview = (TextView) headerView.findViewById(R.id.movie_overview); mPoster = (ImageView) headerView.findViewById(R.id.movie_poster); mCheckBox = (CheckBox) headerView.findViewById(R.id.checkBox); ListView trailerListView = (ListView) rootView.findViewById(R.id.trailer_list); trailerListView.addHeaderView(headerView); trailerListView.addFooterView(footerView); trailerListView.setAdapter(mTrailerAdapter); trailerListView.setOnItemClickListener(new AdapterView.OnItemClickListener() { @Override//ww w .j a va2 s. com public void onItemClick(AdapterView<?> parent, View view, int position, long id) { if (position == parent.getCount() - 1) { Intent intent = new Intent(getActivity(), ReviewActivity.class); intent.putExtra("movieID", mMovieId); getActivity().startActivity(intent); } else { Uri uri = Uri.parse(BASE_YOUTUBE_URL + sKey); Intent intent = new Intent(android.content.Intent.ACTION_VIEW, uri); getActivity().startActivity(intent); } } }); Bundle arguments = getArguments(); if (arguments != null) { trailerListView.setVisibility(View.VISIBLE); mMovieId = arguments.getString("movieID"); } else { trailerListView.setVisibility(View.GONE); } return rootView; }
From source file:com.ultramegasoft.flavordex2.dialog.CatListDialog.java
/** * Get the layout for the Dialog.// w w w. j ava2 s .c om * * @return The View to place inside the Dialog */ @NonNull private ListView getLayout() { final ListView listView = new ListView(getContext()); listView.setOnItemClickListener(new AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) { onCatSelected(position, id); } }); listView.addFooterView( LayoutInflater.from(getContext()).inflate(R.layout.cat_add_list_item, listView, false)); return listView; }
From source file:com.metinkale.prayerapp.vakit.AddCity.java
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.vakit_addcity); mFab = (FloatingActionButton) findViewById(R.id.search); mFab.setOnClickListener(this); ListView listView = (ListView) findViewById(R.id.listView); listView.setFastScrollEnabled(true); listView.setOnItemClickListener(this); listView.addFooterView(View.inflate(this, R.layout.vakit_addcity_addcsv, null)); mAdapter = new MyAdapter(this); listView.setAdapter(mAdapter);/*from w w w . j a v a 2 s . c o m*/ TextView legacy = (TextView) findViewById(R.id.legacySwitch); legacy.setText(R.string.oldAddCity); legacy.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { finish(); startActivity(new Intent(AddCity.this, AddCityLegacy.class)); } }); checkLocation(); }
From source file:au.id.tmm.anewreader.view.MainActivity.java
public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); this.setContentView(R.layout.activity_main_activity); ListView feedListView = (ListView) this.findViewById(R.id.drawer_layout_feed_list); this.feedArrayAdapter = new FeedArrayAdapter(this, android.R.layout.simple_list_item_1); feedListView.setAdapter(this.feedArrayAdapter); feedListView.setOnItemClickListener(onFeedListItemClickListener); ListView itemListView = (ListView) this.findViewById(R.id.item_list); this.itemArrayAdapter = new ItemArrayAdapter(this, android.R.layout.simple_list_item_1); itemListView.addFooterView( this.getLayoutInflater().inflate(R.layout.adapter_view_item_list_loading_footer, null)); itemListView.setAdapter(this.itemArrayAdapter); itemListView.setOnItemClickListener(onItemListItemClickListener); itemListView.setOnScrollListener(onItemListScrollListener); DisplayItems.getInstance().registerListener(this.displayItemsListener); pullToRefreshAttacher = PullToRefreshAttacher.get(this); pullToRefreshAttacher.addRefreshableView(itemListView, this.onPullToRefreshListener); pullToRefreshAttacher.setEnabled(false); this.findViewById(R.id.main_activity_error_panel).setOnClickListener(onErrorPanelClickListener); this.retrieveAccount(); }
From source file:com.dpcsoftware.mn.CategoryStats.java
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); app = (App) getApplication();//from w ww .j a va 2 s . co m setContentView(R.layout.categorystats); ListView lv = ((ListView) findViewById(R.id.listView1)); LayoutInflater inflater = LayoutInflater.from(this); footer = inflater.inflate(R.layout.categorystats_listitem, null); footer.findViewById(R.id.imageView1).setVisibility(View.GONE); ((TextView) footer.findViewById(R.id.textView1)).setText(R.string.categorystats_c1); lv.addFooterView(footer); footer2 = inflater.inflate(R.layout.categorystats_listitem, null); footer2.findViewById(R.id.imageView1).setVisibility(View.GONE); ((TextView) footer2.findViewById(R.id.textView1)).setText(R.string.categorystats_c2); lv.addFooterView(footer2); View emptyView = findViewById(R.id.empty); ((TextView) emptyView.findViewById(R.id.textView1)).setText(R.string.categorystats_c3); lv.setEmptyView(emptyView); lv.setOnItemClickListener(new OnItemClickListener() { public void onItemClick(AdapterView<?> parent, View view, int position, long id) { if (position != adapter.getCount() && position != (adapter.getCount() + 1)) { Intent it = new Intent(CategoryStats.this, ExpensesList.class); it.putExtra("FILTER_ID", id); if (isByMonth) it.putExtra("FILTER_DATE", date); startActivity(it); } } }); ((ImageButton) findViewById(R.id.imageButton1)).setOnClickListener(monthButtonCListener); ((ImageButton) findViewById(R.id.imageButton2)).setOnClickListener(monthButtonCListener); ((RadioGroup) findViewById(R.id.radioGroup1)) .setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() { public void onCheckedChanged(RadioGroup group, int checkedId) { LinearLayout monthPicker = (LinearLayout) findViewById(R.id.LinearLayoutMonthPicker); if (checkedId == R.id.radio0) { isByMonth = true; monthPicker.setVisibility(View.VISIBLE); } else { isByMonth = false; monthPicker.setVisibility(View.GONE); } renderGraph(); } }); }
From source file:nz.ac.otago.psyanlab.common.designer.source.SourceDetailFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View view = inflater.inflate(R.layout.fragment_designer_source_detail, container, false); ListView list = (ListView) view.findViewById(R.id.columns); list.addHeaderView(inflater.inflate(R.layout.header_source_detail, list, false)); list.addFooterView(inflater.inflate(R.layout.footer_source_detail, list, false)); return view;/*from w w w. ja v a 2s . c o m*/ }