コード例 #1
0
  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;
  }
コード例 #2
0
    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;
    }