房间管理员列表和黑名单列表加载全部成员(而不是最多200个)
(cherry picked from commit 45e47939920a81edf53f781329993ce9cdbc8e91)
This commit is contained in:
@@ -5,6 +5,8 @@ import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
import androidx.swiperefreshlayout.widget.SwipeRefreshLayout;
|
||||
|
||||
import android.view.View;
|
||||
import android.widget.TextView;
|
||||
|
||||
@@ -15,6 +17,7 @@ import com.yizhuan.erban.R;
|
||||
import com.yizhuan.erban.avroom.adapter.RoomNormalListAdapter;
|
||||
import com.yizhuan.erban.avroom.presenter.RoomBlackPresenter;
|
||||
import com.yizhuan.erban.avroom.view.IRoomBlackView;
|
||||
import com.yizhuan.erban.ui.utils.RVDelegate;
|
||||
import com.yizhuan.xchat_android_core.auth.AuthModel;
|
||||
import com.yizhuan.xchat_android_core.manager.AvRoomDataManager;
|
||||
import com.yizhuan.erban.base.BaseMvpActivity;
|
||||
@@ -22,6 +25,7 @@ import com.yizhuan.erban.common.widget.dialog.DialogManager;
|
||||
import com.yizhuan.xchat_android_core.room.model.AvRoomModel;
|
||||
import com.yizhuan.xchat_android_core.super_admin.model.SuperAdminModel;
|
||||
import com.yizhuan.xchat_android_core.super_admin.util.SuperAdminUtil;
|
||||
import com.yizhuan.xchat_android_core.user.bean.UserInfo;
|
||||
import com.yizhuan.xchat_android_core.utils.net.DontWarnObserver;
|
||||
import com.yizhuan.xchat_android_library.base.factory.CreatePresenter;
|
||||
import com.yizhuan.xchat_android_library.utils.JavaUtil;
|
||||
@@ -43,7 +47,6 @@ import java.util.Objects;
|
||||
@CreatePresenter(RoomBlackPresenter.class)
|
||||
public class RoomBlackListActivity extends BaseMvpActivity<IRoomBlackView, RoomBlackPresenter>
|
||||
implements RoomNormalListAdapter.OnRoomNormalListOperationClickListener, IRoomBlackView {
|
||||
private TextView count;
|
||||
private RecyclerView recyclerView;
|
||||
private RoomNormalListAdapter normalListAdapter;
|
||||
|
||||
@@ -58,22 +61,18 @@ public class RoomBlackListActivity extends BaseMvpActivity<IRoomBlackView, RoomB
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_room_black_list);
|
||||
initWhiteTitleBar("黑名单");
|
||||
initWhiteTitleBar("黑名单(0)人");
|
||||
initView();
|
||||
|
||||
showLoading();
|
||||
loadData();
|
||||
|
||||
mSuperAdminModel = new SuperAdminModel();
|
||||
loadData();
|
||||
}
|
||||
|
||||
private void loadData() {
|
||||
getMvpPresenter().queryBlackList(500);
|
||||
queryBlackListSuccess(AvRoomDataManager.get().mRoomLimitMemberList);
|
||||
}
|
||||
|
||||
private void initView() {
|
||||
count = (TextView) findViewById(R.id.count);
|
||||
recyclerView = (RecyclerView) findViewById(R.id.recycler_view);
|
||||
recyclerView = findViewById(R.id.recycler_view);
|
||||
normalListAdapter = new RoomNormalListAdapter(this);
|
||||
normalListAdapter.setListOperationClickListener(this);
|
||||
recyclerView.setLayoutManager(new LinearLayoutManager(this));
|
||||
@@ -149,10 +148,10 @@ public class RoomBlackListActivity extends BaseMvpActivity<IRoomBlackView, RoomB
|
||||
if (chatRoomMemberList != null && chatRoomMemberList.size() > 0) {
|
||||
normalListAdapter.setNormalList(chatRoomMemberList);
|
||||
normalListAdapter.notifyDataSetChanged();
|
||||
count.setText("黑名单" + chatRoomMemberList.size() + "人");
|
||||
mTitleBar.setTitle("黑名单(" + chatRoomMemberList.size() + ")人");
|
||||
} else {
|
||||
showNoData("暂没有设置黑名单");
|
||||
count.setText("黑名单0人");
|
||||
mTitleBar.setTitle("黑名单(0)人");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -168,20 +167,20 @@ public class RoomBlackListActivity extends BaseMvpActivity<IRoomBlackView, RoomB
|
||||
if (!ListUtils.isListEmpty(normalList)) {
|
||||
hideStatus();
|
||||
ListIterator<ChatRoomMember> iterator = normalList.listIterator();
|
||||
for (; iterator.hasNext(); ) {
|
||||
while (iterator.hasNext()) {
|
||||
if (Objects.equals(iterator.next().getAccount(), chatRoomMember.getAccount())) {
|
||||
iterator.remove();
|
||||
}
|
||||
}
|
||||
normalListAdapter.notifyDataSetChanged();
|
||||
count.setText("黑名单" + normalList.size() + "人");
|
||||
mTitleBar.setTitle("黑名单(" + normalList.size() + ")人");
|
||||
if (normalList.size() == 0) {
|
||||
showNoData("暂没有设置黑名单");
|
||||
}
|
||||
} else {
|
||||
showNoData("暂没有设置黑名单");
|
||||
count.setText("黑名单0人");
|
||||
mTitleBar.setTitle("黑名单(0)人");
|
||||
}
|
||||
normalListAdapter.notifyDataSetChanged();
|
||||
toast("操作成功");
|
||||
|
||||
}
|
||||
|
@@ -3,10 +3,10 @@ package com.yizhuan.erban.avroom.activity;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.view.View;
|
||||
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
import android.view.View;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.netease.nim.uikit.StatusBarUtil;
|
||||
import com.netease.nimlib.sdk.chatroom.model.ChatRoomMember;
|
||||
@@ -34,7 +34,6 @@ import java.util.Objects;
|
||||
@CreatePresenter(RoomManagerPresenter.class)
|
||||
public class RoomManagerListActivity extends BaseMvpActivity<IRoomManagerView, RoomManagerPresenter>
|
||||
implements RoomNormalListAdapter.OnRoomNormalListOperationClickListener, IRoomManagerView {
|
||||
private TextView count;
|
||||
private RecyclerView recyclerView;
|
||||
private RoomNormalListAdapter normalListAdapter;
|
||||
|
||||
@@ -47,7 +46,7 @@ public class RoomManagerListActivity extends BaseMvpActivity<IRoomManagerView, R
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_room_manager_list);
|
||||
initWhiteTitleBar("管理员");
|
||||
initWhiteTitleBar("管理员(0)人");
|
||||
initView();
|
||||
showLoading();
|
||||
loadData();
|
||||
@@ -58,8 +57,7 @@ public class RoomManagerListActivity extends BaseMvpActivity<IRoomManagerView, R
|
||||
}
|
||||
|
||||
private void initView() {
|
||||
count = (TextView) findViewById(R.id.count);
|
||||
recyclerView = (RecyclerView) findViewById(R.id.recycler_view);
|
||||
recyclerView = findViewById(R.id.recycler_view);
|
||||
normalListAdapter = new RoomNormalListAdapter(this);
|
||||
normalListAdapter.setListOperationClickListener(this);
|
||||
recyclerView.setLayoutManager(new LinearLayoutManager(this));
|
||||
@@ -103,10 +101,10 @@ public class RoomManagerListActivity extends BaseMvpActivity<IRoomManagerView, R
|
||||
if (chatRoomMemberList != null && chatRoomMemberList.size() > 0) {
|
||||
normalListAdapter.setNormalList(chatRoomMemberList);
|
||||
normalListAdapter.notifyDataSetChanged();
|
||||
count.setText("管理员" + chatRoomMemberList.size() + "人");
|
||||
mTitleBar.setTitle("管理员(" + chatRoomMemberList.size() + ")人");
|
||||
} else {
|
||||
showNoData("暂没有设置管理员");
|
||||
count.setText("管理员0人");
|
||||
mTitleBar.setTitle("管理员(0)人");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -122,27 +120,26 @@ public class RoomManagerListActivity extends BaseMvpActivity<IRoomManagerView, R
|
||||
if (!ListUtils.isListEmpty(list)) {
|
||||
hideStatus();
|
||||
ListIterator<ChatRoomMember> iterator = list.listIterator();
|
||||
for (; iterator.hasNext(); ) {
|
||||
while (iterator.hasNext()) {
|
||||
if (Objects.equals(iterator.next().getAccount(), chatRoomMember.getAccount())) {
|
||||
iterator.remove();
|
||||
}
|
||||
}
|
||||
normalListAdapter.notifyDataSetChanged();
|
||||
count.setText("管理员" + list.size() + "人");
|
||||
mTitleBar.setTitle("管理员(" + list.size() + ")人");
|
||||
if (list.size() == 0) {
|
||||
showNoData("暂没有设置管理员");
|
||||
}
|
||||
} else {
|
||||
showNoData("暂没有设置管理员");
|
||||
count.setText("管理员0人");
|
||||
mTitleBar.setTitle("管理员(0)人");
|
||||
}
|
||||
normalListAdapter.notifyDataSetChanged();
|
||||
toast("操作成功");
|
||||
// loadData();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void markManagerListFail(int code, String error) {
|
||||
// toast("操作失败,请重试");
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@@ -3,6 +3,7 @@ package com.yizhuan.erban.avroom.presenter;
|
||||
import com.netease.nimlib.sdk.chatroom.model.ChatRoomMember;
|
||||
import com.yizhuan.erban.avroom.view.IRoomBlackView;
|
||||
import com.yizhuan.erban.base.BaseMvpPresenter;
|
||||
import com.yizhuan.xchat_android_core.manager.AvRoomDataManager;
|
||||
import com.yizhuan.xchat_android_core.room.model.RoomBaseModel;
|
||||
import com.yizhuan.xchat_android_library.net.rxnet.callback.CallBack;
|
||||
|
||||
@@ -24,24 +25,6 @@ public class RoomBlackPresenter extends BaseMvpPresenter<IRoomBlackView> {
|
||||
mRoomBaseModel = new RoomBaseModel();
|
||||
}
|
||||
|
||||
public void queryBlackList(int limit) {
|
||||
mRoomBaseModel.queryBlackList(limit)
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(new Consumer<List<ChatRoomMember>>() {
|
||||
@Override
|
||||
public void accept(List<ChatRoomMember> chatRoomMemberList) throws Exception {
|
||||
if (getMvpView() != null)
|
||||
getMvpView().queryBlackListSuccess(chatRoomMemberList);
|
||||
}
|
||||
}, new Consumer<Throwable>() {
|
||||
@Override
|
||||
public void accept(Throwable throwable) throws Exception {
|
||||
if (getMvpView() != null)
|
||||
getMvpView().queryBlackListFail();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 拉黑操作
|
||||
*
|
||||
|
@@ -45,7 +45,7 @@ public class RoomManagerPresenter extends BaseMvpPresenter<IRoomManagerView> {
|
||||
|
||||
@SuppressLint("CheckResult")
|
||||
public void queryManagerList(int limit) {
|
||||
mRoomBaseModel.queryManagerList(limit)
|
||||
Single.just(AvRoomDataManager.get().mRoomManagerList)
|
||||
.observeOn(Schedulers.io())
|
||||
.flatMap((Function<List<ChatRoomMember>, SingleSource<List<ChatRoomMember>>>) chatRoomMembers -> {
|
||||
List<String> uids = new ArrayList<>();
|
||||
|
@@ -11,19 +11,6 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="@dimen/dp_25" />
|
||||
|
||||
|
||||
<TextView
|
||||
android:id="@+id/count"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="44dp"
|
||||
android:layout_centerVertical="true"
|
||||
android:background="@color/bg_secondary_2a2a39"
|
||||
android:gravity="center_vertical"
|
||||
android:paddingLeft="15dp"
|
||||
android:textColor="@color/text_secondary_4f516a"
|
||||
android:textSize="14dp"
|
||||
android:visibility="gone" />
|
||||
|
||||
<com.yizhuan.erban.common.widget.StatusLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
@@ -11,19 +11,6 @@
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" />
|
||||
|
||||
|
||||
<TextView
|
||||
android:id="@+id/count"
|
||||
android:visibility="gone"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="44dp"
|
||||
android:layout_centerVertical="true"
|
||||
android:gravity="center_vertical"
|
||||
android:background="@color/bg_secondary_2a2a39"
|
||||
android:paddingLeft="15dp"
|
||||
android:textColor="@color/text_secondary_4f516a"
|
||||
android:textSize="14dp" />
|
||||
|
||||
<com.yizhuan.erban.common.widget.StatusLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
@@ -1,5 +1,6 @@
|
||||
package com.yizhuan.xchat_android_core.manager;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.os.Handler;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
@@ -718,6 +719,10 @@ public final class IMNetEaseManager {
|
||||
} else if (attachment.getType() == NotificationType.ChatRoomMemberBlackAdd) {
|
||||
List<String> targets = ((ChatRoomNotificationAttachment) attachment).getTargets();
|
||||
noticeChatMemberBlackAdd(targets.get(0));
|
||||
addBlankMember(targets.get(0));
|
||||
} else if (attachment.getType() == NotificationType.ChatRoomMemberBlackRemove) {
|
||||
List<String> targets = ((ChatRoomNotificationAttachment) attachment).getTargets();
|
||||
AvRoomDataManager.get().removeBlackMember(targets.get(0));
|
||||
} else if (attachment.getType() == NotificationType.ChatRoomMyRoomRoleUpdated) {
|
||||
// 房间内的某人的贵族信息更新了
|
||||
Map<String, Object> extension = null;
|
||||
@@ -2118,6 +2123,23 @@ public final class IMNetEaseManager {
|
||||
AvRoomDataManager.get().removeManagerMember(account);
|
||||
}
|
||||
|
||||
/**
|
||||
* 增加黑名单
|
||||
*
|
||||
* @param account -
|
||||
*/
|
||||
@SuppressLint("CheckResult")
|
||||
private void addBlankMember(final String account) {
|
||||
List<String> accounts = new ArrayList<>(1);
|
||||
accounts.add(account);
|
||||
fetchRoomMembersByIds(accounts).subscribe((chatRoomMembers, throwable) -> {
|
||||
if (!ListUtils.isListEmpty(chatRoomMembers)) {
|
||||
ChatRoomMember chatRoomMember = chatRoomMembers.get(0);
|
||||
AvRoomDataManager.get().addBlackMember(chatRoomMember);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 加入黑名单
|
||||
*
|
||||
|
@@ -474,6 +474,32 @@ public final class AvRoomDataManager {
|
||||
}
|
||||
}
|
||||
|
||||
public void addBlackMember(ChatRoomMember chatRoomMember) {
|
||||
if (chatRoomMember == null || containsAdminMember(chatRoomMember.getAccount())) return;
|
||||
mRoomLimitMemberList.add(chatRoomMember);
|
||||
}
|
||||
|
||||
public boolean containsBlackMember(String uid) {
|
||||
for (ChatRoomMember chatRoomMember : mRoomLimitMemberList) {
|
||||
if (Objects.equals(chatRoomMember.getAccount(), String.valueOf(uid))) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public void removeBlackMember(String account) {
|
||||
if (ListUtils.isListEmpty(mRoomLimitMemberList) || TextUtils.isEmpty(account)) return;
|
||||
ListIterator<ChatRoomMember> iterator = mRoomLimitMemberList.listIterator();
|
||||
while (iterator.hasNext()) {
|
||||
ChatRoomMember chatRoomMember = iterator.next();
|
||||
if (Objects.equals(chatRoomMember.getAccount(), account)) {
|
||||
iterator.remove();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isGuess() {
|
||||
return !isRoomAdmin() && !isRoomOwner();
|
||||
}
|
||||
|
@@ -435,6 +435,9 @@ public class AvRoomModel extends RoomBaseModel implements IAvRoomModel {
|
||||
if (chatRoomMember.getMemberType() == MemberType.CREATOR) {
|
||||
AvRoomDataManager.get().mRoomCreateMember = chatRoomMember;
|
||||
}
|
||||
if (chatRoomMember.isInBlackList()) {
|
||||
AvRoomDataManager.get().addBlackMember(chatRoomMember);
|
||||
}
|
||||
}
|
||||
AvRoomDataManager.get().mRoomFixedMemberList.addAll(chatRoomMemberList);
|
||||
AvRoomDataManager.get().mRoomAllMemberList.addAll(chatRoomMemberList);
|
||||
|
Reference in New Issue
Block a user