本文整理汇总了Java中com.lqr.wechat.model.response.AgreeFriendsResponse类的典型用法代码示例。如果您正苦于以下问题:Java AgreeFriendsResponse类的具体用法?Java AgreeFriendsResponse怎么用?Java AgreeFriendsResponse使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
AgreeFriendsResponse类属于com.lqr.wechat.model.response包,在下文中一共展示了AgreeFriendsResponse类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: agreeFriends
import com.lqr.wechat.model.response.AgreeFriendsResponse; //导入依赖的package包/类
private void agreeFriends(String friendId, LQRViewHolderForRecyclerView helper) {
if (!NetUtils.isNetworkAvailable(mContext)) {
UIUtils.showToast(UIUtils.getString(R.string.please_check_net));
return;
}
ApiRetrofit.getInstance().agreeFriends(friendId)
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.flatMap(new Func1<AgreeFriendsResponse, Observable<GetUserInfoByIdResponse>>() {
@Override
public Observable<GetUserInfoByIdResponse> call(AgreeFriendsResponse agreeFriendsResponse) {
if (agreeFriendsResponse != null && agreeFriendsResponse.getCode() == 200) {
helper.setViewVisibility(R.id.tvAdded, View.VISIBLE)
.setViewVisibility(R.id.btnAck, View.GONE);
return ApiRetrofit.getInstance().getUserInfoById(friendId);
}
return Observable.error(new ServerException(UIUtils.getString(R.string.agree_friend_fail)));
}
})
.subscribe(getUserInfoByIdResponse -> {
if (getUserInfoByIdResponse != null && getUserInfoByIdResponse.getCode() == 200) {
GetUserInfoByIdResponse.ResultEntity result = getUserInfoByIdResponse.getResult();
UserInfo userInfo = new UserInfo(UserCache.getId(), result.getNickname(), Uri.parse(result.getPortraitUri()));
if (TextUtils.isEmpty(userInfo.getPortraitUri().toString())) {
userInfo.setPortraitUri(Uri.parse(DBManager.getInstance().getPortraitUri(userInfo)));
}
Friend friend = new Friend(userInfo.getUserId(), userInfo.getName(), userInfo.getPortraitUri().toString());
DBManager.getInstance().saveOrUpdateFriend(friend);
UIUtils.postTaskDelay(() -> {
BroadcastManager.getInstance(UIUtils.getContext()).sendBroadcast(AppConst.UPDATE_FRIEND);
BroadcastManager.getInstance(UIUtils.getContext()).sendBroadcast(AppConst.UPDATE_CONVERSATIONS);
}, 1000);
}
}, this::loadError);
}
示例2: agreeFriends
import com.lqr.wechat.model.response.AgreeFriendsResponse; //导入依赖的package包/类
public Observable<AgreeFriendsResponse> agreeFriends(String friendId) {
return mApi.agreeFriends(getRequestBody(new AgreeFriendsRequest(friendId)));
}
示例3: agreeFriends
import com.lqr.wechat.model.response.AgreeFriendsResponse; //导入依赖的package包/类
@POST("friendship/agree")
Observable<AgreeFriendsResponse> agreeFriends(@Body RequestBody body);