Esempio n. 1
0
 private void showDeleteDialog(int position, final BmobInvitation invite) {
   AlertDialog.Builder builder = new Builder(this);
   builder
       .setTitle("提示")
       .setMessage("是否删除" + invite.getFromname() + "的好友请求")
       .setPositiveButton(
           "确定",
           new OnClickListener() {
             @Override
             public void onClick(DialogInterface dialog, int which) {
               BmobDB.create(NewFriendActivity.this)
                   .deleteInviteMsg(invite.getFromid(), Long.toString(invite.getTime()));
               dialog.dismiss();
             }
           });
   builder
       .setNegativeButton(
           "取消",
           new OnClickListener() {
             @Override
             public void onClick(DialogInterface dialog, int which) {
               dialog.dismiss();
             }
           })
       .show();
 }
  @Override
  public View bindView(int arg0, View convertView, ViewGroup arg2) {
    if (convertView == null) {
      convertView = mInflater.inflate(R.layout.item_add_friend, null);
    }
    final BmobInvitation msg = getList().get(arg0);
    TextView name = ViewHolder.get(convertView, R.id.name);
    ImageView iv_avatar = ViewHolder.get(convertView, R.id.avatar);

    final Button btn_add = ViewHolder.get(convertView, R.id.btn_add);

    String avatar = msg.getAvatar();

    if (avatar != null && !avatar.equals("")) {
      ImageLoader.getInstance().displayImage(avatar, iv_avatar, ImageLoadOptions.getOptions());
    } else {
      iv_avatar.setImageResource(R.drawable.default_head);
    }

    int status = msg.getStatus();
    if (status == BmobConfig.INVITE_ADD_NO_VALIDATION
        || status == BmobConfig.INVITE_ADD_NO_VALI_RECEIVED) {
      // btn_add.setText("同意");
      // btn_add.setBackgroundDrawable(mContext.getResources().getDrawable(R.drawable.btn_login_selector));
      // btn_add.setTextColor(mContext.getResources().getColor(R.color.base_color_text_white));
      btn_add.setOnClickListener(
          new OnClickListener() {

            @Override
            public void onClick(View arg0) {
              // TODO Auto-generated method stub
              BmobLog.i("点击同意按钮:" + msg.getFromid());
              agressAdd(btn_add, msg);
            }
          });
    } else if (status == BmobConfig.INVITE_ADD_AGREE) {
      btn_add.setText("已同意");
      btn_add.setBackgroundDrawable(null);
      btn_add.setTextColor(mContext.getResources().getColor(R.color.base_color_text_black));
      btn_add.setEnabled(false);
    }
    name.setText(msg.getNick());

    return convertView;
  }
Esempio n. 3
0
 public void showDeleteDialog(final int position, final BmobInvitation invite) {
   DialogTips dialog = new DialogTips(this, invite.getFromname(), "删除好友请求", "确定", true, true);
   // 设置成功事件
   dialog.SetOnSuccessListener(
       new DialogInterface.OnClickListener() {
         public void onClick(DialogInterface dialogInterface, int userId) {
           deleteInvite(position, invite);
         }
       });
   // 显示确认对话框
   dialog.show();
   dialog = null;
 }
Esempio n. 4
0
 /**
  * 删除请求 deleteRecent
  *
  * @param @param recent
  * @return void
  * @throws
  */
 private void deleteInvite(int position, BmobInvitation invite) {
   adapter.remove(position);
   BmobDB.create(this).deleteInviteMsg(invite.getFromid(), Long.toString(invite.getTime()));
 }