本文整理汇总了Java中com.lqr.wechat.model.response.UserRelationshipResponse.ResultEntity方法的典型用法代码示例。如果您正苦于以下问题:Java UserRelationshipResponse.ResultEntity方法的具体用法?Java UserRelationshipResponse.ResultEntity怎么用?Java UserRelationshipResponse.ResultEntity使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.lqr.wechat.model.response.UserRelationshipResponse
的用法示例。
在下文中一共展示了UserRelationshipResponse.ResultEntity方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: 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);
}
示例2: 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);
}