当前位置: 首页>>代码示例>>Java>>正文


Java UserRelationshipResponse类代码示例

本文整理汇总了Java中com.lqr.wechat.model.response.UserRelationshipResponse的典型用法代码示例。如果您正苦于以下问题:Java UserRelationshipResponse类的具体用法?Java UserRelationshipResponse怎么用?Java UserRelationshipResponse使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


UserRelationshipResponse类属于com.lqr.wechat.model.response包,在下文中一共展示了UserRelationshipResponse类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: fetchFriends

import com.lqr.wechat.model.response.UserRelationshipResponse; //导入依赖的package包/类
/**
 * 同步朋友信息
 */
private void fetchFriends() {
    mHasFetchedFriends = false;
    ApiRetrofit.getInstance().getAllUserRelationship()
            .subscribeOn(Schedulers.io())
            .observeOn(Schedulers.io())
            .subscribe(userRelationshipResponse -> {
                if (userRelationshipResponse != null && userRelationshipResponse.getCode() == 200) {
                    List<UserRelationshipResponse.ResultEntity> list = userRelationshipResponse.getResult();
                    if (list != null && list.size() > 0) {
                        deleteFriends();
                        saveFriends(list);
                    }
                    mHasFetchedFriends = true;
                    checkFetchComplete();
                } else {
                    mHasFetchedFriends = true;
                    checkFetchComplete();
                }
            }, this::fetchFriendError);
}
 
开发者ID:starryxp,项目名称:LQRWeChat-master,代码行数:24,代码来源:DBManager.java

示例2: saveFriends

import com.lqr.wechat.model.response.UserRelationshipResponse; //导入依赖的package包/类
public synchronized void saveFriends(List<UserRelationshipResponse.ResultEntity> list) {
    List<Friend> friends = new ArrayList<>();
    for (UserRelationshipResponse.ResultEntity entity : list) {
        if (entity.getStatus() == 20) {//已经是好友
            Friend friend = new Friend(
                    entity.getUser().getId(),
                    entity.getUser().getNickname(),
                    entity.getUser().getPortraitUri(),
                    TextUtils.isEmpty(entity.getDisplayName()) ? entity.getUser().getNickname() : entity.getDisplayName(),
                    null, null, null, null,
                    PinyinUtils.getPinyin(entity.getUser().getNickname()),
                    PinyinUtils.getPinyin(TextUtils.isEmpty(entity.getDisplayName()) ? entity.getUser().getNickname() : entity.getDisplayName())
            );
            if (TextUtils.isEmpty(friend.getPortraitUri())) {
                friend.setPortraitUri(getPortrait(friend));
            }
            friends.add(friend);
        }
    }
    if (friends != null && friends.size() > 0)
        DataSupport.saveAll(friends);
}
 
开发者ID:starryxp,项目名称:LQRWeChat-master,代码行数:23,代码来源:DBManager.java

示例3: loadData

import com.lqr.wechat.model.response.UserRelationshipResponse; //导入依赖的package包/类
private void loadData() {
    ApiRetrofit.getInstance().getAllUserRelationship()
            .subscribeOn(Schedulers.io())
            .observeOn(AndroidSchedulers.mainThread())
            .subscribe(userRelationshipResponse -> {
                if (userRelationshipResponse.getCode() == 200) {
                    List<UserRelationshipResponse.ResultEntity> result = userRelationshipResponse.getResult();

                    if (result != null && result.size() > 0) {
                        for (int i = 0; i < result.size(); i++) {
                            UserRelationshipResponse.ResultEntity re = result.get(i);
                            if (re.getStatus() == 10) {//是我发起的添加好友请求
                                result.remove(re);
                                i--;
                            }
                        }
                    }

                    if (result != null && result.size() > 0) {
                        getView().getLlHasNewFriend().setVisibility(View.VISIBLE);
                        mData.clear();
                        mData.addAll(result);
                        if (mAdapter != null)
                            mAdapter.notifyDataSetChangedWrapper();
                    } else {
                        getView().getLlNoNewFriend().setVisibility(View.VISIBLE);
                    }
                } else {
                    Observable.error(new ServerException(UIUtils.getString(R.string.load_error)));
                }
            }, this::loadError);
}
 
开发者ID:starryxp,项目名称:LQRWeChat-master,代码行数:33,代码来源:NewFriendAtPresenter.java

示例4: setAdapter

import com.lqr.wechat.model.response.UserRelationshipResponse; //导入依赖的package包/类
private void setAdapter() {
    if (mAdapter == null) {
        mAdapter = new LQRAdapterForRecyclerView<UserRelationshipResponse.ResultEntity>(mContext, mData, R.layout.item_new_friends) {
            @Override
            public void convert(LQRViewHolderForRecyclerView helper, UserRelationshipResponse.ResultEntity item, int position) {

                ImageView ivHeader = helper.getView(R.id.ivHeader);
                helper.setText(R.id.tvName, item.getUser().getNickname())
                        .setText(R.id.tvMsg, item.getMessage());

                if (item.getStatus() == 20) {//已经是好友
                    helper.setViewVisibility(R.id.tvAdded, View.VISIBLE)
                            .setViewVisibility(R.id.tvWait, View.GONE)
                            .setViewVisibility(R.id.btnAck, View.GONE);
                } else if (item.getStatus() == 11) {//别人发来的添加好友请求
                    helper.setViewVisibility(R.id.tvAdded, View.GONE)
                            .setViewVisibility(R.id.tvWait, View.GONE)
                            .setViewVisibility(R.id.btnAck, View.VISIBLE);
                } else if (item.getStatus() == 10) {//我发起的添加好友请求
                    helper.setViewVisibility(R.id.tvAdded, View.GONE)
                            .setViewVisibility(R.id.tvWait, View.VISIBLE)
                            .setViewVisibility(R.id.btnAck, View.GONE);
                }

                String portraitUri = item.getUser().getPortraitUri();
                if (TextUtils.isEmpty(portraitUri)) {
                    portraitUri = DBManager.getInstance().getPortraitUri(item.getUser().getNickname(), item.getUser().getId());
                }
                Glide.with(mContext).load(portraitUri).centerCrop().into(ivHeader);
                helper.getView(R.id.btnAck).setOnClickListener(v -> agreeFriends(item.getUser().getId(), helper));

            }
        };
    }
    getView().getRvNewFriend().setAdapter(mAdapter);
}
 
开发者ID:starryxp,项目名称:LQRWeChat-master,代码行数:37,代码来源:NewFriendAtPresenter.java

示例5: getAllUserRelationship

import com.lqr.wechat.model.response.UserRelationshipResponse; //导入依赖的package包/类
public Observable<UserRelationshipResponse> getAllUserRelationship() {
    return mApi.getAllUserRelationship();
}
 
开发者ID:starryxp,项目名称:LQRWeChat-master,代码行数:4,代码来源:ApiRetrofit.java

示例6: getAllUserRelationship

import com.lqr.wechat.model.response.UserRelationshipResponse; //导入依赖的package包/类
@GET("friendship/all")
Observable<UserRelationshipResponse> getAllUserRelationship();
 
开发者ID:starryxp,项目名称:LQRWeChat-master,代码行数:3,代码来源:MyApi.java


注:本文中的com.lqr.wechat.model.response.UserRelationshipResponse类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。