mirror of
https://github.com/Kunzisoft/KeePassDX.git
synced 2025-12-04 15:49:33 +01:00
Solve search issue when no entry available #26
This commit is contained in:
@@ -19,22 +19,22 @@
|
|||||||
*/
|
*/
|
||||||
package com.keepassdroid;
|
package com.keepassdroid;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Collections;
|
|
||||||
import java.util.Comparator;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import android.content.SharedPreferences;
|
import android.content.SharedPreferences;
|
||||||
import android.preference.PreferenceManager;
|
import android.preference.PreferenceManager;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
import android.widget.BaseAdapter;
|
import android.widget.BaseAdapter;
|
||||||
|
|
||||||
import com.kunzisoft.keepass.R;
|
|
||||||
import com.keepassdroid.database.PwEntry;
|
import com.keepassdroid.database.PwEntry;
|
||||||
import com.keepassdroid.database.PwGroup;
|
import com.keepassdroid.database.PwGroup;
|
||||||
import com.keepassdroid.view.PwEntryView;
|
import com.keepassdroid.view.PwEntryView;
|
||||||
import com.keepassdroid.view.PwGroupView;
|
import com.keepassdroid.view.PwGroupView;
|
||||||
|
import com.kunzisoft.keepass.R;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.Comparator;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
public class PwGroupListAdapter extends BaseAdapter {
|
public class PwGroupListAdapter extends BaseAdapter {
|
||||||
|
|
||||||
@@ -71,22 +71,24 @@ public class PwGroupListAdapter extends BaseAdapter {
|
|||||||
|
|
||||||
private void filterAndSort() {
|
private void filterAndSort() {
|
||||||
entriesForViewing = new ArrayList<PwEntry>();
|
entriesForViewing = new ArrayList<PwEntry>();
|
||||||
|
|
||||||
for (int i = 0; i < mGroup.childEntries.size(); i++) {
|
if (mGroup != null) {
|
||||||
PwEntry entry = mGroup.childEntries.get(i);
|
for (int i = 0; i < mGroup.childEntries.size(); i++) {
|
||||||
if ( ! entry.isMetaStream() ) {
|
PwEntry entry = mGroup.childEntries.get(i);
|
||||||
entriesForViewing.add(entry);
|
if (!entry.isMetaStream()) {
|
||||||
|
entriesForViewing.add(entry);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
boolean sortLists = prefs.getBoolean(mAct.getString(R.string.sort_key), mAct.getResources().getBoolean(R.bool.sort_default));
|
||||||
|
if (sortLists) {
|
||||||
|
groupsForViewing = new ArrayList<PwGroup>(mGroup.childGroups);
|
||||||
|
|
||||||
|
Collections.sort(entriesForViewing, entryComp);
|
||||||
|
Collections.sort(groupsForViewing, groupComp);
|
||||||
|
} else {
|
||||||
|
groupsForViewing = mGroup.childGroups;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
boolean sortLists = prefs.getBoolean(mAct.getString(R.string.sort_key), mAct.getResources().getBoolean(R.bool.sort_default));
|
|
||||||
if ( sortLists ) {
|
|
||||||
groupsForViewing = new ArrayList<PwGroup>(mGroup.childGroups);
|
|
||||||
|
|
||||||
Collections.sort(entriesForViewing, entryComp);
|
|
||||||
Collections.sort(groupsForViewing, groupComp);
|
|
||||||
} else {
|
|
||||||
groupsForViewing = mGroup.childGroups;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user