public boolean filterData(String query) { items.clear(); boolean isFound = false; if (query == null || query.isEmpty()) { originalContactList.clear(); refreshList(); } else { query = query.toLowerCase(); if (originalContactList.isEmpty()) { Protocol p = RosterHelper.getInstance().getProtocol(); for (Contact contact : p.getContactItems().values()) { originalContactList.add(contact); } } for (Contact contact : originalContactList) { boolean isSearch = contact.getText().toLowerCase().contains(query); if (isSearch) { items.add(contact); } } isFound = !items.isEmpty(); notifyDataSetChanged(); } return isFound; }
public void rebuildFlatItemsWOG(Protocol p, List<TreeNode> list) { ConcurrentHashMap<String, Contact> contacts = p.getContactItems(); for (Contact contact : contacts.values()) { // if (contact.isVisibleInContactList()) { list.add(contact); // } } RosterHelper.sort(list, null); }