コード例 #1
0
 @Override
 protected void deleteUserReceive(User user) {
   if (user != null) {
     Toast.makeText(MContext, "删除好友" + user.getName(), Toast.LENGTH_SHORT).show();
     refreshList();
   }
 }
コード例 #2
0
    public View getView(int position, View convertView, ViewGroup parent) {

      User user = friends.get(position);
      ViewHolder viewHolder = null;
      if (convertView == null) {
        convertView = friendInflater.inflate(R.layout.singlechatlistadapter, null);
        viewHolder = new ViewHolder();
        viewHolder.tvFriendName = (TextView) convertView.findViewById(R.id.friendName);
        viewHolder.tvState = (TextView) convertView.findViewById(R.id.friendState);
        viewHolder.tvMessageAcount = (TextView) convertView.findViewById(R.id.messageacount);
        viewHolder.ivUserPhoto = (ImageView) convertView.findViewById(R.id.userPhoto);
        convertView.setTag(viewHolder);
      } else {
        viewHolder = (ViewHolder) convertView.getTag();
      }
      viewHolder.tvFriendName.setText(user.getName());
      viewHolder.tvState.setText(user.getStatus());
      if (user.getPhoto() != null) {
        viewHolder.ivUserPhoto.setImageDrawable(user.getPhoto());
      } else {
        viewHolder.ivUserPhoto.setImageResource(R.drawable.xiaohei);
      }
      int number = IMChatManager.getMessagesAccount(user.getName());
      if (number > 0 && number < 100) {
        viewHolder.tvMessageAcount.setText(String.valueOf(number));
      } else if (number >= 100) {
        viewHolder.tvMessageAcount.setText("99+");
      }
      viewHolder.tvMessageAcount.setTextColor(Color.RED);
      return convertView;
    }