diff --git a/common/build.gradle b/common/build.gradle
index 0b8ba7106..57d020310 100644
--- a/common/build.gradle
+++ b/common/build.gradle
@@ -191,4 +191,8 @@ dependencies {
api 'com.github.li-xiaojun:XPopup:2.9.1'
api 'com.github.shenbengit:PagerGridLayoutManager:1.1.7'
+ //选择器
+ api 'com.github.gzu-liyujiang.AndroidPicker:Common:4.1.11'
+ api 'com.github.gzu-liyujiang.AndroidPicker:WheelView:4.1.11'
+
}
diff --git a/common/src/main/res/values-en-rUS/string.xml b/common/src/main/res/values-en-rUS/string.xml
index 567557012..f1af38581 100644
--- a/common/src/main/res/values-en-rUS/string.xml
+++ b/common/src/main/res/values-en-rUS/string.xml
@@ -348,6 +348,7 @@
Kicked out of the room
Forbidden forever
Forbidden by this scene
+ Forbidden by %s min
Set as Administrator
Cancelled administrator
You\'ve been kicked out of the room
@@ -1194,4 +1195,5 @@ Limited ride And limited avatar frame
%S sent to %s
Over the maximum value
Insufficient balance, continue to recharge
+ Time limit gag
diff --git a/common/src/main/res/values-zh-rHK/strings.xml b/common/src/main/res/values-zh-rHK/strings.xml
index 2ff2a2d87..bee2faa9f 100644
--- a/common/src/main/res/values-zh-rHK/strings.xml
+++ b/common/src/main/res/values-zh-rHK/strings.xml
@@ -279,7 +279,7 @@
收入
都市未設定
禮物貢獻榜
- 踢人
+ 踢出房間
永久禁言
本場禁言
設為管理
@@ -292,6 +292,7 @@
被踢出房間
被永久禁言
被本場禁言
+ 被禁言%s分鐘
被設為管理員
被取消管理員
你已經被踢出房間
@@ -1189,4 +1190,5 @@
%S送给了%s
超过最大值
餘額不足,繼續充值
+ 期限禁言
diff --git a/common/src/main/res/values-zh-rTW/strings.xml b/common/src/main/res/values-zh-rTW/strings.xml
index 47e96ef43..dc2735243 100644
--- a/common/src/main/res/values-zh-rTW/strings.xml
+++ b/common/src/main/res/values-zh-rTW/strings.xml
@@ -279,7 +279,7 @@
收入
都市未設定
禮物貢獻榜
- 踢人
+ 踢出房間
永久禁言
本場禁言
設為管理
@@ -292,6 +292,7 @@
被踢出房間
被永久禁言
被本場禁言
+ 被禁言%s分鐘
被設為管理員
被取消管理員
你已經被踢出房間
@@ -1188,4 +1189,5 @@
%S送给了%s
超过最大值
餘額不足,繼續充值
+ 期限禁言
diff --git a/common/src/main/res/values-zh/strings.xml b/common/src/main/res/values-zh/strings.xml
index d120b5b8a..0870f2363 100644
--- a/common/src/main/res/values-zh/strings.xml
+++ b/common/src/main/res/values-zh/strings.xml
@@ -279,7 +279,7 @@
收入
都市未設定
禮物貢獻榜
- 踢人
+ 踢出房間
永久禁言
本場禁言
設為管理
@@ -292,6 +292,7 @@
被踢出房間
被永久禁言
被本場禁言
+ 被禁言%s分鐘
被設為管理員
被取消管理員
你已經被踢出房間
@@ -1189,4 +1190,5 @@
%S送给了%s
超过最大值
餘額不足,繼續充值
+ 期限禁言
diff --git a/common/src/main/res/values/strings.xml b/common/src/main/res/values/strings.xml
index 5dcfc909b..81850c6b9 100644
--- a/common/src/main/res/values/strings.xml
+++ b/common/src/main/res/values/strings.xml
@@ -348,6 +348,7 @@
Kicked out of the room
Forbidden forever
Forbidden by this scene
+ Forbidden by %s minute
Set as Administrator
Cancelled administrator
You\'ve been kicked out of the room
@@ -1195,4 +1196,5 @@ Limited ride And limited avatar frame
Create Vote Error
Over the maximum value
Insufficient balance, continue to recharge
+ Time limit gag
diff --git a/live/src/main/java/com/yunbao/live/activity/LiveActivity.java b/live/src/main/java/com/yunbao/live/activity/LiveActivity.java
index a03991723..84dd06664 100644
--- a/live/src/main/java/com/yunbao/live/activity/LiveActivity.java
+++ b/live/src/main/java/com/yunbao/live/activity/LiveActivity.java
@@ -320,7 +320,7 @@ public abstract class LiveActivity extends AbsActivity implements SocketMessageL
*/
@Override
public void onSendGift(LiveReceiveGiftBean bean, SendBlindGiftEvent event) {
- if (event == null) {
+ if (event == null) {
//购买守护
if (bean.ismTypeBuyGuard()) {
if (mLiveRoomViewHolder != null) {
@@ -1003,6 +1003,13 @@ public abstract class LiveActivity extends AbsActivity implements SocketMessageL
SocketRyChatUtil.sendShutUpMessage(mLiveUid, toUid, toName, type);
}
+ /**
+ * 期限禁言
+ */
+ public void setShutUp(String toUid, String toName, int type, int time) {
+ SocketRyChatUtil.sendShutUpMessage(mLiveUid, toUid, toName, type, time);
+ }
+
/**
* 设置或取消管理员消息
*/
diff --git a/live/src/main/java/com/yunbao/live/dialog/LiveSettingSilenceDialog.java b/live/src/main/java/com/yunbao/live/dialog/LiveSettingSilenceDialog.java
new file mode 100644
index 000000000..290cb15f2
--- /dev/null
+++ b/live/src/main/java/com/yunbao/live/dialog/LiveSettingSilenceDialog.java
@@ -0,0 +1,71 @@
+package com.yunbao.live.dialog;
+
+import android.content.Context;
+import android.graphics.Color;
+import android.view.View;
+
+import androidx.annotation.NonNull;
+
+import com.github.gzuliyujiang.wheelview.widget.WheelView;
+import com.lxj.xpopup.XPopup;
+import com.yunbao.common.dialog.AbsDialogPopupWindow;
+import com.yunbao.common.interfaces.OnItemClickListener;
+import com.yunbao.live.R;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public class LiveSettingSilenceDialog extends AbsDialogPopupWindow {
+ //https://github.com/gzu-liyujiang/AndroidPicker/blob/master/API.md#%E6%BB%9A%E8%BD%AE
+ private WheelView silenceList;
+ private OnItemClickListener itemClickListener;
+
+ public LiveSettingSilenceDialog(@NonNull Context context) {
+ super(context);
+ }
+
+ public LiveSettingSilenceDialog setItemClickListener(OnItemClickListener itemClickListener) {
+ this.itemClickListener = itemClickListener;
+ return this;
+ }
+
+ @Override
+ public void buildDialog(XPopup.Builder builder) {
+
+ }
+
+ @Override
+ public int bindLayoutId() {
+ return R.layout.dialog_live_setting_silence;
+ }
+
+ @Override
+ protected void onCreate() {
+ super.onCreate();
+ silenceList = findViewById(R.id.silenceList);
+ View submit = findViewById(R.id.submit);
+ View cancel = findViewById(R.id.cancel);
+ submit.setOnClickListener(v -> {
+ itemClickListener.onItemClick(silenceList.getCurrentPosition() + 1, silenceList.getCurrentPosition());
+ dismiss();
+ });
+ cancel.setOnClickListener(v -> {
+ dismiss();
+ });
+ initData();
+ }
+
+ void initData() {
+ List list = new ArrayList<>();
+ for (int i = 1; i < 61; i++) {
+ list.add(i + " " + getContext().getString(R.string.minute));
+ }
+ silenceList.setData(list);
+ silenceList.setCyclicEnabled(false);
+ silenceList.setIndicatorEnabled(false);
+ silenceList.setCurtainEnabled(true);
+ silenceList.setCurvedEnabled(true);
+ silenceList.setCurvedMaxAngle(45);
+ silenceList.setCurtainColor(Color.parseColor("#F4F4F4"));
+ }
+}
diff --git a/live/src/main/java/com/yunbao/live/dialog/LiveUserDialogFragment.java b/live/src/main/java/com/yunbao/live/dialog/LiveUserDialogFragment.java
index 844af5d14..dc3c779cc 100644
--- a/live/src/main/java/com/yunbao/live/dialog/LiveUserDialogFragment.java
+++ b/live/src/main/java/com/yunbao/live/dialog/LiveUserDialogFragment.java
@@ -35,6 +35,7 @@ import com.yunbao.common.glide.ImgLoader;
import com.yunbao.common.http.CommonHttpUtil;
import com.yunbao.common.http.HttpCallback;
import com.yunbao.common.interfaces.CommonCallback;
+import com.yunbao.common.interfaces.OnItemClickListener;
import com.yunbao.common.utils.Bus;
import com.yunbao.common.utils.CommonIconUtil;
import com.yunbao.common.utils.DialogUitl;
@@ -703,6 +704,7 @@ public class LiveUserDialogFragment extends AbsDialogFragment implements View.On
list.add(R.string.live_setting_kick);
// list.add(R.string.live_setting_gap);
list.add(R.string.live_setting_gap_2);
+ list.add(R.string.live_setting_gap_3);
break;
case SETTING_ACTION_SUP://设置 超管点主播
list.add(R.string.live_setting_close_live);
@@ -712,16 +714,18 @@ public class LiveUserDialogFragment extends AbsDialogFragment implements View.On
case SETTING_ACTION_ANC_AUD://设置 主播点普通观众
list.add(R.string.live_setting_kick);
// list.add(R.string.live_setting_gap);
- list.add(R.string.live_setting_gap_2);
list.add(R.string.live_setting_admin);
list.add(R.string.live_setting_admin_list);
+ list.add(R.string.live_setting_gap_2);
+ list.add(R.string.live_setting_gap_3);
break;
case SETTING_ACTION_ANC_ADM://设置 主播点房间管理员
list.add(R.string.live_setting_kick);
// list.add(R.string.live_setting_gap);
- list.add(R.string.live_setting_gap_2);
- list.add(R.string.live_setting_admin_cancel);
list.add(R.string.live_setting_admin_list);
+ list.add(R.string.live_setting_admin_cancel);
+ list.add(R.string.live_setting_gap_2);
+ list.add(R.string.live_setting_gap_3);
break;
}
@@ -754,6 +758,8 @@ public class LiveUserDialogFragment extends AbsDialogFragment implements View.On
} else if (tag == R.string.live_setting_close_live_2) {//禁用直播
closeLive2();
+ } else if (tag==R.string.live_setting_gap_3){
+ setShutUp3();
}
}
};
@@ -851,6 +857,23 @@ public class LiveUserDialogFragment extends AbsDialogFragment implements View.On
dismiss();
LiveHttpUtil.superCloseRoom(mLiveUid, 1, mSuperCloseRoomCallback);
}
+ private void setShutUp3(){
+ new LiveSettingSilenceDialog(mContext)
+ .setItemClickListener((bean, position) -> {
+ LiveHttpUtil.setShutUp(mLiveUid, mStream, 1, mToUid, bean+"",new HttpCallback() {
+ @Override
+ public void onSuccess(int code, String msg, String[] info) {
+ if (code == 0) {
+ ((LiveActivity) mContext).setShutUp(mToUid, mToName, 2,bean);
+ dismiss();
+ } else {
+ ToastUtil.show(msg);
+ }
+ }
+ });
+ })
+ .showDialog();
+ }
/**
* 超管关闭直播间并禁用主播账户
diff --git a/live/src/main/java/com/yunbao/live/http/LiveHttpUtil.java b/live/src/main/java/com/yunbao/live/http/LiveHttpUtil.java
index 73e968a5a..12f269782 100644
--- a/live/src/main/java/com/yunbao/live/http/LiveHttpUtil.java
+++ b/live/src/main/java/com/yunbao/live/http/LiveHttpUtil.java
@@ -13,6 +13,7 @@ import com.yunbao.common.http.JsonBean;
import com.yunbao.common.manager.IMLoginManager;
import com.yunbao.common.utils.L;
import com.yunbao.common.utils.MD5Util;
+import com.yunbao.common.utils.StringUtil;
import com.yunbao.common.utils.VersionUtil;
import java.io.File;
@@ -285,17 +286,24 @@ public class LiveHttpUtil {
.execute(callback);
}
+ public static void setShutUp(String liveUid, String stream, int type, String touid, HttpCallback callback) {
+ setShutUp(liveUid, stream, type, touid, null, callback);
+ }
/**
* 主播或管理员禁言
+ * @param time 禁言时间 (分)
*/
- public static void setShutUp(String liveUid, String stream, int type, String touid, HttpCallback callback) {
- HttpClient.getInstance().get("Live.setShutUp", LiveHttpConsts.SET_SHUT_UP)
+ public static void setShutUp(String liveUid, String stream, int type, String touid, String time, HttpCallback callback) {
+ GetRequest request = HttpClient.getInstance().get("Live.setShutUp", LiveHttpConsts.SET_SHUT_UP)
.params("liveuid", liveUid)
.params("stream", stream)
.params("type", type)
- .params("touid", touid)
- .execute(callback);
+ .params("touid", touid);
+ if (!StringUtil.isEmpty(time)) {
+ request.params("minute", time);
+ }
+ request.execute(callback);
}
diff --git a/live/src/main/java/com/yunbao/live/socket/SocketRyChatUtil.java b/live/src/main/java/com/yunbao/live/socket/SocketRyChatUtil.java
index 6d1573c92..7cd18ff92 100644
--- a/live/src/main/java/com/yunbao/live/socket/SocketRyChatUtil.java
+++ b/live/src/main/java/com/yunbao/live/socket/SocketRyChatUtil.java
@@ -164,7 +164,7 @@ public class SocketRyChatUtil {
.param("medal_name", u.getMedalName())
.param("medal_level", u.getMedalLevel())
.param("good_num", u.getGoodnum())
- .param("ct",CommonAppContext.sInstance.getBaseContext().getString(R.string.live_lighted));
+ .param("ct", CommonAppContext.sInstance.getBaseContext().getString(R.string.live_lighted));
msg.create();
String targetId = "g" + mLiveUid;
Conversation.ConversationType conversationType = Conversation.ConversationType.CHATROOM;
@@ -355,7 +355,7 @@ public class SocketRyChatUtil {
.param("uid", u.getId())
.param("touid", toUid)
.param("toname", toName)
- .param("ct", toName +CommonAppContext.sInstance.getBaseContext().getString(R.string.live_kicked));
+ .param("ct", toName + CommonAppContext.sInstance.getBaseContext().getString(R.string.live_kicked));
msg.create();
String targetId = "g" + mLiveUid;
Conversation.ConversationType conversationType = Conversation.ConversationType.CHATROOM;
@@ -388,11 +388,33 @@ public class SocketRyChatUtil {
* 主播或管理员 禁言
*/
public static void sendShutUpMessage(String mLiveUid, String toUid, String toName, int type) {
+ sendShutUpMessage(mLiveUid, toUid, toName, type, 0);
+ }
+
+ /**
+ * 主播或管理员 禁言
+ *
+ * @param time 禁言时间 1~60
+ */
+ public static void sendShutUpMessage(String mLiveUid, String toUid, String toName, int type, int time) {
UserBean u = CommonAppConfig.getInstance().getUserBean();
if (u == null) {
return;
}
+ String ct = "";
+ switch (type) {
+ case 0:
+ ct = CommonAppContext.sInstance.getBaseContext().getString(R.string.live_shut);
+ break;
+ case 1:
+ ct = CommonAppContext.sInstance.getBaseContext().getString(R.string.live_shut_2);
+ break;
+ case 2:
+ ct = String.format(CommonAppContext.sInstance.getBaseContext().getString(R.string.live_shut_3),time+"");
+ break;
+ }
+
final SocketSendBean msg = new SocketSendBean()
.param("_method_", Constants.SOCKET_SHUT_UP)
.param("action", 1)
@@ -402,7 +424,8 @@ public class SocketRyChatUtil {
.param("uid", u.getId())
.param("touid", toUid)
.param("toname", toName)
- .param("ct", toName +CommonAppContext.sInstance.getBaseContext().getString(type == 0 ? R.string.live_shut : R.string.live_shut_2));
+ .param("time", time)
+ .param("ct", toName + ct);
msg.create();
String targetId = "g" + mLiveUid;
Conversation.ConversationType conversationType = Conversation.ConversationType.CHATROOM;
@@ -439,7 +462,7 @@ public class SocketRyChatUtil {
if (u == null) {
return;
}
- String s = action == 1 ?CommonAppContext.sInstance.getBaseContext().getString(R.string.live_set_admin) :CommonAppContext.sInstance.getBaseContext().getString(R.string.live_set_admin_cancel);
+ String s = action == 1 ? CommonAppContext.sInstance.getBaseContext().getString(R.string.live_set_admin) : CommonAppContext.sInstance.getBaseContext().getString(R.string.live_set_admin_cancel);
final SocketSendBean msg = new SocketSendBean()
.param("_method_", Constants.SOCKET_SET_ADMIN)
.param("action", action)
@@ -709,7 +732,7 @@ public class SocketRyChatUtil {
.param("msgtype", 0)
.param("uid", u.getId())
.param("uname", u.getUserNiceName())
- .param("ct",CommonAppContext.sInstance.getBaseContext().getString(R.string.red_pack_22)
+ .param("ct", CommonAppContext.sInstance.getBaseContext().getString(R.string.red_pack_22)
);
msg.create();
String targetId = "g" + mLiveUid;
diff --git a/live/src/main/java/com/yunbao/live/views/PortraitLiveManager.java b/live/src/main/java/com/yunbao/live/views/PortraitLiveManager.java
index 2c7b5fd27..b805b5f1c 100644
--- a/live/src/main/java/com/yunbao/live/views/PortraitLiveManager.java
+++ b/live/src/main/java/com/yunbao/live/views/PortraitLiveManager.java
@@ -1274,7 +1274,9 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe
@Override
public void onShutUp(String touid, String content) {
-
+ if (!TextUtils.isEmpty(touid) && touid.equals(CommonAppConfig.getInstance().getUid())) {
+ DialogUitl.showSimpleTipDialog(mContext, content);
+ }
}
@Override
diff --git a/live/src/main/res/layout/dialog_live_setting_silence.xml b/live/src/main/res/layout/dialog_live_setting_silence.xml
new file mode 100644
index 000000000..359314c6c
--- /dev/null
+++ b/live/src/main/res/layout/dialog_live_setting_silence.xml
@@ -0,0 +1,74 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/live/src/main/res/values-en/strings.xml b/live/src/main/res/values-en/strings.xml
index a357af960..9bbb745b8 100644
--- a/live/src/main/res/values-en/strings.xml
+++ b/live/src/main/res/values-en/strings.xml
@@ -90,4 +90,6 @@
Think again
Letter
Please turn on at least one contact information
+ Minute
+ Please select
\ No newline at end of file
diff --git a/live/src/main/res/values/strings.xml b/live/src/main/res/values/strings.xml
index 50e8ee84b..9496804d2 100644
--- a/live/src/main/res/values/strings.xml
+++ b/live/src/main/res/values/strings.xml
@@ -88,5 +88,6 @@
刪除
再想想
信件欄
-
+ 分鐘
+ 請選擇禁言時間