diff --git a/app/src/main/java/com/yizhuan/erban/avroom/BottomViewListenerWrapper.java b/app/src/main/java/com/yizhuan/erban/avroom/BottomViewListenerWrapper.java index a61feef64..814093410 100644 --- a/app/src/main/java/com/yizhuan/erban/avroom/BottomViewListenerWrapper.java +++ b/app/src/main/java/com/yizhuan/erban/avroom/BottomViewListenerWrapper.java @@ -33,20 +33,6 @@ public abstract class BottomViewListenerWrapper { } - /** - * 转成ktv模式 - */ - public void onTransformKTVClick() { - - } - - /** - * 转成游戏模式 - */ - public void onTransformGameClick() { - - } - /** * 点击排麦按钮 */ 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 235ae41cb..843188985 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 @@ -159,9 +159,6 @@ public class AVRoomActivity extends BaseMvpActivity giftList; private boolean isResume = true; - private int gvTipsIndex = 0; public static void start(Context context, long roomUid) { Intent intent = new Intent(context, AVRoomActivity.class); @@ -264,19 +260,6 @@ public class AVRoomActivity extends BaseMvpActivity { - mVsPartyRoomTip.setVisibility(View.GONE); - SharedPreferenceUtils.put(SHOW_PARTY_ROOM_FIRST_ENTER_TIP, false); - }); - mVsPartyRoomTip.setVisibility(View.VISIBLE); - } else { - mVsPartyRoomTip.setVisibility(View.GONE); - } - } private void setUserInfo(UserInfo userInfo) { if (avatarBg == null || avatar == null || nick == null) return; @@ -1275,45 +1241,6 @@ public class AVRoomActivity extends BaseMvpActivity parent.setVisibility(View.GONE)); - tv_skip_guide.setVisibility(VISIBLE); - ImageView iv_gv_bottom = parent.findViewById(R.id.iv_gv_bottom); - parent.setOnClickListener(v -> { - if (gvTipsIndex < topRes.length) { - iv_gv_top.setImageResource(topRes[gvTipsIndex]); - if (gvTipsIndex == topRes.length - 1) { - tv_skip_guide.setVisibility(View.GONE); - } else { - tv_skip_guide.setVisibility(VISIBLE); - } - } else { - parent.setVisibility(View.GONE); - } - if (gvTipsIndex < bottomRes.length) { - iv_gv_bottom.setImageResource(bottomRes[gvTipsIndex]); - } - gvTipsIndex++; - }); - } private void handlePmExitRoom() { EventBus.getDefault().post(new PmDismissAllLimitDialogEvent()); diff --git a/app/src/main/java/com/yizhuan/erban/avroom/dialog/RoomOperationDialog.java b/app/src/main/java/com/yizhuan/erban/avroom/dialog/RoomOperationDialog.java index 20b6acf94..8be35346f 100644 --- a/app/src/main/java/com/yizhuan/erban/avroom/dialog/RoomOperationDialog.java +++ b/app/src/main/java/com/yizhuan/erban/avroom/dialog/RoomOperationDialog.java @@ -4,36 +4,53 @@ import android.annotation.SuppressLint; import android.content.Context; import android.graphics.Color; import android.os.Bundle; +import android.util.DisplayMetrics; +import android.view.Display; +import android.view.WindowManager; import androidx.annotation.NonNull; import androidx.annotation.Nullable; - -import com.coorchice.library.utils.LogUtils; -import com.google.android.material.bottomsheet.BottomSheetDialog; - import androidx.recyclerview.widget.RecyclerView; -import android.util.DisplayMetrics; -import android.view.Display; -import android.view.View; -import android.view.WindowManager; - import com.chad.library.adapter.base.BaseQuickAdapter; import com.chad.library.adapter.base.BaseViewHolder; +import com.coorchice.library.utils.LogUtils; +import com.google.android.material.bottomsheet.BottomSheetDialog; +import com.tongdaxing.erban.sadmin.RoomSAdminManagerActivity; import com.yizhuan.erban.R; -import com.yizhuan.erban.module_hall.HallDataManager; +import com.yizhuan.erban.avroom.activity.CreatePKActivity; +import com.yizhuan.erban.avroom.activity.RoomSettingActivity; +import com.yizhuan.erban.avroom.anotherroompk.RoomPKCreateActivity; +import com.yizhuan.erban.avroom.giftvalue.GiftValueDialogUiHelper; +import com.yizhuan.erban.common.widget.dialog.DialogManager; import com.yizhuan.erban.ui.widget.marqueeview.Utils; import com.yizhuan.erban.ui.widget.recyclerview.decoration.ColorDecoration; import com.yizhuan.erban.ui.widget.recyclerview.layoutmanager.FullyGridLayoutManager; +import com.yizhuan.tutu.room_chat.activity.RoomInviteFansActivity; import com.yizhuan.xchat_android_core.manager.AvRoomDataManager; +import com.yizhuan.xchat_android_core.manager.IMNetEaseManager; +import com.yizhuan.xchat_android_core.redpackage.RedPackageModel; import com.yizhuan.xchat_android_core.room.bean.RoomInfo; +import com.yizhuan.xchat_android_core.room.giftvalue.GiftValueModel; +import com.yizhuan.xchat_android_core.room.model.AvRoomModel; +import com.yizhuan.xchat_android_core.room.model.HomePartyModel; +import com.yizhuan.xchat_android_core.room.queuing_mic.event.HasAnimationEffect; +import com.yizhuan.xchat_android_core.statistic.StatisticManager; +import com.yizhuan.xchat_android_core.statistic.protocol.StatisticsProtocol; +import com.yizhuan.xchat_android_core.super_admin.model.SuperAdminModel; import com.yizhuan.xchat_android_core.super_admin.util.SuperAdminUtil; +import com.yizhuan.xchat_android_core.utils.net.DontWarnObserver; +import com.yizhuan.xchat_android_core.utils.net.RxHelper; +import com.yizhuan.xchat_android_library.utils.SingleToastUtil; + +import org.greenrobot.eventbus.EventBus; import java.util.List; import butterknife.BindView; import butterknife.ButterKnife; import butterknife.Unbinder; +import io.reactivex.android.schedulers.AndroidSchedulers; /** @@ -88,8 +105,6 @@ public class RoomOperationDialog extends BottomSheetDialog { addRoomPKAction(optAdapter); addDatingAction(optAdapter); addRedPacketAction(optAdapter); - addKTVAction(optAdapter); - //addGameAction(optAdapter); addRoomLimit(optAdapter); addGiftEffectAction(optAdapter); addOpenOrClosePublicScreenAction(optAdapter); @@ -97,8 +112,6 @@ public class RoomOperationDialog extends BottomSheetDialog { addRoomSettingAction(optAdapter); addRedPackageSwitch(); addInviteFansOptAdapter(); - //addRoomModuleHallAction(optAdapter); - //addRoomManagerAction(optAdapter); addSuperAdminAction(optAdapter); rvOPtList.setAdapter(optAdapter); } @@ -124,9 +137,15 @@ public class RoomOperationDialog extends BottomSheetDialog { R.drawable.ic_room_opt_op_pk : R.drawable.ic_room_opt_in_pk; optAdapter.addData(new OptAction(icon, str, () -> { - if (onActionListener != null) { - onActionListener.onPKAction(); + if (AvRoomDataManager.get().isDatingMode()) { + SingleToastUtil.showToast("相亲中不可以开启PK模式!"); + return; } + if (AvRoomDataManager.get().isOpenAnotherPKMode()) { + SingleToastUtil.showToast("跨房PK中不可以开启PK模式!"); + return; + } + CreatePKActivity.start(getContext()); })); } @@ -152,9 +171,19 @@ public class RoomOperationDialog extends BottomSheetDialog { R.drawable.ic_room_opt_another_pk_in : R.drawable.ic_room_opt_another_pk_open; optAdapter.addData(new OptAction(icon, str, () -> { - if (onActionListener != null) { - onActionListener.onRoomPKAction(); + if (AvRoomDataManager.get().isDatingMode()) { + SingleToastUtil.showToast("相亲中不可以开启跨房PK!"); + return; } + if (AvRoomDataManager.get().isOpenPKMode()) { + SingleToastUtil.showToast("PK中不可以开启跨房PK!"); + return; + } + if (AvRoomDataManager.get().isOpenAnotherPKMode()) { + SingleToastUtil.showToast("正在跨房PK中..."); + return; + } + RoomPKCreateActivity.start(getContext()); })); } @@ -182,9 +211,31 @@ public class RoomOperationDialog extends BottomSheetDialog { R.drawable.ic_room_opt_op_dating : R.drawable.ic_room_opt_in_dating; optAdapter.addData(new OptAction(icon, str, () -> { - if (onActionListener != null) { - onActionListener.onDatingAction(); + if (AvRoomDataManager.get().isOpenPKMode()) { + SingleToastUtil.showToast("PK中不可以开启相亲模式!"); + return; } + if (AvRoomDataManager.get().isOpenAnotherPKMode()) { + SingleToastUtil.showToast("跨房PK中不可以开启相亲模式!"); + return; + } + new DialogManager(context).showOkCancelWithTitleDialog( + AvRoomDataManager.get().isDatingMode() ? "关闭相亲模式?" : "开启相亲模式?开启同时现有礼物值将被清空", + AvRoomDataManager.get().isDatingMode() ? "关闭" : "开启", + () -> { + HomePartyModel homePartyModel = new HomePartyModel(); + if (!AvRoomDataManager.get().isDatingMode()) { + homePartyModel.datingOpen(roomInfo.getUid()) + .compose(RxHelper.bindContext(context)) + .doOnError(e -> SingleToastUtil.showToast(e.getMessage())) + .subscribe(); + } else { + homePartyModel.datingClose(roomInfo.getUid()) + .compose(RxHelper.bindContext(context)) + .doOnError(e -> SingleToastUtil.showToast(e.getMessage())) + .subscribe(); + } + }); })); } @@ -210,47 +261,6 @@ public class RoomOperationDialog extends BottomSheetDialog { } - /** - * 添加KTV 操作 - * - * @param optAdapter - */ - private void addKTVAction(OptAdapter optAdapter) { - if (SuperAdminUtil.isSuperAdmin()) { - return; - } - //添加 - if (AvRoomDataManager.get().hasKTVPriv()) { - if (AvRoomDataManager.get().isOpenKTV()) { - optAdapter.addData(new OptAction(R.drawable.ic_room_opt_ktv_select_song, - getContext().getResources().getString(R.string.KTV_ing), - new OptAction.OnAction() { - @Override - public void onAction() { - if (onActionListener != null) { - onActionListener.onRoomKTV(); - } - } - })); - - } else { - //如果不是ktv房间,只有管理有ktv按钮 - if (AvRoomDataManager.get().isManager()) { - optAdapter.addData(new OptAction(R.drawable.ic_room_opt_ktv, - getContext().getResources().getString(R.string.KTV), - new OptAction.OnAction() { - @Override - public void onAction() { - if (onActionListener != null) { - onActionListener.onRoomKTV(); - } - } - })); - } - } - } - } - /** * 添加房间限制 * @@ -261,14 +271,7 @@ public class RoomOperationDialog extends BottomSheetDialog { if (AvRoomDataManager.get().isRoomOwner() && AvRoomDataManager.get().isCpRoom()) { optAdapter.addData(new OptAction(R.drawable.icon_room_limit, "进房限制", - new OptAction.OnAction() { - @Override - public void onAction() { - if (onActionListener != null) { - onActionListener.onRoomLimit(); - } - } - })); + () -> new RoomImposeDialog(context).show())); } } @@ -289,13 +292,11 @@ public class RoomOperationDialog extends BottomSheetDialog { R.drawable.icon_open_my_effect; optAdapter.addData(new OptAction(icon, text, - new OptAction.OnAction() { - @Override - public void onAction() { - if (onActionListener != null) { - onActionListener.onSwitchGiftEffect(); - } - } + () -> { + AvRoomDataManager.get().haveSelfChange = true; + AvRoomDataManager.get().mIsNeedGiftEffect = !AvRoomDataManager.get().mIsNeedGiftEffect; + SingleToastUtil.showToast(AvRoomDataManager.get().mIsNeedGiftEffect ? "礼物特效已开启" : "礼物特效已关闭"); + EventBus.getDefault().post(new HasAnimationEffect()); })); } @@ -324,16 +325,22 @@ public class RoomOperationDialog extends BottomSheetDialog { int icon = isCloseScreen ? R.drawable.icon_open_public_screen : R.drawable.icon_close_public_screen; - optAdapter.addData(new OptAction(icon, text, - new OptAction.OnAction() { - @Override - public void onAction() { - if (onActionListener != null) { - onActionListener.onSwitchPublicScreen(); - } + () -> { + SuperAdminModel superAdminModel = new SuperAdminModel(); + if (isCloseScreen) { + superAdminModel.roomOperate(SuperAdminModel.OPEN_PUBLIC_SCREEN).subscribe(); + } else { + superAdminModel.roomOperate(SuperAdminModel.CLOSE_PUBLIC_SCREEN).subscribe(); } + AvRoomModel.get().closeScreen(roomInfo.getRoomId(), + !isCloseScreen) + .compose(RxHelper.bindContext(context)) + .flatMap(data -> IMNetEaseManager.get().closeOpenScreen( + data.getRoomId(), data)) + .observeOn(AndroidSchedulers.mainThread()) + .subscribe(); })); } @@ -354,9 +361,13 @@ public class RoomOperationDialog extends BottomSheetDialog { R.drawable.ic_room_close_redpackage; optAdapter.addData(new OptAction(icon, text, () -> { - if (onActionListener != null) { - onActionListener.onSwitchRedPackage(); - } + RoomInfo roomInfo = AvRoomDataManager.get().mCurrentRoomInfo; + if (roomInfo == null) return; + RedPackageModel.INSTANCE.setRedPackageSwitch(AvRoomDataManager.get().getRoomUid()).subscribe(setIsNeedOpenRedPackage -> { + roomInfo.setServerRedEnvelopeSwitch(setIsNeedOpenRedPackage); + IMNetEaseManager.get().closeOpenRedPackage(roomInfo.getRoomId(), roomInfo); + SingleToastUtil.showToast(setIsNeedOpenRedPackage ? "全服红包通知已开启" : "全服红包通知已关闭"); + }); })); } @@ -370,9 +381,7 @@ public class RoomOperationDialog extends BottomSheetDialog { optAdapter.addData(new OptAction(R.drawable.ic_room_invite_fans, "邀请粉丝", () -> { - if (onActionListener != null) { - onActionListener.onInviteFans(); - } + RoomInviteFansActivity.start(context); })); } @@ -398,12 +407,52 @@ public class RoomOperationDialog extends BottomSheetDialog { getContext().getResources().getString( openGiftValue ? R.string.close_gift_value_text : R.string.open_gift_value_text), () -> { - if (onActionListener != null) { - onActionListener.onGiftValue(); + if (AvRoomDataManager.get().isCpRoom()) { + return; } + if (AvRoomDataManager.get().isDatingMode()) { + SingleToastUtil.showToast("相亲模式需开启礼物值"); + return; + } + if (AvRoomDataManager.get().isOpenKTV()) { + SingleToastUtil.showToast(R.string.before_open_gift_value_should_close_ktv_model); + return; + } + //开启礼物值不需要弹框 + if (!AvRoomDataManager.get().isShowGiftValue()) { + handleOpenGiftValue(); + return; + } + if (!GiftValueDialogUiHelper.get().isNeedConfirmDialog( + GiftValueDialogUiHelper.TYPE_CLOSE_SHOW_GIFT_VALUE)) { + handleOpenGiftValue(); + return; + } + GiftValueDialogUiHelper.get().showGiftValueDialog(context, null, + GiftValueDialogUiHelper.TYPE_CLOSE_SHOW_GIFT_VALUE, + this::handleOpenGiftValue); })); } + private void handleOpenGiftValue() { + boolean isOpen = !AvRoomDataManager.get().isShowGiftValue(); + GiftValueModel.get().openGiftValue(isOpen) + .compose(RxHelper.bindContext(context)) + .subscribe(new DontWarnObserver() { + @Override + public void accept(String s, String error) { + super.accept(s, error); + if (error != null) { + SingleToastUtil.showToast(error); + } else { + StatisticManager.Instance().onEvent( + StatisticsProtocol.Event.EVENT_ROOM_GIFTVALUE_SWITCH, + "礼物值开关,区分状态:" + isOpen); + } + } + }); + } + /** * 房间设置 * @@ -415,56 +464,10 @@ public class RoomOperationDialog extends BottomSheetDialog { } if (AvRoomDataManager.get().isManager()) { optAdapter.addData(new OptAction(R.drawable.icon_room_setting, - getContext().getResources().getString(R.string.room_setting), () -> { - if (onActionListener != null) { - onActionListener.onSetting(); - } - })); + getContext().getResources().getString(R.string.room_setting), () -> RoomSettingActivity.start(getContext()))); } } - /** - * 房间管理员 - * - * @param optAdapter - */ - private void addRoomManagerAction(OptAdapter optAdapter) { - if (!AvRoomDataManager.get().isRoomOwner() || AvRoomDataManager.get().isCpRoom()) { - return; - } - optAdapter.addData(new OptAction(R.drawable.icon_room_admin, - getContext().getResources().getString(R.string.team_admin), - new OptAction.OnAction() { - @Override - public void onAction() { - if (onActionListener != null) { - onActionListener.onRoomAdmin(); - } - } - })); - } - - /** - * 厅管理 - */ - private void addRoomModuleHallAction(OptAdapter optAdapter) { - if (SuperAdminUtil.isSuperAdmin()) { - return; - } - RoomInfo roomInfo = AvRoomDataManager.get().mCurrentRoomInfo; - if (roomInfo == null || HallDataManager.get().getOwnerUid() != AvRoomDataManager.get().mCurrentRoomInfo.getUid()) - return; - - optAdapter.addData(new OptAction(R.drawable.icon_room_module_hall, - getContext().getResources().getString(R.string.label_room_hall_manage), - () -> { - if (onActionListener != null) { - onActionListener.onRoomHall(); - } - } - )); - } - /** * 超管管理 */ @@ -476,9 +479,7 @@ public class RoomOperationDialog extends BottomSheetDialog { getContext().getResources().getString(R.string.sa_label_room_super_a_manager), true, () -> { - if (onActionListener != null) { - onActionListener.onSuperAdmin(); - } + RoomSAdminManagerActivity.start(context); } )); } @@ -495,36 +496,9 @@ public class RoomOperationDialog extends BottomSheetDialog { } public interface OnActionListener { - void onSwitchGiftEffect(); - - void onSwitchPublicScreen(); - - void onSetting(); - - void onRoomLimit(); - - void onRoomAdmin(); - - void onRoomKTV(); - - void onPKAction(); - - void onRoomPKAction(); - - void onDatingAction(); void onRedPackageAction(); - void onRoomHall(); - - void onGiftValue(); - - void onSuperAdmin(); - - void onSwitchRedPackage(); - - void onInviteFans(); - } static class OptAction { @@ -552,7 +526,7 @@ public class RoomOperationDialog extends BottomSheetDialog { private class OptAdapter extends BaseQuickAdapter { - private Context context; + private final Context context; OptAdapter(Context context, @Nullable List data) { super(R.layout.item_room_opt_dialog, data); @@ -565,12 +539,9 @@ public class RoomOperationDialog extends BottomSheetDialog { .setImageResource(R.id.iv_icon, item.icon) .setTextColor(R.id.tv_name, context.getResources().getColor( item.isAppColor ? R.color.appColor : R.color.white_transparent_50)); - helper.itemView.setOnClickListener(new View.OnClickListener() { - @Override - public void onClick(View v) { - item.onAction.onAction(); - dismiss(); - } + helper.itemView.setOnClickListener(v -> { + item.onAction.onAction(); + dismiss(); }); } } diff --git a/app/src/main/java/com/yizhuan/erban/avroom/fragment/HomePartyFragment.java b/app/src/main/java/com/yizhuan/erban/avroom/fragment/HomePartyFragment.java index 1ac8055a3..8e774d59f 100644 --- a/app/src/main/java/com/yizhuan/erban/avroom/fragment/HomePartyFragment.java +++ b/app/src/main/java/com/yizhuan/erban/avroom/fragment/HomePartyFragment.java @@ -66,7 +66,6 @@ import org.greenrobot.eventbus.EventBus; import org.greenrobot.eventbus.Subscribe; import org.greenrobot.eventbus.ThreadMode; -import java.io.IOException; import java.lang.reflect.Field; import java.util.ArrayList; import java.util.List; @@ -575,7 +574,6 @@ public class HomePartyFragment extends AbsRoomFragment implements View.OnClickLi public void onRoomOnlineNumberSuccess(int onlineNumber) { super.onRoomOnlineNumberSuccess(onlineNumber); updateOnlineNumberView(onlineNumber); - // setIdOnlineData(); } /** @@ -650,34 +648,6 @@ public class HomePartyFragment extends AbsRoomFragment implements View.OnClickLi gameMainBinding.ivKtvTreasureBox.setVisibility(View.GONE); } - /** - *  * 提示音 - *

- *  * @param mContext - *

- *   - */ - - private void playFromRawFile(Context mContext, int res) { - try { - MediaPlayer player = new MediaPlayer(); - AssetFileDescriptor file = mContext.getResources().openRawResourceFd(res); - try { - player.setDataSource(file.getFileDescriptor(), file.getStartOffset(), file.getLength()); - file.close(); - if (!player.isPlaying()) { - player.prepare(); - player.start(); - } - } catch (IOException e) { - player = null; - } - } catch (Exception e) { - e.printStackTrace(); - } - - } - public void dismissGiftDialog() { if (roomFragment != null) { roomFragment.dismissGiftDialog(); diff --git a/app/src/main/java/com/yizhuan/erban/avroom/fragment/HomePartyRoomFragment.java b/app/src/main/java/com/yizhuan/erban/avroom/fragment/HomePartyRoomFragment.java index 83478c27e..cb3ebd772 100644 --- a/app/src/main/java/com/yizhuan/erban/avroom/fragment/HomePartyRoomFragment.java +++ b/app/src/main/java/com/yizhuan/erban/avroom/fragment/HomePartyRoomFragment.java @@ -43,17 +43,13 @@ import com.netease.nimlib.sdk.chatroom.model.ChatRoomMessage; import com.netease.nimlib.sdk.chatroom.model.ChatRoomStatusChangeData; import com.orhanobut.logger.Logger; import com.tbruyelle.rxpermissions2.RxPermissions; -import com.tongdaxing.erban.sadmin.RoomSAdminManagerActivity; import com.trello.rxlifecycle3.android.FragmentEvent; import com.yizhuan.erban.R; import com.yizhuan.erban.avroom.BottomViewListenerWrapper; import com.yizhuan.erban.avroom.ButtonItemFactory; import com.yizhuan.erban.avroom.SoftKeyBoardListener; import com.yizhuan.erban.avroom.activity.AVRoomActivity; -import com.yizhuan.erban.avroom.activity.CreatePKActivity; import com.yizhuan.erban.avroom.activity.RoomInviteActivity; -import com.yizhuan.erban.avroom.activity.RoomManagerListActivity; -import com.yizhuan.erban.avroom.activity.RoomSettingActivity; import com.yizhuan.erban.avroom.activity.RoomTitleEditActivity; import com.yizhuan.erban.avroom.adapter.BaseMicroViewAdapter; import com.yizhuan.erban.avroom.adapter.CpMicroViewAdapter; @@ -61,7 +57,6 @@ import com.yizhuan.erban.avroom.adapter.DatingMicroViewAdapter; import com.yizhuan.erban.avroom.adapter.KtvMicroViewAdapter; import com.yizhuan.erban.avroom.adapter.MicroViewAdapter; import com.yizhuan.erban.avroom.adapter.OnMicroItemClickListener; -import com.yizhuan.erban.avroom.anotherroompk.RoomPKCreateActivity; import com.yizhuan.erban.avroom.anotherroompk.RoomPkFinishDialog; import com.yizhuan.erban.avroom.anotherroompk.RoomPkForceFinishDialog; import com.yizhuan.erban.avroom.anotherroompk.RoomPkReceivedDialog; @@ -70,7 +65,6 @@ import com.yizhuan.erban.avroom.dialog.MicQueueDialog; import com.yizhuan.erban.avroom.dialog.PKMicQueueDialog; import com.yizhuan.erban.avroom.dialog.PKResultDialog; import com.yizhuan.erban.avroom.dialog.PKScoreBoardDialog; -import com.yizhuan.erban.avroom.dialog.RoomImposeDialog; import com.yizhuan.erban.avroom.dialog.RoomOperationDialog; import com.yizhuan.erban.avroom.firstcharge.FirstChargeDialog; import com.yizhuan.erban.avroom.firstcharge.FirstChargePrizeDialog; @@ -78,7 +72,6 @@ import com.yizhuan.erban.avroom.giftvalue.GiftValueDialogUiHelper; import com.yizhuan.erban.avroom.helper.RoomViewModel; import com.yizhuan.erban.avroom.ktv.KtvHelper; import com.yizhuan.erban.avroom.ktv.KtvMusicManager; -import com.yizhuan.erban.avroom.ktv.KtvSelectSongActivity; import com.yizhuan.erban.avroom.ktv.KtvSongListActivity; import com.yizhuan.erban.avroom.presenter.HomePartyPresenter; import com.yizhuan.erban.avroom.redpackage.RedPackageSendDialog; @@ -96,7 +89,6 @@ import com.yizhuan.erban.event.OpenRoomIntroEvent; import com.yizhuan.erban.friend.view.SelectFriendActivity; import com.yizhuan.erban.home.adapter.RoomActAdapter; import com.yizhuan.erban.miniworld.activity.MiniWorldGuestPageActivity; -import com.yizhuan.erban.module_hall.hall.activity.ModuleHallActivity; import com.yizhuan.erban.treasure_box.activity.TreasureBoxActivity; import com.yizhuan.erban.treasure_box.activity.TreasureBoxHonourActivity; import com.yizhuan.erban.treasure_box.fragment.ChooseTreasureBoxDialogFragment; @@ -117,7 +109,6 @@ import com.yizhuan.erban.ui.widget.rollviewpager.hintview.ColorPointHintView; import com.yizhuan.erban.utils.KeyBoardUtils; import com.yizhuan.erban.utils.UserUtils; import com.yizhuan.tutu.music.widget.MusicPlayerView; -import com.yizhuan.tutu.room_chat.activity.RoomInviteFansActivity; import com.yizhuan.tutu.room_chat.activity.RoomMsgActivity; import com.yizhuan.xchat_android_constants.XChatConstants; import com.yizhuan.xchat_android_core.Constants; @@ -150,7 +141,6 @@ import com.yizhuan.xchat_android_core.mentoring_relationship.model.MentoringRela import com.yizhuan.xchat_android_core.miniworld.bean.MiniWorldInWorldInfo; import com.yizhuan.xchat_android_core.music.model.PlayerModel; import com.yizhuan.xchat_android_core.pay.event.FirstChargeEvent; -import com.yizhuan.xchat_android_core.redpackage.RedPackageModel; import com.yizhuan.xchat_android_core.room.activitytimer.ActivityTimerEvent; import com.yizhuan.xchat_android_core.room.anotherroompk.ShowGiftDialogEvent; import com.yizhuan.xchat_android_core.room.anotherroompk.ShowUserInfoDialogEvent; @@ -159,7 +149,6 @@ import com.yizhuan.xchat_android_core.room.event.DatingSelectUserEvent; import com.yizhuan.xchat_android_core.room.event.RoomClearScreenEvent; import com.yizhuan.xchat_android_core.room.face.DynamicFaceModel; import com.yizhuan.xchat_android_core.room.face.FaceInfo; -import com.yizhuan.xchat_android_core.room.giftvalue.GiftValueModel; import com.yizhuan.xchat_android_core.room.giftvalue.helper.GiftValueMrg; import com.yizhuan.xchat_android_core.room.ktv.KtvModel; import com.yizhuan.xchat_android_core.room.ktv.bean.MusicInfo; @@ -173,7 +162,6 @@ import com.yizhuan.xchat_android_core.room.pk.event.PKStateEvent; import com.yizhuan.xchat_android_core.room.pk.model.PkModel; import com.yizhuan.xchat_android_core.room.queue.bean.MicMemberInfo; import com.yizhuan.xchat_android_core.room.queuing_mic.bean.RespQueuingMicListInfo; -import com.yizhuan.xchat_android_core.room.queuing_mic.event.HasAnimationEffect; import com.yizhuan.xchat_android_core.room.queuing_mic.event.QueuingMicEmptyEvent; import com.yizhuan.xchat_android_core.room.queuing_mic.event.QueuingMicNotEmptyEvent; import com.yizhuan.xchat_android_core.share.bean.SessionType; @@ -187,7 +175,6 @@ import com.yizhuan.xchat_android_core.user.bean.BaseInfo; import com.yizhuan.xchat_android_core.user.bean.UserInfo; import com.yizhuan.xchat_android_core.utils.CurrentTimeUtils; import com.yizhuan.xchat_android_core.utils.net.BeanObserver; -import com.yizhuan.xchat_android_core.utils.net.DontWarnObserver; import com.yizhuan.xchat_android_library.base.factory.CreatePresenter; import com.yizhuan.xchat_android_library.net.rxnet.utils.RxNetWorkUtils; import com.yizhuan.xchat_android_library.rxbus.RxBus; @@ -242,7 +229,6 @@ public class HomePartyRoomFragment extends BaseMvpFragment IMNetEaseManager.get().closeOpenScreen( - data.getRoomId(), data)) - .observeOn(AndroidSchedulers.mainThread()) - .subscribe(); - } - - @SuppressLint("CheckResult") - @Override - public void onSwitchRedPackage() { - RoomInfo roomInfo = AvRoomDataManager.get().mCurrentRoomInfo; - if (roomInfo == null) return; - RedPackageModel.INSTANCE.setRedPackageSwitch(AvRoomDataManager.get().getRoomUid()).subscribe(setIsNeedOpenRedPackage -> { - roomInfo.setServerRedEnvelopeSwitch(setIsNeedOpenRedPackage); - IMNetEaseManager.get().closeOpenRedPackage(roomInfo.getRoomId(), roomInfo); - SingleToastUtil.showToastShort(setIsNeedOpenRedPackage ? "全服红包通知已开启" : "全服红包通知已关闭"); - }); - } - - //邀请粉丝 - @Override - public void onInviteFans() { - RoomInviteFansActivity.start(mContext); - } - - @Override - public void onSetting() { - RoomSettingActivity.start(mContext); - } - - @Override - public void onRoomLimit() { - new RoomImposeDialog(getActivity()).show(); - } - - @Override - public void onRoomAdmin() { - RoomManagerListActivity.start(mContext); - } - - @Override - public void onRoomKTV() { - if (!isKtvMode) { - - RoomInfo roomInfo = AvRoomDataManager.get().mCurrentRoomInfo; - if (roomInfo == null) return; - - if (roomInfo.isLeaveMode()) { - SingleToastUtil.showToast("开启ktv请先关闭离开模式"); - return; - } - - if (AvRoomDataManager.get().isCpRoom()) { - StatisticManager.Instance().onEvent(StatisticsProtocol.Event.roomcp_ktv_open_click, "开启KTV"); - } - String giftValueTips = ""; - if (AvRoomDataManager.get().isShowGiftValue()) { - giftValueTips = "\n开启KTV模式默认关闭礼物值"; - } - getDialogManager().showOkCancelWithTitleDialog( - isGameMode ? "当前正在游戏中,切换至KTV后将会关闭游戏模式,确认切换至KTV吗?" : - "是否开启KTV功能?\n开启后所有麦上用户可通过KTV入口点歌" + giftValueTips, - HomePartyRoomFragment.this::openKtvModelByRequest); - } else { - if (AvRoomDataManager.get().isCpRoom()) { - StatisticManager.Instance().onEvent(StatisticsProtocol.Event.roomcp_ktv_choosesong_click, "KTV点唱"); - } - - KtvSelectSongActivity.start(mContext, false); - } - } - - @Override - public void onPKAction() { - if (AvRoomDataManager.get().isDatingMode()) { - SingleToastUtil.showToast("相亲中不可以开启PK模式!"); - return; - } - if (AvRoomDataManager.get().isOpenAnotherPKMode()) { - SingleToastUtil.showToast("跨房PK中不可以开启PK模式!"); - return; - } - CreatePKActivity.start(getContext()); - } - - @Override - public void onRoomPKAction() { - if (AvRoomDataManager.get().isDatingMode()) { - SingleToastUtil.showToast("相亲中不可以开启跨房PK!"); - return; - } - if (AvRoomDataManager.get().isOpenPKMode()) { - SingleToastUtil.showToast("PK中不可以开启跨房PK!"); - return; - } - if (AvRoomDataManager.get().isOpenAnotherPKMode()) { - SingleToastUtil.showToast("正在跨房PK中..."); - return; - } - RoomPKCreateActivity.start(getContext()); - } - - @Override - public void onDatingAction() { - if (AvRoomDataManager.get().isOpenPKMode()) { - SingleToastUtil.showToast("PK中不可以开启相亲模式!"); - return; - } - if (AvRoomDataManager.get().isOpenAnotherPKMode()) { - SingleToastUtil.showToast("跨房PK中不可以开启相亲模式!"); - return; - } - if (getMvpPresenter() == null) return; - getDialogManager().showOkCancelWithTitleDialog( - AvRoomDataManager.get().isDatingMode() ? "关闭相亲模式?" : "开启相亲模式?开启同时现有礼物值将被清空", - AvRoomDataManager.get().isDatingMode() ? "关闭" : "开启", - () -> getMvpPresenter().datingOpen()); - } - - @Override - public void onRedPackageAction() { - redPackageSendDialog = new RedPackageSendDialog(); - redPackageSendDialog.show(getActivity()); - StatisticManager.Instance().onEvent(StatisticsProtocol.Event.EVENT_ROOM_SENDHONGBAO_CLICK, - "进入发红包页面"); - } - - @Override - public void onRoomHall() { - StatisticManager.Instance().onEvent(StatisticsProtocol.Event.EVENT_ROOM_MY_HALL_CLICK, "厅管理入口"); - ModuleHallActivity.start(mContext); - } - - @Override - public void onGiftValue() { - if (AvRoomDataManager.get().isCpRoom()) { - return; - } - if (AvRoomDataManager.get().isDatingMode()) { - SingleToastUtil.showToast("相亲模式需开启礼物值"); - return; - } - if (AvRoomDataManager.get().isOpenKTV()) { - SingleToastUtil.showToast(mContext.getResources().getString( - R.string.before_open_gift_value_should_close_ktv_model)); - return; - } - //开启礼物值不需要弹框 - if (!AvRoomDataManager.get().isShowGiftValue()) { - handleOpenGiftValue(); - return; - } - if (!GiftValueDialogUiHelper.get().isNeedConfirmDialog( - GiftValueDialogUiHelper.TYPE_CLOSE_SHOW_GIFT_VALUE)) { - handleOpenGiftValue(); - return; - } - GiftValueDialogUiHelper.get().showGiftValueDialog(mContext, getDialogManager(), - GiftValueDialogUiHelper.TYPE_CLOSE_SHOW_GIFT_VALUE, - this::handleOpenGiftValue); - - } - - private void handleOpenGiftValue() { - boolean isOpen = !AvRoomDataManager.get().isShowGiftValue(); - GiftValueModel.get().openGiftValue(isOpen) - .compose(bindUntilEvent(FragmentEvent.DESTROY_VIEW)) - .subscribe(new DontWarnObserver() { - @Override - public void accept(String s, String error) { - super.accept(s, error); - if (error != null) { - SingleToastUtil.showToast(error); - } else { - StatisticManager.Instance().onEvent( - StatisticsProtocol.Event.EVENT_ROOM_GIFTVALUE_SWITCH, - "礼物值开关,区分状态:" + isOpen); - } - } - }); - } - - @Override - public void onSuperAdmin() { - RoomSAdminManagerActivity.start(mContext); - } - - + dialog.setOnActionListener(() -> { + redPackageSendDialog = new RedPackageSendDialog(); + redPackageSendDialog.show(getActivity()); + StatisticManager.Instance().onEvent(StatisticsProtocol.Event.EVENT_ROOM_SENDHONGBAO_CLICK, + "进入发红包页面"); }); dialog.show(); } - /** * 点击排麦按钮 */ @@ -2975,11 +2746,6 @@ public class HomePartyRoomFragment extends BaseMvpFragment { }); } - public void datingOpen(){ - final RoomInfo roomInfo = AvRoomDataManager.get().mCurrentRoomInfo; - if (roomInfo == null) return; - if (!AvRoomDataManager.get().isDatingMode()){ - mHomePartyMode.datingOpen(roomInfo.getUid()) - .compose(bindToLifecycle()) - .doOnError(e -> SingleToastUtil.showToast(e.getMessage())) - .subscribe(); - } - else { - mHomePartyMode.datingClose(roomInfo.getUid()) - .compose(bindToLifecycle()) - .doOnError(e -> SingleToastUtil.showToast(e.getMessage())) - .subscribe(); - } - - } - public void datingNext() { final RoomInfo roomInfo = AvRoomDataManager.get().mCurrentRoomInfo; if (roomInfo == null) return; diff --git a/app/src/main/java/com/yizhuan/erban/avroom/widget/BottomView.java b/app/src/main/java/com/yizhuan/erban/avroom/widget/BottomView.java index 493d9324c..7bbad4f8a 100644 --- a/app/src/main/java/com/yizhuan/erban/avroom/widget/BottomView.java +++ b/app/src/main/java/com/yizhuan/erban/avroom/widget/BottomView.java @@ -75,8 +75,6 @@ public class BottomView extends RelativeLayout implements View.OnClickListener { private ImageView remoteMute; private LinearLayout faceLayout; private LinearLayout micLayout; - // private ImageView ivRoomKtv; - private ImageView ivRoomGame; private ImageView iconMicQueue; private ImageView iconRoomMsg; @@ -111,7 +109,6 @@ public class BottomView extends RelativeLayout implements View.OnClickListener { sendGift = findViewById(R.id.icon_room_send_gift); sendMagic = findViewById(R.id.icon_room_send_magic); remoteMute = findViewById(R.id.icon_room_open_remote_mic); - ivRoomGame = findViewById(R.id.icon_room_game); faceLayout = findViewById(R.id.room_face_layout); micLayout = findViewById(R.id.room_mic_layout); @@ -126,8 +123,6 @@ public class BottomView extends RelativeLayout implements View.OnClickListener { sendGift.setOnClickListener(this); remoteMute.setOnClickListener(this); sendMagic.setOnClickListener(this); -// ivRoomKtv.setOnClickListener(this); - ivRoomGame.setOnClickListener(this); iconMicQueue.setOnClickListener(this); iconRoomMsg.setOnClickListener(this); @@ -280,30 +275,9 @@ public class BottomView extends RelativeLayout implements View.OnClickListener { R.drawable.icon_room_mic_queue_not_empty); } - public void showGameBottom() { - if (MarketVerifyModel.get().isMarketChecking()) { - ivRoomGame.setVisibility(GONE); - } else { - ivRoomGame.setVisibility((AvRoomDataManager.get().isCpRoom() && AvRoomDataManager.get().isRoomOwner()) ? VISIBLE : GONE); - } - } - - public void setGameClose() { - ivRoomGame.setImageResource(R.drawable.icon_room_game_close); - } - - public void setGameOpen() { - ivRoomGame.setImageResource(R.drawable.icon_room_game); - } public void showKtvBottom(boolean isShow) { -// ivRoomKtv.setImageResource(isShow ? R.drawable.ic_ktv_select : R.drawable.icon_room_ktv_entrance); - boolean hasKTVPriv = false; - RoomInfo roomInfo = AvRoomDataManager.get().mCurrentRoomInfo; - if (roomInfo != null) { - hasKTVPriv = roomInfo.hasKTVPriv; - } - // ivRoomKtv.setVisibility(((isShow || AvRoomDataManager.get().isManager()) && hasKTVPriv) ? VISIBLE : GONE); + } @@ -350,22 +324,12 @@ public class BottomView extends RelativeLayout implements View.OnClickListener { wrapper.onMoreBtnClick(); } break; -// case R.id.icon_room_ktv: -// if (wrapper != null) { -// wrapper.onTransformKTVClick(); -// } -// break; case R.id.icon_mic_queue: case R.id.iv_queuing_micro://注意这里是在HomePartyRoomFragment调用的 if (wrapper != null) { wrapper.onMicQueueClick(); } break; - case R.id.icon_room_game: - if (wrapper != null) { - wrapper.onTransformGameClick(); - } - break; case R.id.iv_room_message: if (wrapper != null) { wrapper.onRoomMessageClick(); @@ -383,10 +347,6 @@ public class BottomView extends RelativeLayout implements View.OnClickListener { llSendMsg.setVisibility(isIcon ? VISIBLE : GONE); } - public View getSendGiftView() { - return sendGift; - } - private void dismissMsgPopupWindow() { if (msgTipPopupWindow != null) { try { diff --git a/app/src/main/res/layout/layout_bottom_view.xml b/app/src/main/res/layout/layout_bottom_view.xml index 5cd233bee..6f128a68a 100644 --- a/app/src/main/res/layout/layout_bottom_view.xml +++ b/app/src/main/res/layout/layout_bottom_view.xml @@ -112,15 +112,6 @@ android:scaleType="fitXY" android:src="@drawable/icon_send_magic" /> - -