新增BaseRoomFragment
This commit is contained in:
@@ -30,8 +30,6 @@ import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.core.content.ContextCompat;
|
||||
import androidx.fragment.app.DialogFragment;
|
||||
import androidx.fragment.app.Fragment;
|
||||
import androidx.viewpager.widget.ViewPager;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
@@ -59,7 +57,6 @@ import com.yizhuan.erban.base.BaseMvpActivity;
|
||||
import com.yizhuan.erban.common.widget.CircleImageView;
|
||||
import com.yizhuan.erban.common.widget.CustomImageSpan;
|
||||
import com.yizhuan.erban.common.widget.dialog.DialogManager;
|
||||
import com.yizhuan.erban.home.adapter.FragmentViewPagerAdapter;
|
||||
import com.yizhuan.erban.ui.patriarch.help.LimitEnterRoomHelper;
|
||||
import com.yizhuan.erban.ui.pay.ChargeActivity;
|
||||
import com.yizhuan.erban.ui.user.UserInfoActivity;
|
||||
@@ -152,10 +149,8 @@ public class AVRoomActivity extends BaseMvpActivity<IAvRoomView, AvRoomPresenter
|
||||
public static final int FROM_TYPE_GAME_RECOMMEND = 8;//赛事详情进房
|
||||
public static final int FROM_TYPE_ROOM_PK = 9;//跨房PK进房
|
||||
private static final String TAG = "AVRoomActivity";
|
||||
private static final String SHOW_PARTY_ROOM_FIRST_ENTER_TIP = "show_party_room_first_enter_tip";
|
||||
private static final int SHOW_RED_DIALOG_MAX = 10;
|
||||
public static boolean isPKModel = false;
|
||||
boolean isLast = true;
|
||||
/**
|
||||
* 管理限制进房
|
||||
*/
|
||||
@@ -166,7 +161,6 @@ public class AVRoomActivity extends BaseMvpActivity<IAvRoomView, AvRoomPresenter
|
||||
private SVGAImageView svgaRoomBg;
|
||||
private RelativeLayout finishLayout;
|
||||
private ViewStub mVsRoomOffline;
|
||||
private ViewStub mVsPartyRoomTip;
|
||||
private ImageView avatarBg;
|
||||
private TextView nick;
|
||||
private CircleImageView avatar;
|
||||
@@ -179,11 +173,6 @@ public class AVRoomActivity extends BaseMvpActivity<IAvRoomView, AvRoomPresenter
|
||||
private ImageView ivHeadWear;
|
||||
private View shade;
|
||||
private MonsterDialog monsterDialog;
|
||||
private ViewPager viewpager;
|
||||
private List<Fragment> fragmentList = new ArrayList<>();
|
||||
;
|
||||
private FragmentViewPagerAdapter mAdapter;
|
||||
private int pos = 0;
|
||||
private LoadingDialog mLoadingDialog;
|
||||
private List<RedPackageOpenDialog> openDialogs;
|
||||
private String[] bgPicture = new String[]{""};
|
||||
@@ -370,11 +359,8 @@ public class AVRoomActivity extends BaseMvpActivity<IAvRoomView, AvRoomPresenter
|
||||
svgaRoomBg = findViewById(R.id.svga_image_view_bg);
|
||||
mVsRoomOffline = findViewById(R.id.vs_room_offline);
|
||||
mVsNobleOpen = findViewById(R.id.vs_noble_open_notice);
|
||||
mVsPartyRoomTip = findViewById(R.id.vs_hiparty_room_tips);
|
||||
viewpager = findViewById(R.id.viewpager);
|
||||
shade = findViewById(R.id.view);
|
||||
|
||||
|
||||
IMNetEaseManager.get().getChatRoomEventObservable()
|
||||
.compose(bindToLifecycle())
|
||||
.subscribe(this::onRoomEventReceive);
|
||||
@@ -384,52 +370,6 @@ public class AVRoomActivity extends BaseMvpActivity<IAvRoomView, AvRoomPresenter
|
||||
}
|
||||
|
||||
EventBus.getDefault().register(this);
|
||||
|
||||
mAdapter = new FragmentViewPagerAdapter(getSupportFragmentManager(), fragmentList);
|
||||
viewpager.addOnPageChangeListener(new ViewPager.OnPageChangeListener() {
|
||||
@Override
|
||||
public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPageSelected(int position) {
|
||||
dismissLoadingDialog();
|
||||
pos = position;
|
||||
List<SimplePartyRoomInfo> roomUidList = AvRoomDataManager.get().getRoomUidList();
|
||||
if (fragmentList != null && fragmentList.size() > 0
|
||||
&& roomUidList != null && roomUidList.size() > 0) {
|
||||
showLoadingDialog();
|
||||
mCurrentFragment = (HomePartyFragment) fragmentList.get(position);
|
||||
|
||||
//嗨聊房切换时清除公屏信息
|
||||
EventBus.getDefault().post(new RoomClearScreenEvent());
|
||||
|
||||
roomUid = roomUidList.get(position).getUid();
|
||||
StatisticManager.Instance().onEvent(StatisticsProtocol.Event.room_hiparty_slide, "房间内-滑动切换嗨聊房");
|
||||
updateRoomInfo();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPageScrollStateChanged(int state) {
|
||||
if (state == 2) {
|
||||
isLast = false;
|
||||
} else if (state == 0 && isLast) {
|
||||
//此处为你需要的情况,再加入当前页码判断可知道是第一页还是最后一页
|
||||
if (fragmentList.size() != 1 && pos == (fragmentList.size() - 1)) {
|
||||
showLoadingDialog();
|
||||
viewpager.setCurrentItem(0);
|
||||
} else if (fragmentList.size() != 1 && pos == 0) {
|
||||
showLoadingDialog();
|
||||
viewpager.setCurrentItem(fragmentList.size() - 1);
|
||||
}
|
||||
} else {
|
||||
isLast = true;
|
||||
}
|
||||
}
|
||||
});
|
||||
viewpager.setAdapter(mAdapter);
|
||||
|
||||
//第一次进来
|
||||
if (AvRoomDataManager.get().isFirstEnterRoomOrChangeOtherRoom(roomUid)) {
|
||||
getDialogManager().showProgressDialog(this, getString(R.string.waiting_text), false);
|
||||
@@ -616,15 +556,10 @@ public class AVRoomActivity extends BaseMvpActivity<IAvRoomView, AvRoomPresenter
|
||||
RoomInfo roomInfo = AvRoomDataManager.get().mCurrentRoomInfo;
|
||||
if (roomInfo != null) {
|
||||
setBackBg(this, roomInfo, svgaRoomBg, bgPicture, shade);
|
||||
if (mCurrentFragment == null) {
|
||||
fragmentList.clear();
|
||||
mCurrentFragment = HomePartyFragment.newInstance(roomUid, isRoomMin);
|
||||
fragmentList.add(mCurrentFragment);
|
||||
}
|
||||
if (fragmentList != null && fragmentList.size() > 0) {
|
||||
mAdapter.setmFragmentList(fragmentList);
|
||||
mAdapter.notifyDataSetChanged();
|
||||
}
|
||||
getSupportFragmentManager()
|
||||
.beginTransaction()
|
||||
.replace(R.id.fragment_container, HomePartyFragment.newInstance(roomUid, isRoomMin))
|
||||
.commit();
|
||||
showRedPackage(roomInfo);
|
||||
}
|
||||
if (isRoomMin) {
|
||||
@@ -633,9 +568,6 @@ public class AVRoomActivity extends BaseMvpActivity<IAvRoomView, AvRoomPresenter
|
||||
}
|
||||
|
||||
private void showLiveFinishView(long uid) {
|
||||
if (mCurrentFragment instanceof HomePartyFragment) {
|
||||
((HomePartyFragment) mCurrentFragment).dismissGiftDialog();
|
||||
}
|
||||
if (finishLayout == null) {
|
||||
finishLayout = (RelativeLayout) mVsRoomOffline.inflate();
|
||||
ivHeadWear = finishLayout.findViewById(R.id.iv_head_wear);
|
||||
@@ -711,8 +643,8 @@ public class AVRoomActivity extends BaseMvpActivity<IAvRoomView, AvRoomPresenter
|
||||
if (openDialogs != null) {
|
||||
openDialogs.clear();
|
||||
}
|
||||
if (mCurrentFragment instanceof HomePartyFragment) {
|
||||
((HomePartyFragment) mCurrentFragment).dismissSendRedPackageDialog();
|
||||
if (mCurrentFragment != null) {
|
||||
mCurrentFragment.dismissSendRedPackageDialog();
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -1,6 +1,5 @@
|
||||
package com.yizhuan.erban.avroom.adapter;
|
||||
|
||||
import com.netease.nimlib.sdk.chatroom.model.ChatRoomMember;
|
||||
import com.yizhuan.xchat_android_core.room.queue.bean.MicMemberInfo;
|
||||
|
||||
/**
|
||||
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -498,8 +498,8 @@ public class HomePartyFragment extends BaseFragment implements View.OnClickListe
|
||||
}
|
||||
|
||||
public void dismissSendRedPackageDialog() {
|
||||
if (roomFragment instanceof HomePartyRoomFragment) {
|
||||
((HomePartyRoomFragment) roomFragment).clearDialog();
|
||||
if (roomFragment instanceof BaseRoomFragment) {
|
||||
((BaseRoomFragment) roomFragment).clearDialog();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -747,12 +747,6 @@ public class HomePartyFragment extends BaseFragment implements View.OnClickListe
|
||||
giftView.onReceiveMultiMagicMsg(multiMagicReceivedInfo);
|
||||
}
|
||||
|
||||
public void dismissGiftDialog() {
|
||||
if (roomFragment instanceof HomePartyRoomFragment) {
|
||||
((HomePartyRoomFragment) roomFragment).dismissGiftDialog();
|
||||
}
|
||||
}
|
||||
|
||||
private void updateOnlineNumberView(int onlineNumber) {
|
||||
if (!SuperAdminUtil.isSuperAdmin()) {
|
||||
if (onlineNumber < 1) {
|
||||
|
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,604 @@
|
||||
package com.yizhuan.erban.avroom.presenter;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.JsonObject;
|
||||
import com.google.gson.JsonParser;
|
||||
import com.netease.nimlib.sdk.NIMClient;
|
||||
import com.netease.nimlib.sdk.RequestCallbackWrapper;
|
||||
import com.netease.nimlib.sdk.ResponseCode;
|
||||
import com.netease.nimlib.sdk.chatroom.ChatRoomMessageBuilder;
|
||||
import com.netease.nimlib.sdk.chatroom.ChatRoomService;
|
||||
import com.netease.nimlib.sdk.chatroom.model.ChatRoomMessage;
|
||||
import com.netease.nimlib.sdk.msg.constant.MsgTypeEnum;
|
||||
import com.netease.nimlib.sdk.msg.model.QueryDirectionEnum;
|
||||
import com.netease.nimlib.sdk.util.Entry;
|
||||
import com.orhanobut.logger.Logger;
|
||||
import com.yizhuan.erban.avroom.view.IBaseRoomView;
|
||||
import com.yizhuan.erban.base.BaseMvpPresenter;
|
||||
import com.yizhuan.xchat_android_core.Constants;
|
||||
import com.yizhuan.xchat_android_core.auth.AuthModel;
|
||||
import com.yizhuan.xchat_android_core.bean.RoomQueueInfo;
|
||||
import com.yizhuan.xchat_android_core.im.custom.bean.CustomAttachment;
|
||||
import com.yizhuan.xchat_android_core.im.custom.bean.FaceAttachment;
|
||||
import com.yizhuan.xchat_android_core.im.custom.bean.RoomInfoAttachment;
|
||||
import com.yizhuan.xchat_android_core.initial.InitialModel;
|
||||
import com.yizhuan.xchat_android_core.initial.bean.InitInfo;
|
||||
import com.yizhuan.xchat_android_core.manager.AvRoomDataManager;
|
||||
import com.yizhuan.xchat_android_core.manager.IMNetEaseManager;
|
||||
import com.yizhuan.xchat_android_core.pay.bean.WalletInfo;
|
||||
import com.yizhuan.xchat_android_core.praise.PraiseModel;
|
||||
import com.yizhuan.xchat_android_core.room.bean.RoomInfo;
|
||||
import com.yizhuan.xchat_android_core.room.exception.AntiSpamHitException;
|
||||
import com.yizhuan.xchat_android_core.room.face.FaceReceiveInfo;
|
||||
import com.yizhuan.xchat_android_core.room.game.GameStatus;
|
||||
import com.yizhuan.xchat_android_core.room.giftvalue.helper.GiftValueMrg;
|
||||
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.model.RoomBaseModel;
|
||||
import com.yizhuan.xchat_android_core.room.queue.bean.MicMemberInfo;
|
||||
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.user.UserModel;
|
||||
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.net.DontWarnObserver;
|
||||
import com.yizhuan.xchat_android_core.utils.net.RxHelper;
|
||||
import com.yizhuan.xchat_android_library.base.PresenterEvent;
|
||||
import com.yizhuan.xchat_android_library.net.rxnet.callback.CallBack;
|
||||
import com.yizhuan.xchat_android_library.utils.ListUtils;
|
||||
import com.yizhuan.xchat_android_library.utils.SingleToastUtil;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import io.reactivex.Observable;
|
||||
import io.reactivex.Single;
|
||||
import io.reactivex.SingleSource;
|
||||
import io.reactivex.android.schedulers.AndroidSchedulers;
|
||||
import io.reactivex.functions.BiConsumer;
|
||||
import io.reactivex.functions.Consumer;
|
||||
import io.reactivex.functions.Function;
|
||||
|
||||
|
||||
/**
|
||||
* <p> </p>
|
||||
*
|
||||
* @author jiahui
|
||||
* @date 2017/12/8
|
||||
*/
|
||||
public class BaseRoomPresenter<V extends IBaseRoomView> extends BaseMvpPresenter<V> {
|
||||
|
||||
/**
|
||||
* 显示关注房主的时间
|
||||
*/
|
||||
public static final int SHOW_FOLLOW_TIME = 3 * 60 * 1000;
|
||||
public final Gson gson = new Gson();
|
||||
public final HomePartyModel mHomePartyMode;
|
||||
public final AvRoomModel mAvRoomModel;
|
||||
public final SuperAdminModel mSuperAdminModel;
|
||||
/**
|
||||
* 判断所坑服务端是否响应回来了
|
||||
*/
|
||||
private boolean mIsLockMicPosResultSuccess = true;
|
||||
private boolean mIsUnLockMicPosResultSuccess = true;
|
||||
|
||||
public BaseRoomPresenter() {
|
||||
mHomePartyMode = new HomePartyModel();
|
||||
mAvRoomModel = AvRoomModel.get();
|
||||
mSuperAdminModel = new SuperAdminModel();
|
||||
}
|
||||
|
||||
/**
|
||||
* 麦坑点击处理,麦上没人的时候
|
||||
*
|
||||
* @param micPosition 麦序位置
|
||||
* @param chatRoomMember 坑上的用户
|
||||
*/
|
||||
public void microPhonePositionClick(final int micPosition, MicMemberInfo chatRoomMember) {
|
||||
final RoomInfo currentRoom = AvRoomDataManager.get().mCurrentRoomInfo;
|
||||
if (currentRoom == null) {
|
||||
return;
|
||||
}
|
||||
if (AvRoomDataManager.get().isSelfGamePlaying()) {
|
||||
SingleToastUtil.showToast("游戏中不可以换麦!");
|
||||
return;
|
||||
}
|
||||
if (UserModel.get().getCacheLoginUserInfo() != null) {
|
||||
UserModel.get().getCacheLoginUserInfo().setGameStatus(GameStatus.STATUS_NOT_JOIN);
|
||||
}
|
||||
final String currentUid = String.valueOf(AuthModel.get().getCurrentUid());
|
||||
if (AvRoomDataManager.get().isRoomOwner(currentUid) || AvRoomDataManager.get().isRoomAdmin(currentUid)
|
||||
|| SuperAdminUtil.isSuperAdmin()) {
|
||||
if (AvRoomDataManager.get().isRoomOwner(currentUid) && currentRoom.isLeaveMode()) {
|
||||
SingleToastUtil.showToast("请先关闭离开模式");
|
||||
return;
|
||||
}
|
||||
onOwnerUpMicroClick(micPosition, Long.parseLong(currentUid));
|
||||
} else {
|
||||
if (AvRoomDataManager.get().getRoomQueueMemberInfoByMicPosition(micPosition).mRoomMicInfo.isMicLock()) {
|
||||
if (AvRoomDataManager.get().isQueuingMicro()) {
|
||||
String msg;
|
||||
if (AvRoomDataManager.get().isOnMic(AuthModel.get().getCurrentUid())) {
|
||||
msg = "你已经在麦上啦";
|
||||
} else {
|
||||
msg = "要排麦才可以上麦哦~";
|
||||
}
|
||||
SingleToastUtil.showToast(msg);
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (AvRoomDataManager.get().isQueuingMicro() && AvRoomDataManager.get().myIsInQueue) {
|
||||
SingleToastUtil.showToast("取消报名才可以上麦哦!");
|
||||
return;
|
||||
}
|
||||
getMvpView().toUpMicroPhone(micPosition, currentUid, false);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
private void onOwnerUpMicroClick(final int micPosition, final long currentUid) {
|
||||
RoomQueueInfo roomQueueInfo = AvRoomDataManager.get().getRoomQueueMemberInfoByMicPosition(micPosition);
|
||||
if (roomQueueInfo == null) return;
|
||||
if (getMvpView() != null)
|
||||
getMvpView().showOwnerClickDialog(roomQueueInfo.mRoomMicInfo, micPosition, currentUid);
|
||||
}
|
||||
|
||||
public void lockMicroPhone(int micPosition) {
|
||||
if (!mIsLockMicPosResultSuccess) {
|
||||
return;
|
||||
}
|
||||
mIsLockMicPosResultSuccess = false;
|
||||
RoomInfo currentRoom = AvRoomDataManager.get().mCurrentRoomInfo;
|
||||
if (currentRoom == null) {
|
||||
return;
|
||||
}
|
||||
final String currentUid = String.valueOf(currentRoom.getUid());
|
||||
mHomePartyMode.lockMicroPhone(micPosition, currentUid, AuthModel.get().getTicket())
|
||||
.doOnSuccess(data -> {
|
||||
Logger.i("用户%1$s锁坑成功: %2$s", String.valueOf(currentUid), data);
|
||||
mIsLockMicPosResultSuccess = true;
|
||||
})
|
||||
.doOnError(throwable -> {
|
||||
Logger.i("用户%1$s锁坑失败: %2$s", String.valueOf(currentUid),
|
||||
RxHelper.getNotEmptyError(throwable));
|
||||
mIsLockMicPosResultSuccess = true;
|
||||
})
|
||||
.subscribe();
|
||||
}
|
||||
|
||||
/**
|
||||
* 坑位释放锁
|
||||
*/
|
||||
public void unLockMicroPhone(int micPosition) {
|
||||
if (!mIsUnLockMicPosResultSuccess) {
|
||||
return;
|
||||
}
|
||||
mIsUnLockMicPosResultSuccess = false;
|
||||
RoomInfo currentRoom = AvRoomDataManager.get().mCurrentRoomInfo;
|
||||
if (currentRoom == null) {
|
||||
return;
|
||||
}
|
||||
final String currentUid = String.valueOf(currentRoom.getUid());
|
||||
if (AvRoomDataManager.get().isRoomAdmin() || AvRoomDataManager.get().isRoomOwner(currentUid)) {
|
||||
mHomePartyMode.unLockMicroPhone(micPosition, currentUid, AuthModel.get().getTicket())
|
||||
.subscribe(new Consumer<String>() {
|
||||
@Override
|
||||
public void accept(String data) throws Exception {
|
||||
Logger.i("用户%1$s解麦成功: %2$s", String.valueOf(currentUid), data);
|
||||
mIsUnLockMicPosResultSuccess = true;
|
||||
}
|
||||
}, new Consumer<Throwable>() {
|
||||
@Override
|
||||
public void accept(Throwable throwable) throws Exception {
|
||||
Logger.i("用户%1$s解麦失败: %2$s", String.valueOf(currentUid), throwable.getMessage());
|
||||
mIsUnLockMicPosResultSuccess = true;
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 下麦
|
||||
*
|
||||
* @param micPosition
|
||||
* @param isKick 是否是主动的
|
||||
*/
|
||||
public void downMicroPhone(int micPosition, final boolean isKick) {
|
||||
final RoomInfo roomInfo = AvRoomDataManager.get().mCurrentRoomInfo;
|
||||
if (roomInfo == null) {
|
||||
return;
|
||||
}
|
||||
final String currentUid = String.valueOf(AuthModel.get());
|
||||
mHomePartyMode.downMicroPhone(micPosition, new CallBack<String>() {
|
||||
@Override
|
||||
public void onSuccess(String data) {
|
||||
Logger.i("用户%1$s下麦成功:%2$s", currentUid, data);
|
||||
if (!isKick) {
|
||||
//被踢了
|
||||
if (getMvpView() != null) {
|
||||
getMvpView().kickDownMicroPhoneSuccess();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFail(int code, String error) {
|
||||
Logger.i("用户%1$s下麦失败:%2$s----", currentUid, error);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 上麦
|
||||
*
|
||||
* @param micPosition
|
||||
* @param uId
|
||||
* @param isInviteUpMic 是否是主动的,false:主动
|
||||
* @param isReconnect 是否需要清除礼物值,普通情况下上麦传false,断网重连传ture
|
||||
*/
|
||||
public void upMicroPhone(final int micPosition, final String uId, boolean isInviteUpMic, boolean isReconnect) {
|
||||
final RoomInfo roomInfo = AvRoomDataManager.get().mCurrentRoomInfo;
|
||||
if (roomInfo == null) {
|
||||
return;
|
||||
}
|
||||
if (!isInviteUpMic) {
|
||||
upMicroPhone(micPosition, uId, isInviteUpMic, roomInfo, isReconnect);
|
||||
} else {
|
||||
AvRoomDataManager.get().haveStartDragon = false;
|
||||
upMicroPhone(micPosition, uId, isInviteUpMic, roomInfo, isReconnect);
|
||||
}
|
||||
}
|
||||
|
||||
public void upMicroPhone(final int micPosition, final String uId, boolean isInviteUpMic) {
|
||||
upMicroPhone(micPosition, uId, isInviteUpMic, false);
|
||||
}
|
||||
|
||||
public void upMicroPhone(int micPosition, String uId, boolean isInviteUpMic, RoomInfo roomInfo,
|
||||
boolean isReconnect) {
|
||||
mHomePartyMode.upMicroPhone(micPosition, uId, String.valueOf(roomInfo.getRoomId()),
|
||||
isInviteUpMic, new CallBack<String>() {
|
||||
@Override
|
||||
public void onSuccess(String data) {
|
||||
Logger.i("用户%1$s上麦成功:%2$s", uId, data);
|
||||
if (!isReconnect) {
|
||||
GiftValueMrg.get().requestUpMic(micPosition, uId);
|
||||
} else {
|
||||
GiftValueMrg.get().handleReconnect(true);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFail(int code, String error) {
|
||||
if (code == RoomBaseModel.CODE_UPDATE_MIC) {
|
||||
if (getMvpView() != null) {
|
||||
getMvpView().updateMicView();
|
||||
}
|
||||
}
|
||||
Logger.i("用户%1$s上麦失败:%2$s----", uId, error);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 邀请用户上麦
|
||||
*
|
||||
* @param micInfo 要邀请的用户
|
||||
* @param position 坑位
|
||||
*/
|
||||
public void inviteMicroPhone(final BaseInfo micInfo, final int position) {
|
||||
final long micUid = micInfo.getUid();
|
||||
if (AvRoomDataManager.get().isOnMic(micUid)) {
|
||||
return;
|
||||
}
|
||||
//如果点击的就是自己,那这里就是自己上麦
|
||||
if (AvRoomDataManager.get().isOwner(micUid)) {
|
||||
upMicroPhone(position, String.valueOf(micUid), true);
|
||||
return;
|
||||
}
|
||||
mHomePartyMode.inviteMicroPhone(micInfo, position)
|
||||
.compose(bindUntilEvent(PresenterEvent.DESTROY))
|
||||
.subscribe(new BiConsumer<ChatRoomMessage, Throwable>() {
|
||||
@Override
|
||||
public void accept(ChatRoomMessage chatRoomMessage,
|
||||
Throwable throwable) throws Exception {
|
||||
if (throwable != null) {
|
||||
Logger.i("邀请用户%d上麦失败!!!" + micUid);
|
||||
} else
|
||||
Logger.i("邀请用户%d上麦成功!!!" + micUid);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 开麦
|
||||
*
|
||||
* @param micPosition
|
||||
*/
|
||||
public void openMicroPhone(int micPosition) {
|
||||
final RoomInfo roomInfo = AvRoomDataManager.get().mCurrentRoomInfo;
|
||||
if (roomInfo == null) {
|
||||
return;
|
||||
}
|
||||
mHomePartyMode.openMicroPhone(micPosition, roomInfo.getUid())
|
||||
.subscribe(new DontWarnObserver<String>() {
|
||||
@Override
|
||||
public void accept(String data, String error) {
|
||||
super.accept(data, error);
|
||||
if (error != null) {
|
||||
Logger.i("用户%1$s开麦失败: %2$s", String.valueOf(roomInfo.getUid()), error);
|
||||
} else {
|
||||
Logger.i("用户%1$s开麦成功: %2$s", String.valueOf(roomInfo.getUid()), data);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 闭麦
|
||||
*
|
||||
* @param micPosition
|
||||
*/
|
||||
public void closeMicroPhone(int micPosition) {
|
||||
final RoomInfo roomInfo = AvRoomDataManager.get().mCurrentRoomInfo;
|
||||
if (roomInfo == null) {
|
||||
return;
|
||||
}
|
||||
mHomePartyMode.closeMicroPhone(micPosition, roomInfo.getUid())
|
||||
.doOnSuccess(data -> {
|
||||
Logger.i("用户%1$s闭麦成功: %2$s", String.valueOf(roomInfo.getUid()), data);
|
||||
})
|
||||
.doOnError(throwable -> {
|
||||
Logger.i("用户%1$s闭麦失败: %2$s", String.valueOf(roomInfo.getUid()),
|
||||
RxHelper.getNotEmptyError(throwable));
|
||||
})
|
||||
.subscribe();
|
||||
}
|
||||
|
||||
public void roomOperate(int operate) {
|
||||
mSuperAdminModel.roomOperate(operate)
|
||||
.subscribe();
|
||||
}
|
||||
|
||||
@SuppressLint("CheckResult")
|
||||
public void chatRoomReConnect(final RoomQueueInfo queueInfo) {
|
||||
final RoomInfo roomInfo = AvRoomDataManager.get().mCurrentRoomInfo;
|
||||
if (roomInfo == null) return;
|
||||
mHomePartyMode.queryRoomMicInfo(String.valueOf(roomInfo.getRoomId()))
|
||||
.delay(1, TimeUnit.SECONDS)
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(entries -> {
|
||||
if (!ListUtils.isListEmpty(entries)) {
|
||||
JsonParser jsonParser = new JsonParser();
|
||||
MicMemberInfo chatRoomMember;
|
||||
for (Entry<String, String> entry : entries) {
|
||||
RoomQueueInfo roomQueueInfo = AvRoomDataManager.get().mMicQueueMemberMap.get(Integer.parseInt(entry.key));
|
||||
if (roomQueueInfo != null) {
|
||||
JsonObject valueJsonObj = jsonParser.parse(entry.value).getAsJsonObject();
|
||||
if (valueJsonObj != null) {
|
||||
chatRoomMember = gson.fromJson(valueJsonObj, MicMemberInfo.class);
|
||||
roomQueueInfo.mChatRoomMember = chatRoomMember;
|
||||
}
|
||||
AvRoomDataManager.get().addRoomQueueInfo(entry.key, roomQueueInfo);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
//麦上都没有人
|
||||
AvRoomDataManager.get().resetMicMembers();
|
||||
}
|
||||
if (getMvpView() != null)
|
||||
getMvpView().chatRoomReConnectView();
|
||||
//之前在麦上
|
||||
if (queueInfo != null && queueInfo.mChatRoomMember != null && queueInfo.mRoomMicInfo != null) {
|
||||
RoomQueueInfo roomQueueInfo = AvRoomDataManager.get()
|
||||
.getRoomQueueMemberInfoByMicPosition(queueInfo.mRoomMicInfo.getPosition());
|
||||
//麦上没人
|
||||
String account = queueInfo.mChatRoomMember.getAccount();
|
||||
if (roomQueueInfo != null && (roomQueueInfo.mChatRoomMember == null ||
|
||||
Objects.equals(account, roomQueueInfo.mChatRoomMember.getAccount()))) {
|
||||
roomQueueInfo.mChatRoomMember = null;
|
||||
//断网重连,不要清除麦上的礼物值
|
||||
upMicroPhone(queueInfo.mRoomMicInfo.getPosition(), account, true, true);
|
||||
}
|
||||
}
|
||||
IMNetEaseManager.get().mCacheRoomQueueInfo = null;
|
||||
Logger.i("断网重连获取队列信息成功...." + entries);
|
||||
}, new Consumer<Throwable>() {
|
||||
@Override
|
||||
public void accept(Throwable throwable) throws Exception {
|
||||
throwable.printStackTrace();
|
||||
Logger.i("断网重连获取队列信息失败....");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void userRoomIn() {
|
||||
final RoomInfo roomInfo = AvRoomDataManager.get().mCurrentRoomInfo;
|
||||
if (roomInfo == null) return;
|
||||
long currentUid = AuthModel.get().getCurrentUid();
|
||||
mAvRoomModel.userRoomIn(String.valueOf(currentUid), roomInfo.getUid(), 0, "")
|
||||
.delay(1, TimeUnit.SECONDS)
|
||||
.observeOn(AndroidSchedulers.mainThread()).subscribe();
|
||||
}
|
||||
|
||||
@NonNull
|
||||
private ChatRoomMessage getChatRoomMessage(RoomInfo roomInfo, List<Integer> integers, int second) {
|
||||
UserInfo userInfo = UserModel.get().getCacheLoginUserInfo();
|
||||
List<FaceReceiveInfo> faceReceiveInfos = new ArrayList<>();
|
||||
FaceReceiveInfo faceReceiveInfo = new FaceReceiveInfo();
|
||||
faceReceiveInfo.setNick(userInfo.getNick());
|
||||
faceReceiveInfo.setFaceId(Constants.DRAGON_BAR_ID);
|
||||
faceReceiveInfo.setUid(userInfo.getUid());
|
||||
|
||||
faceReceiveInfo.setResultIndexes(integers);
|
||||
faceReceiveInfos.add(faceReceiveInfo);
|
||||
|
||||
// 发送云信信息给所有人
|
||||
FaceAttachment faceAttachment =
|
||||
new FaceAttachment(CustomAttachment.CUSTOM_MSG_DRAGON_BAR, second);
|
||||
faceAttachment.setUid(userInfo.getUid());
|
||||
faceAttachment.setFaceReceiveInfos(faceReceiveInfos);
|
||||
|
||||
return ChatRoomMessageBuilder.createChatRoomCustomMessage(
|
||||
// 聊天室id
|
||||
roomInfo.getRoomId() + "",
|
||||
// 自定义消息
|
||||
faceAttachment
|
||||
);
|
||||
}
|
||||
|
||||
public void updateScreen(boolean isCloseScreen) {
|
||||
String contentText;
|
||||
if (isCloseScreen) {
|
||||
ChatRoomMessage firstMsg = IMNetEaseManager.get().getFirstMessageContent();
|
||||
IMNetEaseManager.get().addCloseScreenMessages(firstMsg);
|
||||
if (AvRoomDataManager.get().closeScreenBySAdmin()) {
|
||||
contentText = "系统检测涉嫌违规,予以关闭公屏消息警告";
|
||||
} else {
|
||||
contentText = "管理员已关闭聊天公屏";
|
||||
}
|
||||
} else {
|
||||
contentText = "管理员已开启聊天公屏";
|
||||
}
|
||||
RoomInfoAttachment attachment = new RoomInfoAttachment(CustomAttachment.CUSTOM_MSG_UPDATE_ROOM_INFO,
|
||||
CustomAttachment.CUSTOM_MSG_UPDATE_ROOM_INFO_CLOSE_SCREEN);
|
||||
ChatRoomMessage screenMsg = ChatRoomMessageBuilder.createChatRoomCustomMessage(
|
||||
String.valueOf(AvRoomDataManager.get().getRoomId()),
|
||||
attachment
|
||||
);
|
||||
screenMsg.setContent(contentText);
|
||||
IMNetEaseManager.get().addCloseScreenMessages(screenMsg);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 检查是否关注了这个用户
|
||||
*
|
||||
* @param uid
|
||||
*/
|
||||
@SuppressLint("CheckResult")
|
||||
public void checkFollow(long uid) {
|
||||
Single.just("")
|
||||
.delay(SHOW_FOLLOW_TIME, TimeUnit.MILLISECONDS)
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.flatMap(new Function<String, SingleSource<Boolean>>() {
|
||||
@Override
|
||||
public SingleSource<Boolean> apply(String s) throws Exception {
|
||||
return PraiseModel.get().isPraised(AuthModel.get().getCurrentUid(), uid);
|
||||
}
|
||||
})
|
||||
.compose(bindUntilEvent(PresenterEvent.DESTROY))
|
||||
.compose(RxHelper.handleSchAndExce())
|
||||
.subscribe(new BiConsumer<Boolean, Throwable>() {
|
||||
@Override
|
||||
public void accept(Boolean aBoolean, Throwable throwable) throws Exception {
|
||||
if (throwable != null || getMvpView() == null) {
|
||||
return;
|
||||
}
|
||||
//如果没有关注
|
||||
if (!aBoolean) {
|
||||
getMvpView().noFollow();
|
||||
}
|
||||
}
|
||||
});
|
||||
Observable.interval(1, 5, TimeUnit.MINUTES)
|
||||
.compose(bindUntilEvent(PresenterEvent.DESTROY))
|
||||
.map(aLong -> AvRoomDataManager.get().isRoomFans)
|
||||
.takeUntil(aBoolean -> aBoolean)
|
||||
.subscribe(aBoolean -> {
|
||||
if (!aBoolean && getMvpView() != null) {
|
||||
getMvpView().noFollow2();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 公屏历史消息
|
||||
*/
|
||||
public void loadMessageHistory() {
|
||||
RoomInfo roomInfo = AvRoomDataManager.get().mCurrentRoomInfo;
|
||||
|
||||
if (roomInfo == null) return;
|
||||
if (!roomInfo.isCloseScreen()) {
|
||||
int count = 10;
|
||||
InitInfo initInfo = InitialModel.get().getCacheInitInfo();
|
||||
if (initInfo != null) count = initInfo.getRoomMessageCount();
|
||||
NIMClient.getService(ChatRoomService.class)
|
||||
.pullMessageHistoryExType(String.valueOf(roomInfo.getRoomId()), 0,
|
||||
count, QueryDirectionEnum.QUERY_OLD, new MsgTypeEnum[]{MsgTypeEnum.text})
|
||||
.setCallback(new RequestCallbackWrapper<List<ChatRoomMessage>>() {
|
||||
@Override
|
||||
public void onResult(int code, List<ChatRoomMessage> result, Throwable exception) {
|
||||
if (code == ResponseCode.RES_SUCCESS && result != null && result.size() > 0) {
|
||||
Collections.reverse(result);
|
||||
if (getMvpView() != null) {
|
||||
getMvpView().showMessageHistory(result);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 关注房主
|
||||
*
|
||||
* @param position
|
||||
* @param ownerUid
|
||||
*/
|
||||
@SuppressLint("CheckResult")
|
||||
public void followOwner(int position, long ownerUid) {
|
||||
PraiseModel.get().praise(ownerUid, true).subscribe(new BiConsumer<String, Throwable>() {
|
||||
@Override
|
||||
public void accept(String s, Throwable throwable) throws Exception {
|
||||
if (getMvpView() == null) {
|
||||
return;
|
||||
}
|
||||
if (throwable == null) {
|
||||
getMvpView().onFollowSuccess(position);
|
||||
} else {
|
||||
getMvpView().onFollowFail(throwable.getMessage());
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/***
|
||||
* 发送房间消息
|
||||
* @param message
|
||||
*/
|
||||
@SuppressLint("CheckResult")
|
||||
public void sendTextMsg(String message) {
|
||||
RoomInfo roomInfo = AvRoomDataManager.get().mCurrentRoomInfo;
|
||||
if (roomInfo == null || TextUtils.isEmpty(message)) return;
|
||||
IMNetEaseManager.get().sendTextMsg(roomInfo.getRoomId(), message)
|
||||
.subscribe(new BiConsumer<ChatRoomMessage, Throwable>() {
|
||||
@Override
|
||||
public void accept(ChatRoomMessage chatRoomMessage,
|
||||
Throwable throwable) throws Exception {
|
||||
if (throwable != null) {
|
||||
if (throwable instanceof AntiSpamHitException) {
|
||||
Log.e("sendTextMsg", throwable.getMessage());
|
||||
} else {
|
||||
Logger.i("发送房间信息失败:" + throwable.getMessage());
|
||||
}
|
||||
} else {
|
||||
getMvpView().onSendMsgSuccess(message);
|
||||
IMNetEaseManager.get().addMessagesImmediately(chatRoomMessage);
|
||||
Logger.i("发送房间信息成功:" + chatRoomMessage.getUuid());
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
@@ -1,75 +1,15 @@
|
||||
package com.yizhuan.erban.avroom.presenter;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.JsonObject;
|
||||
import com.google.gson.JsonParser;
|
||||
import com.netease.nimlib.sdk.NIMClient;
|
||||
import com.netease.nimlib.sdk.RequestCallbackWrapper;
|
||||
import com.netease.nimlib.sdk.ResponseCode;
|
||||
import com.netease.nimlib.sdk.chatroom.ChatRoomMessageBuilder;
|
||||
import com.netease.nimlib.sdk.chatroom.ChatRoomService;
|
||||
import com.netease.nimlib.sdk.chatroom.model.ChatRoomMessage;
|
||||
import com.netease.nimlib.sdk.msg.constant.MsgTypeEnum;
|
||||
import com.netease.nimlib.sdk.msg.model.QueryDirectionEnum;
|
||||
import com.netease.nimlib.sdk.util.Entry;
|
||||
import com.orhanobut.logger.Logger;
|
||||
import com.yizhuan.erban.avroom.view.IGameRoomView;
|
||||
import com.yizhuan.erban.base.BaseMvpPresenter;
|
||||
import com.yizhuan.erban.treasure_box.widget.GoldBoxHelper;
|
||||
import com.yizhuan.erban.utils.UserUtils;
|
||||
import com.yizhuan.xchat_android_core.Constants;
|
||||
import com.yizhuan.xchat_android_core.auth.AuthModel;
|
||||
import com.yizhuan.xchat_android_core.bean.RoomQueueInfo;
|
||||
import com.yizhuan.xchat_android_core.home.bean.BannerInfo;
|
||||
import com.yizhuan.xchat_android_core.im.custom.bean.CustomAttachment;
|
||||
import com.yizhuan.xchat_android_core.im.custom.bean.FaceAttachment;
|
||||
import com.yizhuan.xchat_android_core.im.custom.bean.RoomInfoAttachment;
|
||||
import com.yizhuan.xchat_android_core.initial.InitialModel;
|
||||
import com.yizhuan.xchat_android_core.initial.bean.InitInfo;
|
||||
import com.yizhuan.xchat_android_core.manager.AvRoomDataManager;
|
||||
import com.yizhuan.xchat_android_core.manager.IMNetEaseManager;
|
||||
import com.yizhuan.xchat_android_core.pay.bean.WalletInfo;
|
||||
import com.yizhuan.xchat_android_core.praise.PraiseModel;
|
||||
import com.yizhuan.xchat_android_core.room.bean.RoomInfo;
|
||||
import com.yizhuan.xchat_android_core.room.exception.AntiSpamHitException;
|
||||
import com.yizhuan.xchat_android_core.room.face.FaceReceiveInfo;
|
||||
import com.yizhuan.xchat_android_core.room.game.GameStatus;
|
||||
import com.yizhuan.xchat_android_core.room.giftvalue.helper.GiftValueMrg;
|
||||
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.model.RoomBaseModel;
|
||||
import com.yizhuan.xchat_android_core.room.queue.bean.MicMemberInfo;
|
||||
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.user.UserModel;
|
||||
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.net.DontWarnObserver;
|
||||
import com.yizhuan.xchat_android_core.utils.net.RxHelper;
|
||||
import com.yizhuan.xchat_android_library.base.PresenterEvent;
|
||||
import com.yizhuan.xchat_android_library.net.rxnet.callback.CallBack;
|
||||
import com.yizhuan.xchat_android_library.utils.ListUtils;
|
||||
import com.yizhuan.xchat_android_library.utils.SingleToastUtil;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import io.reactivex.Observable;
|
||||
import io.reactivex.Single;
|
||||
import io.reactivex.SingleSource;
|
||||
import io.reactivex.android.schedulers.AndroidSchedulers;
|
||||
import io.reactivex.functions.BiConsumer;
|
||||
import io.reactivex.functions.Consumer;
|
||||
import io.reactivex.functions.Function;
|
||||
|
||||
|
||||
/**
|
||||
@@ -78,537 +18,11 @@ import io.reactivex.functions.Function;
|
||||
* @author jiahui
|
||||
* @date 2017/12/8
|
||||
*/
|
||||
public class GameRoomPresenter extends BaseMvpPresenter<IGameRoomView> {
|
||||
|
||||
/**
|
||||
* 显示关注房主的时间
|
||||
*/
|
||||
public static final int SHOW_FOLLOW_TIME = 3 * 60 * 1000;
|
||||
|
||||
private final HomePartyModel mHomePartyMode;
|
||||
private final AvRoomModel mAvRoomModel;
|
||||
private final SuperAdminModel mSuperAdminModel;
|
||||
protected WalletInfo walletInfo;
|
||||
/**
|
||||
* 判断所坑服务端是否响应回来了
|
||||
*/
|
||||
private boolean mIsLockMicPosResultSuccess = true;
|
||||
private boolean mIsUnLockMicPosResultSuccess = true;
|
||||
|
||||
private Gson gson = new Gson();
|
||||
|
||||
public GameRoomPresenter() {
|
||||
mHomePartyMode = new HomePartyModel();
|
||||
mAvRoomModel = AvRoomModel.get();
|
||||
mSuperAdminModel = new SuperAdminModel();
|
||||
}
|
||||
|
||||
/**
|
||||
* 麦坑点击处理,麦上没人的时候
|
||||
*
|
||||
* @param micPosition 麦序位置
|
||||
* @param chatRoomMember 坑上的用户
|
||||
*/
|
||||
public void microPhonePositionClick(final int micPosition, MicMemberInfo chatRoomMember) {
|
||||
final RoomInfo currentRoom = AvRoomDataManager.get().mCurrentRoomInfo;
|
||||
if (currentRoom == null) {
|
||||
return;
|
||||
}
|
||||
if (AvRoomDataManager.get().isSelfGamePlaying()){
|
||||
SingleToastUtil.showToast("游戏中不可以换麦!");
|
||||
return;
|
||||
}
|
||||
if (UserModel.get().getCacheLoginUserInfo() != null) {
|
||||
UserModel.get().getCacheLoginUserInfo().setGameStatus(GameStatus.STATUS_NOT_JOIN);
|
||||
}
|
||||
final String currentUid = String.valueOf(AuthModel.get().getCurrentUid());
|
||||
if (AvRoomDataManager.get().isRoomOwner(currentUid) || AvRoomDataManager.get().isRoomAdmin(currentUid)
|
||||
|| SuperAdminUtil.isSuperAdmin()) {
|
||||
if (AvRoomDataManager.get().isRoomOwner(currentUid) && currentRoom.isLeaveMode()) {
|
||||
SingleToastUtil.showToast("请先关闭离开模式");
|
||||
return;
|
||||
}
|
||||
onOwnerUpMicroClick(micPosition, Long.parseLong(currentUid));
|
||||
} else {
|
||||
if (AvRoomDataManager.get().getRoomQueueMemberInfoByMicPosition(micPosition).mRoomMicInfo.isMicLock()) {
|
||||
if (AvRoomDataManager.get().isQueuingMicro()) {
|
||||
String msg;
|
||||
if (AvRoomDataManager.get().isOnMic(AuthModel.get().getCurrentUid())) {
|
||||
msg = "你已经在麦上啦";
|
||||
} else {
|
||||
msg = "要排麦才可以上麦哦~";
|
||||
}
|
||||
SingleToastUtil.showToast(msg);
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (AvRoomDataManager.get().isQueuingMicro() && AvRoomDataManager.get().myIsInQueue) {
|
||||
SingleToastUtil.showToast("取消报名才可以上麦哦!");
|
||||
return;
|
||||
}
|
||||
getMvpView().toUpMicroPhone(micPosition, currentUid, false);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
private void onOwnerUpMicroClick(final int micPosition, final long currentUid) {
|
||||
RoomQueueInfo roomQueueInfo = AvRoomDataManager.get().getRoomQueueMemberInfoByMicPosition(micPosition);
|
||||
if (roomQueueInfo == null) return;
|
||||
if (getMvpView() != null)
|
||||
getMvpView().showOwnerClickDialog(roomQueueInfo.mRoomMicInfo, micPosition, currentUid);
|
||||
}
|
||||
|
||||
public void lockMicroPhone(int micPosition) {
|
||||
if (!mIsLockMicPosResultSuccess) {
|
||||
return;
|
||||
}
|
||||
mIsLockMicPosResultSuccess = false;
|
||||
RoomInfo currentRoom = AvRoomDataManager.get().mCurrentRoomInfo;
|
||||
if (currentRoom == null) {
|
||||
return;
|
||||
}
|
||||
final String currentUid = String.valueOf(currentRoom.getUid());
|
||||
mHomePartyMode.lockMicroPhone(micPosition, currentUid, AuthModel.get().getTicket())
|
||||
.doOnSuccess(data -> {
|
||||
Logger.i("用户%1$s锁坑成功: %2$s", String.valueOf(currentUid), data);
|
||||
mIsLockMicPosResultSuccess = true;
|
||||
})
|
||||
.doOnError(throwable -> {
|
||||
Logger.i("用户%1$s锁坑失败: %2$s", String.valueOf(currentUid),
|
||||
RxHelper.getNotEmptyError(throwable));
|
||||
mIsLockMicPosResultSuccess = true;
|
||||
})
|
||||
.subscribe();
|
||||
}
|
||||
|
||||
/**
|
||||
* 坑位释放锁
|
||||
*/
|
||||
public void unLockMicroPhone(int micPosition) {
|
||||
if (!mIsUnLockMicPosResultSuccess) {
|
||||
return;
|
||||
}
|
||||
mIsUnLockMicPosResultSuccess = false;
|
||||
RoomInfo currentRoom = AvRoomDataManager.get().mCurrentRoomInfo;
|
||||
if (currentRoom == null) {
|
||||
return;
|
||||
}
|
||||
final String currentUid = String.valueOf(currentRoom.getUid());
|
||||
if (AvRoomDataManager.get().isRoomAdmin() || AvRoomDataManager.get().isRoomOwner(currentUid)) {
|
||||
mHomePartyMode.unLockMicroPhone(micPosition, currentUid, AuthModel.get().getTicket())
|
||||
.subscribe(new Consumer<String>() {
|
||||
@Override
|
||||
public void accept(String data) throws Exception {
|
||||
Logger.i("用户%1$s解麦成功: %2$s", String.valueOf(currentUid), data);
|
||||
mIsUnLockMicPosResultSuccess = true;
|
||||
}
|
||||
}, new Consumer<Throwable>() {
|
||||
@Override
|
||||
public void accept(Throwable throwable) throws Exception {
|
||||
Logger.i("用户%1$s解麦失败: %2$s", String.valueOf(currentUid), throwable.getMessage());
|
||||
mIsUnLockMicPosResultSuccess = true;
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 下麦
|
||||
*
|
||||
* @param micPosition
|
||||
* @param isKick 是否是主动的
|
||||
*/
|
||||
public void downMicroPhone(int micPosition, final boolean isKick) {
|
||||
final RoomInfo roomInfo = AvRoomDataManager.get().mCurrentRoomInfo;
|
||||
if (roomInfo == null) {
|
||||
return;
|
||||
}
|
||||
final String currentUid = String.valueOf(AuthModel.get());
|
||||
mHomePartyMode.downMicroPhone(micPosition, new CallBack<String>() {
|
||||
@Override
|
||||
public void onSuccess(String data) {
|
||||
Logger.i("用户%1$s下麦成功:%2$s", currentUid, data);
|
||||
if (!isKick) {
|
||||
//被踢了
|
||||
if (getMvpView() != null) {
|
||||
getMvpView().kickDownMicroPhoneSuccess();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFail(int code, String error) {
|
||||
Logger.i("用户%1$s下麦失败:%2$s----", currentUid, error);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 上麦
|
||||
*
|
||||
* @param micPosition
|
||||
* @param uId
|
||||
* @param isInviteUpMic 是否是主动的,false:主动
|
||||
* @param isReconnect 是否需要清除礼物值,普通情况下上麦传false,断网重连传ture
|
||||
*/
|
||||
public void upMicroPhone(final int micPosition, final String uId, boolean isInviteUpMic, boolean isReconnect) {
|
||||
final RoomInfo roomInfo = AvRoomDataManager.get().mCurrentRoomInfo;
|
||||
if (roomInfo == null) {
|
||||
return;
|
||||
}
|
||||
if (!isInviteUpMic) {
|
||||
upMicroPhone(micPosition, uId, isInviteUpMic, roomInfo, isReconnect);
|
||||
} else {
|
||||
AvRoomDataManager.get().haveStartDragon = false;
|
||||
upMicroPhone(micPosition, uId, isInviteUpMic, roomInfo, isReconnect);
|
||||
}
|
||||
}
|
||||
|
||||
public void upMicroPhone(final int micPosition, final String uId, boolean isInviteUpMic) {
|
||||
upMicroPhone(micPosition, uId, isInviteUpMic, false);
|
||||
}
|
||||
|
||||
public void upMicroPhone(int micPosition, String uId, boolean isInviteUpMic, RoomInfo roomInfo,
|
||||
boolean isReconnect) {
|
||||
mHomePartyMode.upMicroPhone(micPosition, uId, String.valueOf(roomInfo.getRoomId()),
|
||||
isInviteUpMic, new CallBack<String>() {
|
||||
@Override
|
||||
public void onSuccess(String data) {
|
||||
Logger.i("用户%1$s上麦成功:%2$s", uId, data);
|
||||
if (!isReconnect) {
|
||||
GiftValueMrg.get().requestUpMic(micPosition, uId);
|
||||
} else {
|
||||
GiftValueMrg.get().handleReconnect(true);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFail(int code, String error) {
|
||||
if (code == RoomBaseModel.CODE_UPDATE_MIC) {
|
||||
if (getMvpView() != null) {
|
||||
getMvpView().updateMicView();
|
||||
}
|
||||
}
|
||||
Logger.i("用户%1$s上麦失败:%2$s----", uId, error);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 邀请用户上麦
|
||||
*
|
||||
* @param micInfo 要邀请的用户
|
||||
* @param position 坑位
|
||||
*/
|
||||
public void inviteMicroPhone(final BaseInfo micInfo, final int position) {
|
||||
final long micUid = micInfo.getUid();
|
||||
if (AvRoomDataManager.get().isOnMic(micUid)) {
|
||||
return;
|
||||
}
|
||||
//如果点击的就是自己,那这里就是自己上麦
|
||||
if (AvRoomDataManager.get().isOwner(micUid)) {
|
||||
upMicroPhone(position, String.valueOf(micUid), true);
|
||||
return;
|
||||
}
|
||||
mHomePartyMode.inviteMicroPhone(micInfo, position)
|
||||
.compose(bindUntilEvent(PresenterEvent.DESTROY))
|
||||
.subscribe(new BiConsumer<ChatRoomMessage, Throwable>() {
|
||||
@Override
|
||||
public void accept(ChatRoomMessage chatRoomMessage,
|
||||
Throwable throwable) throws Exception {
|
||||
if (throwable != null) {
|
||||
Logger.i("邀请用户%d上麦失败!!!" + micUid);
|
||||
} else
|
||||
Logger.i("邀请用户%d上麦成功!!!" + micUid);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 开麦
|
||||
*
|
||||
* @param micPosition
|
||||
*/
|
||||
public void openMicroPhone(int micPosition) {
|
||||
final RoomInfo roomInfo = AvRoomDataManager.get().mCurrentRoomInfo;
|
||||
if (roomInfo == null) {
|
||||
return;
|
||||
}
|
||||
mHomePartyMode.openMicroPhone(micPosition, roomInfo.getUid())
|
||||
.subscribe(new DontWarnObserver<String>() {
|
||||
@Override
|
||||
public void accept(String data, String error) {
|
||||
super.accept(data, error);
|
||||
if (error != null) {
|
||||
Logger.i("用户%1$s开麦失败: %2$s", String.valueOf(roomInfo.getUid()), error);
|
||||
} else {
|
||||
Logger.i("用户%1$s开麦成功: %2$s", String.valueOf(roomInfo.getUid()), data);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 闭麦
|
||||
*
|
||||
* @param micPosition
|
||||
*/
|
||||
public void closeMicroPhone(int micPosition) {
|
||||
final RoomInfo roomInfo = AvRoomDataManager.get().mCurrentRoomInfo;
|
||||
if (roomInfo == null) {
|
||||
return;
|
||||
}
|
||||
mHomePartyMode.closeMicroPhone(micPosition, roomInfo.getUid())
|
||||
.doOnSuccess(data -> {
|
||||
Logger.i("用户%1$s闭麦成功: %2$s", String.valueOf(roomInfo.getUid()), data);
|
||||
})
|
||||
.doOnError(throwable -> {
|
||||
Logger.i("用户%1$s闭麦失败: %2$s", String.valueOf(roomInfo.getUid()),
|
||||
RxHelper.getNotEmptyError(throwable));
|
||||
})
|
||||
.subscribe();
|
||||
}
|
||||
|
||||
public void roomOperate(int operate) {
|
||||
mSuperAdminModel.roomOperate(operate)
|
||||
.subscribe();
|
||||
}
|
||||
|
||||
/***
|
||||
* 发送房间消息
|
||||
* @param message
|
||||
*/
|
||||
@SuppressLint("CheckResult")
|
||||
public void sendTextMsg(String message) {
|
||||
RoomInfo roomInfo = AvRoomDataManager.get().mCurrentRoomInfo;
|
||||
if (roomInfo == null || TextUtils.isEmpty(message)) return;
|
||||
IMNetEaseManager.get().sendTextMsg(roomInfo.getRoomId(), message)
|
||||
.subscribe(new BiConsumer<ChatRoomMessage, Throwable>() {
|
||||
@Override
|
||||
public void accept(ChatRoomMessage chatRoomMessage,
|
||||
Throwable throwable) throws Exception {
|
||||
if (throwable != null) {
|
||||
if (throwable instanceof AntiSpamHitException) {
|
||||
Log.e("sendTextMsg", throwable.getMessage());
|
||||
} else {
|
||||
Logger.i("发送房间信息失败:" + throwable.getMessage());
|
||||
}
|
||||
} else {
|
||||
getMvpView().onSendMsgSuccess(message);
|
||||
IMNetEaseManager.get().addMessagesImmediately(chatRoomMessage);
|
||||
Logger.i("发送房间信息成功:" + chatRoomMessage.getUuid());
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@SuppressLint("CheckResult")
|
||||
public void chatRoomReConnect(final RoomQueueInfo queueInfo) {
|
||||
final RoomInfo roomInfo = AvRoomDataManager.get().mCurrentRoomInfo;
|
||||
if (roomInfo == null) return;
|
||||
mHomePartyMode.queryRoomMicInfo(String.valueOf(roomInfo.getRoomId()))
|
||||
.delay(1, TimeUnit.SECONDS)
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(entries -> {
|
||||
if (!ListUtils.isListEmpty(entries)) {
|
||||
JsonParser jsonParser = new JsonParser();
|
||||
MicMemberInfo chatRoomMember;
|
||||
for (Entry<String, String> entry : entries) {
|
||||
RoomQueueInfo roomQueueInfo = AvRoomDataManager.get().mMicQueueMemberMap.get(Integer.parseInt(entry.key));
|
||||
if (roomQueueInfo != null) {
|
||||
JsonObject valueJsonObj = jsonParser.parse(entry.value).getAsJsonObject();
|
||||
if (valueJsonObj != null) {
|
||||
chatRoomMember = gson.fromJson(valueJsonObj, MicMemberInfo.class);
|
||||
roomQueueInfo.mChatRoomMember = chatRoomMember;
|
||||
}
|
||||
AvRoomDataManager.get().addRoomQueueInfo(entry.key, roomQueueInfo);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
//麦上都没有人
|
||||
AvRoomDataManager.get().resetMicMembers();
|
||||
}
|
||||
if (getMvpView() != null)
|
||||
getMvpView().chatRoomReConnectView();
|
||||
//之前在麦上
|
||||
if (queueInfo != null && queueInfo.mChatRoomMember != null && queueInfo.mRoomMicInfo != null) {
|
||||
RoomQueueInfo roomQueueInfo = AvRoomDataManager.get()
|
||||
.getRoomQueueMemberInfoByMicPosition(queueInfo.mRoomMicInfo.getPosition());
|
||||
//麦上没人
|
||||
String account = queueInfo.mChatRoomMember.getAccount();
|
||||
if (roomQueueInfo != null && (roomQueueInfo.mChatRoomMember == null ||
|
||||
Objects.equals(account, roomQueueInfo.mChatRoomMember.getAccount()))) {
|
||||
roomQueueInfo.mChatRoomMember = null;
|
||||
//断网重连,不要清除麦上的礼物值
|
||||
upMicroPhone(queueInfo.mRoomMicInfo.getPosition(), account, true, true);
|
||||
}
|
||||
}
|
||||
IMNetEaseManager.get().mCacheRoomQueueInfo = null;
|
||||
Logger.i("断网重连获取队列信息成功...." + entries);
|
||||
}, new Consumer<Throwable>() {
|
||||
@Override
|
||||
public void accept(Throwable throwable) throws Exception {
|
||||
throwable.printStackTrace();
|
||||
Logger.i("断网重连获取队列信息失败....");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void userRoomIn() {
|
||||
final RoomInfo roomInfo = AvRoomDataManager.get().mCurrentRoomInfo;
|
||||
if (roomInfo == null) return;
|
||||
long currentUid = AuthModel.get().getCurrentUid();
|
||||
mAvRoomModel.userRoomIn(String.valueOf(currentUid), roomInfo.getUid(), 0, "")
|
||||
.delay(1, TimeUnit.SECONDS)
|
||||
.observeOn(AndroidSchedulers.mainThread()).subscribe();
|
||||
}
|
||||
|
||||
@NonNull
|
||||
private ChatRoomMessage getChatRoomMessage(RoomInfo roomInfo, List<Integer> integers, int second) {
|
||||
UserInfo userInfo = UserModel.get().getCacheLoginUserInfo();
|
||||
List<FaceReceiveInfo> faceReceiveInfos = new ArrayList<>();
|
||||
FaceReceiveInfo faceReceiveInfo = new FaceReceiveInfo();
|
||||
faceReceiveInfo.setNick(userInfo.getNick());
|
||||
faceReceiveInfo.setFaceId(Constants.DRAGON_BAR_ID);
|
||||
faceReceiveInfo.setUid(userInfo.getUid());
|
||||
|
||||
faceReceiveInfo.setResultIndexes(integers);
|
||||
faceReceiveInfos.add(faceReceiveInfo);
|
||||
|
||||
// 发送云信信息给所有人
|
||||
FaceAttachment faceAttachment =
|
||||
new FaceAttachment(CustomAttachment.CUSTOM_MSG_DRAGON_BAR, second);
|
||||
faceAttachment.setUid(userInfo.getUid());
|
||||
faceAttachment.setFaceReceiveInfos(faceReceiveInfos);
|
||||
|
||||
return ChatRoomMessageBuilder.createChatRoomCustomMessage(
|
||||
// 聊天室id
|
||||
roomInfo.getRoomId() + "",
|
||||
// 自定义消息
|
||||
faceAttachment
|
||||
);
|
||||
}
|
||||
|
||||
public void updateScreen(boolean isCloseScreen) {
|
||||
String contentText;
|
||||
if (isCloseScreen) {
|
||||
ChatRoomMessage firstMsg = IMNetEaseManager.get().getFirstMessageContent();
|
||||
IMNetEaseManager.get().addCloseScreenMessages(firstMsg);
|
||||
if (AvRoomDataManager.get().closeScreenBySAdmin()) {
|
||||
contentText = "系统检测涉嫌违规,予以关闭公屏消息警告";
|
||||
} else {
|
||||
contentText = "管理员已关闭聊天公屏";
|
||||
}
|
||||
} else {
|
||||
contentText = "管理员已开启聊天公屏";
|
||||
}
|
||||
RoomInfoAttachment attachment = new RoomInfoAttachment(CustomAttachment.CUSTOM_MSG_UPDATE_ROOM_INFO,
|
||||
CustomAttachment.CUSTOM_MSG_UPDATE_ROOM_INFO_CLOSE_SCREEN);
|
||||
ChatRoomMessage screenMsg = ChatRoomMessageBuilder.createChatRoomCustomMessage(
|
||||
String.valueOf(AvRoomDataManager.get().getRoomId()),
|
||||
attachment
|
||||
);
|
||||
screenMsg.setContent(contentText);
|
||||
IMNetEaseManager.get().addCloseScreenMessages(screenMsg);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 检查是否关注了这个用户
|
||||
*
|
||||
* @param uid
|
||||
*/
|
||||
@SuppressLint("CheckResult")
|
||||
public void checkFollow(long uid) {
|
||||
Single.just("")
|
||||
.delay(SHOW_FOLLOW_TIME, TimeUnit.MILLISECONDS)
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.flatMap(new Function<String, SingleSource<Boolean>>() {
|
||||
@Override
|
||||
public SingleSource<Boolean> apply(String s) throws Exception {
|
||||
return PraiseModel.get().isPraised(AuthModel.get().getCurrentUid(), uid);
|
||||
}
|
||||
})
|
||||
.compose(bindUntilEvent(PresenterEvent.DESTROY))
|
||||
.compose(RxHelper.handleSchAndExce())
|
||||
.subscribe(new BiConsumer<Boolean, Throwable>() {
|
||||
@Override
|
||||
public void accept(Boolean aBoolean, Throwable throwable) throws Exception {
|
||||
if (throwable != null || getMvpView() == null) {
|
||||
return;
|
||||
}
|
||||
//如果没有关注
|
||||
if (!aBoolean) {
|
||||
getMvpView().noFollow();
|
||||
}
|
||||
}
|
||||
});
|
||||
Observable.interval(1, 5, TimeUnit.MINUTES)
|
||||
.compose(bindUntilEvent(PresenterEvent.DESTROY))
|
||||
.map(aLong -> AvRoomDataManager.get().isRoomFans)
|
||||
.takeUntil(aBoolean -> aBoolean)
|
||||
.subscribe(aBoolean -> {
|
||||
if (!aBoolean && getMvpView() != null) {
|
||||
getMvpView().noFollow2();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 公屏历史消息
|
||||
*/
|
||||
public void loadMessageHistory() {
|
||||
RoomInfo roomInfo = AvRoomDataManager.get().mCurrentRoomInfo;
|
||||
|
||||
if (roomInfo == null) return;
|
||||
if (!roomInfo.isCloseScreen()) {
|
||||
int count = 10;
|
||||
InitInfo initInfo = InitialModel.get().getCacheInitInfo();
|
||||
if (initInfo != null) count = initInfo.getRoomMessageCount();
|
||||
NIMClient.getService(ChatRoomService.class)
|
||||
.pullMessageHistoryExType(String.valueOf(roomInfo.getRoomId()), 0,
|
||||
count, QueryDirectionEnum.QUERY_OLD, new MsgTypeEnum[]{MsgTypeEnum.text})
|
||||
.setCallback(new RequestCallbackWrapper<List<ChatRoomMessage>>() {
|
||||
@Override
|
||||
public void onResult(int code, List<ChatRoomMessage> result, Throwable exception) {
|
||||
if (code == ResponseCode.RES_SUCCESS && result != null && result.size() > 0) {
|
||||
Collections.reverse(result);
|
||||
if (getMvpView() != null) {
|
||||
getMvpView().showMessageHistory(result);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 关注房主
|
||||
*
|
||||
* @param position
|
||||
* @param ownerUid
|
||||
*/
|
||||
@SuppressLint("CheckResult")
|
||||
public void followOwner(int position, long ownerUid) {
|
||||
PraiseModel.get().praise(ownerUid, true).subscribe(new BiConsumer<String, Throwable>() {
|
||||
@Override
|
||||
public void accept(String s, Throwable throwable) throws Exception {
|
||||
if (getMvpView() == null) {
|
||||
return;
|
||||
}
|
||||
if (throwable == null) {
|
||||
getMvpView().onFollowSuccess(position);
|
||||
} else {
|
||||
getMvpView().onFollowFail(throwable.getMessage());
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
public class GameRoomPresenter extends BaseRoomPresenter<IGameRoomView> {
|
||||
|
||||
@SuppressLint("CheckResult")
|
||||
public void getBannerList() {
|
||||
mAvRoomModel.getRoomBanner()
|
||||
AvRoomModel.get().getRoomBanner()
|
||||
.compose(bindToLifecycle())
|
||||
.subscribe(bannerInfos -> {
|
||||
if (bannerInfos == null) bannerInfos = new ArrayList<>();
|
||||
|
@@ -9,41 +9,23 @@ import android.util.Log;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.JsonObject;
|
||||
import com.google.gson.JsonParser;
|
||||
import com.netease.nimlib.sdk.NIMClient;
|
||||
import com.netease.nimlib.sdk.RequestCallbackWrapper;
|
||||
import com.netease.nimlib.sdk.ResponseCode;
|
||||
import com.netease.nimlib.sdk.chatroom.ChatRoomMessageBuilder;
|
||||
import com.netease.nimlib.sdk.chatroom.ChatRoomService;
|
||||
import com.netease.nimlib.sdk.chatroom.model.ChatRoomMember;
|
||||
import com.netease.nimlib.sdk.chatroom.model.ChatRoomMessage;
|
||||
import com.netease.nimlib.sdk.msg.constant.MsgTypeEnum;
|
||||
import com.netease.nimlib.sdk.msg.model.QueryDirectionEnum;
|
||||
import com.netease.nimlib.sdk.util.Entry;
|
||||
import com.orhanobut.logger.Logger;
|
||||
import com.yizhuan.erban.avroom.view.IHomePartyView;
|
||||
import com.yizhuan.erban.base.BaseMvpPresenter;
|
||||
import com.yizhuan.erban.treasure_box.widget.GoldBoxHelper;
|
||||
import com.yizhuan.erban.utils.UserUtils;
|
||||
import com.yizhuan.xchat_android_core.Constants;
|
||||
import com.yizhuan.xchat_android_core.auth.AuthModel;
|
||||
import com.yizhuan.xchat_android_core.bean.RoomQueueInfo;
|
||||
import com.yizhuan.xchat_android_core.home.bean.BannerInfo;
|
||||
import com.yizhuan.xchat_android_core.im.custom.bean.CustomAttachment;
|
||||
import com.yizhuan.xchat_android_core.im.custom.bean.FaceAttachment;
|
||||
import com.yizhuan.xchat_android_core.im.custom.bean.RoomInfoAttachment;
|
||||
import com.yizhuan.xchat_android_core.initial.InitialModel;
|
||||
import com.yizhuan.xchat_android_core.initial.bean.InitInfo;
|
||||
import com.yizhuan.xchat_android_core.manager.AvRoomDataManager;
|
||||
import com.yizhuan.xchat_android_core.manager.IMNetEaseManager;
|
||||
import com.yizhuan.xchat_android_core.manager.RoomEvent;
|
||||
import com.yizhuan.xchat_android_core.mentoring_relationship.model.MentoringRelationshipModel;
|
||||
import com.yizhuan.xchat_android_core.miniworld.bean.MiniWorldInWorldInfo;
|
||||
import com.yizhuan.xchat_android_core.miniworld.model.MiniWorldModel;
|
||||
import com.yizhuan.xchat_android_core.pay.bean.WalletInfo;
|
||||
import com.yizhuan.xchat_android_core.praise.PraiseModel;
|
||||
import com.yizhuan.xchat_android_core.room.bean.DragonBarInfo;
|
||||
import com.yizhuan.xchat_android_core.room.bean.RoomInfo;
|
||||
import com.yizhuan.xchat_android_core.room.dragonball.DragonBallModel;
|
||||
@@ -51,40 +33,21 @@ import com.yizhuan.xchat_android_core.room.exception.AntiSpamHitException;
|
||||
import com.yizhuan.xchat_android_core.room.face.FaceInfo;
|
||||
import com.yizhuan.xchat_android_core.room.face.FaceReceiveInfo;
|
||||
import com.yizhuan.xchat_android_core.room.giftvalue.helper.GiftValueMrg;
|
||||
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.model.RoomBaseModel;
|
||||
import com.yizhuan.xchat_android_core.room.model.RoomSettingModel;
|
||||
import com.yizhuan.xchat_android_core.room.queue.bean.MicMemberInfo;
|
||||
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.user.UserModel;
|
||||
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.net.BeanObserver;
|
||||
import com.yizhuan.xchat_android_core.utils.net.DontWarnObserver;
|
||||
import com.yizhuan.xchat_android_core.utils.net.RxHelper;
|
||||
import com.yizhuan.xchat_android_library.base.PresenterEvent;
|
||||
import com.yizhuan.xchat_android_library.net.rxnet.callback.CallBack;
|
||||
import com.yizhuan.xchat_android_library.utils.ListUtils;
|
||||
import com.yizhuan.xchat_android_library.utils.SingleToastUtil;
|
||||
import com.yizhuan.xchat_android_library.utils.config.BasicConfig;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import io.reactivex.Observable;
|
||||
import io.reactivex.Single;
|
||||
import io.reactivex.SingleSource;
|
||||
import io.reactivex.android.schedulers.AndroidSchedulers;
|
||||
import io.reactivex.functions.BiConsumer;
|
||||
import io.reactivex.functions.Consumer;
|
||||
import io.reactivex.functions.Function;
|
||||
|
||||
|
||||
/**
|
||||
@@ -93,167 +56,10 @@ import io.reactivex.functions.Function;
|
||||
* @author jiahui
|
||||
* @date 2017/12/8
|
||||
*/
|
||||
public class HomePartyPresenter extends BaseMvpPresenter<IHomePartyView> {
|
||||
|
||||
/**
|
||||
* 显示关注房主的时间
|
||||
*/
|
||||
public static final int SHOW_FOLLOW_TIME = 3 * 60 * 1000;
|
||||
|
||||
private final HomePartyModel mHomePartyMode;
|
||||
private final AvRoomModel mAvRoomModel;
|
||||
private final SuperAdminModel mSuperAdminModel;
|
||||
/**
|
||||
* 判断所坑服务端是否响应回来了
|
||||
*/
|
||||
private boolean mIsLockMicPosResultSuccess = true;
|
||||
private boolean mIsUnLockMicPosResultSuccess = true;
|
||||
public class HomePartyPresenter extends BaseRoomPresenter<IHomePartyView> {
|
||||
|
||||
private boolean isLeaveMode = false;
|
||||
|
||||
private Gson gson = new Gson();
|
||||
|
||||
protected WalletInfo walletInfo;
|
||||
|
||||
public HomePartyPresenter() {
|
||||
mHomePartyMode = new HomePartyModel();
|
||||
mAvRoomModel = AvRoomModel.get();
|
||||
mSuperAdminModel = new SuperAdminModel();
|
||||
}
|
||||
|
||||
/**
|
||||
* 麦坑点击处理,麦上没人的时候
|
||||
*
|
||||
* @param micPosition 麦序位置
|
||||
* @param chatRoomMember 坑上的用户
|
||||
*/
|
||||
public void microPhonePositionClick(final int micPosition, MicMemberInfo chatRoomMember) {
|
||||
final RoomInfo currentRoom = AvRoomDataManager.get().mCurrentRoomInfo;
|
||||
if (currentRoom == null) {
|
||||
return;
|
||||
}
|
||||
final String currentUid = String.valueOf(AuthModel.get().getCurrentUid());
|
||||
if (AvRoomDataManager.get().isRoomOwner(currentUid) || AvRoomDataManager.get().isRoomAdmin(currentUid)
|
||||
|| SuperAdminUtil.isSuperAdmin()) {
|
||||
if (AvRoomDataManager.get().isRoomOwner(currentUid) && currentRoom.isLeaveMode()) {
|
||||
SingleToastUtil.showToast("请先关闭离开模式");
|
||||
return;
|
||||
}
|
||||
onOwnerUpMicroClick(micPosition, Long.parseLong(currentUid));
|
||||
} else {
|
||||
if (AvRoomDataManager.get().getRoomQueueMemberInfoByMicPosition(micPosition).mRoomMicInfo.isMicLock()) {
|
||||
if (AvRoomDataManager.get().isQueuingMicro()) {
|
||||
String msg;
|
||||
if (AvRoomDataManager.get().isOnMic(AuthModel.get().getCurrentUid())) {
|
||||
msg = "你已经在麦上啦";
|
||||
} else {
|
||||
msg = "要排麦才可以上麦哦~";
|
||||
}
|
||||
SingleToastUtil.showToast(msg);
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (AvRoomDataManager.get().isQueuingMicro() && AvRoomDataManager.get().myIsInQueue) {
|
||||
SingleToastUtil.showToast("取消报名才可以上麦哦!");
|
||||
return;
|
||||
}
|
||||
getMvpView().toUpMicroPhone(micPosition, currentUid, false);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
private void onOwnerUpMicroClick(final int micPosition, final long currentUid) {
|
||||
RoomQueueInfo roomQueueInfo = AvRoomDataManager.get().getRoomQueueMemberInfoByMicPosition(micPosition);
|
||||
if (roomQueueInfo == null) return;
|
||||
if (getMvpView() != null)
|
||||
getMvpView().showOwnerClickDialog(roomQueueInfo.mRoomMicInfo, micPosition, currentUid);
|
||||
}
|
||||
|
||||
public void lockMicroPhone(int micPosition) {
|
||||
if (!mIsLockMicPosResultSuccess) {
|
||||
return;
|
||||
}
|
||||
mIsLockMicPosResultSuccess = false;
|
||||
RoomInfo currentRoom = AvRoomDataManager.get().mCurrentRoomInfo;
|
||||
if (currentRoom == null) {
|
||||
return;
|
||||
}
|
||||
final String currentUid = String.valueOf(currentRoom.getUid());
|
||||
mHomePartyMode.lockMicroPhone(micPosition, currentUid, AuthModel.get().getTicket())
|
||||
.doOnSuccess(data -> {
|
||||
Logger.i("用户%1$s锁坑成功: %2$s", String.valueOf(currentUid), data);
|
||||
mIsLockMicPosResultSuccess = true;
|
||||
})
|
||||
.doOnError(throwable -> {
|
||||
Logger.i("用户%1$s锁坑失败: %2$s", String.valueOf(currentUid),
|
||||
RxHelper.getNotEmptyError(throwable));
|
||||
mIsLockMicPosResultSuccess = true;
|
||||
})
|
||||
.subscribe();
|
||||
}
|
||||
|
||||
/**
|
||||
* 坑位释放锁
|
||||
*/
|
||||
public void unLockMicroPhone(int micPosition) {
|
||||
if (!mIsUnLockMicPosResultSuccess) {
|
||||
return;
|
||||
}
|
||||
mIsUnLockMicPosResultSuccess = false;
|
||||
RoomInfo currentRoom = AvRoomDataManager.get().mCurrentRoomInfo;
|
||||
if (currentRoom == null) {
|
||||
return;
|
||||
}
|
||||
final String currentUid = String.valueOf(currentRoom.getUid());
|
||||
if (AvRoomDataManager.get().isRoomAdmin() || AvRoomDataManager.get().isRoomOwner(currentUid)) {
|
||||
mHomePartyMode.unLockMicroPhone(micPosition, currentUid, AuthModel.get().getTicket())
|
||||
.subscribe(new Consumer<String>() {
|
||||
@Override
|
||||
public void accept(String data) throws Exception {
|
||||
Logger.i("用户%1$s解麦成功: %2$s", String.valueOf(currentUid), data);
|
||||
mIsUnLockMicPosResultSuccess = true;
|
||||
}
|
||||
}, new Consumer<Throwable>() {
|
||||
@Override
|
||||
public void accept(Throwable throwable) throws Exception {
|
||||
Logger.i("用户%1$s解麦失败: %2$s", String.valueOf(currentUid), throwable.getMessage());
|
||||
mIsUnLockMicPosResultSuccess = true;
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 下麦
|
||||
*
|
||||
* @param micPosition
|
||||
* @param isKick 是否是主动的
|
||||
*/
|
||||
public void downMicroPhone(int micPosition, final boolean isKick) {
|
||||
final RoomInfo roomInfo = AvRoomDataManager.get().mCurrentRoomInfo;
|
||||
if (roomInfo == null) {
|
||||
return;
|
||||
}
|
||||
final String currentUid = String.valueOf(AuthModel.get());
|
||||
mHomePartyMode.downMicroPhone(micPosition, new CallBack<String>() {
|
||||
@Override
|
||||
public void onSuccess(String data) {
|
||||
Logger.i("用户%1$s下麦成功:%2$s", currentUid, data);
|
||||
if (!isKick) {
|
||||
//被踢了
|
||||
if (getMvpView() != null) {
|
||||
getMvpView().kickDownMicroPhoneSuccess();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFail(int code, String error) {
|
||||
Logger.i("用户%1$s下麦失败:%2$s----", currentUid, error);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 上麦
|
||||
*
|
||||
@@ -289,234 +95,10 @@ public class HomePartyPresenter extends BaseMvpPresenter<IHomePartyView> {
|
||||
}
|
||||
}
|
||||
|
||||
public void upMicroPhone(final int micPosition, final String uId, boolean isInviteUpMic) {
|
||||
upMicroPhone(micPosition, uId, isInviteUpMic, false);
|
||||
}
|
||||
|
||||
public void upMicroPhone(int micPosition, String uId, boolean isInviteUpMic, RoomInfo roomInfo) {
|
||||
upMicroPhone(micPosition, uId, isInviteUpMic, roomInfo, false);
|
||||
}
|
||||
|
||||
public void upMicroPhone(int micPosition, String uId, boolean isInviteUpMic, RoomInfo roomInfo,
|
||||
boolean isReconnect) {
|
||||
mHomePartyMode.upMicroPhone(micPosition, uId, String.valueOf(roomInfo.getRoomId()),
|
||||
isInviteUpMic, new CallBack<String>() {
|
||||
@Override
|
||||
public void onSuccess(String data) {
|
||||
Logger.i("用户%1$s上麦成功:%2$s", uId, data);
|
||||
if (!isReconnect) {
|
||||
GiftValueMrg.get().requestUpMic(micPosition, uId);
|
||||
} else {
|
||||
GiftValueMrg.get().handleReconnect(true);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFail(int code, String error) {
|
||||
if (code == RoomBaseModel.CODE_UPDATE_MIC) {
|
||||
if (getMvpView() != null) {
|
||||
getMvpView().updateMicView();
|
||||
}
|
||||
}
|
||||
Logger.i("用户%1$s上麦失败:%2$s----", uId, error);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 邀请用户上麦
|
||||
*
|
||||
* @param micInfo 要邀请的用户
|
||||
* @param position 坑位
|
||||
*/
|
||||
public void inviteMicroPhone(final BaseInfo micInfo, final int position) {
|
||||
final long micUid = micInfo.getUid();
|
||||
if (AvRoomDataManager.get().isOnMic(micUid)) {
|
||||
return;
|
||||
}
|
||||
//如果点击的就是自己,那这里就是自己上麦
|
||||
if (AvRoomDataManager.get().isOwner(micUid)) {
|
||||
upMicroPhone(position, String.valueOf(micUid), true);
|
||||
return;
|
||||
}
|
||||
mHomePartyMode.inviteMicroPhone(micInfo, position)
|
||||
.compose(bindUntilEvent(PresenterEvent.DESTROY))
|
||||
.subscribe(new BiConsumer<ChatRoomMessage, Throwable>() {
|
||||
@Override
|
||||
public void accept(ChatRoomMessage chatRoomMessage,
|
||||
Throwable throwable) throws Exception {
|
||||
if (throwable != null) {
|
||||
Logger.i("邀请用户%d上麦失败!!!" + micUid);
|
||||
} else
|
||||
Logger.i("邀请用户%d上麦成功!!!" + micUid);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取固定成员(创建者,管理员,普通用户,受限用户)
|
||||
*/
|
||||
public void loadNormalMembers() {
|
||||
RoomInfo currentRoom = AvRoomDataManager.get().mCurrentRoomInfo;
|
||||
if (currentRoom == null) {
|
||||
return;
|
||||
}
|
||||
mHomePartyMode.loadNormalMembers(String.valueOf(currentRoom.getRoomId()), 0, 500,
|
||||
new CallBack<List<ChatRoomMember>>() {
|
||||
@Override
|
||||
public void onSuccess(List<ChatRoomMember> data) {
|
||||
if (getMvpView() != null) {
|
||||
getMvpView().resultLoadNormalMembers(data);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFail(int code, String error) {
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 开麦
|
||||
*
|
||||
* @param micPosition
|
||||
*/
|
||||
public void openMicroPhone(int micPosition) {
|
||||
final RoomInfo roomInfo = AvRoomDataManager.get().mCurrentRoomInfo;
|
||||
if (roomInfo == null) {
|
||||
return;
|
||||
}
|
||||
mHomePartyMode.openMicroPhone(micPosition, roomInfo.getUid())
|
||||
.subscribe(new DontWarnObserver<String>() {
|
||||
@Override
|
||||
public void accept(String data, String error) {
|
||||
super.accept(data, error);
|
||||
if (error != null) {
|
||||
Logger.i("用户%1$s开麦失败: %2$s", String.valueOf(roomInfo.getUid()), error);
|
||||
} else {
|
||||
Logger.i("用户%1$s开麦成功: %2$s", String.valueOf(roomInfo.getUid()), data);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 闭麦
|
||||
*
|
||||
* @param micPosition
|
||||
*/
|
||||
public void closeMicroPhone(int micPosition) {
|
||||
final RoomInfo roomInfo = AvRoomDataManager.get().mCurrentRoomInfo;
|
||||
if (roomInfo == null) {
|
||||
return;
|
||||
}
|
||||
mHomePartyMode.closeMicroPhone(micPosition, roomInfo.getUid())
|
||||
.doOnSuccess(data -> {
|
||||
Logger.i("用户%1$s闭麦成功: %2$s", String.valueOf(roomInfo.getUid()), data);
|
||||
})
|
||||
.doOnError(throwable -> {
|
||||
Logger.i("用户%1$s闭麦失败: %2$s", String.valueOf(roomInfo.getUid()),
|
||||
RxHelper.getNotEmptyError(throwable));
|
||||
})
|
||||
.subscribe();
|
||||
}
|
||||
|
||||
public void roomOperate(int operate) {
|
||||
mSuperAdminModel.roomOperate(operate)
|
||||
.subscribe();
|
||||
}
|
||||
|
||||
/***
|
||||
* 发送房间消息
|
||||
* @param message
|
||||
*/
|
||||
@SuppressLint("CheckResult")
|
||||
public void sendTextMsg(String message) {
|
||||
RoomInfo roomInfo = AvRoomDataManager.get().mCurrentRoomInfo;
|
||||
if (roomInfo == null || TextUtils.isEmpty(message)) return;
|
||||
IMNetEaseManager.get().sendTextMsg(roomInfo.getRoomId(), message)
|
||||
.subscribe(new BiConsumer<ChatRoomMessage, Throwable>() {
|
||||
@Override
|
||||
public void accept(ChatRoomMessage chatRoomMessage,
|
||||
Throwable throwable) throws Exception {
|
||||
if (throwable != null) {
|
||||
if (throwable instanceof AntiSpamHitException) {
|
||||
Log.e("sendTextMsg", throwable.getMessage());
|
||||
} else {
|
||||
Logger.i("发送房间信息失败:" + throwable.getMessage());
|
||||
}
|
||||
} else {
|
||||
getMvpView().onSendMsgSuccess();
|
||||
IMNetEaseManager.get().addMessagesImmediately(chatRoomMessage);
|
||||
Logger.i("发送房间信息成功:" + chatRoomMessage.getUuid());
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@SuppressLint("CheckResult")
|
||||
public void chatRoomReConnect(final RoomQueueInfo queueInfo) {
|
||||
final RoomInfo roomInfo = AvRoomDataManager.get().mCurrentRoomInfo;
|
||||
if (roomInfo == null) return;
|
||||
mHomePartyMode.queryRoomMicInfo(String.valueOf(roomInfo.getRoomId()))
|
||||
.delay(1, TimeUnit.SECONDS)
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(entries -> {
|
||||
if (!ListUtils.isListEmpty(entries)) {
|
||||
JsonParser jsonParser = new JsonParser();
|
||||
MicMemberInfo chatRoomMember;
|
||||
for (Entry<String, String> entry : entries) {
|
||||
RoomQueueInfo roomQueueInfo = AvRoomDataManager.get().mMicQueueMemberMap.get(Integer.parseInt(entry.key));
|
||||
if (roomQueueInfo != null) {
|
||||
JsonObject valueJsonObj = jsonParser.parse(entry.value).getAsJsonObject();
|
||||
if (valueJsonObj != null) {
|
||||
chatRoomMember = gson.fromJson(valueJsonObj, MicMemberInfo.class);
|
||||
roomQueueInfo.mChatRoomMember = chatRoomMember;
|
||||
}
|
||||
AvRoomDataManager.get().addRoomQueueInfo(entry.key, roomQueueInfo);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
//麦上都没有人
|
||||
AvRoomDataManager.get().resetMicMembers();
|
||||
}
|
||||
if (getMvpView() != null)
|
||||
getMvpView().chatRoomReConnectView();
|
||||
//之前在麦上
|
||||
if (queueInfo != null && queueInfo.mChatRoomMember != null && queueInfo.mRoomMicInfo != null) {
|
||||
RoomQueueInfo roomQueueInfo = AvRoomDataManager.get()
|
||||
.getRoomQueueMemberInfoByMicPosition(queueInfo.mRoomMicInfo.getPosition());
|
||||
//麦上没人
|
||||
String account = queueInfo.mChatRoomMember.getAccount();
|
||||
if (roomQueueInfo != null && (roomQueueInfo.mChatRoomMember == null ||
|
||||
Objects.equals(account, roomQueueInfo.mChatRoomMember.getAccount()))) {
|
||||
roomQueueInfo.mChatRoomMember = null;
|
||||
//断网重连,不要清除麦上的礼物值
|
||||
upMicroPhone(queueInfo.mRoomMicInfo.getPosition(), account, true, true);
|
||||
}
|
||||
}
|
||||
IMNetEaseManager.get().mCacheRoomQueueInfo = null;
|
||||
Logger.i("断网重连获取队列信息成功...." + entries);
|
||||
}, new Consumer<Throwable>() {
|
||||
@Override
|
||||
public void accept(Throwable throwable) throws Exception {
|
||||
throwable.printStackTrace();
|
||||
Logger.i("断网重连获取队列信息失败....");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
public void userRoomIn() {
|
||||
final RoomInfo roomInfo = AvRoomDataManager.get().mCurrentRoomInfo;
|
||||
if (roomInfo == null) return;
|
||||
long currentUid = AuthModel.get().getCurrentUid();
|
||||
mAvRoomModel.userRoomIn(String.valueOf(currentUid), roomInfo.getUid(),0,"")
|
||||
.delay(1, TimeUnit.SECONDS)
|
||||
.observeOn(AndroidSchedulers.mainThread()).subscribe();
|
||||
}
|
||||
|
||||
//isGiven上次是否异常退出
|
||||
public void sendDragonBar(FaceInfo faceInfo, String point, boolean isGiven) {
|
||||
RoomInfo roomInfo = AvRoomDataManager.get().mCurrentRoomInfo;
|
||||
@@ -641,29 +223,6 @@ public class HomePartyPresenter extends BaseMvpPresenter<IHomePartyView> {
|
||||
});
|
||||
}
|
||||
|
||||
public void updateScreen(boolean isCloseScreen) {
|
||||
String contentText;
|
||||
if (isCloseScreen) {
|
||||
ChatRoomMessage firstMsg = IMNetEaseManager.get().getFirstMessageContent();
|
||||
IMNetEaseManager.get().addCloseScreenMessages(firstMsg);
|
||||
if (AvRoomDataManager.get().closeScreenBySAdmin()) {
|
||||
contentText = "系统检测涉嫌违规,予以关闭公屏消息警告";
|
||||
} else {
|
||||
contentText = "管理员已关闭聊天公屏";
|
||||
}
|
||||
} else {
|
||||
contentText = "管理员已开启聊天公屏";
|
||||
}
|
||||
RoomInfoAttachment attachment = new RoomInfoAttachment(CustomAttachment.CUSTOM_MSG_UPDATE_ROOM_INFO,
|
||||
CustomAttachment.CUSTOM_MSG_UPDATE_ROOM_INFO_CLOSE_SCREEN);
|
||||
ChatRoomMessage screenMsg = ChatRoomMessageBuilder.createChatRoomCustomMessage(
|
||||
String.valueOf(AvRoomDataManager.get().getRoomId()),
|
||||
attachment
|
||||
);
|
||||
screenMsg.setContent(contentText);
|
||||
IMNetEaseManager.get().addCloseScreenMessages(screenMsg);
|
||||
}
|
||||
|
||||
@SuppressLint("CheckResult")
|
||||
public void reportToServerMissionThree() {
|
||||
MentoringRelationshipModel.get()
|
||||
@@ -705,18 +264,13 @@ public class HomePartyPresenter extends BaseMvpPresenter<IHomePartyView> {
|
||||
|
||||
}
|
||||
|
||||
private RoomSettingModel mRoomSettingModel;
|
||||
|
||||
public void closeLeaveMode(int micPosition, String account) {
|
||||
RoomInfo roomInfo = AvRoomDataManager.get().mCurrentRoomInfo;
|
||||
int position = AvRoomDataManager.get().getMicPosition(AvRoomDataManager.get().getRoomUid());
|
||||
if (roomInfo != null && roomInfo.isLeaveMode() && micPosition == position) {
|
||||
if (mRoomSettingModel == null)
|
||||
mRoomSettingModel = new RoomSettingModel();
|
||||
|
||||
// 新版由管理员和房主位上麦用户共同调接口关闭离开模式(提高关闭离开模式成功率,降低接口调用频率);
|
||||
if (AvRoomDataManager.get().isManager() || String.valueOf(AuthModel.get().getCurrentUid()).equals(account)) {
|
||||
mRoomSettingModel.leaveModeClose(roomInfo.getUid()).subscribe(new BeanObserver<String>() {
|
||||
new RoomSettingModel().leaveModeClose(roomInfo.getUid()).subscribe(new BeanObserver<String>() {
|
||||
@Override
|
||||
public void onErrorMsg(String error) {
|
||||
|
||||
@@ -747,75 +301,6 @@ public class HomePartyPresenter extends BaseMvpPresenter<IHomePartyView> {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 检查是否关注了这个用户
|
||||
*
|
||||
* @param uid
|
||||
*/
|
||||
@SuppressLint("CheckResult")
|
||||
public void checkFollow(long uid) {
|
||||
Single.just("")
|
||||
.delay(SHOW_FOLLOW_TIME, TimeUnit.MILLISECONDS)
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.flatMap(new Function<String, SingleSource<Boolean>>() {
|
||||
@Override
|
||||
public SingleSource<Boolean> apply(String s) throws Exception {
|
||||
return PraiseModel.get().isPraised(AuthModel.get().getCurrentUid(), uid);
|
||||
}
|
||||
})
|
||||
.compose(bindUntilEvent(PresenterEvent.DESTROY))
|
||||
.compose(RxHelper.handleSchAndExce())
|
||||
.subscribe(new BiConsumer<Boolean, Throwable>() {
|
||||
@Override
|
||||
public void accept(Boolean aBoolean, Throwable throwable) throws Exception {
|
||||
if (throwable != null || getMvpView() == null) {
|
||||
return;
|
||||
}
|
||||
//如果没有关注
|
||||
if (!aBoolean) {
|
||||
getMvpView().noFollow();
|
||||
}
|
||||
}
|
||||
});
|
||||
Observable.interval(1, 5, TimeUnit.MINUTES)
|
||||
.compose(bindUntilEvent(PresenterEvent.DESTROY))
|
||||
.map(aLong -> AvRoomDataManager.get().isRoomFans)
|
||||
.takeUntil(aBoolean -> aBoolean)
|
||||
.subscribe(aBoolean -> {
|
||||
if (!aBoolean && getMvpView() != null) {
|
||||
getMvpView().noFollow2();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 公屏历史消息
|
||||
*/
|
||||
public void loadMessageHistory() {
|
||||
RoomInfo roomInfo = AvRoomDataManager.get().mCurrentRoomInfo;
|
||||
|
||||
if (roomInfo == null) return;
|
||||
if (!roomInfo.isCloseScreen()) {
|
||||
int count = 10;
|
||||
InitInfo initInfo = InitialModel.get().getCacheInitInfo();
|
||||
if (initInfo != null) count = initInfo.getRoomMessageCount();
|
||||
NIMClient.getService(ChatRoomService.class)
|
||||
.pullMessageHistoryExType(String.valueOf(roomInfo.getRoomId()), 0,
|
||||
count, QueryDirectionEnum.QUERY_OLD, new MsgTypeEnum[]{MsgTypeEnum.text})
|
||||
.setCallback(new RequestCallbackWrapper<List<ChatRoomMessage>>() {
|
||||
@Override
|
||||
public void onResult(int code, List<ChatRoomMessage> result, Throwable exception) {
|
||||
if (code == ResponseCode.RES_SUCCESS && result != null && result.size() > 0) {
|
||||
Collections.reverse(result);
|
||||
if (getMvpView() != null) {
|
||||
getMvpView().showMessageHistory(result);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 检查当前用户是否在话题中
|
||||
*
|
||||
@@ -840,29 +325,6 @@ public class HomePartyPresenter extends BaseMvpPresenter<IHomePartyView> {
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 关注房主
|
||||
*
|
||||
* @param position
|
||||
* @param ownerUid
|
||||
*/
|
||||
@SuppressLint("CheckResult")
|
||||
public void followOwner(int position, long ownerUid) {
|
||||
PraiseModel.get().praise(ownerUid, true).subscribe(new BiConsumer<String, Throwable>() {
|
||||
@Override
|
||||
public void accept(String s, Throwable throwable) throws Exception {
|
||||
if (getMvpView() == null) {
|
||||
return;
|
||||
}
|
||||
if (throwable == null) {
|
||||
getMvpView().onFollowSuccess(position);
|
||||
} else {
|
||||
getMvpView().onFollowFail(throwable.getMessage());
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void datingNext() {
|
||||
final RoomInfo roomInfo = AvRoomDataManager.get().mCurrentRoomInfo;
|
||||
if (roomInfo == null) return;
|
||||
|
@@ -0,0 +1,72 @@
|
||||
package com.yizhuan.erban.avroom.view
|
||||
|
||||
import com.netease.nimlib.sdk.chatroom.model.ChatRoomMessage
|
||||
import com.yizhuan.xchat_android_core.bean.RoomMicInfo
|
||||
import com.yizhuan.xchat_android_library.base.IMvpBaseView
|
||||
|
||||
/**
|
||||
*
|
||||
* 轰趴房View层
|
||||
*
|
||||
* @author jiahui
|
||||
* @date 2017/12/8
|
||||
*/
|
||||
interface IBaseRoomView : IMvpBaseView {
|
||||
/**
|
||||
* 被踢下麦成功
|
||||
*/
|
||||
fun kickDownMicroPhoneSuccess()
|
||||
|
||||
/**
|
||||
* 麦上没人点击坑位处理
|
||||
*
|
||||
* @param roomMicInfo 坑位信息
|
||||
* @param micPosition
|
||||
* @param currentUid
|
||||
*/
|
||||
fun showOwnerClickDialog(roomMicInfo: RoomMicInfo, micPosition: Int, currentUid: Long)
|
||||
|
||||
/**
|
||||
* 断网重连回调
|
||||
*/
|
||||
fun chatRoomReConnectView()
|
||||
fun showToast(msg: String?)
|
||||
fun onSendMsgSuccess(msg: String?)
|
||||
|
||||
/**
|
||||
* 上麦请求
|
||||
*
|
||||
* @param micPosition
|
||||
* @param currentUid
|
||||
* @param b
|
||||
*/
|
||||
fun toUpMicroPhone(micPosition: Int, currentUid: String, b: Boolean)
|
||||
|
||||
/**
|
||||
* 没有关注用户的监听
|
||||
*/
|
||||
fun noFollow()
|
||||
|
||||
/**
|
||||
* 鬼知道之前有一个,现在又要加一个
|
||||
*/
|
||||
fun noFollow2()
|
||||
|
||||
/**
|
||||
* 没有关注用户的监听
|
||||
*/
|
||||
fun showMessageHistory(messages: List<ChatRoomMessage>?)
|
||||
|
||||
/**
|
||||
* 关注成功
|
||||
* @param position
|
||||
*/
|
||||
fun onFollowSuccess(position: Int)
|
||||
|
||||
/**
|
||||
* 关注失败
|
||||
* @param msg
|
||||
*/
|
||||
fun onFollowFail(msg: String?)
|
||||
fun updateMicView()
|
||||
}
|
@@ -1,15 +1,6 @@
|
||||
package com.yizhuan.erban.avroom.view;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import com.netease.nimlib.sdk.chatroom.model.ChatRoomMember;
|
||||
import com.netease.nimlib.sdk.chatroom.model.ChatRoomMessage;
|
||||
import com.yizhuan.erban.avroom.widget.ViewItem;
|
||||
import com.yizhuan.xchat_android_core.bean.RoomMicInfo;
|
||||
import com.yizhuan.xchat_android_core.home.bean.BannerInfo;
|
||||
import com.yizhuan.xchat_android_core.miniworld.bean.MiniWorldInWorldInfo;
|
||||
import com.yizhuan.xchat_android_core.room.bean.RoomInfo;
|
||||
import com.yizhuan.xchat_android_library.base.IMvpBaseView;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -19,69 +10,7 @@ import java.util.List;
|
||||
* @author jiahui
|
||||
* @date 2017/12/8
|
||||
*/
|
||||
public interface IGameRoomView extends IMvpBaseView {
|
||||
|
||||
/**
|
||||
* 被踢下麦成功
|
||||
*/
|
||||
void kickDownMicroPhoneSuccess();
|
||||
|
||||
/**
|
||||
* 麦上没人点击坑位处理
|
||||
*
|
||||
* @param roomMicInfo 坑位信息
|
||||
* @param micPosition
|
||||
* @param currentUid
|
||||
*/
|
||||
void showOwnerClickDialog(RoomMicInfo roomMicInfo, int micPosition, long currentUid);
|
||||
|
||||
/**
|
||||
* 断网重连回调
|
||||
*/
|
||||
void chatRoomReConnectView();
|
||||
|
||||
|
||||
void showToast(String msg);
|
||||
|
||||
void onSendMsgSuccess(@Nullable String msg);
|
||||
|
||||
/**
|
||||
* 上麦请求
|
||||
*
|
||||
* @param micPosition
|
||||
* @param currentUid
|
||||
* @param b
|
||||
*/
|
||||
void toUpMicroPhone(int micPosition, String currentUid, boolean b);
|
||||
|
||||
/**
|
||||
* 没有关注用户的监听
|
||||
*/
|
||||
void noFollow();
|
||||
|
||||
/**
|
||||
* 鬼知道之前有一个,现在又要加一个
|
||||
*/
|
||||
void noFollow2();
|
||||
|
||||
/**
|
||||
* 没有关注用户的监听
|
||||
*/
|
||||
void showMessageHistory(List<ChatRoomMessage> messages);
|
||||
|
||||
/**
|
||||
* 关注成功
|
||||
* @param position
|
||||
*/
|
||||
void onFollowSuccess(int position);
|
||||
|
||||
/**
|
||||
* 关注失败
|
||||
* @param msg
|
||||
*/
|
||||
void onFollowFail(String msg);
|
||||
|
||||
void updateMicView();
|
||||
public interface IGameRoomView extends IBaseRoomView {
|
||||
|
||||
void onShowBanner(List<BannerInfo> dialogInfos);
|
||||
|
||||
|
@@ -1,15 +1,8 @@
|
||||
package com.yizhuan.erban.avroom.view;
|
||||
|
||||
import com.netease.nimlib.sdk.chatroom.model.ChatRoomMember;
|
||||
import com.netease.nimlib.sdk.chatroom.model.ChatRoomMessage;
|
||||
import com.yizhuan.erban.avroom.widget.ViewItem;
|
||||
import com.yizhuan.xchat_android_core.bean.RoomMicInfo;
|
||||
import com.yizhuan.xchat_android_core.home.bean.BannerInfo;
|
||||
import com.yizhuan.xchat_android_core.miniworld.bean.MiniWorldInWorldInfo;
|
||||
import com.yizhuan.xchat_android_core.pay.bean.WalletInfo;
|
||||
import com.yizhuan.xchat_android_core.room.bean.RoomInfo;
|
||||
import com.yizhuan.xchat_android_library.base.IMvpBaseView;
|
||||
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -19,37 +12,7 @@ import java.util.List;
|
||||
* @author jiahui
|
||||
* @date 2017/12/8
|
||||
*/
|
||||
public interface IHomePartyView extends IMvpBaseView {
|
||||
|
||||
void resultLoadNormalMembers(List<ChatRoomMember> chatRoomMemberList);
|
||||
|
||||
/**
|
||||
* 点击麦上用户头像,显示操作对话框
|
||||
*
|
||||
* @param buttonItemList
|
||||
*/
|
||||
void showMicAvatarClickDialog(List<ViewItem> buttonItemList, String uid);
|
||||
|
||||
/**
|
||||
* 点击麦上头像,显示用户信息对话框
|
||||
*
|
||||
* @param uId
|
||||
*/
|
||||
void showMicAvatarUserInfoDialog(String uId);
|
||||
|
||||
/**
|
||||
* 被踢下麦成功
|
||||
*/
|
||||
void kickDownMicroPhoneSuccess();
|
||||
|
||||
/**
|
||||
* 麦上没人点击坑位处理
|
||||
*
|
||||
* @param roomMicInfo 坑位信息
|
||||
* @param micPosition
|
||||
* @param currentUid
|
||||
*/
|
||||
void showOwnerClickDialog(RoomMicInfo roomMicInfo, int micPosition, long currentUid);
|
||||
public interface IHomePartyView extends IBaseRoomView {
|
||||
|
||||
//玩龙珠时换坑
|
||||
void onDragonBarChangeMic(int micPosition, String uId, boolean isInviteUpMic, RoomInfo roomInfo);
|
||||
@@ -59,43 +22,10 @@ public interface IHomePartyView extends IMvpBaseView {
|
||||
*/
|
||||
void onGiftValueChangeMic(int micPosition, String uId, boolean isInviteUpMic, RoomInfo roomInfo);
|
||||
|
||||
/**
|
||||
* 断网重连回调
|
||||
*/
|
||||
void chatRoomReConnectView();
|
||||
|
||||
void onKtvChangeMic(int micPosition, String uId, boolean isInviteUpMic, RoomInfo roomInfo);
|
||||
|
||||
void showToast(String msg);
|
||||
|
||||
void onMentoringCountingFinish();
|
||||
|
||||
void onSendMsgSuccess();
|
||||
|
||||
/**
|
||||
* 上麦请求
|
||||
*
|
||||
* @param micPosition
|
||||
* @param currentUid
|
||||
* @param b
|
||||
*/
|
||||
void toUpMicroPhone(int micPosition, String currentUid, boolean b);
|
||||
|
||||
/**
|
||||
* 没有关注用户的监听
|
||||
*/
|
||||
void noFollow();
|
||||
|
||||
/**
|
||||
* 鬼知道之前有一个,现在又要加一个
|
||||
*/
|
||||
void noFollow2();
|
||||
|
||||
/**
|
||||
* 没有关注用户的监听
|
||||
*/
|
||||
void showMessageHistory(List<ChatRoomMessage> messages);
|
||||
|
||||
/**
|
||||
* 没有加入这个话题
|
||||
*
|
||||
@@ -103,19 +33,5 @@ public interface IHomePartyView extends IMvpBaseView {
|
||||
*/
|
||||
void notInWorld(MiniWorldInWorldInfo miniWorldInWorldInfo);
|
||||
|
||||
/**
|
||||
* 关注成功
|
||||
* @param position
|
||||
*/
|
||||
void onFollowSuccess(int position);
|
||||
|
||||
/**
|
||||
* 关注失败
|
||||
* @param msg
|
||||
*/
|
||||
void onFollowFail(String msg);
|
||||
|
||||
void updateMicView();
|
||||
|
||||
void onShowBanner(List<BannerInfo> bannerInfos);
|
||||
}
|
||||
|
@@ -237,9 +237,6 @@ public class MicroView extends FrameLayout implements View.OnLayoutChangeListene
|
||||
|
||||
}
|
||||
|
||||
public void updateRoomInfo() {
|
||||
|
||||
}
|
||||
|
||||
@SuppressLint("CheckResult")
|
||||
public void onSpeakQueueUpdate(List<Integer> positions) {
|
||||
|
@@ -5,11 +5,12 @@ import com.yizhuan.xchat_android_core.gift.bean.GiftInfo;
|
||||
import com.yizhuan.xchat_android_core.magic.bean.MagicInfo;
|
||||
import com.yizhuan.xchat_android_core.room.queue.bean.MicMemberInfo;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class OnGiftDialogBtnClickListenerWrapper implements GiftDialog.OnGiftDialogBtnClickListener {
|
||||
@Override
|
||||
public void onSendGiftBtnClick(GiftInfo giftInfo, List<MicMemberInfo> micMemberInfos, int number, String msg, boolean isKnap, boolean isWholeMic, GiftDialog.SenGiftCallback callback) {
|
||||
public void onSendGiftBtnClick(GiftInfo giftInfo, ArrayList<MicMemberInfo> micMemberInfos, int number, String msg, boolean isKnap, boolean isWholeMic, GiftDialog.SenGiftCallback callback) {
|
||||
|
||||
}
|
||||
|
||||
|
@@ -22,6 +22,7 @@ import com.yizhuan.xchat_android_core.user.bean.UserInfo;
|
||||
import com.yizhuan.xchat_android_core.utils.net.BeanObserver;
|
||||
import com.yizhuan.xchat_android_library.utils.SingleToastUtil;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
@@ -54,7 +55,7 @@ public class GiftAction extends BaseAction implements GiftDialog.OnGiftDialogBtn
|
||||
|
||||
@SuppressLint("CheckResult")
|
||||
@Override
|
||||
public void onSendGiftBtnClick(GiftInfo giftInfo, List<MicMemberInfo> micMemberInfos, int number, String msg, boolean isknap, boolean isWholeMic, GiftDialog.SenGiftCallback callback) {
|
||||
public void onSendGiftBtnClick(GiftInfo giftInfo, ArrayList<MicMemberInfo> micMemberInfos, int number, String msg, boolean isknap, boolean isWholeMic, GiftDialog.SenGiftCallback callback) {
|
||||
if (giftInfo == null) return;
|
||||
boolean canUseNobleGiftOrNot = GiftModel.get().canUseNobleGiftOrNot(giftInfo);
|
||||
if (canUseNobleGiftOrNot) {
|
||||
|
@@ -1049,7 +1049,7 @@ public class GiftDialog extends BottomSheetDialog implements View.OnClickListene
|
||||
sendGiftButton.setEnabled(true);
|
||||
} else {
|
||||
if (!isInRoom) {//不在房间的情况
|
||||
List<MicMemberInfo> targetUids = new ArrayList<>();
|
||||
ArrayList<MicMemberInfo> targetUids = new ArrayList<>();
|
||||
MicMemberInfo micMemberInfo = new MicMemberInfo();
|
||||
micMemberInfo.setAccount(String.valueOf(uid));
|
||||
targetUids.add(micMemberInfo);
|
||||
@@ -1075,7 +1075,7 @@ public class GiftDialog extends BottomSheetDialog implements View.OnClickListene
|
||||
return;
|
||||
}
|
||||
if (!userOnMic && uid > 0) {
|
||||
List<MicMemberInfo> targetUids = new ArrayList<>();
|
||||
ArrayList<MicMemberInfo> targetUids = new ArrayList<>();
|
||||
MicMemberInfo micMemberInfo = new MicMemberInfo();
|
||||
micMemberInfo.setAccount(String.valueOf(uid));
|
||||
targetUids.add(micMemberInfo);
|
||||
@@ -1101,7 +1101,7 @@ public class GiftDialog extends BottomSheetDialog implements View.OnClickListene
|
||||
});
|
||||
etSendMessage.setText("");
|
||||
} else if (avatarListAdapter != null && avatarListAdapter.getSelectedMember().size() > 0) {
|
||||
List<MicMemberInfo> selectedMembers = avatarListAdapter.getSelectedMember();
|
||||
ArrayList<MicMemberInfo> selectedMembers = (ArrayList<MicMemberInfo>) avatarListAdapter.getSelectedMember();
|
||||
|
||||
if (giftIndicator.getCurrrentType() == GiftIndicator.TYPE_KNAP
|
||||
&& giftNumber * selectedMembers.size() > current.getCount()) {
|
||||
@@ -1476,7 +1476,7 @@ public class GiftDialog extends BottomSheetDialog implements View.OnClickListene
|
||||
* @param isWholeMic
|
||||
* @param callback
|
||||
*/
|
||||
void onSendGiftBtnClick(GiftInfo giftInfo, List<MicMemberInfo> micMemberInfos,
|
||||
void onSendGiftBtnClick(GiftInfo giftInfo, ArrayList<MicMemberInfo> micMemberInfos,
|
||||
int number, String msg, boolean isKnap,
|
||||
boolean isWholeMic, SenGiftCallback callback);
|
||||
|
||||
|
@@ -1,5 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
@@ -18,8 +18,8 @@
|
||||
android:layout_height="match_parent"
|
||||
android:background="@color/black_transparent_30" />
|
||||
|
||||
<androidx.viewpager.widget.ViewPager
|
||||
android:id="@+id/viewpager"
|
||||
<androidx.fragment.app.FragmentContainerView
|
||||
android:id="@+id/fragment_container"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:clipToPadding="true" />
|
||||
@@ -40,14 +40,6 @@
|
||||
android:fitsSystemWindows="true"
|
||||
android:clipToPadding="true" />
|
||||
|
||||
<ViewStub
|
||||
android:id="@+id/vs_hiparty_room_tips"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout="@layout/vs_hiparty_room_first_show_layout"
|
||||
android:fitsSystemWindows="true"
|
||||
android:clipToPadding="true" />
|
||||
|
||||
<ViewStub
|
||||
android:id="@+id/vs_gift_value_tips"
|
||||
android:visibility="gone"
|
||||
@@ -55,4 +47,4 @@
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent" />
|
||||
|
||||
</RelativeLayout>
|
||||
</FrameLayout>
|
@@ -76,6 +76,7 @@ import org.greenrobot.eventbus.EventBus;
|
||||
import org.greenrobot.eventbus.Subscribe;
|
||||
import org.greenrobot.eventbus.ThreadMode;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import butterknife.BindView;
|
||||
@@ -182,7 +183,7 @@ public class MWTeamRoomMessageAct extends BaseMessageActivity implements IMWTeam
|
||||
new OnGiftDialogBtnClickListenerWrapper() {
|
||||
@SuppressLint("CheckResult")
|
||||
@Override
|
||||
public void onSendGiftBtnClick(GiftInfo giftInfo, List<MicMemberInfo> micMemberInfos, int number, String msg, boolean isKnap, boolean isWholeMic, GiftDialog.SenGiftCallback callback) {
|
||||
public void onSendGiftBtnClick(GiftInfo giftInfo, ArrayList<MicMemberInfo> micMemberInfos, int number, String msg, boolean isKnap, boolean isWholeMic, GiftDialog.SenGiftCallback callback) {
|
||||
if (giftInfo == null) return;
|
||||
|
||||
if (mMwChatInfo != null) {
|
||||
|
@@ -206,7 +206,7 @@ public class MiniWorldTeamMessageActivity extends BaseMessageActivity implements
|
||||
new OnGiftDialogBtnClickListenerWrapper() {
|
||||
@SuppressLint("CheckResult")
|
||||
@Override
|
||||
public void onSendGiftBtnClick(GiftInfo giftInfo, List<MicMemberInfo> micMemberInfos, int number, String msg, boolean isKnap, boolean isWholeMic, GiftDialog.SenGiftCallback callback) {
|
||||
public void onSendGiftBtnClick(GiftInfo giftInfo, ArrayList<MicMemberInfo> micMemberInfos, int number, String msg, boolean isKnap, boolean isWholeMic, GiftDialog.SenGiftCallback callback) {
|
||||
if (giftInfo == null) return;
|
||||
|
||||
if (mMwChatInfo != null) {
|
||||
|
@@ -302,7 +302,7 @@ public class PublicChatHallMessageFragment extends TFragment implements ModulePr
|
||||
new OnGiftDialogBtnClickListenerWrapper() {
|
||||
@SuppressLint("CheckResult")
|
||||
@Override
|
||||
public void onSendGiftBtnClick(GiftInfo giftInfo, List<MicMemberInfo> micMemberInfos, int number, String msg, boolean isKnap, boolean isWholeMic, GiftDialog.SenGiftCallback callback) {
|
||||
public void onSendGiftBtnClick(GiftInfo giftInfo, ArrayList<MicMemberInfo> micMemberInfos, int number, String msg, boolean isKnap, boolean isWholeMic, GiftDialog.SenGiftCallback callback) {
|
||||
if (giftInfo == null) return;
|
||||
boolean canUseNobleGiftOrNot = GiftModel.get().canUseNobleGiftOrNot(giftInfo);
|
||||
if (canUseNobleGiftOrNot) {
|
||||
|
@@ -41,7 +41,7 @@ public class XChatConstants {
|
||||
/**
|
||||
* bugly key (DEBUG)
|
||||
*/
|
||||
public static final String BUGLY_KEY_DEBUG = "b50c879569";//已更改
|
||||
public static final String BUGLY_KEY_DEBUG = "2a7521d23f";//已更改
|
||||
|
||||
/**
|
||||
* bugly key (RELEASE)
|
||||
|
@@ -151,10 +151,7 @@ public final class AvRoomDataManager {
|
||||
* 龙珠数组
|
||||
*/
|
||||
public List<Integer> dragons;
|
||||
/**
|
||||
* 是否开启了游戏模式
|
||||
*/
|
||||
public boolean gameModel;
|
||||
|
||||
// 房主基本信息
|
||||
public String nick;
|
||||
public int gender;
|
||||
@@ -321,7 +318,6 @@ public final class AvRoomDataManager {
|
||||
if (subscribe != null) {
|
||||
subscribe.dispose();
|
||||
}
|
||||
gameModel = false;
|
||||
haveSelfChange = false;
|
||||
GiftValueMrg.get().clearObsever();
|
||||
mMicQueueMemberMap.clear();
|
||||
|
Reference in New Issue
Block a user