/** * 点击添加新朋友 * * @param AddUserId * @param textView * @param imageView * @param mode */ public void addNewFriend( String AddUserId, final TextView textView, final ImageView imageView, final ConteactMode mode) { DialogUtil.showProgress((Activity) mContext, ""); CommonRequestUtil.addNewFriend( mContext, AddUserId, mode, null, new OnAddFriendCallback() { @Override public void onError() { DialogUtil.dismissProgress(); } @Override public void onAddSuccess(boolean IsVerified) { DialogUtil.dismissProgress(); if (IsVerified) { mode.setState("等待验证"); textView.setText("验证中"); imageView.setVisibility(View.GONE); } else { mode.setState("朋友"); } notifyDataSetChanged(); } }); }
/** * 验证好友 拒绝 或者通过 * * @param AddUserId */ private void AddValidation( String AddUserId, String State, final ArrayList<ConteactMode> data, final int p) { DialogUtil.showProgress((Activity) mContext, ""); SoapBody soap = WebServiceAccess.AddValidation( (Activity) mContext, ConstantPool.getInstance().USER_ACCOUNT_NO, AddUserId, State); new SoapAsyncTask( (Activity) mContext, new OnUICallback() { @Override public void onSuccess(AbstractRequest request) { DialogUtil.dismissProgress(); // 默认操作失败 所以不用刷新 if (request instanceof Me_PassAndRefuseRequest) { Me_PassAndRefuseRequest req = (Me_PassAndRefuseRequest) request; ArrayList<IsAddOKBean> OKList = req.getmBeanList(); if (OKList != null && OKList.size() > 0) { IsAddOKBean okBean = OKList.get(0); if (Boolean.parseBoolean(okBean.IsAddOK)) { // 成功之后,设置通讯录可以刷新 AndroidUtils.showErrorInCenter( (Activity) mContext, mContext.getString(R.string.me_addfriend_success)); data.remove(p); notifyDataSetChanged(); } else { AndroidUtils.showErrorInCenter((Activity) mContext, okBean.RtMsg); } } else { AndroidUtils.showErrorInCenter( (Activity) mContext, mContext.getString(R.string.me_addfriend_faile)); } } } @Override public void onProgress(int progress, String msg) {} @Override public void onResponseError() {} @Override public void onNetworkError() {} }) .execute(new Me_PassAndRefuseRequest(soap, (Activity) mContext)); }