新增期间禁言功能
This commit is contained in:
parent
a1c96cfd0f
commit
beb566b294
@ -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'
|
||||
|
||||
}
|
||||
|
@ -348,6 +348,7 @@
|
||||
<string name="live_kicked">Kicked out of the room</string>
|
||||
<string name="live_shut">Forbidden forever</string>
|
||||
<string name="live_shut_2">Forbidden by this scene</string>
|
||||
<string name="live_shut_3">Forbidden by %s min</string>
|
||||
<string name="live_set_admin">Set as Administrator</string>
|
||||
<string name="live_set_admin_cancel">Cancelled administrator</string>
|
||||
<string name="live_kicked_2">You\'ve been kicked out of the room</string>
|
||||
@ -1194,4 +1195,5 @@ Limited ride And limited avatar frame</string>
|
||||
<string name="extract_to2">%S sent to %s</string>
|
||||
<string name="rebot_config_auto_say_max">Over the maximum value</string>
|
||||
<string name="insufficient_balance">Insufficient balance, continue to recharge</string>
|
||||
<string name="live_setting_gap_3">Time limit gag</string>
|
||||
</resources>
|
||||
|
@ -279,7 +279,7 @@
|
||||
<string name="live_user_get">收入</string>
|
||||
<string name="live_user_city_empty">都市未設定</string>
|
||||
<string name="live_contribute">禮物貢獻榜</string>
|
||||
<string name="live_setting_kick">踢人</string>
|
||||
<string name="live_setting_kick">踢出房間</string>
|
||||
<string name="live_setting_gap">永久禁言</string>
|
||||
<string name="live_setting_gap_2">本場禁言</string>
|
||||
<string name="live_setting_admin">設為管理</string>
|
||||
@ -292,6 +292,7 @@
|
||||
<string name="live_kicked">被踢出房間</string>
|
||||
<string name="live_shut">被永久禁言</string>
|
||||
<string name="live_shut_2">被本場禁言</string>
|
||||
<string name="live_shut_3">被禁言%s分鐘</string>
|
||||
<string name="live_set_admin">被設為管理員</string>
|
||||
<string name="live_set_admin_cancel">被取消管理員</string>
|
||||
<string name="live_kicked_2">你已經被踢出房間</string>
|
||||
@ -1189,4 +1190,5 @@
|
||||
<string name="extract_to2">%S送给了%s</string>
|
||||
<string name="rebot_config_auto_say_max">超过最大值</string>
|
||||
<string name="insufficient_balance">餘額不足,繼續充值</string>
|
||||
<string name="live_setting_gap_3">期限禁言</string>
|
||||
</resources>
|
||||
|
@ -279,7 +279,7 @@
|
||||
<string name="live_user_get">收入</string>
|
||||
<string name="live_user_city_empty">都市未設定</string>
|
||||
<string name="live_contribute">禮物貢獻榜</string>
|
||||
<string name="live_setting_kick">踢人</string>
|
||||
<string name="live_setting_kick">踢出房間</string>
|
||||
<string name="live_setting_gap">永久禁言</string>
|
||||
<string name="live_setting_gap_2">本場禁言</string>
|
||||
<string name="live_setting_admin">設為管理</string>
|
||||
@ -292,6 +292,7 @@
|
||||
<string name="live_kicked">被踢出房間</string>
|
||||
<string name="live_shut">被永久禁言</string>
|
||||
<string name="live_shut_2">被本場禁言</string>
|
||||
<string name="live_shut_3">被禁言%s分鐘</string>
|
||||
<string name="live_set_admin">被設為管理員</string>
|
||||
<string name="live_set_admin_cancel">被取消管理員</string>
|
||||
<string name="live_kicked_2">你已經被踢出房間</string>
|
||||
@ -1188,4 +1189,5 @@
|
||||
<string name="extract_to2">%S送给了%s</string>
|
||||
<string name="rebot_config_auto_say_max">超过最大值</string>
|
||||
<string name="insufficient_balance">餘額不足,繼續充值</string>
|
||||
<string name="live_setting_gap_3">期限禁言</string>
|
||||
</resources>
|
||||
|
@ -279,7 +279,7 @@
|
||||
<string name="live_user_get">收入</string>
|
||||
<string name="live_user_city_empty">都市未設定</string>
|
||||
<string name="live_contribute">禮物貢獻榜</string>
|
||||
<string name="live_setting_kick">踢人</string>
|
||||
<string name="live_setting_kick">踢出房間</string>
|
||||
<string name="live_setting_gap">永久禁言</string>
|
||||
<string name="live_setting_gap_2">本場禁言</string>
|
||||
<string name="live_setting_admin">設為管理</string>
|
||||
@ -292,6 +292,7 @@
|
||||
<string name="live_kicked">被踢出房間</string>
|
||||
<string name="live_shut">被永久禁言</string>
|
||||
<string name="live_shut_2">被本場禁言</string>
|
||||
<string name="live_shut_3">被禁言%s分鐘</string>
|
||||
<string name="live_set_admin">被設為管理員</string>
|
||||
<string name="live_set_admin_cancel">被取消管理員</string>
|
||||
<string name="live_kicked_2">你已經被踢出房間</string>
|
||||
@ -1189,4 +1190,5 @@
|
||||
<string name="extract_to2">%S送给了%s</string>
|
||||
<string name="rebot_config_auto_say_max">超过最大值</string>
|
||||
<string name="insufficient_balance">餘額不足,繼續充值</string>
|
||||
<string name="live_setting_gap_3">期限禁言</string>
|
||||
</resources>
|
||||
|
@ -348,6 +348,7 @@
|
||||
<string name="live_kicked">Kicked out of the room</string>
|
||||
<string name="live_shut">Forbidden forever</string>
|
||||
<string name="live_shut_2">Forbidden by this scene</string>
|
||||
<string name="live_shut_3">Forbidden by %s minute</string>
|
||||
<string name="live_set_admin">Set as Administrator</string>
|
||||
<string name="live_set_admin_cancel">Cancelled administrator</string>
|
||||
<string name="live_kicked_2">You\'ve been kicked out of the room</string>
|
||||
@ -1195,4 +1196,5 @@ Limited ride And limited avatar frame</string>
|
||||
<string name="live_vote_create_error">Create Vote Error</string>
|
||||
<string name="rebot_config_auto_say_max">Over the maximum value</string>
|
||||
<string name="insufficient_balance">Insufficient balance, continue to recharge</string>
|
||||
<string name="live_setting_gap_3">Time limit gag</string>
|
||||
</resources>
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置或取消管理员消息
|
||||
*/
|
||||
|
@ -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<Integer> itemClickListener;
|
||||
|
||||
public LiveSettingSilenceDialog(@NonNull Context context) {
|
||||
super(context);
|
||||
}
|
||||
|
||||
public LiveSettingSilenceDialog setItemClickListener(OnItemClickListener<Integer> 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<String> 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"));
|
||||
}
|
||||
}
|
@ -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();
|
||||
}
|
||||
|
||||
/**
|
||||
* 超管关闭直播间并禁用主播账户
|
||||
|
@ -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<JsonBean> 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);
|
||||
}
|
||||
|
||||
|
||||
|
@ -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;
|
||||
|
@ -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
|
||||
|
74
live/src/main/res/layout/dialog_live_setting_silence.xml
Normal file
74
live/src/main/res/layout/dialog_live_setting_silence.xml
Normal file
@ -0,0 +1,74 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="300dp"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:background="@drawable/background_fff"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto">
|
||||
<LinearLayout
|
||||
android:id="@+id/linearLayout2"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:layout_marginTop="16dp"
|
||||
android:orientation="horizontal"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/cancel"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="16dp"
|
||||
android:layout_weight="1"
|
||||
android:text="@string/cancel"
|
||||
android:textColor="#999999"
|
||||
android:textSize="16sp" />
|
||||
|
||||
|
||||
<TextView
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="16dp"
|
||||
android:layout_weight="1"
|
||||
android:text="@string/live_setting_silence_title"
|
||||
android:textColor="#333333"
|
||||
android:textSize="16sp" />
|
||||
|
||||
|
||||
<TextView
|
||||
android:id="@+id/submit"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:gravity="end"
|
||||
android:layout_marginEnd="16dp"
|
||||
android:text="@string/dialog_fount_submit"
|
||||
android:textColor="#0A9FFE"
|
||||
android:textSize="16sp" />
|
||||
|
||||
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<View
|
||||
android:id="@+id/divider"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:layout_marginTop="16dp"
|
||||
android:background="#1a000000"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/linearLayout2" />
|
||||
|
||||
<com.github.gzuliyujiang.wheelview.widget.WheelView
|
||||
android:id="@+id/silenceList"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="@+id/divider" />
|
||||
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
@ -90,4 +90,6 @@
|
||||
<string name="live_user_letter_dialog_no">Think again</string>
|
||||
<string name="dialog_live_mailbox_title">Letter</string>
|
||||
<string name="live_anchor_edit_call_me_not_call_info_toash">Please turn on at least one contact information</string>
|
||||
<string name="minute">Minute</string>
|
||||
<string name="live_setting_silence_title">Please select</string>
|
||||
</resources>
|
@ -88,5 +88,6 @@
|
||||
<string name="live_user_letter_dialog_yes">刪除</string>
|
||||
<string name="live_user_letter_dialog_no">再想想</string>
|
||||
<string name="dialog_live_mailbox_title">信件欄</string>
|
||||
|
||||
<string name="minute">分鐘</string>
|
||||
<string name="live_setting_silence_title">請選擇禁言時間</string>
|
||||
</resources>
|
||||
|
Loading…
Reference in New Issue
Block a user