private void selectAll() { final DownloadIndexAdapter listAdapter = (DownloadIndexAdapter) getExpandableListAdapter(); int selected = 0; for (int j = 0; j < listAdapter.getGroupCount(); j++) { for (int i = 0; i < listAdapter.getChildrenCount(j); i++) { IndexItem es = listAdapter.getChild(j, i); if (!getEntriesToDownload().containsKey(es)) { selected++; getEntriesToDownload() .put( es, es.createDownloadEntry( getClientContext(), type, new ArrayList<DownloadEntry>(1))); } } } AccessibleToast.makeText( this, MessageFormat.format(getString(R.string.items_were_selected), selected), Toast.LENGTH_SHORT) .show(); listAdapter.notifyDataSetInvalidated(); if (selected > 0) { updateDownloadButton(true); } }
public void deselectAll() { final DownloadIndexAdapter listAdapter = (DownloadIndexAdapter) getExpandableListAdapter(); downloadListIndexThread.getEntriesToDownload().clear(); listAdapter.notifyDataSetInvalidated(); findViewById(R.id.DownloadButton).setVisibility(View.GONE); }
private void filterExisting() { final DownloadIndexAdapter listAdapter = (DownloadIndexAdapter) getExpandableListAdapter(); final Map<String, String> listAlreadyDownloaded = downloadListIndexThread.getDownloadedIndexFileNames(); final List<IndexItem> filtered = new ArrayList<IndexItem>(); for (IndexItem fileItem : listAdapter.getIndexFiles()) { if (fileItem.isAlreadyDownloaded(listAlreadyDownloaded)) { filtered.add(fileItem); } } listAdapter.setIndexFiles( filtered, IndexItemCategory.categorizeIndexItems(getClientContext(), filtered)); listAdapter.notifyDataSetChanged(); }