移除UserInfo.java 里面家族相关字段
This commit is contained in:
@@ -1,24 +1,24 @@
|
||||
package com.yizhuan.erban.module_hall;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
|
||||
import androidx.lifecycle.LifecycleOwner;
|
||||
import androidx.lifecycle.MutableLiveData;
|
||||
import androidx.lifecycle.Observer;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.text.TextUtils;
|
||||
|
||||
import com.netease.nim.uikit.api.NimUIKit;
|
||||
import com.yizhuan.erban.module_hall.im.msgholder.HallMsgViewHolder;
|
||||
import com.yizhuan.xchat_android_core.auth.AuthModel;
|
||||
import com.yizhuan.xchat_android_core.auth.event.LogoutEvent;
|
||||
import com.yizhuan.xchat_android_core.im.custom.AttachManager;
|
||||
import com.yizhuan.xchat_android_core.manager.event.HallInfoChangeEvent;
|
||||
import com.yizhuan.xchat_android_core.module_hall.hall.HallModel;
|
||||
import com.yizhuan.xchat_android_core.module_hall.hall.bean.ClanAndHallInfo;
|
||||
import com.yizhuan.xchat_android_core.module_hall.hall.bean.ClanInfo;
|
||||
import com.yizhuan.xchat_android_core.module_hall.hall.bean.HallInfo;
|
||||
import com.yizhuan.xchat_android_core.module_hall.hall.bean.RoleType;
|
||||
import com.yizhuan.xchat_android_core.module_hall.hall.event.UserHallUpdateEvent;
|
||||
import com.yizhuan.xchat_android_core.module_hall.im.HallAttachment;
|
||||
import com.yizhuan.erban.module_hall.im.msgholder.HallMsgViewHolder;
|
||||
import com.yizhuan.xchat_android_core.auth.event.LogoutEvent;
|
||||
import com.yizhuan.xchat_android_core.im.custom.AttachManager;
|
||||
import com.yizhuan.xchat_android_core.module_hall.hall.HallModel;
|
||||
import com.yizhuan.xchat_android_core.module_hall.hall.bean.HallInfo;
|
||||
import com.yizhuan.xchat_android_core.user.UserModel;
|
||||
import com.yizhuan.xchat_android_core.user.bean.UserInfo;
|
||||
|
||||
@@ -26,37 +26,44 @@ import org.greenrobot.eventbus.EventBus;
|
||||
import org.greenrobot.eventbus.Subscribe;
|
||||
import org.greenrobot.eventbus.ThreadMode;
|
||||
|
||||
import io.reactivex.functions.Consumer;
|
||||
|
||||
import static com.yizhuan.xchat_android_core.im.custom.bean.CustomAttachment.CUSTOM_MSG_MODULE_HALL;
|
||||
|
||||
/**
|
||||
*
|
||||
* Created by lvzebiao on 2019/1/7.
|
||||
*/
|
||||
|
||||
public class HallDataManager {
|
||||
|
||||
private HallInfo hallInfo;
|
||||
/**模厅名字*/
|
||||
/**
|
||||
* 模厅名字
|
||||
*/
|
||||
private MutableLiveData<String> liveHallName;
|
||||
/**公会ID*/
|
||||
/**
|
||||
* 公会ID
|
||||
*/
|
||||
private MutableLiveData<Long> liveHallID;
|
||||
/**厅主ID*/
|
||||
/**
|
||||
* 厅主ID
|
||||
*/
|
||||
private MutableLiveData<Long> liveOwnerUid;
|
||||
/**是否具有模厅*/
|
||||
/**
|
||||
* 是否具有模厅
|
||||
*/
|
||||
private MutableLiveData<Boolean> liveHallExist;
|
||||
/**
|
||||
* 上一次厅ID
|
||||
*/
|
||||
private long lastHallId = -1;
|
||||
|
||||
private int roleType = 0 ;
|
||||
private int roleType = 0;
|
||||
|
||||
private boolean userIsClanElder = false;
|
||||
private boolean isClanElder = false;
|
||||
|
||||
|
||||
/**家族信息*/
|
||||
/**
|
||||
* 家族信息
|
||||
*/
|
||||
private MutableLiveData<ClanInfo> liveClanInfo;
|
||||
|
||||
private static final class Helper {
|
||||
@@ -77,13 +84,17 @@ public class HallDataManager {
|
||||
return Helper.INSTANCE;
|
||||
}
|
||||
|
||||
/**application的初始化*/
|
||||
/**
|
||||
* application的初始化
|
||||
*/
|
||||
public void application() {
|
||||
AttachManager.register(CUSTOM_MSG_MODULE_HALL, HallAttachment.class);
|
||||
HallModel.get();
|
||||
}
|
||||
|
||||
/**云信模块*/
|
||||
/**
|
||||
* 云信模块
|
||||
*/
|
||||
public void mainNimOnCreate() {
|
||||
NimUIKit.registerMsgItemViewHolder(HallAttachment.class, HallMsgViewHolder.class);
|
||||
}
|
||||
@@ -101,22 +112,7 @@ public class HallDataManager {
|
||||
private void initHallInfo() {
|
||||
UserInfo userInfo = UserModel.get().getCacheLoginUserInfo();
|
||||
if (userInfo != null) {
|
||||
roleType = userInfo.getHallRoleType();
|
||||
userIsClanElder = userInfo.isUserIsClanElder();
|
||||
long newHallId = userInfo.getHallId();
|
||||
if (hallInfo == null || lastHallId != newHallId) {
|
||||
hallInfo = new HallInfo();
|
||||
hallInfo.setHallId(newHallId);
|
||||
liveHallExist.setValue(newHallId > 0 || userIsClanElder);
|
||||
if (newHallId > 0) {
|
||||
updateHallInfo();
|
||||
}
|
||||
} else if (TextUtils.isEmpty(liveHallName.getValue())) {
|
||||
if (newHallId > 0) {
|
||||
updateHallInfo();
|
||||
}
|
||||
}
|
||||
lastHallId = newHallId;
|
||||
updateHallInfo();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -150,18 +146,22 @@ public class HallDataManager {
|
||||
|
||||
@SuppressLint("CheckResult")
|
||||
public void updateHallInfo() {
|
||||
if (getHallId() <= 0) {
|
||||
return;
|
||||
}
|
||||
HallModel.get().getHallInfo(AuthModel.get().getCurrentUid(), getHallId())
|
||||
HallModel.get().getUserHallAndClan(AuthModel.get().getCurrentUid())
|
||||
.subscribe(this::updateHallInfo);
|
||||
}
|
||||
|
||||
public void updateHallInfo(HallInfo info) {
|
||||
hallInfo = info;
|
||||
liveHallName.setValue(hallInfo.getHallName());
|
||||
liveHallExist.setValue(hallInfo.getHallId() > 0 || userIsClanElder);
|
||||
liveHallID.setValue(hallInfo.getHallId());
|
||||
public void updateHallInfo(ClanAndHallInfo clanAndHallInfo) {
|
||||
hallInfo = clanAndHallInfo.getHall();
|
||||
if (clanAndHallInfo.getClan() != null) {
|
||||
isClanElder = clanAndHallInfo.getClan().isUserIsElder();
|
||||
}
|
||||
if (hallInfo != null) {
|
||||
lastHallId = hallInfo.getHallId();
|
||||
liveHallName.setValue(hallInfo.getHallName());
|
||||
liveHallExist.setValue(hallInfo.getHallId() > 0 || isClanElder);
|
||||
liveHallID.setValue(hallInfo.getHallId());
|
||||
roleType = hallInfo.getRoleType();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -181,17 +181,22 @@ public class HallDataManager {
|
||||
liveHallName.setValue(newHallName);
|
||||
}
|
||||
|
||||
/**获取自己的角色*/
|
||||
/**
|
||||
* 获取自己的角色
|
||||
*/
|
||||
public int getRoleType() {
|
||||
return roleType;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @return true if owner or admin
|
||||
*/
|
||||
public boolean isManager(){
|
||||
return roleType == RoleType.OWNER || roleType == RoleType.ADMIN;
|
||||
public boolean isManager() {
|
||||
return roleType == RoleType.OWNER || roleType == RoleType.ADMIN;
|
||||
}
|
||||
|
||||
public boolean isClanElder() {
|
||||
return isClanElder;
|
||||
}
|
||||
|
||||
public boolean hasLiveHall() {
|
||||
@@ -206,15 +211,15 @@ public class HallDataManager {
|
||||
return hallInfo == null ? 0 : hallInfo.getOwnerUid();
|
||||
}
|
||||
|
||||
public String getOwnerNick(){
|
||||
return hallInfo == null ?"":hallInfo.getOwnerNick();
|
||||
public String getOwnerNick() {
|
||||
return hallInfo == null ? "" : hallInfo.getOwnerNick();
|
||||
}
|
||||
|
||||
public String getOwnerAvatar(){
|
||||
return hallInfo == null ?"":hallInfo.getOwnerAvatar();
|
||||
public String getOwnerAvatar() {
|
||||
return hallInfo == null ? "" : hallInfo.getOwnerAvatar();
|
||||
}
|
||||
|
||||
public int getMemberCount(){
|
||||
public int getMemberCount() {
|
||||
return hallInfo == null ? 0 : hallInfo.getMemberCount();
|
||||
}
|
||||
}
|
||||
|
@@ -206,15 +206,14 @@ public class ModuleHallActivity extends BaseMvpActivity<IModuleHallView, ModuleH
|
||||
loadHallList();
|
||||
}
|
||||
});
|
||||
//如果用户只是族长而且不是会长,隐藏设置
|
||||
UserModel.get().getCurrentUserInfo()
|
||||
.compose(bindToLifecycle())
|
||||
.subscribe(userInfo -> setSettingOption(userInfo.isUserIsClanElder() &&
|
||||
HallDataManager.get().getRoleType() != RoleType.OWNER));
|
||||
|
||||
HallModel.get().getUserHallAndClan(AuthModel.get().getCurrentUid())
|
||||
.compose(bindToLifecycle())
|
||||
.subscribe(clanAndHallInfo -> {
|
||||
HallDataManager.get().updateHallInfo(clanAndHallInfo);
|
||||
//如果用户只是族长而且不是会长,隐藏设置
|
||||
setSettingOption(HallDataManager.get().isClanElder() &&
|
||||
HallDataManager.get().getRoleType() != RoleType.OWNER);
|
||||
clanInfo = clanAndHallInfo.getClan();
|
||||
String bgUrl = "";
|
||||
HallInfo hallInfo = clanAndHallInfo.getHall();
|
||||
|
@@ -11,9 +11,7 @@ import android.widget.EditText;
|
||||
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
import androidx.swiperefreshlayout.widget.SwipeRefreshLayout;
|
||||
|
||||
import com.coorchice.library.utils.LogUtils;
|
||||
import com.orhanobut.logger.Logger;
|
||||
import com.yizhuan.erban.R;
|
||||
import com.yizhuan.erban.UIHelper;
|
||||
@@ -48,8 +46,6 @@ import butterknife.OnClick;
|
||||
public class RemoveMemberListActivity extends BaseMvpActivity<IRemoveMemberView, RemoveMemberPresenter>
|
||||
implements IRemoveMemberView {
|
||||
|
||||
@BindView(R.id.srl_group)
|
||||
SwipeRefreshLayout srlGroup;
|
||||
@BindView(R.id.recycler_view)
|
||||
RecyclerView recyclerView;
|
||||
@BindView(R.id.et_search)
|
||||
@@ -87,8 +83,6 @@ public class RemoveMemberListActivity extends BaseMvpActivity<IRemoveMemberView,
|
||||
searchStr = s;
|
||||
}
|
||||
});
|
||||
srlGroup.setOnRefreshListener(() -> loadMembers(true));
|
||||
|
||||
mGroupMemberListAdapter = new GroupMemberListAdapter(this, null);
|
||||
mGroupMemberListAdapter.setmType(GroupMemberListAdapter.TYPE_REMOVE);
|
||||
rvDelegate = new RVDelegate.Builder<MemberInfo>()
|
||||
@@ -134,7 +128,6 @@ public class RemoveMemberListActivity extends BaseMvpActivity<IRemoveMemberView,
|
||||
HallModel.get().getAllMembers(HallDataManager.get().getHallId(), page, pageSize)
|
||||
.compose(RxHelper.bindActivity(this))
|
||||
.subscribe((listMemberInfo, throwable) -> {
|
||||
srlGroup.setRefreshing(false);
|
||||
if (throwable != null) {
|
||||
Logger.i("模厅成员加载失败...");
|
||||
rvDelegate.loadErr(refresh);
|
||||
@@ -210,7 +203,6 @@ public class RemoveMemberListActivity extends BaseMvpActivity<IRemoveMemberView,
|
||||
|
||||
|
||||
private void doSearch(CharSequence str) {
|
||||
LogUtils.d(str.toString());
|
||||
ArrayList<MemberInfo> mTempBeansList = new ArrayList<>();
|
||||
// 如果需要排序考虑 Pair
|
||||
for (int i = 0; i < orignalList.size(); i++) {
|
||||
@@ -226,6 +218,7 @@ public class RemoveMemberListActivity extends BaseMvpActivity<IRemoveMemberView,
|
||||
searchList.addAll(orignalList);
|
||||
}
|
||||
mGroupMemberListAdapter.setNewData(searchList);
|
||||
mGroupMemberListAdapter.loadMoreEnd(true);
|
||||
mTempBeansList.clear();
|
||||
}
|
||||
}
|
||||
|
@@ -66,18 +66,11 @@
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<androidx.swiperefreshlayout.widget.SwipeRefreshLayout
|
||||
android:id="@+id/srl_group"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/recycler_view"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent" />
|
||||
|
||||
</androidx.swiperefreshlayout.widget.SwipeRefreshLayout>
|
||||
|
||||
</com.yizhuan.erban.common.widget.StatusLayout>
|
||||
|
||||
</LinearLayout>
|
@@ -125,21 +125,6 @@ public class UserInfo implements Serializable {
|
||||
*/
|
||||
private long hallId;
|
||||
|
||||
/**
|
||||
* 家族
|
||||
*/
|
||||
@Getter
|
||||
@Setter
|
||||
private long clanId;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
private int hallRoleType;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
private boolean userIsClanElder;
|
||||
|
||||
/**
|
||||
* 判断是否已经实名认证了
|
||||
*/
|
||||
|
Reference in New Issue
Block a user