diff --git a/live/src/main/java/com/yunbao/live/activity/LiveRyAnchorActivity.java b/live/src/main/java/com/yunbao/live/activity/LiveRyAnchorActivity.java index be7ab8c0c..82a9de24b 100644 --- a/live/src/main/java/com/yunbao/live/activity/LiveRyAnchorActivity.java +++ b/live/src/main/java/com/yunbao/live/activity/LiveRyAnchorActivity.java @@ -249,17 +249,7 @@ public class LiveRyAnchorActivity extends LiveActivity implements LiveFunctionCl break; case Constants.LIVE_FUNC_MIC://語音 //ToastUtil.show("開發中,敬請期待"); - - LiveMicAnchorDialogFragment fragment = new LiveMicAnchorDialogFragment(); - Bundle bundle = new Bundle(); - bundle.putString(Constants.LIVE_UID, mLiveUid); - bundle.putString(Constants.STREAM, mStream); - bundle.putString("By", "1"); - fragment.setArguments(bundle); - micListener = fragment.getMicListener(); - fragment.setMicQueueList(mMicQueueList); - fragment.setAudienceList(mAudienceList); - fragment.show(((LiveRyAnchorActivity) mContext).getSupportFragmentManager(), "LiveMicAnchorDialogFragment"); + openMicWindow(); break; case Constants.LIVE_FUNC_DR://多人PK if (isDRPK != 1) { @@ -402,6 +392,19 @@ public class LiveRyAnchorActivity extends LiveActivity implements LiveFunctionCl } } + private void openMicWindow() { + LiveMicAnchorDialogFragment fragment = new LiveMicAnchorDialogFragment(); + Bundle bundle = new Bundle(); + bundle.putString(Constants.LIVE_UID, mLiveUid); + bundle.putString(Constants.STREAM, mStream); + bundle.putString("By", "1"); + fragment.setArguments(bundle); + micListener = fragment.getMicListener(); + fragment.setMicQueueList(mMicQueueList); + fragment.setAudienceList(mAudienceList); + fragment.show(((LiveRyAnchorActivity) mContext).getSupportFragmentManager(), "LiveMicAnchorDialogFragment"); + } + /** * 主播展示离开直播间 */ @@ -1327,6 +1330,16 @@ public class LiveRyAnchorActivity extends LiveActivity implements LiveFunctionCl } if (micListener != null) { micListener.updateMicList(mMicQueueList); + DialogUitl.showSimpleDialog(mContext, + String.format(WordUtil.getString(R.string.live_mic_user_apply), ((LinkMicUserBean) event.getObject()).getUname()), + new DialogUitl.SimpleCallback() { + @Override + public void onConfirmClick(Dialog dialog, String content) { + openMicWindow(); + dialog.dismiss(); + } + } + ); } break; case LINK_MIC_CANCEL: diff --git a/live/src/main/java/com/yunbao/live/adapter/AnchorUserMicInfoAdapter.java b/live/src/main/java/com/yunbao/live/adapter/AnchorUserMicInfoAdapter.java index bf1355ea3..7a360013f 100644 --- a/live/src/main/java/com/yunbao/live/adapter/AnchorUserMicInfoAdapter.java +++ b/live/src/main/java/com/yunbao/live/adapter/AnchorUserMicInfoAdapter.java @@ -28,6 +28,7 @@ import com.yunbao.common.http.ResponseModel; import com.yunbao.common.utils.CommonIconUtil; import com.yunbao.common.utils.SVGAViewUtils; import com.yunbao.common.utils.ToastUtil; +import com.yunbao.common.utils.WordUtil; import com.yunbao.live.R; import com.yunbao.live.activity.LiveActivity; import com.yunbao.live.activity.LiveAudienceActivity; @@ -45,9 +46,11 @@ import java.net.URL; import io.reactivex.android.schedulers.AndroidSchedulers; import io.reactivex.functions.Consumer; import io.reactivex.schedulers.Schedulers; +import io.rong.imkit.IMCenter; import io.rong.imlib.IRongCallback; import io.rong.imlib.RongIMClient; import io.rong.imlib.model.Conversation; +import io.rong.imlib.model.Message; import io.rong.message.TextMessage; public class AnchorUserMicInfoAdapter extends RefreshAdapter { @@ -130,8 +133,8 @@ public class AnchorUserMicInfoAdapter extends RefreshAdapter { SocketSendBean bean = createSocketSendBean().param("targetId", tag.getId()); applyMic(tag, 1, bean); } - }else{ - ToastUtil.show("仅允许三人与主播连麦"); + } else { + ToastUtil.show(WordUtil.getString(R.string.live_mic_max)); } } }); @@ -148,6 +151,7 @@ public class AnchorUserMicInfoAdapter extends RefreshAdapter { @Override public void accept(ResponseModel stringResponseModel) throws Exception { applyMic((MicUserBean) v.getTag(), 8, createSocketSendBean()); + ToastUtil.show(WordUtil.getString(R.string.live_mic_user_down)); } }, Throwable::printStackTrace).isDisposed(); @@ -183,7 +187,8 @@ public class AnchorUserMicInfoAdapter extends RefreshAdapter { public void onSuccess(io.rong.imlib.model.Message message) { Log.e("ry", "发送成功"); refreshView.initData(); - + IMCenter.getInstance().deleteRemoteMessages(Conversation.ConversationType.PRIVATE, message.getTargetId(), new Message[]{message}, null); + IMCenter.getInstance().clearMessagesUnreadStatus(Conversation.ConversationType.PRIVATE, message.getTargetId(), null); } @Override diff --git a/live/src/main/res/values-en/strings.xml b/live/src/main/res/values-en/strings.xml index 5bbc2d6cf..a6cc2d9aa 100644 --- a/live/src/main/res/values-en/strings.xml +++ b/live/src/main/res/values-en/strings.xml @@ -17,4 +17,5 @@ Available for all Only those who have the room code can watch Submit + The number of voices has reached 3, and no more can be added. \ 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 4f77f04c7..c67f52549 100644 --- a/live/src/main/res/values/strings.xml +++ b/live/src/main/res/values/strings.xml @@ -27,4 +27,7 @@ 已超过10秒未识别到录音 身份特權 貴族坐席 + 當前連麥語音人數已達到3人,無法再添加。 + %s 申请连麦 + 已踢下麥