예제 #1
0
  @Override
  public void onResume() {
    super.onResume();

    if (mContactsListViewAdapter.getCount() == 0) {
      // 初始化联系人链表
      new LoadDataTask().execute();
    }
  }
예제 #2
0
  private void filterData(String filterData) {
    List<ContactsItemData> filterDataList = new ArrayList<ContactsItemData>();
    if (TextUtils.isEmpty(filterData)) {
      filterDataList = mContactsList;

    } else {
      filterDataList.clear();

      for (ContactsItemData item : mContactsList) {
        String name = item.getContactsUserNickname();

        if (name.indexOf(filterData) != -1
            || mCharacterParser.getSelling(name).startsWith(filterData.toString())) {

          filterDataList.add(item);
        }
      }
    }

    // 根据a-z排序
    Collections.sort(filterDataList, mPinyinComparator);
    mContactsListViewAdapter.updateListView(filterDataList);
  }