1.房间公屏消息长度增长 2.发起私聊限制 3.移除公会成员刷新列表
This commit is contained in:
@@ -84,7 +84,7 @@ public class CustomImageSpan extends ImageSpan {
|
||||
Paint paint = new Paint();
|
||||
paint.setTextSize(ratio * 22);
|
||||
float textWidth = paint.measureText(content);
|
||||
this.width = (int) (textWidth + (50 + 4) * ratio + 16 * ratio);
|
||||
this.width = (int) (textWidth + (50 + 4) * ratio + 16 * ratio +10);
|
||||
|
||||
this.drawable = defaultDrawable;
|
||||
getDrawable().setBounds(0, 0, width, height);
|
||||
|
@@ -62,6 +62,7 @@ import com.netease.nimlib.sdk.robot.model.RobotAttachment;
|
||||
import com.netease.nimlib.sdk.robot.model.RobotMsgType;
|
||||
import com.netease.nimlib.sdk.team.constant.TeamMemberType;
|
||||
import com.netease.nimlib.sdk.team.model.TeamMember;
|
||||
import com.yizhuan.erban.event.MessageSizeEvent;
|
||||
import com.yizhuan.xchat_android_core.auth.AuthModel;
|
||||
import com.yizhuan.xchat_android_core.im.custom.bean.CustomAttachment;
|
||||
import com.yizhuan.xchat_android_core.im.custom.bean.ImGameAttachment;
|
||||
@@ -70,6 +71,8 @@ import com.yizhuan.xchat_android_core.im.game.ImGameInfo;
|
||||
import com.yizhuan.xchat_android_core.im.game.ImGameMode;
|
||||
import com.yizhuan.xchat_android_library.utils.SingleToastUtil;
|
||||
|
||||
import org.greenrobot.eventbus.EventBus;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.util.ArrayList;
|
||||
@@ -668,10 +671,16 @@ public class MessageListPanelEx {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 私聊聊天信息数(发起私聊限制需要用到)
|
||||
* @param messages
|
||||
*/
|
||||
private void onMessageLoaded(List<IMMessage> messages) {
|
||||
if (messages == null) {
|
||||
return;
|
||||
}
|
||||
EventBus.getDefault().post(new MessageSizeEvent(messages.size()));
|
||||
//服务器加载的时间不对的游戏直接失效
|
||||
for (IMMessage message : messages) {
|
||||
if (message.getAttachment() instanceof ImGameAttachment) {
|
||||
|
@@ -0,0 +1,11 @@
|
||||
package com.yizhuan.erban.ui.im.bean;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class PrivateChatLimitInfo implements Serializable {
|
||||
private boolean chat;
|
||||
private String message;
|
||||
}
|
@@ -61,6 +61,7 @@ import com.yizhuan.erban.ui.im.GreetPresenter;
|
||||
import com.yizhuan.erban.ui.im.MessageListPanelEx;
|
||||
import com.yizhuan.erban.ui.im.avtivity.NimP2PMessageActivity;
|
||||
import com.yizhuan.erban.ui.im.chat.MVHChatterBoxStart;
|
||||
import com.yizhuan.erban.ui.im.model.IMCustomModel;
|
||||
import com.yizhuan.erban.utils.PushMessageHandler;
|
||||
import com.yizhuan.xchat_android_core.auth.AuthModel;
|
||||
import com.yizhuan.xchat_android_core.im.chatterbox.ChatterBoxHelper;
|
||||
@@ -137,8 +138,11 @@ public class MessageFragment extends TFragment implements ModuleProxy, MessageLi
|
||||
|
||||
private RxPermissions rxPermissions;
|
||||
|
||||
private int limitLevel;
|
||||
private int currentLevel;
|
||||
// private int limitLevel;
|
||||
// private int currentLevel;
|
||||
|
||||
private boolean isChat;
|
||||
private String hintText;
|
||||
|
||||
@Override
|
||||
public void onActivityCreated(Bundle savedInstanceState) {
|
||||
@@ -343,7 +347,7 @@ public class MessageFragment extends TFragment implements ModuleProxy, MessageLi
|
||||
if (inputPanel == null) {
|
||||
inputPanel = new InputPanel(container, rootView, getActionList());
|
||||
inputPanel.setCustomization(customization);
|
||||
inputPanel.setLimitLevel(limitLevel, currentLevel);
|
||||
inputPanel.setLimitLevel(isChat,hintText);
|
||||
} else {
|
||||
inputPanel.reload(container, customization);
|
||||
}
|
||||
@@ -761,12 +765,24 @@ public class MessageFragment extends TFragment implements ModuleProxy, MessageLi
|
||||
}
|
||||
}
|
||||
|
||||
// @Subscribe(threadMode = ThreadMode.MAIN)
|
||||
// public void onReloadInputPanel(MessageSizeEvent event) {
|
||||
// if (inputPanel != null) {
|
||||
// inputPanel.setLimitLevel(limitLevel, currentLevel);
|
||||
// }
|
||||
// }
|
||||
@Subscribe(threadMode = ThreadMode.MAIN)
|
||||
public void onReloadInputPanel(MessageSizeEvent event) {
|
||||
if (inputPanel != null) {
|
||||
if (event.getSize() > 0){
|
||||
inputPanel.setLimitLevel(true,"");
|
||||
}else {
|
||||
IMCustomModel.get().getPrivateChatLimit().subscribe(((privateChatLimitInfo, throwable) -> {
|
||||
if (throwable != null) {
|
||||
throwable.printStackTrace();
|
||||
} else {
|
||||
isChat = privateChatLimitInfo.isChat();
|
||||
hintText = privateChatLimitInfo.getMessage();
|
||||
inputPanel.setLimitLevel(privateChatLimitInfo.isChat(), privateChatLimitInfo.getMessage());
|
||||
}
|
||||
}));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressLint("CheckResult")
|
||||
public Observable<Boolean> checkPermission(String... mPerms) {
|
||||
@@ -800,12 +816,10 @@ public class MessageFragment extends TFragment implements ModuleProxy, MessageLi
|
||||
}
|
||||
|
||||
public void setLimitLevel(int limitLevel) {
|
||||
this.limitLevel = limitLevel;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
//
|
||||
public void setCurrentLevel(int currentLevel) {
|
||||
this.currentLevel = currentLevel;
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -0,0 +1,48 @@
|
||||
package com.yizhuan.erban.ui.im.model;
|
||||
|
||||
import com.yizhuan.erban.ui.im.bean.PrivateChatLimitInfo;
|
||||
import com.yizhuan.xchat_android_core.bean.response.ServiceResult;
|
||||
import com.yizhuan.xchat_android_core.bean.response.result.UserListResult;
|
||||
import com.yizhuan.xchat_android_core.im.friend.IMFriendModel;
|
||||
import com.yizhuan.xchat_android_core.manager.BaseMvpModel;
|
||||
import com.yizhuan.xchat_android_core.room.game.GameInfo;
|
||||
import com.yizhuan.xchat_android_core.user.UserModel;
|
||||
import com.yizhuan.xchat_android_core.utils.net.RxHelper;
|
||||
import com.yizhuan.xchat_android_library.net.rxnet.RxNet;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import io.reactivex.Single;
|
||||
import retrofit2.http.GET;
|
||||
import retrofit2.http.Query;
|
||||
|
||||
public class IMCustomModel extends BaseMvpModel {
|
||||
|
||||
private static IMCustomModel model;
|
||||
private IMCustomModel.Api api = RxNet.create(IMCustomModel.Api.class);
|
||||
public static IMCustomModel get() {
|
||||
if (model == null) {
|
||||
synchronized (IMCustomModel.class) {
|
||||
if (model == null) {
|
||||
model = new IMCustomModel();
|
||||
}
|
||||
}
|
||||
}
|
||||
return model;
|
||||
}
|
||||
|
||||
public Single<PrivateChatLimitInfo> getPrivateChatLimit() {
|
||||
return api.getPrivateChatLimit()
|
||||
.compose(RxHelper.handleBeanData())
|
||||
.compose(RxHelper.handleSchedulers());
|
||||
}
|
||||
|
||||
private interface Api {
|
||||
/**
|
||||
* 获取是否可以发送私聊
|
||||
* @return
|
||||
*/
|
||||
@GET("/privateChat/limit")
|
||||
Single<ServiceResult<PrivateChatLimitInfo>> getPrivateChatLimit();
|
||||
}
|
||||
}
|
@@ -309,7 +309,6 @@ public class UserInfoActivity extends BaseBindingActivity<ActivityUserInfoBindin
|
||||
mBinding.llModuleHall.setVisibility(View.GONE);
|
||||
if (userInfo.getHallId() > 0){
|
||||
if (AuthModel.get().getCurrentUid() != userId){
|
||||
mBinding.tvHallDetail.setCompoundDrawables(null,null,null,null);
|
||||
mBinding.tvApplyHall.setVisibility(View.VISIBLE);
|
||||
}
|
||||
HallModel.get().getHallInfo(userInfo.getUid(), userInfo.getHallId())
|
||||
@@ -636,11 +635,6 @@ public class UserInfoActivity extends BaseBindingActivity<ActivityUserInfoBindin
|
||||
}
|
||||
break;
|
||||
|
||||
case R.id.ll_module_hall:
|
||||
if (AuthModel.get().getCurrentUid() != userId) return;
|
||||
ModuleHallActivity.start(this);
|
||||
break;
|
||||
|
||||
// /**************** 测试代码 **************/
|
||||
// AVRoomActivity.start(this, 91, mRoomInfo!!.type)
|
||||
}
|
||||
|
@@ -231,7 +231,6 @@
|
||||
android:paddingStart="@dimen/dp_15"
|
||||
android:textSize="@dimen/sp_13"
|
||||
android:textColor="@color/color_333333"
|
||||
android:drawableEnd="@drawable/arrow_right_2"
|
||||
/>
|
||||
|
||||
<LinearLayout
|
||||
|
@@ -19,6 +19,7 @@ import com.yizhuan.erban.base.TitleBar;
|
||||
import com.yizhuan.erban.common.widget.dialog.DialogManager;
|
||||
import com.yizhuan.erban.module_hall.HallDataManager;
|
||||
import com.yizhuan.erban.module_hall.hall.adapter.GroupMemberListAdapter;
|
||||
import com.yizhuan.erban.module_hall.hall.event.RemoveMemberEvent;
|
||||
import com.yizhuan.erban.module_hall.hall.presenter.GroupMemberPresenter;
|
||||
import com.yizhuan.erban.module_hall.hall.view.IGroupMemberView;
|
||||
import com.yizhuan.erban.module_hall.hall.view.dialog.HallMenuDialog;
|
||||
@@ -46,8 +47,6 @@ import butterknife.ButterKnife;
|
||||
public class GroupMemberListActivity extends BaseMvpActivity<IGroupMemberView, GroupMemberPresenter>
|
||||
implements IGroupMemberView{
|
||||
|
||||
|
||||
|
||||
@BindView(R.id.tv_count)
|
||||
TextView tvCount;
|
||||
@BindView(R.id.srl_group)
|
||||
@@ -189,6 +188,8 @@ public class GroupMemberListActivity extends BaseMvpActivity<IGroupMemberView, G
|
||||
}
|
||||
page ++;
|
||||
}
|
||||
mGroupMemberListAdapter.setmType(GroupMemberListAdapter.TYPE_REMOVE);
|
||||
mGroupMemberListAdapter.notifyDataSetChanged();
|
||||
}
|
||||
});
|
||||
|
||||
@@ -202,12 +203,12 @@ public class GroupMemberListActivity extends BaseMvpActivity<IGroupMemberView, G
|
||||
}
|
||||
});
|
||||
|
||||
mTitleBar.addAction(new TitleBar.ImageAction(R.drawable.ic_hall_member_more) {
|
||||
@Override
|
||||
public void performAction(View view) {
|
||||
moreOption(view, mAuthInfoList);
|
||||
}
|
||||
});
|
||||
// mTitleBar.addAction(new TitleBar.ImageAction(R.drawable.ic_hall_member_more) {
|
||||
// @Override
|
||||
// public void performAction(View view) {
|
||||
// moreOption(view, mAuthInfoList);
|
||||
// }
|
||||
// });
|
||||
|
||||
}
|
||||
|
||||
@@ -370,7 +371,7 @@ public class GroupMemberListActivity extends BaseMvpActivity<IGroupMemberView, G
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
EventBus.getDefault().post(new RemoveMemberEvent());
|
||||
statusNone();
|
||||
mTargetUid = -1;
|
||||
}
|
||||
|
@@ -29,6 +29,7 @@ import com.yizhuan.erban.friend.action.AbstractSelectFriendAction;
|
||||
import com.yizhuan.erban.module_hall.HallDataManager;
|
||||
|
||||
import com.yizhuan.erban.module_hall.hall.adapter.GroupMemberListAdapter;
|
||||
import com.yizhuan.erban.module_hall.hall.event.RemoveMemberEvent;
|
||||
import com.yizhuan.erban.module_hall.secretcode.PwdCodeMgr;
|
||||
import com.yizhuan.erban.module_hall.team.activity.CreateHallTeamActivity;
|
||||
|
||||
@@ -49,6 +50,7 @@ import com.yizhuan.erban.ui.widget.recyclerview.decoration.SpacingDecoration;
|
||||
|
||||
import com.yizhuan.xchat_android_constants.XChatConstants;
|
||||
import com.yizhuan.xchat_android_core.auth.AuthModel;
|
||||
import com.yizhuan.xchat_android_core.linked.event.LinkMeInfoUpdateEvent;
|
||||
import com.yizhuan.xchat_android_core.module_hall.hall.HallModel;
|
||||
import com.yizhuan.xchat_android_core.module_hall.hall.bean.AuthInfo;
|
||||
|
||||
@@ -603,4 +605,9 @@ public class ModuleHallActivity extends BaseMvpActivity<IModuleHallView, ModuleH
|
||||
});
|
||||
}
|
||||
|
||||
@Subscribe(threadMode = ThreadMode.MAIN)
|
||||
public void onRemoveMemberSuccess(RemoveMemberEvent event) {
|
||||
loadMembers();
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -0,0 +1,4 @@
|
||||
package com.yizhuan.erban.module_hall.hall.event;
|
||||
|
||||
public class RemoveMemberEvent {
|
||||
}
|
@@ -161,7 +161,7 @@ public class MessageFragment extends TFragment implements ModuleProxy, MessageLi
|
||||
boolean isTextAudioSwitchShow = getArguments().getBoolean("isTextAudioSwitchShow", true);
|
||||
inputPanel = new InputPanel(container, rootView, getActionList(), isTextAudioSwitchShow);
|
||||
inputPanel.setCustomization(customization);
|
||||
inputPanel.setLimitLevel(limitLevel, currentLevel);
|
||||
inputPanel.setLimitLevel(true, "");
|
||||
if (moreCustomDrawable > 0 && moreCustomId > 0) // 自定义更多按钮只响应哪个功能
|
||||
inputPanel.setMoreFuntionButtonInInputBar(moreCustomDrawable, moreCustomId);
|
||||
|
||||
|
@@ -121,8 +121,9 @@ public class InputPanel implements IEmoticonSelectedListener, IAudioRecordCallba
|
||||
|
||||
private volatile boolean disable;
|
||||
|
||||
private int limitLevel;
|
||||
private int currentLevel;
|
||||
|
||||
private String hintText;
|
||||
private boolean isChat;
|
||||
|
||||
public InputPanel(Container container, View view, List<BaseAction> actions, boolean isTextAudioSwitchShow) {
|
||||
this.container = container;
|
||||
@@ -434,7 +435,7 @@ public class InputPanel implements IEmoticonSelectedListener, IAudioRecordCallba
|
||||
|
||||
// 切换成音频,收起键盘,按钮切换成键盘
|
||||
private void switchToAudioLayout() {
|
||||
if (currentLevel < limitLevel) {
|
||||
if (!isChat) {
|
||||
SingleToastUtil.showToast("等级不够");
|
||||
return;
|
||||
}
|
||||
@@ -461,7 +462,7 @@ public class InputPanel implements IEmoticonSelectedListener, IAudioRecordCallba
|
||||
for (BaseAction action : actions) {
|
||||
|
||||
if (action.getTitleId() == moreCustomId) {
|
||||
if (currentLevel < limitLevel) {
|
||||
if (!isChat) {
|
||||
SingleToastUtil.showToast("等级不够");
|
||||
} else {
|
||||
action.onClick();
|
||||
@@ -483,7 +484,7 @@ public class InputPanel implements IEmoticonSelectedListener, IAudioRecordCallba
|
||||
|
||||
// 点击表情,切换到表情布局
|
||||
private void toggleEmojiLayout() {
|
||||
if (currentLevel < limitLevel) {
|
||||
if (!isChat) {
|
||||
SingleToastUtil.showToast("等级不够");
|
||||
} else {
|
||||
if (emoticonPickerView == null || emoticonPickerView.getVisibility() == View.GONE) {
|
||||
@@ -960,15 +961,15 @@ public class InputPanel implements IEmoticonSelectedListener, IAudioRecordCallba
|
||||
container.proxy.sendMessage(customMessage);
|
||||
}
|
||||
|
||||
public void setLimitLevel(int limitLevel, int currentLevel) {
|
||||
this.limitLevel = limitLevel;
|
||||
this.currentLevel = currentLevel;
|
||||
public void setLimitLevel(boolean isChat,String msg) {
|
||||
this.isChat = isChat;
|
||||
this.hintText = msg;
|
||||
setEditTextState();
|
||||
}
|
||||
|
||||
private void setEditTextState() {
|
||||
if (currentLevel < limitLevel) {
|
||||
messageEditText.setHint("用户等级不足" + limitLevel + "级, 不可以发言哦");
|
||||
if (!isChat) {
|
||||
messageEditText.setHint(hintText);
|
||||
messageEditText.setFocusable(false);
|
||||
messageEditText.setFocusableInTouchMode(false);
|
||||
messageEditText.setEnabled(false);
|
||||
|
Reference in New Issue
Block a user