主动发起私聊限制需求
This commit is contained in:
@@ -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(limitLevel, currentLevel,limitRegisterDay,currentRegisterDay);
|
||||
if (moreCustomDrawable > 0 && moreCustomId > 0) // 自定义更多按钮只响应哪个功能
|
||||
inputPanel.setMoreFuntionButtonInInputBar(moreCustomDrawable, moreCustomId);
|
||||
|
||||
@@ -465,17 +465,28 @@ public class MessageFragment extends TFragment implements ModuleProxy, MessageLi
|
||||
|
||||
private int limitLevel;
|
||||
|
||||
|
||||
public void setLimitLevel(int limitLevel) {
|
||||
Log.i("setLimitLevel", "" + limitLevel);
|
||||
this.limitLevel = limitLevel;
|
||||
}
|
||||
|
||||
private int currentLevel;
|
||||
|
||||
public void setCurrentLevel(int currentLevel) {
|
||||
this.currentLevel = currentLevel;
|
||||
}
|
||||
|
||||
private int limitRegisterDay;
|
||||
public void setLimitRegisterDay(int limitRegisterDay) {
|
||||
Log.i("setLimitRegisterDay", "" + limitRegisterDay);
|
||||
this.limitRegisterDay = limitRegisterDay;
|
||||
}
|
||||
|
||||
private int currentRegisterDay;
|
||||
public void setCurrentRegisterDay(int currentRegisterDay) {
|
||||
this.currentRegisterDay = currentRegisterDay;
|
||||
}
|
||||
|
||||
boolean canAudioPartyOpen = true;
|
||||
|
||||
public void setmAudioPartyOpenVisible(boolean visible) {
|
||||
|
@@ -123,6 +123,8 @@ public class InputPanel implements IEmoticonSelectedListener, IAudioRecordCallba
|
||||
|
||||
private int limitLevel;
|
||||
private int currentLevel;
|
||||
private int limitRegisterDay;
|
||||
private int currentRegisterDay;
|
||||
|
||||
public InputPanel(Container container, View view, List<BaseAction> actions, boolean isTextAudioSwitchShow) {
|
||||
this.container = container;
|
||||
@@ -417,9 +419,20 @@ public class InputPanel implements IEmoticonSelectedListener, IAudioRecordCallba
|
||||
private void onTextMessageSendButtonPressed() {
|
||||
String text = messageEditText.getText().toString();
|
||||
if (TextUtils.isEmpty(text.trim())) return;
|
||||
if (limitLevel <= 1 && currentRegisterDay < limitRegisterDay) {
|
||||
SingleToastUtil.showToastShort("注册时间满"+limitRegisterDay+"天才能发起聊天");
|
||||
return;
|
||||
}
|
||||
if (currentLevel < limitLevel && limitRegisterDay < 1){
|
||||
SingleToastUtil.showToastShort("等级满" + limitLevel + "才能发起聊天");
|
||||
return;
|
||||
}
|
||||
if (currentRegisterDay < limitRegisterDay || currentLevel < limitLevel){
|
||||
SingleToastUtil.showToastShort("注册时间满" + limitRegisterDay + "天或等级满" + limitLevel + "才能发起聊天");
|
||||
return;
|
||||
}
|
||||
|
||||
EventBus.getDefault().post(new ActiveEvent());
|
||||
|
||||
IMMessage textMessage = createTextMessage(text);
|
||||
if (AntiSpamUtil.checkLocalAntiSpam(textMessage)) {
|
||||
EventBus.getDefault().post(new AntiSpamEvent());
|
||||
@@ -962,30 +975,30 @@ public class InputPanel implements IEmoticonSelectedListener, IAudioRecordCallba
|
||||
container.proxy.sendMessage(customMessage);
|
||||
}
|
||||
|
||||
public void setLimitLevel(int limitLevel, int currentLevel) {
|
||||
public void setLimitLevel(int limitLevel, int currentLevel,int limitRegisterDay,int currentRegisterDay) {
|
||||
this.limitLevel = limitLevel;
|
||||
this.currentLevel = currentLevel;
|
||||
|
||||
this.limitRegisterDay = limitRegisterDay;
|
||||
this.currentRegisterDay = currentRegisterDay;
|
||||
setEditTextState();
|
||||
}
|
||||
|
||||
private void setEditTextState() {
|
||||
if (currentLevel < limitLevel) {
|
||||
messageEditText.setHint("用户等级不足" + limitLevel + "级, 不可以发言哦");
|
||||
messageEditText.setFocusable(false);
|
||||
messageEditText.setFocusableInTouchMode(false);
|
||||
messageEditText.setEnabled(false);
|
||||
moreFuntionButtonInInputBar.setEnabled(false);
|
||||
sendMessageButtonInInputBar.setEnabled(false);
|
||||
} else {
|
||||
// if (currentLevel < limitLevel) {
|
||||
// messageEditText.setHint("用户等级不足" + limitLevel + "级, 不可以发言哦");
|
||||
// messageEditText.setFocusable(false);
|
||||
// messageEditText.setFocusableInTouchMode(false);
|
||||
// messageEditText.setEnabled(false);
|
||||
// moreFuntionButtonInInputBar.setEnabled(false);
|
||||
// sendMessageButtonInInputBar.setEnabled(false);
|
||||
// } else {
|
||||
messageEditText.setHint("请输入消息");
|
||||
messageEditText.setFocusable(true);
|
||||
messageEditText.setFocusableInTouchMode(true);
|
||||
messageEditText.setEnabled(true);
|
||||
moreFuntionButtonInInputBar.setEnabled(true);
|
||||
sendMessageButtonInInputBar.setEnabled(true);
|
||||
}
|
||||
|
||||
// }
|
||||
}
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user