From 78e530c776044800e594f5c13a28666ddac934b3 Mon Sep 17 00:00:00 2001 From: huangjian Date: Thu, 14 Jul 2022 14:34:52 +0800 Subject: [PATCH] =?UTF-8?q?=E4=B8=AA=E6=92=AD=E6=BB=91=E5=8A=A8=E5=88=87?= =?UTF-8?q?=E6=8D=A2=E6=88=BF=E9=97=B4=E6=8E=A5=E5=8F=A3=E5=AF=B9=E6=8E=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../erban/avroom/activity/AVRoomActivity.java | 47 +- .../erban/avroom/fragment/BaseRoomFragment.kt | 12 +- .../avroom/fragment/FakeSingleRoomFragment.kt | 8 +- .../avroom/fragment/SingleRoomFragment.kt | 11 - .../widget/VerticalViewPagerAdapter.java | 6 +- .../common/widget/dialog/DialogManager.java | 438 +++++++++--------- .../main/res/layout/activity_chat_room.xml | 2 +- app/src/main/res/values/strings.xml | 2 +- .../manager/IMNetEaseManager.java | 20 + .../room/model/AvRoomModel.java | 7 + .../room/model/RoomBaseModel.java | 9 + .../room/model/inteface/IAvRoomModel.java | 2 + 12 files changed, 293 insertions(+), 271 deletions(-) diff --git a/app/src/main/java/com/yizhuan/erban/avroom/activity/AVRoomActivity.java b/app/src/main/java/com/yizhuan/erban/avroom/activity/AVRoomActivity.java index c69867034..0a544aa37 100644 --- a/app/src/main/java/com/yizhuan/erban/avroom/activity/AVRoomActivity.java +++ b/app/src/main/java/com/yizhuan/erban/avroom/activity/AVRoomActivity.java @@ -31,7 +31,6 @@ import androidx.annotation.NonNull; import androidx.annotation.Nullable; import androidx.core.content.ContextCompat; import androidx.fragment.app.DialogFragment; -import androidx.recyclerview.widget.RecyclerView; import androidx.viewpager2.widget.ViewPager2; import com.alibaba.fastjson.JSON; @@ -110,6 +109,8 @@ import com.yizhuan.xchat_android_core.room.bean.SimplePartyRoomInfo; import com.yizhuan.xchat_android_core.room.dragonball.DragonBallModel; import com.yizhuan.xchat_android_core.room.event.FinishAvRoomEvent; import com.yizhuan.xchat_android_core.room.event.RoomClearScreenEvent; +import com.yizhuan.xchat_android_core.room.model.AvRoomModel; +import com.yizhuan.xchat_android_core.room.model.RoomBaseModel; import com.yizhuan.xchat_android_core.room.pk.event.PKStateEvent; import com.yizhuan.xchat_android_core.statistic.StatisticManager; import com.yizhuan.xchat_android_core.statistic.protocol.StatisticsProtocol; @@ -120,6 +121,7 @@ import com.yizhuan.xchat_android_core.user.bean.UserInfo; import com.yizhuan.xchat_android_core.utils.LogUtils; import com.yizhuan.xchat_android_core.utils.StringUtils; import com.yizhuan.xchat_android_library.base.factory.CreatePresenter; +import com.yizhuan.xchat_android_library.net.rxnet.callback.CallBack; import com.yizhuan.xchat_android_library.utils.JavaUtil; import com.yizhuan.xchat_android_library.utils.UIUtils; @@ -204,7 +206,7 @@ public class AVRoomActivity extends BaseMvpActivity?> : AvRoomDataManager.get().mCurrentRoomInfo?.isServerRedEnvelopeSwitch == true } - /** - * 嗨聊房切换清屏方法 - */ - private fun clearScreen() { - messageView.clear() - } - /** * 嗨聊房切换重置公屏消息(绿色公告) */ @@ -638,9 +631,8 @@ open class BaseRoomFragment?> : */ @Subscribe(threadMode = ThreadMode.MAIN) fun onClearScreenEvent(event: RoomClearScreenEvent?) { - clearScreen() - val firstMsg = IMNetEaseManager.get().firstMessageContent - addMessage(firstMsg) + AvRoomDataManager.get().chatRoomDataRelease(false) + messageView.clear() } @CallSuper diff --git a/app/src/main/java/com/yizhuan/erban/avroom/fragment/FakeSingleRoomFragment.kt b/app/src/main/java/com/yizhuan/erban/avroom/fragment/FakeSingleRoomFragment.kt index 4ede4f73c..b5bd995d9 100644 --- a/app/src/main/java/com/yizhuan/erban/avroom/fragment/FakeSingleRoomFragment.kt +++ b/app/src/main/java/com/yizhuan/erban/avroom/fragment/FakeSingleRoomFragment.kt @@ -25,7 +25,6 @@ class FakeSingleRoomFragment : BaseViewBindingFragment { - //个播模式房主进房自动上麦 - if (AvRoomDataManager.get().isSingleRoom && AvRoomDataManager.get().isRoomOwner) { - AvRoomDataManager.get().mIsNeedOpenMic = true - mvpPresenter?.upMicroPhone( - -1, - AuthModel.get().currentUid.toString(), - false - ) - } - } RoomEvent.REQUEST_UP_MIC -> { (roomEvent.chatRoomMessage?.attachment as? RequestUpmicAttachment)?.userInfo?.let { showInviteDialog(it) diff --git a/app/src/main/java/com/yizhuan/erban/avroom/widget/VerticalViewPagerAdapter.java b/app/src/main/java/com/yizhuan/erban/avroom/widget/VerticalViewPagerAdapter.java index e82f44b3b..0c4eee43b 100644 --- a/app/src/main/java/com/yizhuan/erban/avroom/widget/VerticalViewPagerAdapter.java +++ b/app/src/main/java/com/yizhuan/erban/avroom/widget/VerticalViewPagerAdapter.java @@ -21,10 +21,12 @@ import com.yizhuan.erban.avroom.fragment.HomePartyFragment; public class VerticalViewPagerAdapter extends FragmentStateAdapter { private final SparseArray fragmentList; + private final boolean isRoomMin; - public VerticalViewPagerAdapter(FragmentActivity fm) { + public VerticalViewPagerAdapter(FragmentActivity fm, boolean isRoomMin) { super(fm); fragmentList = new SparseArray<>(); + this.isRoomMin = isRoomMin; } @@ -34,7 +36,7 @@ public class VerticalViewPagerAdapter extends FragmentStateAdapter { Fragment fragment = fragmentList.get(position); if (fragment == null) { if (position == 0) { - fragment = HomePartyFragment.newInstance(false); + fragment = HomePartyFragment.newInstance(isRoomMin); } else { fragment = new FakeSingleRoomFragment(); } diff --git a/app/src/main/java/com/yizhuan/erban/common/widget/dialog/DialogManager.java b/app/src/main/java/com/yizhuan/erban/common/widget/dialog/DialogManager.java index 452abc2f4..56107c940 100644 --- a/app/src/main/java/com/yizhuan/erban/common/widget/dialog/DialogManager.java +++ b/app/src/main/java/com/yizhuan/erban/common/widget/dialog/DialogManager.java @@ -5,6 +5,7 @@ import android.app.Activity; import android.app.Dialog; import android.content.Context; import android.content.DialogInterface; +import android.graphics.drawable.AnimationDrawable; import android.os.Build; import android.text.SpannableString; import android.text.TextUtils; @@ -53,6 +54,8 @@ public class DialogManager { * 新增的一种弹框类型,支持只弹一次 */ private Switch switchTips; + private int mProgressMax = 0; + private String mTip; public DialogManager(Context context) { mContext = context; @@ -76,6 +79,180 @@ public class DialogManager { mCanceledOnClickOutside = canceledOnClickOutside; } + public static boolean isHtmlAlertDialog(String html) { + try { + return html.matches(".*<([^>]*)>.*"); + } catch (Exception e) { + return false; + } + } + + /** + * 注释 见 {@link DialogManager#showOkCancelDialog( + *CharSequence, CharSequence, CharSequence, CharSequence, boolean, + * boolean, boolean, OkCancelDialogListener, OnKeyBackListener, boolean)} + */ + public static void setDialog(Dialog dialog, CharSequence title, CharSequence message, CharSequence okLabel, + CharSequence cancelLabel, boolean isCanCancel, boolean canceledOnTouchOutside, + final boolean isAutoHide, final OkCancelDialogListener l, + final OnKeyBackListener backListener, boolean dismissAfterBack) { + dialog.setCancelable(isCanCancel); + dialog.setCanceledOnTouchOutside(canceledOnTouchOutside); + + Window window = dialog.getWindow(); + window.setContentView(R.layout.layout_common_ok_cancel_dialog); + //标题 + TextView tvTilte = window.findViewById(R.id.tv_title); + if (tvTilte != null) { + if (!TextUtils.isEmpty(title)) { + tvTilte.setVisibility(View.VISIBLE); + tvTilte.setText(title); + } else { + tvTilte.setVisibility(View.GONE); + } + } + //内容 + TextView tip = window.findViewById(R.id.message); + tip.setText(message); + + TextView ok = window.findViewById(R.id.btn_ok); + if (!TextUtils.isEmpty(okLabel)) { + ok.setText(okLabel); + } + ok.setOnClickListener(v -> { + if (isAutoHide) { + dialog.dismiss(); + } + if (l != null) { + l.onOk(); + } + }); + + TextView cancel = window.findViewById(R.id.btn_cancel); + if (!TextUtils.isEmpty(cancelLabel)) { + cancel.setText(cancelLabel); + cancel.setOnClickListener(v -> { + if (isAutoHide) { + dialog.dismiss(); + } + if (l != null) { + l.onCancel(); + } + }); + } else { + cancel.setVisibility(View.GONE); + } + + if (backListener != null) { + dialog.setOnKeyListener((dialog1, keyCode, event) -> { + if (keyCode == KeyEvent.KEYCODE_BACK && event.getRepeatCount() == 0 + && event.getAction() == KeyEvent.ACTION_DOWN) { + if (dismissAfterBack) { + dialog.dismiss(); + } + backListener.onBack(); + return true; + } + return false; + }); + } + } + + /** + * 注释 见 {@link DialogManager#showOkCancelDialog( + *CharSequence, CharSequence, CharSequence, CharSequence, boolean, + * boolean, boolean, OkCancelDialogListener, OnKeyBackListener, boolean)} + */ + public static void setHelloDialog(Dialog dialog, String avatar, int gender, CharSequence title, CharSequence message, CharSequence okLabel, + CharSequence cancelLabel, boolean isCanCancel, boolean canceledOnTouchOutside, + final boolean isAutoHide, final OkCancelDialogListener l, + final OnKeyBackListener backListener, boolean dismissAfterBack, Context context) { + dialog.setCancelable(isCanCancel); + dialog.setCanceledOnTouchOutside(canceledOnTouchOutside); + + Window window = dialog.getWindow(); + window.setContentView(R.layout.layout_newbie_hello_dialog); + //头像 + RoundedImageView ivAvatar = window.findViewById(R.id.iv_avatar); + if (ivAvatar != null) { + if (!TextUtils.isEmpty(avatar)) { + ivAvatar.setVisibility(View.VISIBLE); + GlideApp.with(context) + .load(avatar) +// .diskCacheStrategy(DiskCacheStrategy.ALL) +// .transforms(new CenterCrop(), +// new RoundedCorners(context.getResources().getDimensionPixelOffset(R.dimen.dp_6))) + .into(ivAvatar); + } else { + ivAvatar.setVisibility(View.GONE); + } + } + + //性别 + ImageView ivGender = window.findViewById(R.id.iv_gender); + ivGender.setImageDrawable(gender == 1 ? context.getResources().getDrawable(R.drawable.ic_gender_male) : context.getResources().getDrawable(R.drawable.ic_gender_female)); + //标题 + TextView tvTilte = window.findViewById(R.id.tv_title); + if (tvTilte != null) { + if (!TextUtils.isEmpty(title)) { + tvTilte.setVisibility(View.VISIBLE); + tvTilte.setText(title); + } else { + tvTilte.setVisibility(View.GONE); + } + } + //内容 + TextView tip = window.findViewById(R.id.message); + tip.setText(message); + + TextView ok = window.findViewById(R.id.btn_ok); + if (!TextUtils.isEmpty(okLabel)) { + ok.setText(okLabel); + } + ok.setOnClickListener(v -> { + if (isAutoHide) { + dialog.dismiss(); + } + if (l != null) { + l.onOk(); + } + }); + + TextView cancel = window.findViewById(R.id.btn_cancel); + if (!TextUtils.isEmpty(cancelLabel)) { + cancel.setText(cancelLabel); + cancel.setOnClickListener(v -> { + if (isAutoHide) { + dialog.dismiss(); + } + if (l != null) { + l.onCancel(); + } + }); + } else { + cancel.setVisibility(View.GONE); + } + + if (backListener != null) { + dialog.setOnKeyListener((dialog1, keyCode, event) -> { + if (keyCode == KeyEvent.KEYCODE_BACK && event.getRepeatCount() == 0 + && event.getAction() == KeyEvent.ACTION_DOWN) { + if (dismissAfterBack) { + dialog.dismiss(); + } + backListener.onBack(); + return true; + } + return false; + }); + } + } + + public static Dialog createDialog(Context context) { + AlertDialog.Builder builder = new BaseAlertDialogBuilder(context, R.style.MyAlertDialogStyle); + return builder.create(); + } + public Context getContext() { return mContext; } @@ -296,35 +473,6 @@ public class DialogManager { return mDialog; } - public interface DynamicTokenLoginDialogListener { - public void onOK(String token); - - public void onCancle(); - } - - public interface InputPwdDialogListener { - public void onConfirm(); - - public void onCancel(); - } - - public interface OkCancelDialogListener { - - default void onCancel() { - //默认空实现 - } - - void onOk(); - } - - public static abstract class AbsOkDialogListener implements OkCancelDialogListener { - public void onCancel() { - //do nothing - } - - public abstract void onOk(); - } - public void showNewbieHelloDialog(String avatar, int gender, CharSequence titleStr, CharSequence message, CharSequence okLabel, CharSequence cancelLabel, boolean cancelable, final OkCancelDialogListener l, Context context) { showHelloDialog(avatar, gender, titleStr, message, okLabel, cancelLabel, cancelable, mCanceledOnClickOutside, true, l, null, false, context); } @@ -389,7 +537,6 @@ public class DialogManager { showOkCancelDialog(titleStr, message, okLabel, cancelLabel, l); } - public void showOkCancelWithTitleDialog(CharSequence titleStr, CharSequence message, CharSequence okLabel, CharSequence cancelLabel, boolean isCanCancel, @@ -479,7 +626,6 @@ public class DialogManager { showOkCancelDialog(null, message, okLabel, cancelLabel, cancelable, l); } - public void showOkCancelDialog(CharSequence title, CharSequence[] messages, final OkCancelDialogListener l) { showOkCancelDialog(title, messages, getContext().getString(R.string.text_ok), @@ -678,13 +824,11 @@ public class DialogManager { showOkCancelCustomDialog(contentView, okLabel, cancelLabel, isCanCancel, l); } - public void showOkCancelCustomDialog(View customView, boolean isCanCancel, OkCancelDialogListener l) { showOkCancelCustomDialog(customView, getContext().getString(R.string.text_ok), getContext().getString(R.string.text_canle), isCanCancel, true, l); } - public void showOkCancelCustomDialog(View customView, CharSequence okLabel, CharSequence cancelLabel, boolean isCanCancel, OkCancelDialogListener l) { showOkCancelCustomDialog(customView, okLabel, cancelLabel, isCanCancel, true, l); @@ -741,7 +885,6 @@ public class DialogManager { } - public void setReCreate(boolean reCreate) { mReCreate = reCreate; } @@ -798,9 +941,8 @@ public class DialogManager { mDialog.show(); } mDialog.setContentView(R.layout.layout_progress_dialog); - TextView tvTip = (TextView) mDialog.findViewById(R.id.tv_tip); - //tvTip.setText(msg); - //叶彬说统一文案,用loading... + ((AnimationDrawable) ((ImageView) mDialog.findViewById(R.id.iv_loading_icon)).getDrawable()).start(); + TextView tvTip = mDialog.findViewById(R.id.tv_tip); tvTip.setText(R.string.common_loading_tips); mDialog.setOnDismissListener(dialog -> { @@ -810,9 +952,6 @@ public class DialogManager { }); } - private int mProgressMax = 0; - private String mTip; - public void setText(String text) { mTip = text; } @@ -892,10 +1031,6 @@ public class DialogManager { }); } - public interface OnClickListener { - public void onClick(View view, int btnIndex); - } - private String getTicketProtcol(long channelId, long subChannelId, String title) { return "yy://pd-[sid=" + channelId + "&subid=" + subChannelId + "]\n" + title; } @@ -904,202 +1039,61 @@ public class DialogManager { return "yy://pd-[sid=" + channelId + "&subid=" + subChannelId + "]"; } + public AlertDialog.Builder getBuilder() { + return mBuilder; + } + + public boolean isOpenSwitch() { + return switchTips != null && switchTips.isChecked(); + } + + public interface DynamicTokenLoginDialogListener { + public void onOK(String token); + + public void onCancle(); + } + + public interface InputPwdDialogListener { + public void onConfirm(); + + public void onCancel(); + } + + public interface OkCancelDialogListener { + + default void onCancel() { + //默认空实现 + } + + void onOk(); + } + + public interface OnClickListener { + public void onClick(View view, int btnIndex); + } + public interface OnInputPasswordClickListener { void onOk(String password); void onCancel(); } - public static boolean isHtmlAlertDialog(String html) { - try { - return html.matches(".*<([^>]*)>.*"); - } catch (Exception e) { - return false; - } - } - - public AlertDialog.Builder getBuilder() { - return mBuilder; - } - public interface LambdaOkDialogListener extends OkCancelDialogListener { default void onCancel() { //do nothing } } - public boolean isOpenSwitch() { - return switchTips != null && switchTips.isChecked(); - } - public interface OnKeyBackListener { void onBack(); } - /** - * 注释 见 {@link DialogManager#showOkCancelDialog( - *CharSequence, CharSequence, CharSequence, CharSequence, boolean, - * boolean, boolean, OkCancelDialogListener, OnKeyBackListener, boolean)} - */ - public static void setDialog(Dialog dialog, CharSequence title, CharSequence message, CharSequence okLabel, - CharSequence cancelLabel, boolean isCanCancel, boolean canceledOnTouchOutside, - final boolean isAutoHide, final OkCancelDialogListener l, - final OnKeyBackListener backListener, boolean dismissAfterBack) { - dialog.setCancelable(isCanCancel); - dialog.setCanceledOnTouchOutside(canceledOnTouchOutside); - - Window window = dialog.getWindow(); - window.setContentView(R.layout.layout_common_ok_cancel_dialog); - //标题 - TextView tvTilte = window.findViewById(R.id.tv_title); - if (tvTilte != null) { - if (!TextUtils.isEmpty(title)) { - tvTilte.setVisibility(View.VISIBLE); - tvTilte.setText(title); - } else { - tvTilte.setVisibility(View.GONE); - } - } - //内容 - TextView tip = window.findViewById(R.id.message); - tip.setText(message); - - TextView ok = window.findViewById(R.id.btn_ok); - if (!TextUtils.isEmpty(okLabel)) { - ok.setText(okLabel); - } - ok.setOnClickListener(v -> { - if (isAutoHide) { - dialog.dismiss(); - } - if (l != null) { - l.onOk(); - } - }); - - TextView cancel = window.findViewById(R.id.btn_cancel); - if (!TextUtils.isEmpty(cancelLabel)) { - cancel.setText(cancelLabel); - cancel.setOnClickListener(v -> { - if (isAutoHide) { - dialog.dismiss(); - } - if (l != null) { - l.onCancel(); - } - }); - } else { - cancel.setVisibility(View.GONE); + public static abstract class AbsOkDialogListener implements OkCancelDialogListener { + public void onCancel() { + //do nothing } - if (backListener != null) { - dialog.setOnKeyListener((dialog1, keyCode, event) -> { - if (keyCode == KeyEvent.KEYCODE_BACK && event.getRepeatCount() == 0 - && event.getAction() == KeyEvent.ACTION_DOWN) { - if (dismissAfterBack) { - dialog.dismiss(); - } - backListener.onBack(); - return true; - } - return false; - }); - } - } - - /** - * 注释 见 {@link DialogManager#showOkCancelDialog( - *CharSequence, CharSequence, CharSequence, CharSequence, boolean, - * boolean, boolean, OkCancelDialogListener, OnKeyBackListener, boolean)} - */ - public static void setHelloDialog(Dialog dialog, String avatar, int gender, CharSequence title, CharSequence message, CharSequence okLabel, - CharSequence cancelLabel, boolean isCanCancel, boolean canceledOnTouchOutside, - final boolean isAutoHide, final OkCancelDialogListener l, - final OnKeyBackListener backListener, boolean dismissAfterBack, Context context) { - dialog.setCancelable(isCanCancel); - dialog.setCanceledOnTouchOutside(canceledOnTouchOutside); - - Window window = dialog.getWindow(); - window.setContentView(R.layout.layout_newbie_hello_dialog); - //头像 - RoundedImageView ivAvatar = window.findViewById(R.id.iv_avatar); - if (ivAvatar != null) { - if (!TextUtils.isEmpty(avatar)) { - ivAvatar.setVisibility(View.VISIBLE); - GlideApp.with(context) - .load(avatar) -// .diskCacheStrategy(DiskCacheStrategy.ALL) -// .transforms(new CenterCrop(), -// new RoundedCorners(context.getResources().getDimensionPixelOffset(R.dimen.dp_6))) - .into(ivAvatar); - } else { - ivAvatar.setVisibility(View.GONE); - } - } - - //性别 - ImageView ivGender = window.findViewById(R.id.iv_gender); - ivGender.setImageDrawable(gender == 1 ? context.getResources().getDrawable(R.drawable.ic_gender_male) : context.getResources().getDrawable(R.drawable.ic_gender_female)); - //标题 - TextView tvTilte = window.findViewById(R.id.tv_title); - if (tvTilte != null) { - if (!TextUtils.isEmpty(title)) { - tvTilte.setVisibility(View.VISIBLE); - tvTilte.setText(title); - } else { - tvTilte.setVisibility(View.GONE); - } - } - //内容 - TextView tip = window.findViewById(R.id.message); - tip.setText(message); - - TextView ok = window.findViewById(R.id.btn_ok); - if (!TextUtils.isEmpty(okLabel)) { - ok.setText(okLabel); - } - ok.setOnClickListener(v -> { - if (isAutoHide) { - dialog.dismiss(); - } - if (l != null) { - l.onOk(); - } - }); - - TextView cancel = window.findViewById(R.id.btn_cancel); - if (!TextUtils.isEmpty(cancelLabel)) { - cancel.setText(cancelLabel); - cancel.setOnClickListener(v -> { - if (isAutoHide) { - dialog.dismiss(); - } - if (l != null) { - l.onCancel(); - } - }); - } else { - cancel.setVisibility(View.GONE); - } - - if (backListener != null) { - dialog.setOnKeyListener((dialog1, keyCode, event) -> { - if (keyCode == KeyEvent.KEYCODE_BACK && event.getRepeatCount() == 0 - && event.getAction() == KeyEvent.ACTION_DOWN) { - if (dismissAfterBack) { - dialog.dismiss(); - } - backListener.onBack(); - return true; - } - return false; - }); - } - } - - public static Dialog createDialog(Context context) { - AlertDialog.Builder builder = new BaseAlertDialogBuilder(context, R.style.MyAlertDialogStyle); - return builder.create(); + public abstract void onOk(); } } diff --git a/app/src/main/res/layout/activity_chat_room.xml b/app/src/main/res/layout/activity_chat_room.xml index 4564c8cb7..eef75406c 100644 --- a/app/src/main/res/layout/activity_chat_room.xml +++ b/app/src/main/res/layout/activity_chat_room.xml @@ -3,7 +3,7 @@ xmlns:app="http://schemas.android.com/apk/res-auto" android:layout_width="match_parent" android:layout_height="match_parent" - android:background="@drawable/bg_room_normal_default_pic"> + android:background="#150153"> 我的推荐位 厅管理 KTV中... - loading… + 加载中… 我是一只小萌新 (选填) diff --git a/core/src/diff_src_erban/java/com/yizhuan/xchat_android_core/manager/IMNetEaseManager.java b/core/src/diff_src_erban/java/com/yizhuan/xchat_android_core/manager/IMNetEaseManager.java index e8c18dfc9..5db59a0ae 100644 --- a/core/src/diff_src_erban/java/com/yizhuan/xchat_android_core/manager/IMNetEaseManager.java +++ b/core/src/diff_src_erban/java/com/yizhuan/xchat_android_core/manager/IMNetEaseManager.java @@ -1693,7 +1693,27 @@ public final class IMNetEaseManager { RoomInfo curRoomInfo = AvRoomDataManager.get().mCurrentRoomInfo; if (curRoomInfo == null) return; noticeEnterMessages(); + //个播模式房主进房自动上麦 + if (AvRoomDataManager.get().isSingleRoom() && AvRoomDataManager.get().isRoomOwner()) { + AvRoomDataManager.get().mIsNeedOpenMic = true; + AvRoomModel.get().upMicroPhone( + -1, + String.valueOf(AuthModel.get().getCurrentUid()), + String.valueOf(curRoomInfo.getRoomId()), + false, + new CallBack() { + @Override + public void onSuccess(String data) { + } + + @Override + public void onFail(int code, String error) { + + } + } + ); + } long uid = AuthModel.get().getCurrentUid(); if (curRoomInfo.getUid() == uid) { StatisticManager.Instance().onEventStart(BasicConfig.INSTANCE.getAppContext(), diff --git a/core/src/main/java/com/yizhuan/xchat_android_core/room/model/AvRoomModel.java b/core/src/main/java/com/yizhuan/xchat_android_core/room/model/AvRoomModel.java index dfc89e713..9d51efc2c 100644 --- a/core/src/main/java/com/yizhuan/xchat_android_core/room/model/AvRoomModel.java +++ b/core/src/main/java/com/yizhuan/xchat_android_core/room/model/AvRoomModel.java @@ -611,4 +611,11 @@ public class AvRoomModel extends RoomBaseModel implements IAvRoomModel { .compose(RxHelper.handleBeanData()) .compose(RxHelper.handleSchedulers()); } + + @Override + public Single getNextSingleRoomInfo() { + return mRoomService.getNextSingleRoomInfo(AvRoomDataManager.get().getRoomUid()) + .compose(RxHelper.handleBeanData()) + .compose(RxHelper.handleSchedulers()); + } } diff --git a/core/src/main/java/com/yizhuan/xchat_android_core/room/model/RoomBaseModel.java b/core/src/main/java/com/yizhuan/xchat_android_core/room/model/RoomBaseModel.java index 63ec32671..d85297b0c 100644 --- a/core/src/main/java/com/yizhuan/xchat_android_core/room/model/RoomBaseModel.java +++ b/core/src/main/java/com/yizhuan/xchat_android_core/room/model/RoomBaseModel.java @@ -1137,6 +1137,15 @@ public class RoomBaseModel extends BaseModel implements IRoomBaseModel { @GET("/roominsiderecommend/recommendRoomList") Single>> getRecommendRoomList(@Query("roomId") String roomId); + /** + * 获取个播随机下一个房间信息 + * + * @param roomUid + * @return + */ + @GET("/single/broadcast/room/page") + Single getNextSingleRoomInfo(@Query("roomUid") long roomUid); + } } diff --git a/core/src/main/java/com/yizhuan/xchat_android_core/room/model/inteface/IAvRoomModel.java b/core/src/main/java/com/yizhuan/xchat_android_core/room/model/inteface/IAvRoomModel.java index 450b4167f..e5171ee74 100644 --- a/core/src/main/java/com/yizhuan/xchat_android_core/room/model/inteface/IAvRoomModel.java +++ b/core/src/main/java/com/yizhuan/xchat_android_core/room/model/inteface/IAvRoomModel.java @@ -177,4 +177,6 @@ public interface IAvRoomModel extends IModel { Single cleanScreen(long roomUid, long uid); Single> getRecommendRoomList(String roomId); + + Single getNextSingleRoomInfo(); }