@Override
    protected Boolean doInBackground(Void... params) {

      Map<String, UserEntity> userEntityMap = contactsUserDao.getContactsList();

      if (userEntityMap != null) {

        // 遍历查询的好友链表
        Iterator iterator = userEntityMap.entrySet().iterator();

        while (iterator.hasNext()) {

          Map.Entry entry = (Map.Entry) iterator.next();
          UserEntity entity = (UserEntity) entry.getValue();

          // 为联系人数据源添加数据
          addData(entity);

          Log.i(TAG, "nickname = " + entity.getUserNickName());
        }

        Collections.sort(mContactsList, mPinyinComparator);

        return true;
      } else {
        return false;
      }
    }
  /**
   * 为list添加数据
   *
   * @param userEntity
   * @return
   */
  private void addData(UserEntity userEntity) {

    ContactsItemData data = new ContactsItemData();

    // 添加用户名
    data.setContactsUserName(userEntity.getUsername());

    // 添加昵称
    data.setContactsUserNickname(userEntity.getUserNickName());

    // 添加头像的网络地址
    data.setContactsUserHeadImageURL(userEntity.getUserHeadImageUrl());

    // 汉字转拼音
    String pinyin = mCharacterParser.getSelling(userEntity.getUserNickName());
    String sortString = pinyin.substring(0, 1).toUpperCase();

    // 正则表达式,判断首字母是否为英文字母
    if (sortString.matches("[A-Z]")) {
      data.setSortLetters(sortString);
    } else {
      data.setSortLetters("#");
    }

    mContactsList.add(data);
  }