mFiles is never null

This commit is contained in:
tobiasKaminsky 2018-01-02 13:07:33 +01:00
parent ad6509bdb5
commit b4b2500b75
No known key found for this signature in database
GPG key ID: 0E00D4D47D0C5AF7

View file

@ -81,8 +81,8 @@ public class FileListListAdapter extends BaseAdapter {
public static final int showFilenameColumnThreshold = 4;
private Context mContext;
private Vector<OCFile> mFilesAll = new Vector<OCFile>();
private Vector<OCFile> mFiles = null;
private Vector<OCFile> mFilesAll = new Vector<>();
private Vector<OCFile> mFiles = new Vector<>();
private boolean mJustFolders;
private boolean mHideItemOptions;
@ -217,7 +217,7 @@ public class FileListListAdapter extends BaseAdapter {
}
if (file != null) {
ImageView fileIcon = (ImageView) view.findViewById(R.id.thumbnail);
ImageView fileIcon = view.findViewById(R.id.thumbnail);
fileIcon.setTag(file.getFileId());
TextView fileName;
@ -225,9 +225,9 @@ public class FileListListAdapter extends BaseAdapter {
switch (viewType) {
case LIST_ITEM:
TextView fileSizeV = (TextView) view.findViewById(R.id.file_size);
TextView fileSizeSeparatorV = (TextView) view.findViewById(R.id.file_separator);
TextView lastModV = (TextView) view.findViewById(R.id.last_mod);
TextView fileSizeV = view.findViewById(R.id.file_size);
TextView fileSizeSeparatorV = view.findViewById(R.id.file_separator);
TextView lastModV = view.findViewById(R.id.last_mod);
lastModV.setVisibility(View.VISIBLE);
@ -240,7 +240,7 @@ public class FileListListAdapter extends BaseAdapter {
case GRID_ITEM:
// filename
fileName = (TextView) view.findViewById(R.id.Filename);
fileName = view.findViewById(R.id.Filename);
fileName.setText(name);
if (OCFileListFragmentInterface.getColumnSize() > showFilenameColumnThreshold
@ -251,7 +251,7 @@ public class FileListListAdapter extends BaseAdapter {
case GRID_IMAGE:
// local state
ImageView localStateView = (ImageView) view.findViewById(R.id.localFileIndicator);
ImageView localStateView = view.findViewById(R.id.localFileIndicator);
localStateView.bringToFront();
FileDownloaderBinder downloaderBinder = mTransferServiceGetter.getFileDownloaderBinder();
FileUploaderBinder uploaderBinder = mTransferServiceGetter.getFileUploaderBinder();
@ -294,7 +294,7 @@ public class FileListListAdapter extends BaseAdapter {
view.findViewById(R.id.favorite_action).setVisibility(View.GONE);
}
ImageView checkBoxV = (ImageView) view.findViewById(R.id.custom_checkbox);
ImageView checkBoxV = view.findViewById(R.id.custom_checkbox);
view.setBackgroundColor(Color.WHITE);
AbsListView parentList = (AbsListView) parent;
@ -315,10 +315,10 @@ public class FileListListAdapter extends BaseAdapter {
checkBoxV.setVisibility(View.GONE);
if (mHideItemOptions) {
ImageView sharedIconView = (ImageView) view.findViewById(R.id.sharedIcon);
ImageView sharedIconView = view.findViewById(R.id.sharedIcon);
sharedIconView.setVisibility(View.GONE);
ImageView overflowIndicatorView = (ImageView) view.findViewById(R.id.overflow_menu);
ImageView overflowIndicatorView = view.findViewById(R.id.overflow_menu);
overflowIndicatorView.setVisibility(View.GONE);
} else {
showShareIcon(view, file);
@ -403,7 +403,7 @@ public class FileListListAdapter extends BaseAdapter {
}
private void showShareIcon(View view, OCFile file) {
ImageView sharedIconV = (ImageView) view.findViewById(R.id.sharedIcon);
ImageView sharedIconV = view.findViewById(R.id.sharedIcon);
sharedIconV.setVisibility(View.VISIBLE);
if (file.isSharedWithSharee() || file.isSharedWithMe()) {
sharedIconV.setImageResource(R.drawable.shared_via_users);
@ -426,7 +426,7 @@ public class FileListListAdapter extends BaseAdapter {
private void showOverflowMenuIcon(View view, OCFile file, ViewType viewType) {
if (ViewType.LIST_ITEM.equals(viewType)) {
ImageView overflowIndicatorV = (ImageView) view.findViewById(R.id.overflow_menu);
ImageView overflowIndicatorV = view.findViewById(R.id.overflow_menu);
overflowIndicatorV.setVisibility(View.VISIBLE);
overflowIndicatorV.setOnClickListener(new View.OnClickListener() {
@Override
@ -439,7 +439,7 @@ public class FileListListAdapter extends BaseAdapter {
private void hideOverflowMenuIcon(View view, ViewType viewType) {
if (ViewType.LIST_ITEM.equals(viewType)) {
ImageView overflowIndicatorV = (ImageView) view.findViewById(R.id.overflow_menu);
ImageView overflowIndicatorV = view.findViewById(R.id.overflow_menu);
overflowIndicatorV.setVisibility(View.GONE);
}
}
@ -488,7 +488,7 @@ public class FileListListAdapter extends BaseAdapter {
currentDirectory = directory;
} else {
mFiles = null;
mFiles.clear();
mFilesAll.clear();
}
@ -509,7 +509,7 @@ public class FileListListAdapter extends BaseAdapter {
if (storageManager != null && mStorageManager == null) {
mStorageManager = storageManager;
}
mFiles = new Vector<>();
mFiles.clear();
// early exit
if (objects.size() > 0 && mStorageManager != null) {
@ -708,7 +708,7 @@ public class FileListListAdapter extends BaseAdapter {
@Override
protected void publishResults(CharSequence constraint, Filter.FilterResults results) {
Vector<OCFile> ocFiles = (Vector<OCFile>) results.values;
mFiles = new Vector<>();
mFiles.clear();
if (ocFiles != null && ocFiles.size() > 0) {
mFiles.addAll(ocFiles);
if (!PreferenceManager.showHiddenFilesEnabled(mContext)) {