Update according to review

This commit is contained in:
Mario Danic 2017-02-19 15:28:56 +01:00 committed by AndyScherzinger
parent 8d09630eb1
commit 767560a2e0
No known key found for this signature in database
GPG key ID: 6CADC7E3523C308B
3 changed files with 13 additions and 10 deletions

View file

@ -477,21 +477,22 @@ public class FileListListAdapter extends BaseAdapter {
@Override @Override
protected FilterResults performFiltering(CharSequence constraint) { protected FilterResults performFiltering(CharSequence constraint) {
FilterResults results = new FilterResults(); FilterResults results = new FilterResults();
Vector<OCFile> ocFileVector = new Vector<>(); Vector<OCFile> filteredFiles = new Vector<>();
if (!TextUtils.isEmpty(constraint)) { if (!TextUtils.isEmpty(constraint)) {
for (int i = 0; i < mFilesAll.size(); i++) { for (int i = 0; i < mFilesAll.size(); i++) {
OCFile currentFile = mFilesAll.get(i); OCFile currentFile = mFilesAll.get(i);
if (currentFile.getRemotePath().replace(currentFile.getFileName(), "").equals(currentDirectory.getRemotePath()) && if (currentFile.getRemotePath().replace(currentFile.getFileName(), "")
.equals(currentDirectory.getRemotePath()) &&
currentFile.getFileName().toLowerCase().contains(constraint) && currentFile.getFileName().toLowerCase().contains(constraint) &&
!ocFileVector.contains(currentFile)) { !filteredFiles.contains(currentFile)) {
ocFileVector.add(currentFile); filteredFiles.add(currentFile);
} }
} }
} }
results.values = ocFileVector; results.values = filteredFiles;
results.count = ocFileVector.size(); results.count = filteredFiles.size();
return results; return results;
} }

View file

@ -524,15 +524,16 @@ public class ExtendedListFragment extends Fragment
} }
public void setEmptyListMessage(boolean isSearch) { public void setEmptyListMessage(boolean isSearch) {
if (!isSearch) { if (isSearch) {
setMessageForEmptyList(R.string.file_list_empty_headline_search,
R.string.file_list_empty_search, R.drawable.ic_search_light_grey);
} else {
setMessageForEmptyList( setMessageForEmptyList(
R.string.file_list_empty_headline, R.string.file_list_empty_headline,
R.string.file_list_empty, R.string.file_list_empty,
R.drawable.ic_list_empty_folder R.drawable.ic_list_empty_folder
); );
} else {
setMessageForEmptyList(R.string.file_list_empty_headline_search,
R.string.file_list_empty_search, R.drawable.ic_search_light_grey);
} }
} }

View file

@ -3,6 +3,7 @@
* *
* @author Mario Danic * @author Mario Danic
* Copyright (C) 2017 Mario Danic * Copyright (C) 2017 Mario Danic
* Copyright (C) 2017 Nextcloud GmbH
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by * it under the terms of the GNU Affero General Public License as published by