@Override public void onResume() { super.onResume(); initBroadcastReceiver(); if (adapter != null) { restorePreviouslyChecked(); restorePreviousFilter(); browseFilesButtonClick(adapter.getFileType()); } }
private void updateFiles(Object[] data) { if (data == null) { LOG.warn("Something wrong, data is null"); return; } try { byte fileType = (Byte) data[0]; @SuppressWarnings("unchecked") List<FileDescriptor> items = (List<FileDescriptor>) data[1]; adapter = new FileListAdapter(getActivity(), items, fileType) { @Override protected void onItemChecked(View v, boolean isChecked) { if (!isChecked) { filesBar.clearCheckAll(); } } @Override protected void onLocalPlay() { if (adapter != null) { saveListViewVisiblePosition(adapter.getFileType()); } } }; adapter.setCheckboxesVisibility(true); restorePreviouslyChecked(); restorePreviousFilter(); list.setAdapter(adapter); } catch (Throwable e) { LOG.error("Error updating files in list", e); } }