diff --git a/app/ui/src/main/java/com/fsck/k9/activity/FolderListFilter.java b/app/ui/src/main/java/com/fsck/k9/activity/FolderListFilter.java index ca8c139aa..51d88a7c7 100644 --- a/app/ui/src/main/java/com/fsck/k9/activity/FolderListFilter.java +++ b/app/ui/src/main/java/com/fsck/k9/activity/FolderListFilter.java @@ -11,28 +11,28 @@ import android.widget.Filter; * Filter to search for occurrences of the search-expression in any place of the folder name. */ public class FolderListFilter extends Filter { - private FilterableAdapter mFolders; - private List mOriginalValues = null; + private FilterableAdapter adapter; + private List unfilteredFolderList = null; public FolderListFilter(final FilterableAdapter folders) { - this.mFolders = folders; + this.adapter = folders; } @Override protected FilterResults performFiltering(CharSequence searchTerm) { FilterResults results = new FilterResults(); - if (mOriginalValues == null) { - int count = mFolders.getCount(); - mOriginalValues = new ArrayList<>(count); + if (unfilteredFolderList == null) { + int count = adapter.getCount(); + unfilteredFolderList = new ArrayList<>(count); for (int i = 0; i < count; i++) { - mOriginalValues.add(mFolders.getItem(i)); + unfilteredFolderList.add(adapter.getItem(i)); } } Locale locale = Locale.getDefault(); if ((searchTerm == null) || (searchTerm.length() == 0)) { - List list = new ArrayList<>(mOriginalValues); + List list = new ArrayList<>(unfilteredFolderList); results.values = list; results.count = list.size(); } else { @@ -40,7 +40,7 @@ public class FolderListFilter extends Filter { final String[] words = searchTermString.split(" "); final int wordCount = words.length; - final List values = mOriginalValues; + final List values = unfilteredFolderList; final List newValues = new ArrayList<>(); @@ -66,18 +66,18 @@ public class FolderListFilter extends Filter { @Override protected void publishResults(CharSequence constraint, FilterResults results) { final List folders = (List) results.values; - mFolders.clear(); + adapter.clear(); if (folders != null) { for (T folder : folders) { if (folder != null) { - mFolders.add(folder); + adapter.add(folder); } } } else { Timber.w("FolderListFilter.publishResults - null search-result "); } - mFolders.notifyDataSetChanged(); + adapter.notifyDataSetChanged(); } public interface FilterableAdapter {