本文整理汇总了Java中com.lqr.wechat.db.model.Groups类的典型用法代码示例。如果您正苦于以下问题:Java Groups类的具体用法?Java Groups怎么用?Java Groups使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Groups类属于com.lqr.wechat.db.model包,在下文中一共展示了Groups类的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setAdapter
import com.lqr.wechat.db.model.Groups; //导入依赖的package包/类
private void setAdapter() {
if (mAdapter == null) {
mAdapter = new LQRAdapterForRecyclerView<Groups>(mContext, mData, R.layout.item_contact) {
@Override
public void convert(LQRViewHolderForRecyclerView helper, Groups item, int position) {
LQRNineGridImageView ngvi = helper.setViewVisibility(R.id.ngiv, View.VISIBLE)
.setViewVisibility(R.id.ivHeader, View.GONE)
.setText(R.id.tvName, item.getName())
.getView(R.id.ngiv);
ngvi.setAdapter(mNgivAdapter);
List<GroupMember> groupMembers = DBManager.getInstance().getGroupMembers(item.getGroupId());
ngvi.setImagesData(groupMembers);
}
};
mAdapter.setOnItemClickListener((lqrViewHolder, viewGroup, view, i) -> {
Intent intent = new Intent(mContext, SessionActivity.class);
intent.putExtra("sessionId", mData.get(i).getGroupId());
intent.putExtra("sessionType", SessionActivity.SESSION_TYPE_GROUP);
mContext.jumpToActivity(intent);
mContext.finish();
});
getView().getRvGroupList().setAdapter(mAdapter);
} else {
mAdapter.notifyDataSetChangedWrapper();
}
}
示例2: getGroups
import com.lqr.wechat.db.model.Groups; //导入依赖的package包/类
public void getGroups(String groupId) {
if (!mHasFetchedGroups) {
fetchGroups();
} else {
ApiRetrofit.getInstance().getGroupInfo(groupId)
.subscribeOn(Schedulers.io())
.observeOn(Schedulers.io())
.subscribe(getGroupInfoResponse -> {
if (getGroupInfoResponse != null && getGroupInfoResponse.getCode() == 200) {
GetGroupInfoResponse.ResultEntity groupInfo = getGroupInfoResponse.getResult();
if (groupInfo != null) {
String role = groupInfo.getCreatorId().equalsIgnoreCase(UserCache.getId()) ? "0" : "1";
saveOrUpdateGroup(new Groups(groupId, groupInfo.getName(), groupInfo.getPortraitUri(), role));
}
}
}, this::loadError);
}
}
示例3: loadData
import com.lqr.wechat.db.model.Groups; //导入依赖的package包/类
private void loadData() {
List<Groups> groups = DBManager.getInstance().getGroups();
if (groups != null && groups.size() > 0) {
mData.clear();
mData.addAll(groups);
setAdapter();
getView().getLlGroups().setVisibility(View.VISIBLE);
} else {
getView().getLlGroups().setVisibility(View.GONE);
}
}
示例4: loadData
import com.lqr.wechat.db.model.Groups; //导入依赖的package包/类
private void loadData() {
if (mConversationType == Conversation.ConversationType.PRIVATE) {
UserInfo userInfo = DBManager.getInstance().getUserInfo(mSessionId);
if (userInfo != null) {
mData.clear();
GroupMember newMember = new GroupMember(mSessionId,
userInfo.getUserId(),
userInfo.getName(),
userInfo.getPortraitUri().toString(),
userInfo.getName(),
PinyinUtils.getPinyin(userInfo.getName()),
PinyinUtils.getPinyin(userInfo.getName()),
"",
"",
"");
mData.add(newMember);
mData.add(new GroupMember("", "", ""));//+
}
mIsCreateNewGroup = true;
} else {
List<GroupMember> groupMembers = DBManager.getInstance().getGroupMembers(mSessionId);
if (groupMembers != null && groupMembers.size() > 0) {
Groups groupsById = DBManager.getInstance().getGroupsById(mSessionId);
if (groupsById != null && groupsById.getRole().equals("0")) {
mIsManager = true;
}
mData.clear();
mData.addAll(groupMembers);
mData.add(new GroupMember("", "", ""));//+
if (mIsManager) {
mData.add(new GroupMember("", "", ""));//-
}
}
mIsCreateNewGroup = false;
}
setAdapter();
}
示例5: addGroupMember
import com.lqr.wechat.db.model.Groups; //导入依赖的package包/类
public void addGroupMember(ArrayList<String> selectedIds) {
LogUtils.sf("addGroupMember : " + selectedIds);
mContext.showWaitingDialog(UIUtils.getString(R.string.please_wait));
ApiRetrofit.getInstance().addGroupMember(mSessionId, selectedIds)
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(addGroupMemberResponse -> {
if (addGroupMemberResponse != null && addGroupMemberResponse.getCode() == 200) {
LogUtils.sf("网络请求成功,开始添加群成员:");
Groups groups = DBManager.getInstance().getGroupsById(mSessionId);
for (String groupMemberId : selectedIds) {
UserInfo userInfo = DBManager.getInstance().getUserInfo(groupMemberId);
if (userInfo != null) {
GroupMember newMember = new GroupMember(mSessionId,
userInfo.getUserId(),
userInfo.getName(),
userInfo.getPortraitUri().toString(),
userInfo.getName(),
PinyinUtils.getPinyin(userInfo.getName()),
PinyinUtils.getPinyin(userInfo.getName()),
groups.getName(),
PinyinUtils.getPinyin(groups.getName()),
groups.getPortraitUri());
DBManager.getInstance().saveOrUpdateGroupMember(newMember);
LogUtils.sf("添加群成员成功");
}
}
LogUtils.sf("添加群成员结束");
mContext.hideWaitingDialog();
loadData();
LogUtils.sf("重新加载数据");
UIUtils.showToast(UIUtils.getString(R.string.add_member_success));
}
}, this::addMembersError);
}
示例6: setDisplayName
import com.lqr.wechat.db.model.Groups; //导入依赖的package包/类
public void setDisplayName() {
View view = View.inflate(mContext, R.layout.dialog_group_display_name_change, null);
mSetDisplayNameDialog = new CustomDialog(mContext, view, R.style.MyDialog);
EditText etName = (EditText) view.findViewById(R.id.etName);
etName.setText(mDisplayName);
etName.setSelection(mDisplayName.length());
view.findViewById(R.id.tvCancle).setOnClickListener(v -> mSetDisplayNameDialog.dismiss());
view.findViewById(R.id.tvOk).setOnClickListener(v -> {
String displayName = etName.getText().toString().trim();
if (!TextUtils.isEmpty(displayName)) {
ApiRetrofit.getInstance().setGroupDisplayName(mSessionId, displayName)
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(setGroupDisplayNameResponse -> {
if (setGroupDisplayNameResponse != null && setGroupDisplayNameResponse.getCode() == 200) {
Groups groups = DBManager.getInstance().getGroupsById(mSessionId);
if (groups != null) {
groups.setDisplayName(displayName);
groups.saveOrUpdate("groupid=?", groups.getGroupId());
mDisplayName = displayName;
getView().getOivNickNameInGroup().setRightText(mDisplayName);
}
UIUtils.showToast(UIUtils.getString(R.string.change_success));
} else {
UIUtils.showToast(UIUtils.getString(R.string.change_fail));
}
mSetDisplayNameDialog.dismiss();
}, this::setDisplayNameError);
}
});
mSetDisplayNameDialog.show();
}
示例7: setTitle
import com.lqr.wechat.db.model.Groups; //导入依赖的package包/类
private void setTitle() {
if (mConversationType == Conversation.ConversationType.PRIVATE) {
UserInfo userInfo = DBManager.getInstance().getUserInfo(mSessionId);
if (userInfo != null)
setToolbarTitle(userInfo.getName());
} else if (mConversationType == Conversation.ConversationType.GROUP) {
Groups groups = DBManager.getInstance().getGroupsById(mSessionId);
if (groups != null)
setToolbarTitle(groups.getName());
}
}
示例8: deleteAllUserInfo
import com.lqr.wechat.db.model.Groups; //导入依赖的package包/类
/**
* 清除所有用户数据
*/
public void deleteAllUserInfo() {
// deleteFriends();
// deleteGroups();
// deleteGroupMembers();
DataSupport.deleteAll(Friend.class);
DataSupport.deleteAll(GroupMember.class);
DataSupport.deleteAll(Groups.class);
//TODO:删除黑名单数据
}
示例9: saveOrUpdateGroup
import com.lqr.wechat.db.model.Groups; //导入依赖的package包/类
public synchronized void saveOrUpdateGroup(Groups groups) {
if (groups != null) {
String portrait = groups.getPortraitUri();
if (TextUtils.isEmpty(portrait)) {
portrait = RongGenerate.generateDefaultAvatar(groups.getName(), groups.getGroupId());
groups.setPortraitUri(portrait);
}
groups.saveOrUpdate("groupid = ?", groups.getGroupId());
}
}
示例10: getGroupsById
import com.lqr.wechat.db.model.Groups; //导入依赖的package包/类
public synchronized Groups getGroupsById(String groupId) {
if (!TextUtils.isEmpty(groupId)) {
List<Groups> groupses = DataSupport.where("groupid = ?", groupId).find(Groups.class);
if (groupses != null && groupses.size() > 0) {
return groupses.get(0);
}
}
return null;
}
示例11: saveGroups
import com.lqr.wechat.db.model.Groups; //导入依赖的package包/类
public synchronized void saveGroups(List<GetGroupResponse.ResultEntity> list) {
if (list != null && list.size() > 0) {
mGroupsList = new ArrayList<>();
for (GetGroupResponse.ResultEntity groups : list) {
String portrait = groups.getGroup().getPortraitUri();
if (TextUtils.isEmpty(portrait)) {
portrait = RongGenerate.generateDefaultAvatar(groups.getGroup().getName(), groups.getGroup().getId());
}
mGroupsList.add(new Groups(groups.getGroup().getId(), groups.getGroup().getName(), portrait, String.valueOf(groups.getRole())));
}
}
if (mGroupsList.size() > 0)
DataSupport.saveAll(mGroupsList);
}
示例12: updateGroupsName
import com.lqr.wechat.db.model.Groups; //导入依赖的package包/类
public synchronized void updateGroupsName(String groupId, String groupName) {
Groups groups = getGroupsById(groupId);
if (groups != null) {
groups.setName(groupName);
saveOrUpdateGroup(groups);
}
}
示例13: setCreatedToTop
import com.lqr.wechat.db.model.Groups; //导入依赖的package包/类
private synchronized List<GroupMember> setCreatedToTop(List<GetGroupMemberResponse.ResultEntity> groupMember, String groupId) {
List<GroupMember> newList = new ArrayList<>();
GroupMember created = null;
for (GetGroupMemberResponse.ResultEntity group : groupMember) {
String groupName = null;
String groupPortraitUri = null;
Groups groups = getGroupsById(groupId);
if (groups != null) {
groupName = groups.getName();
groupPortraitUri = groups.getPortraitUri();
}
GroupMember newMember = new GroupMember(groupId,
group.getUser().getId(),
group.getUser().getNickname(),
group.getUser().getPortraitUri(),
group.getDisplayName(),
PinyinUtils.getPinyin(group.getUser().getNickname()),
PinyinUtils.getPinyin(group.getDisplayName()),
groupName,
PinyinUtils.getPinyin(groupName),
groupPortraitUri);
if (group.getRole() == 0) {
created = newMember;
} else {
newList.add(newMember);
}
}
if (created != null) {
newList.add(created);
}
Collections.reverse(newList);
return newList;
}
示例14: isInThisGroup
import com.lqr.wechat.db.model.Groups; //导入依赖的package包/类
public boolean isInThisGroup(String groupId) {
Groups groups = getGroupsById(groupId);
return groups != null;
}