use of com.frostwire.android.gui.adapters.menu.FileListAdapter in project frostwire by frostwire.
the class MyFilesFragment method updateFiles.
private void updateFiles(Object[] data) {
if (data == null || data.length < 2 || data[1] == 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, selectAllModeOn) {
@Override
protected void onLocalPlay() {
if (adapter != null) {
saveListViewVisiblePosition(adapter.getFileType());
}
}
@Override
protected void onItemChecked(View v, boolean isChecked) {
super.onItemChecked(v, isChecked);
autoCheckUnCheckSelectAllCheckbox();
selectionModeCallback.onItemChecked(getActivity(), adapter.getCheckedCount());
}
@Override
protected boolean onItemLongClicked(View v) {
return onFileItemLongClicked(v);
}
@Override
protected void onItemClicked(View v) {
onFileItemClicked(v);
}
};
adapter.setCheckboxesVisibility(selectAllModeOn);
list.setNumColumns(adapter.getNumColumns());
restorePreviouslyChecked();
if (previousFilter != null) {
performFilter(previousFilter);
} else {
updateAdapter();
}
} catch (Throwable e) {
LOG.error("Error updating files in list", e);
}
}
Aggregations