private List<Object> getContactList() { List<Friend> addList = ContactManage.getUnfriendContact(getContentResolver(), getApplicationContext()); System.out.println("add list size - " + addList.size()); List<Object> contactList = new ArrayList<Object>(); int initialIndex = -1; for (Friend friend : addList) { char first = friend.name.charAt(0); if (Initial.isHangul(first)) { int index = Initial.getInitialSound(first); if (index > initialIndex) { contactList.add(Initial.INITIAL_SOUND[index] + ""); initialIndex = index; } } contactList.add(friend); } System.out.println("contactList size - " + contactList.size()); return contactList; }
protected char getQueryCharacter(String queryText) { char queryCharacter = ' '; if (queryText.length() > 0) { char c = queryText.charAt(0); if (Initial.isInitialSound(queryCharacter)) { queryCharacter = c; } } return queryCharacter; }
protected boolean checkFilter(String queryText, char queryCharacter, Friend item) { if (queryCharacter == ' ') { if (item.name.contains(queryText) || item.phone.contains(queryText)) { return true; } } else { char c = item.name.charAt(0); if (queryCharacter == Initial.INITIAL_SOUND[Initial.getInitialSound(c)]) { return true; } } return false; }