mirror of
https://github.com/nextcloud/android.git
synced 2024-11-24 06:05:42 +03:00
mFiles is never null
This commit is contained in:
parent
ad6509bdb5
commit
b4b2500b75
1 changed files with 17 additions and 17 deletions
|
@ -81,8 +81,8 @@ public class FileListListAdapter extends BaseAdapter {
|
||||||
|
|
||||||
public static final int showFilenameColumnThreshold = 4;
|
public static final int showFilenameColumnThreshold = 4;
|
||||||
private Context mContext;
|
private Context mContext;
|
||||||
private Vector<OCFile> mFilesAll = new Vector<OCFile>();
|
private Vector<OCFile> mFilesAll = new Vector<>();
|
||||||
private Vector<OCFile> mFiles = null;
|
private Vector<OCFile> mFiles = new Vector<>();
|
||||||
private boolean mJustFolders;
|
private boolean mJustFolders;
|
||||||
private boolean mHideItemOptions;
|
private boolean mHideItemOptions;
|
||||||
|
|
||||||
|
@ -217,7 +217,7 @@ public class FileListListAdapter extends BaseAdapter {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (file != null) {
|
if (file != null) {
|
||||||
ImageView fileIcon = (ImageView) view.findViewById(R.id.thumbnail);
|
ImageView fileIcon = view.findViewById(R.id.thumbnail);
|
||||||
|
|
||||||
fileIcon.setTag(file.getFileId());
|
fileIcon.setTag(file.getFileId());
|
||||||
TextView fileName;
|
TextView fileName;
|
||||||
|
@ -225,9 +225,9 @@ public class FileListListAdapter extends BaseAdapter {
|
||||||
|
|
||||||
switch (viewType) {
|
switch (viewType) {
|
||||||
case LIST_ITEM:
|
case LIST_ITEM:
|
||||||
TextView fileSizeV = (TextView) view.findViewById(R.id.file_size);
|
TextView fileSizeV = view.findViewById(R.id.file_size);
|
||||||
TextView fileSizeSeparatorV = (TextView) view.findViewById(R.id.file_separator);
|
TextView fileSizeSeparatorV = view.findViewById(R.id.file_separator);
|
||||||
TextView lastModV = (TextView) view.findViewById(R.id.last_mod);
|
TextView lastModV = view.findViewById(R.id.last_mod);
|
||||||
|
|
||||||
|
|
||||||
lastModV.setVisibility(View.VISIBLE);
|
lastModV.setVisibility(View.VISIBLE);
|
||||||
|
@ -240,7 +240,7 @@ public class FileListListAdapter extends BaseAdapter {
|
||||||
|
|
||||||
case GRID_ITEM:
|
case GRID_ITEM:
|
||||||
// filename
|
// filename
|
||||||
fileName = (TextView) view.findViewById(R.id.Filename);
|
fileName = view.findViewById(R.id.Filename);
|
||||||
fileName.setText(name);
|
fileName.setText(name);
|
||||||
|
|
||||||
if (OCFileListFragmentInterface.getColumnSize() > showFilenameColumnThreshold
|
if (OCFileListFragmentInterface.getColumnSize() > showFilenameColumnThreshold
|
||||||
|
@ -251,7 +251,7 @@ public class FileListListAdapter extends BaseAdapter {
|
||||||
case GRID_IMAGE:
|
case GRID_IMAGE:
|
||||||
|
|
||||||
// local state
|
// local state
|
||||||
ImageView localStateView = (ImageView) view.findViewById(R.id.localFileIndicator);
|
ImageView localStateView = view.findViewById(R.id.localFileIndicator);
|
||||||
localStateView.bringToFront();
|
localStateView.bringToFront();
|
||||||
FileDownloaderBinder downloaderBinder = mTransferServiceGetter.getFileDownloaderBinder();
|
FileDownloaderBinder downloaderBinder = mTransferServiceGetter.getFileDownloaderBinder();
|
||||||
FileUploaderBinder uploaderBinder = mTransferServiceGetter.getFileUploaderBinder();
|
FileUploaderBinder uploaderBinder = mTransferServiceGetter.getFileUploaderBinder();
|
||||||
|
@ -294,7 +294,7 @@ public class FileListListAdapter extends BaseAdapter {
|
||||||
view.findViewById(R.id.favorite_action).setVisibility(View.GONE);
|
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);
|
view.setBackgroundColor(Color.WHITE);
|
||||||
|
|
||||||
AbsListView parentList = (AbsListView) parent;
|
AbsListView parentList = (AbsListView) parent;
|
||||||
|
@ -315,10 +315,10 @@ public class FileListListAdapter extends BaseAdapter {
|
||||||
checkBoxV.setVisibility(View.GONE);
|
checkBoxV.setVisibility(View.GONE);
|
||||||
|
|
||||||
if (mHideItemOptions) {
|
if (mHideItemOptions) {
|
||||||
ImageView sharedIconView = (ImageView) view.findViewById(R.id.sharedIcon);
|
ImageView sharedIconView = view.findViewById(R.id.sharedIcon);
|
||||||
sharedIconView.setVisibility(View.GONE);
|
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);
|
overflowIndicatorView.setVisibility(View.GONE);
|
||||||
} else {
|
} else {
|
||||||
showShareIcon(view, file);
|
showShareIcon(view, file);
|
||||||
|
@ -403,7 +403,7 @@ public class FileListListAdapter extends BaseAdapter {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void showShareIcon(View view, OCFile file) {
|
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);
|
sharedIconV.setVisibility(View.VISIBLE);
|
||||||
if (file.isSharedWithSharee() || file.isSharedWithMe()) {
|
if (file.isSharedWithSharee() || file.isSharedWithMe()) {
|
||||||
sharedIconV.setImageResource(R.drawable.shared_via_users);
|
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) {
|
private void showOverflowMenuIcon(View view, OCFile file, ViewType viewType) {
|
||||||
if (ViewType.LIST_ITEM.equals(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.setVisibility(View.VISIBLE);
|
||||||
overflowIndicatorV.setOnClickListener(new View.OnClickListener() {
|
overflowIndicatorV.setOnClickListener(new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
|
@ -439,7 +439,7 @@ public class FileListListAdapter extends BaseAdapter {
|
||||||
|
|
||||||
private void hideOverflowMenuIcon(View view, ViewType viewType) {
|
private void hideOverflowMenuIcon(View view, ViewType viewType) {
|
||||||
if (ViewType.LIST_ITEM.equals(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);
|
overflowIndicatorV.setVisibility(View.GONE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -488,7 +488,7 @@ public class FileListListAdapter extends BaseAdapter {
|
||||||
|
|
||||||
currentDirectory = directory;
|
currentDirectory = directory;
|
||||||
} else {
|
} else {
|
||||||
mFiles = null;
|
mFiles.clear();
|
||||||
mFilesAll.clear();
|
mFilesAll.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -509,7 +509,7 @@ public class FileListListAdapter extends BaseAdapter {
|
||||||
if (storageManager != null && mStorageManager == null) {
|
if (storageManager != null && mStorageManager == null) {
|
||||||
mStorageManager = storageManager;
|
mStorageManager = storageManager;
|
||||||
}
|
}
|
||||||
mFiles = new Vector<>();
|
mFiles.clear();
|
||||||
|
|
||||||
// early exit
|
// early exit
|
||||||
if (objects.size() > 0 && mStorageManager != null) {
|
if (objects.size() > 0 && mStorageManager != null) {
|
||||||
|
@ -708,7 +708,7 @@ public class FileListListAdapter extends BaseAdapter {
|
||||||
@Override
|
@Override
|
||||||
protected void publishResults(CharSequence constraint, Filter.FilterResults results) {
|
protected void publishResults(CharSequence constraint, Filter.FilterResults results) {
|
||||||
Vector<OCFile> ocFiles = (Vector<OCFile>) results.values;
|
Vector<OCFile> ocFiles = (Vector<OCFile>) results.values;
|
||||||
mFiles = new Vector<>();
|
mFiles.clear();
|
||||||
if (ocFiles != null && ocFiles.size() > 0) {
|
if (ocFiles != null && ocFiles.size() > 0) {
|
||||||
mFiles.addAll(ocFiles);
|
mFiles.addAll(ocFiles);
|
||||||
if (!PreferenceManager.showHiddenFilesEnabled(mContext)) {
|
if (!PreferenceManager.showHiddenFilesEnabled(mContext)) {
|
||||||
|
|
Loading…
Reference in a new issue