新增房主切换房间游戏弹窗
This commit is contained in:
@@ -19,6 +19,7 @@ import android.widget.LinearLayout;
|
||||
import android.widget.RelativeLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.core.content.ContextCompat;
|
||||
import androidx.fragment.app.DialogFragment;
|
||||
@@ -107,6 +108,7 @@ import com.yizhuan.xchat_android_core.super_admin.util.SAdminOptUtil;
|
||||
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.UserInfo;
|
||||
import com.yizhuan.xchat_android_core.utils.LogUtils;
|
||||
import com.yizhuan.xchat_android_core.utils.SharedPreferenceUtils;
|
||||
import com.yizhuan.xchat_android_core.utils.StringUtils;
|
||||
import com.yizhuan.xchat_android_library.base.factory.CreatePresenter;
|
||||
@@ -187,7 +189,8 @@ public class AVRoomActivity extends BaseMvpActivity<IAvRoomView, AvRoomPresenter
|
||||
private View shade;
|
||||
private MonsterDialog monsterDialog;
|
||||
private ViewPager viewpager;
|
||||
private List<Fragment> fragmentList;
|
||||
private List<Fragment> fragmentList = new ArrayList<>();
|
||||
;
|
||||
private FragmentViewPagerAdapter mAdapter;
|
||||
private int pos = 0;
|
||||
private LoadingDialog mLoadingDialog;
|
||||
@@ -372,7 +375,6 @@ public class AVRoomActivity extends BaseMvpActivity<IAvRoomView, AvRoomPresenter
|
||||
roomUid = roomUidList.get(0).getUid();
|
||||
}
|
||||
}
|
||||
fragmentList = new ArrayList<>();
|
||||
|
||||
svgaRoomBg = findViewById(R.id.svga_image_view_bg);
|
||||
mVsRoomOffline = findViewById(R.id.vs_room_offline);
|
||||
@@ -597,7 +599,7 @@ public class AVRoomActivity extends BaseMvpActivity<IAvRoomView, AvRoomPresenter
|
||||
}
|
||||
finish();
|
||||
} else if (reasonReason == ChatRoomKickOutEvent.ChatRoomKickOutReason.CHAT_ROOM_INVALID) {
|
||||
showLiveFinishView();
|
||||
showLiveFinishView(AvRoomDataManager.get().getRoomUid());
|
||||
} else if (reasonReason == ChatRoomKickOutEvent.ChatRoomKickOutReason.KICK_OUT_BY_MANAGER) {
|
||||
if (SAdminOptUtil.isOptBySAdmin(reason)) {
|
||||
toast(R.string.kick_out_room_by_s_admin);
|
||||
@@ -623,9 +625,7 @@ public class AVRoomActivity extends BaseMvpActivity<IAvRoomView, AvRoomPresenter
|
||||
RoomInfo roomInfo = AvRoomDataManager.get().mCurrentRoomInfo;
|
||||
if (roomInfo != null) {
|
||||
setBackBg(this, roomInfo, svgaRoomBg, bgPicture, shade);
|
||||
int roomType = roomInfo.getType();
|
||||
if (roomType == RoomInfo.ROOMTYPE_HOME_PARTY &&
|
||||
!(mCurrentFragment instanceof HomePartyFragment)) {
|
||||
if (mCurrentFragment == null) {
|
||||
fragmentList.clear();
|
||||
mCurrentFragment = HomePartyFragment.newInstance(roomUid, isRoomMin);
|
||||
fragmentList.add(mCurrentFragment);
|
||||
@@ -642,50 +642,46 @@ public class AVRoomActivity extends BaseMvpActivity<IAvRoomView, AvRoomPresenter
|
||||
}
|
||||
}
|
||||
|
||||
private void showLiveFinishView() {
|
||||
private void showLiveFinishView(long uid) {
|
||||
if (mCurrentFragment instanceof HomePartyFragment) {
|
||||
((HomePartyFragment) mCurrentFragment).dismissGiftDialog();
|
||||
}
|
||||
if (mRoomInfo != null) {
|
||||
if (finishLayout == null) {
|
||||
finishLayout = (RelativeLayout) mVsRoomOffline.inflate();
|
||||
ivHeadWear = finishLayout.findViewById(R.id.iv_head_wear);
|
||||
avatar = finishLayout.findViewById(R.id.avatar);
|
||||
avatarBg = finishLayout.findViewById(R.id.avatar_bg);
|
||||
nick = finishLayout.findViewById(R.id.nick);
|
||||
}
|
||||
//防止点击到底下的操作按钮
|
||||
finishLayout.setOnClickListener(null);
|
||||
finishLayout.setVisibility(VISIBLE);
|
||||
finishLayout.findViewById(R.id.home_page_btn).setOnClickListener(this);
|
||||
finishLayout.findViewById(R.id.back_btn).setOnClickListener(this);
|
||||
|
||||
RoomInfo roomInfo = AvRoomDataManager.get().mCurrentRoomInfo;
|
||||
if (roomInfo != null) {
|
||||
setBackBg(this, roomInfo, svgaRoomBg, bgPicture, shade);
|
||||
}
|
||||
|
||||
UserModel.get().getUserInfo(mRoomInfo.getUid()).subscribe(new SingleObserver<UserInfo>() {
|
||||
@Override
|
||||
public void onSubscribe(Disposable d) {
|
||||
mCompositeDisposable.add(d);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSuccess(UserInfo userInfo) {
|
||||
setUserInfo(userInfo);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Throwable e) {
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
} else {
|
||||
|
||||
finish();
|
||||
if (finishLayout == null) {
|
||||
finishLayout = (RelativeLayout) mVsRoomOffline.inflate();
|
||||
ivHeadWear = finishLayout.findViewById(R.id.iv_head_wear);
|
||||
avatar = finishLayout.findViewById(R.id.avatar);
|
||||
avatarBg = finishLayout.findViewById(R.id.avatar_bg);
|
||||
nick = finishLayout.findViewById(R.id.nick);
|
||||
}
|
||||
//防止点击到底下的操作按钮
|
||||
finishLayout.setOnClickListener(null);
|
||||
finishLayout.setVisibility(VISIBLE);
|
||||
finishLayout.findViewById(R.id.home_page_btn).setOnClickListener(this);
|
||||
finishLayout.findViewById(R.id.back_btn).setOnClickListener(this);
|
||||
|
||||
RoomInfo roomInfo = AvRoomDataManager.get().mCurrentRoomInfo;
|
||||
if (roomInfo != null) {
|
||||
setBackBg(this, roomInfo, svgaRoomBg, bgPicture, shade);
|
||||
}
|
||||
|
||||
UserModel.get().getUserInfo(uid).subscribe(new SingleObserver<UserInfo>() {
|
||||
@Override
|
||||
public void onSubscribe(Disposable d) {
|
||||
mCompositeDisposable.add(d);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSuccess(@NonNull UserInfo userInfo) {
|
||||
setUserInfo(userInfo);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(@NonNull Throwable e) {
|
||||
e.printStackTrace();
|
||||
LogUtils.d("showLiveFinishView error");
|
||||
|
||||
}
|
||||
});
|
||||
AvRoomDataManager.get().release();
|
||||
}
|
||||
|
||||
@@ -1075,10 +1071,10 @@ public class AVRoomActivity extends BaseMvpActivity<IAvRoomView, AvRoomPresenter
|
||||
}
|
||||
|
||||
@Override
|
||||
public void showFinishRoomView() {
|
||||
public void showFinishRoomView(long uid) {
|
||||
dismissLoadingDialog();
|
||||
dismissDialog();
|
||||
showLiveFinishView();
|
||||
showLiveFinishView(uid);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@@ -109,7 +109,7 @@ public class CpRoomInviteActivity extends BaseBindingActivity<ActivityCpRoomInvi
|
||||
limitType,
|
||||
roomInfo.isPureMode(),
|
||||
roomInfo.getType(),
|
||||
roomInfo.getGameId());
|
||||
roomInfo.getMgId());
|
||||
} else {
|
||||
return model.updateByAdmin(roomInfo.getUid(), roomInfo.title,
|
||||
roomInfo.getRoomDesc(),
|
||||
|
@@ -267,7 +267,7 @@ public class RoomSettingActivity extends BaseMvpActivity<IRoomSettingView, RoomS
|
||||
binding.switchAudio.isChecked() ? 2 : 1,
|
||||
roomInfo.getLimitType(), roomInfo.isPureMode(),
|
||||
roomInfo.getType(),
|
||||
roomInfo.getGameId())
|
||||
roomInfo.getMgId())
|
||||
.compose(bindToLifecycle())
|
||||
.subscribe(observer);
|
||||
StatisticManager.Instance().sortLogFileByLastModified();
|
||||
|
@@ -122,7 +122,7 @@ public class RoomTitleEditActivity extends BaseBindingActivity<ActivityRoomTitle
|
||||
mDialogManager.showProgressDialog(this);
|
||||
Disposable disposable = roomSettingModel.updateRoomInfo(info.title, desc, introduction, info.roomPwd, info.getRoomTag(), info.tagId, currentUid,
|
||||
ticket, info.isHasAnimationEffect(), info.getAudioQuality(), info.getLimitType(),info.isPureMode(), info.getType(),
|
||||
info.getGameId())
|
||||
info.getMgId())
|
||||
.subscribe(this);
|
||||
|
||||
mDisposable.add(disposable);
|
||||
|
@@ -0,0 +1,15 @@
|
||||
package com.yizhuan.erban.avroom.adapter
|
||||
|
||||
import com.chad.library.adapter.base.BaseQuickAdapter
|
||||
import com.chad.library.adapter.base.BaseViewHolder
|
||||
import com.yizhuan.erban.R
|
||||
import com.yizhuan.xchat_android_core.room.game.GameInfo
|
||||
|
||||
class SelectGameAdapter :
|
||||
BaseQuickAdapter<GameInfo, BaseViewHolder>(R.layout.item_room_select_game) {
|
||||
|
||||
override fun convert(helper: BaseViewHolder, item: GameInfo) {
|
||||
helper.setText(R.id.tv_name,item.name)
|
||||
}
|
||||
|
||||
}
|
@@ -139,7 +139,7 @@ public class RoomImposeDialog extends BottomSheetDialog implements View.OnClickL
|
||||
limitType,
|
||||
roomInfo.isPureMode(),
|
||||
roomInfo.getType(),
|
||||
roomInfo.getGameId())
|
||||
roomInfo.getMgId())
|
||||
.subscribe(new DontWarnObserver<RoomInfo>() {
|
||||
@Override
|
||||
public void accept(RoomInfo roomInfo, String error) {
|
||||
|
@@ -203,7 +203,9 @@ class GameRoomFragment() : BaseMvpFragment<IGameRoomView?, GameRoomPresenter?>()
|
||||
}
|
||||
}
|
||||
|
||||
gameDelegate = GameDelegate(requireActivity(), gameBinding.flGameContainer)
|
||||
gameDelegate = GameDelegate(requireActivity(),
|
||||
gameBinding.flGameContainer,
|
||||
AvRoomDataManager.get().mCurrentRoomInfo?.mgId)
|
||||
gameDelegate.setOnGameStatusChangeListener(this)
|
||||
}
|
||||
|
||||
@@ -556,6 +558,7 @@ class GameRoomFragment() : BaseMvpFragment<IGameRoomView?, GameRoomPresenter?>()
|
||||
}
|
||||
|
||||
private fun updateView() {
|
||||
gameDelegate.updateGame(AvRoomDataManager.get().mCurrentRoomInfo?.mgId)
|
||||
// 更新底栏
|
||||
showBottomViewForDifRole()
|
||||
microView.adapter.notifyDataSetChanged()
|
||||
|
@@ -1,10 +1,7 @@
|
||||
package com.yizhuan.erban.avroom.fragment;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.res.AssetFileDescriptor;
|
||||
import android.media.MediaPlayer;
|
||||
import android.os.Bundle;
|
||||
import android.view.View;
|
||||
import android.view.ViewConfiguration;
|
||||
@@ -16,6 +13,7 @@ import androidx.annotation.Nullable;
|
||||
import androidx.appcompat.widget.AppCompatImageView;
|
||||
import androidx.databinding.DataBindingUtil;
|
||||
import androidx.fragment.app.Fragment;
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
|
||||
import com.netease.nim.uikit.common.util.string.StringUtil;
|
||||
import com.netease.nimlib.sdk.chatroom.ChatRoomMessageBuilder;
|
||||
@@ -26,13 +24,14 @@ import com.yizhuan.erban.R;
|
||||
import com.yizhuan.erban.UIHelper;
|
||||
import com.yizhuan.erban.avroom.activity.AVRoomActivity;
|
||||
import com.yizhuan.erban.avroom.activity.RoomOnlineUserActivity;
|
||||
import com.yizhuan.erban.avroom.adapter.SelectGameAdapter;
|
||||
import com.yizhuan.erban.avroom.presenter.HomePartyPresenter;
|
||||
import com.yizhuan.erban.avroom.widget.GiftV2View;
|
||||
import com.yizhuan.erban.base.BaseMvpActivity;
|
||||
import com.yizhuan.erban.common.widget.dialog.DialogManager;
|
||||
import com.yizhuan.erban.databinding.FragmentChatroomGameMainBinding;
|
||||
import com.yizhuan.erban.friend.view.SelectFriendActivity;
|
||||
import com.yizhuan.erban.treasure_box.widget.GoldBoxHelper;
|
||||
import com.yizhuan.erban.home.helper.OpenRoomHelper;
|
||||
import com.yizhuan.erban.ui.widget.ButtonItem;
|
||||
import com.yizhuan.erban.ui.widget.ShareDialog;
|
||||
import com.yizhuan.erban.utils.RegexUtil;
|
||||
@@ -55,6 +54,8 @@ import com.yizhuan.xchat_android_core.manager.IMNetEaseManager;
|
||||
import com.yizhuan.xchat_android_core.manager.RoomEvent;
|
||||
import com.yizhuan.xchat_android_core.praise.PraiseModel;
|
||||
import com.yizhuan.xchat_android_core.room.bean.RoomInfo;
|
||||
import com.yizhuan.xchat_android_core.room.game.GameInfo;
|
||||
import com.yizhuan.xchat_android_core.room.game.GameModel;
|
||||
import com.yizhuan.xchat_android_core.room.queuing_mic.event.HasAnimationEffect;
|
||||
import com.yizhuan.xchat_android_core.share.ShareModel;
|
||||
import com.yizhuan.xchat_android_core.statistic.StatisticManager;
|
||||
@@ -62,6 +63,7 @@ import com.yizhuan.xchat_android_core.statistic.protocol.StatisticsProtocol;
|
||||
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.UserInfo;
|
||||
import com.yizhuan.xchat_android_library.utils.JavaUtil;
|
||||
import com.yizhuan.xchat_android_library.utils.SingleToastUtil;
|
||||
|
||||
import org.greenrobot.eventbus.EventBus;
|
||||
@@ -71,6 +73,7 @@ import org.greenrobot.eventbus.ThreadMode;
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
import cn.sharesdk.framework.Platform;
|
||||
import io.reactivex.SingleObserver;
|
||||
@@ -109,7 +112,8 @@ public class HomePartyFragment extends AbsRoomFragment implements View.OnClickLi
|
||||
|
||||
//收藏房间
|
||||
private String FOLLOW_ROOM_TYPE = "";
|
||||
//取消收藏房间
|
||||
private SelectGameAdapter gameAdapter;
|
||||
|
||||
|
||||
public static HomePartyFragment newInstance(long roomUid, boolean isRoomMin) {
|
||||
HomePartyFragment homePartyFragment = new HomePartyFragment();
|
||||
@@ -213,10 +217,52 @@ public class HomePartyFragment extends AbsRoomFragment implements View.OnClickLi
|
||||
@SuppressLint("CheckResult")
|
||||
@Override
|
||||
public void initiate() {
|
||||
|
||||
if (!AvRoomDataManager.get().haveSelfChange && AvRoomDataManager.get().mCurrentRoomInfo != null) {
|
||||
RoomInfo roomInfo = AvRoomDataManager.get().mCurrentRoomInfo;
|
||||
if (roomInfo == null) return;
|
||||
if (!AvRoomDataManager.get().haveSelfChange) {
|
||||
AvRoomDataManager.get().mIsNeedGiftEffect = AvRoomDataManager.get().mCurrentRoomInfo.isHasAnimationEffect();
|
||||
}
|
||||
|
||||
if (AvRoomDataManager.get().isRoomOwner()) {
|
||||
gameMainBinding.llChangeGame.setVisibility(View.VISIBLE);
|
||||
gameMainBinding.rvGame.setLayoutManager(new LinearLayoutManager(mContext));
|
||||
gameMainBinding.rvGame.setAdapter(gameAdapter = new SelectGameAdapter());
|
||||
gameMainBinding.tvCurrGame.setOnClickListener(v -> {
|
||||
if (gameMainBinding.rvGame.getVisibility() == View.VISIBLE) {
|
||||
gameMainBinding.rvGame.setVisibility(View.GONE);
|
||||
} else {
|
||||
gameMainBinding.rvGame.setVisibility(View.VISIBLE);
|
||||
}
|
||||
});
|
||||
|
||||
gameAdapter.setOnItemClickListener((adapter, view, position) -> {
|
||||
GameInfo gameInfo = gameAdapter.getItem(position);
|
||||
if (gameInfo != null) {
|
||||
int type;
|
||||
long mgId = 0;
|
||||
if (Objects.equals("扩列交友", gameInfo.getName())) {
|
||||
type = RoomInfo.ROOMTYPE_HOME_PARTY;
|
||||
} else {
|
||||
type = RoomInfo.ROOMTYPE_GAME;
|
||||
mgId = JavaUtil.str2long(gameInfo.getMgId());
|
||||
}
|
||||
gameMainBinding.rvGame.setVisibility(View.GONE);
|
||||
|
||||
if (roomInfo.getType() != RoomInfo.ROOMTYPE_GAME &&
|
||||
mgId == roomInfo.getMgId() &&
|
||||
type == roomInfo.getType()) return;
|
||||
|
||||
OpenRoomHelper.updateRoomInfo(
|
||||
getBaseActivity(),
|
||||
AvRoomDataManager.get().mCurrentRoomInfo,
|
||||
type,
|
||||
mgId,
|
||||
false);
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -320,6 +366,7 @@ public class HomePartyFragment extends AbsRoomFragment implements View.OnClickLi
|
||||
gameMainBinding.setRoomInfo(roomInfo);
|
||||
}
|
||||
|
||||
@SuppressLint("CheckResult")
|
||||
public void updateView() {
|
||||
RoomInfo currentRoomInfo = AvRoomDataManager.get().mCurrentRoomInfo;
|
||||
if (currentRoomInfo != null) {
|
||||
@@ -327,7 +374,8 @@ public class HomePartyFragment extends AbsRoomFragment implements View.OnClickLi
|
||||
if (currentRoomInfo.getType() == RoomInfo.ROOMTYPE_GAME &&
|
||||
!(roomFragment instanceof GameRoomFragment)) {
|
||||
roomFragment = GameRoomFragment.newInstance(isRoomMin);
|
||||
} else if (!(roomFragment instanceof HomePartyRoomFragment)) {
|
||||
} else if (currentRoomInfo.getType() != RoomInfo.ROOMTYPE_GAME &&
|
||||
!(roomFragment instanceof HomePartyRoomFragment)) {
|
||||
roomFragment = HomePartyRoomFragment.newInstance(isRoomMin);
|
||||
}
|
||||
|
||||
@@ -353,6 +401,30 @@ public class HomePartyFragment extends AbsRoomFragment implements View.OnClickLi
|
||||
tvFollowRoom.setBackgroundResource(AvRoomDataManager.get().isRoomFans ? R.drawable.bg_room_follow_room_collected : R.drawable.bg_room_follow_room);
|
||||
|
||||
setIdOnlineData();
|
||||
if (AvRoomDataManager.get().isRoomOwner()) {
|
||||
if (AvRoomDataManager.get().isOpenGame()) {
|
||||
gameMainBinding.tvCurrGame.setText(currentRoomInfo.getMgName());
|
||||
} else {
|
||||
gameMainBinding.tvCurrGame.setText("扩列交友");
|
||||
}
|
||||
GameModel.INSTANCE.getGameList()
|
||||
.compose(bindToLifecycle())
|
||||
.subscribe(gameInfos -> {
|
||||
if (AvRoomDataManager.get().isOpenGame()) {
|
||||
for (int i = 0; i < gameInfos.size(); i++) {
|
||||
GameInfo gameInfo = gameInfos.get(i);
|
||||
if (JavaUtil.str2long(gameInfo.getMgId()) == currentRoomInfo.getMgId()) {
|
||||
gameInfos.remove(i);
|
||||
break;
|
||||
}
|
||||
}
|
||||
GameInfo gameInfo = new GameInfo();
|
||||
gameInfo.setName("扩列交友");
|
||||
gameInfos.add(gameInfo);
|
||||
}
|
||||
gameAdapter.setNewData(gameInfos);
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -26,7 +26,7 @@ import org.json.JSONObject
|
||||
import tech.sud.mgp.core.*
|
||||
import java.util.*
|
||||
|
||||
class GameDelegate(val activity: Activity, val container: FrameLayout) {
|
||||
class GameDelegate(val activity: Activity, val container: FrameLayout, var mgId: Long?) {
|
||||
|
||||
companion object {
|
||||
const val MG_ID_BUMPER_CAR = 1461227817776713818L //游戏ID:碰碰车
|
||||
@@ -57,7 +57,7 @@ class GameDelegate(val activity: Activity, val container: FrameLayout) {
|
||||
private val gson = Gson()
|
||||
|
||||
//小游戏ID
|
||||
private var mMGID = MG_ID_BUMPER_CAR
|
||||
private var mMGID = 0L
|
||||
|
||||
//通用状态-游戏,关键词
|
||||
private var mKeyWord: String? = null
|
||||
@@ -94,6 +94,7 @@ class GameDelegate(val activity: Activity, val container: FrameLayout) {
|
||||
}
|
||||
|
||||
init {
|
||||
mMGID = mgId ?: 0L
|
||||
login(loginCallback)
|
||||
}
|
||||
|
||||
@@ -114,6 +115,12 @@ class GameDelegate(val activity: Activity, val container: FrameLayout) {
|
||||
|
||||
}
|
||||
|
||||
fun updateGame(mgId: Long?) {
|
||||
if (mgId == null || mgId == 0L || mgId == mMGID || iSudFSTAPP == null) return
|
||||
mMGID = mgId
|
||||
loadMG(activity, mUid, mRoomID, APP_CODE, mMGID, mLanguage)
|
||||
}
|
||||
|
||||
/**
|
||||
* 1,初始化游戏SDK
|
||||
*
|
||||
@@ -655,7 +662,7 @@ class GameDelegate(val activity: Activity, val container: FrameLayout) {
|
||||
}
|
||||
|
||||
fun onResume() {
|
||||
// iSudFSTAPP?.playMG() //开始游戏
|
||||
// iSudFSTAPP?.playMG() //开始游戏
|
||||
}
|
||||
|
||||
fun onPause() {
|
||||
@@ -663,7 +670,7 @@ class GameDelegate(val activity: Activity, val container: FrameLayout) {
|
||||
}
|
||||
|
||||
fun onStop() {
|
||||
// iSudFSTAPP?.stopMG() //停止游戏
|
||||
// iSudFSTAPP?.stopMG() //停止游戏
|
||||
}
|
||||
|
||||
fun onDestroy() {
|
||||
|
@@ -6,6 +6,7 @@ import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
import android.util.SparseArray;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
@@ -62,6 +63,7 @@ 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.threadmgr.ThreadPoolManager;
|
||||
import com.yizhuan.xchat_android_library.utils.JavaUtil;
|
||||
import com.yizhuan.xchat_android_library.utils.ListUtils;
|
||||
|
||||
import org.greenrobot.eventbus.EventBus;
|
||||
@@ -108,12 +110,7 @@ public class AvRoomPresenter extends BaseMvpPresenter<IAvRoomView> {
|
||||
* 进入云信聊天室回调
|
||||
*/
|
||||
@SuppressLint("CheckResult")
|
||||
public void enterRoom(RoomInfo roomInfo, int fromType, String fromNick, String fromUid) {
|
||||
if (roomInfo == null) {
|
||||
if (getMvpView() != null)
|
||||
getMvpView().showFinishRoomView();
|
||||
return;
|
||||
}
|
||||
public void enterRoom(@NonNull RoomInfo roomInfo, int fromType, String fromNick, String fromUid) {
|
||||
if (!TextUtils.isEmpty(PublicChatHallDataManager.get().getPublicChatHallUid()) &&
|
||||
Objects.equals(roomInfo.getUid(), Long.parseLong(
|
||||
PublicChatHallDataManager.get().getPublicChatHallUid()))) {
|
||||
@@ -187,7 +184,7 @@ public class AvRoomPresenter extends BaseMvpPresenter<IAvRoomView> {
|
||||
case "404":
|
||||
case "13002":
|
||||
if (getMvpView() != null)
|
||||
getMvpView().showFinishRoomView();
|
||||
getMvpView().showFinishRoomView(AvRoomDataManager.get().getRoomUid());
|
||||
error = "聊天室不存在";
|
||||
break;
|
||||
case "403":
|
||||
@@ -364,9 +361,9 @@ public class AvRoomPresenter extends BaseMvpPresenter<IAvRoomView> {
|
||||
}
|
||||
if (roomResult.isSuccess()) {
|
||||
RoomInfo data = roomResult.getData();
|
||||
if (data == null || data.getRoomId() == 0) {
|
||||
if (data == null || data.getRoomId() == 0 || !data.isValid()) {
|
||||
if (getMvpView() != null) {
|
||||
getMvpView().showFinishRoomView();
|
||||
getMvpView().showFinishRoomView(JavaUtil.str2long(uId));
|
||||
}
|
||||
//获取房间信息失败 发送log 到阿里
|
||||
StatisticManager.Instance().sendAliyunLog(LogFactory.create(
|
||||
|
@@ -34,7 +34,7 @@ public interface IAvRoomView extends IMvpBaseView {
|
||||
/**
|
||||
* 显示结束直播界面
|
||||
*/
|
||||
void showFinishRoomView();
|
||||
void showFinishRoomView(long uid);
|
||||
|
||||
/**
|
||||
* 显示黑名单进入房间错误页面
|
||||
|
@@ -6,6 +6,7 @@ import com.yizhuan.erban.base.BaseViewModel
|
||||
import com.yizhuan.xchat_android_core.bean.response.ListResult
|
||||
import com.yizhuan.xchat_android_core.home.bean.*
|
||||
import com.yizhuan.xchat_android_core.home.model.HomeModel
|
||||
import com.yizhuan.xchat_android_core.utils.net.ServerException
|
||||
import com.yizhuan.xchat_android_core.utils.toast
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.async
|
||||
|
@@ -21,7 +21,7 @@ class RoomCommonAdapter : BaseQuickAdapter<HomeRoomInfo, BaseViewHolder>(R.layou
|
||||
setText(R.id.tv_online_number, "${item.onlineNum}")
|
||||
setText(R.id.tv_room_title, item.title)
|
||||
itemView.setOnClickListener {
|
||||
AVRoomActivity.start(mContext, item.uid)
|
||||
AVRoomActivity.start(mContext, item.roomUid)
|
||||
}
|
||||
setText(R.id.tv_id, "ID:${item.erbanNo}")
|
||||
}
|
||||
|
@@ -94,7 +94,7 @@ class RecommendFragment : BaseFragment(),
|
||||
}
|
||||
}
|
||||
|
||||
homeViewModel.resourceJumpLiveData.observe(this){
|
||||
homeViewModel.resourceJumpLiveData.observe(this) {
|
||||
dialogManager.dismissDialog()
|
||||
it?.let {
|
||||
|
||||
@@ -111,6 +111,7 @@ class RecommendFragment : BaseFragment(),
|
||||
mBinding.refreshLayout.finishRefresh()
|
||||
EventBus.getDefault().post(RefreshHomeDataEvent())
|
||||
}
|
||||
mBinding.refreshLayout.isEnableLoadmore = false
|
||||
mBinding.refreshLayout.isEnableOverScrollBounce = false
|
||||
val themeColor = requireContext().resources.getColor(R.color.color_666666)
|
||||
mBinding.refreshHeader.lastUpdateText.setTextColor(themeColor)
|
||||
|
@@ -44,7 +44,7 @@ class RoomCommonFragment : BaseViewBindingFragment<FragmentRoomCommonBinding>()
|
||||
.setRecyclerView(binding.recyclerView)
|
||||
.build()
|
||||
mAdapter.setOnItemClickListener { _, _, position ->
|
||||
mAdapter.getItem(position)?.let { AVRoomActivity.start(context, it.uid) }
|
||||
mAdapter.getItem(position)?.let { AVRoomActivity.start(context, it.roomUid) }
|
||||
}
|
||||
mAdapter.setOnLoadMoreListener({
|
||||
loadData(false)
|
||||
|
@@ -37,7 +37,6 @@ class RoomHotFragment : BaseViewBindingFragment<FragmentRoomHotBinding>() {
|
||||
.setLayoutManager(LinearLayoutManager(mContext))
|
||||
.setPageSize(pageSize)
|
||||
.build()
|
||||
roomHotAdapter.setOnLoadMoreListener({ loadData(false) }, binding.recyclerView)
|
||||
|
||||
homeViewModel.hotRoomLiveData.observe(this) {
|
||||
rvDelegate.loadData(it)
|
||||
@@ -50,11 +49,6 @@ class RoomHotFragment : BaseViewBindingFragment<FragmentRoomHotBinding>() {
|
||||
}
|
||||
|
||||
private fun loadData(isRefresh: Boolean) {
|
||||
if (isRefresh) {
|
||||
page = 1
|
||||
} else {
|
||||
page++
|
||||
}
|
||||
homeViewModel.getHotRoom(page, pageSize)
|
||||
}
|
||||
}
|
@@ -116,7 +116,7 @@ public class OpenRoomHelper {
|
||||
if (type == RoomInfo.ROOMTYPE_DEFAULT || roomInfo.getType() == type) {
|
||||
onOpenRoomSuccess(activity, roomInfo);
|
||||
} else {
|
||||
updateRoomInfo(activity, roomInfo, type, gameId);
|
||||
updateRoomInfo(activity, roomInfo, type, gameId,true);
|
||||
}
|
||||
} else {
|
||||
openRoom(activity, roomInfo, type, gameId);
|
||||
@@ -134,7 +134,7 @@ public class OpenRoomHelper {
|
||||
|
||||
}
|
||||
|
||||
private static void updateRoomInfo(BaseActivity activity, RoomInfo roomInfo, int type, long gameId) {
|
||||
public static void updateRoomInfo(BaseActivity activity, RoomInfo roomInfo, int type, long gameId,boolean needOpen) {
|
||||
RoomSettingModel roomSettingModel = new RoomSettingModel();
|
||||
roomSettingModel.updateRoomInfo(
|
||||
roomInfo.getTitle(),
|
||||
@@ -160,7 +160,9 @@ public class OpenRoomHelper {
|
||||
|
||||
@Override
|
||||
public void onSuccess(@NonNull RoomInfo roomInfo) {
|
||||
openRoom(activity, roomInfo, type, gameId);
|
||||
if (needOpen){
|
||||
openRoom(activity, roomInfo, type, gameId);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
BIN
app/src/main/res/drawable-xhdpi/ic_room_arrow_type.png
Normal file
BIN
app/src/main/res/drawable-xhdpi/ic_room_arrow_type.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 383 B |
@@ -4,8 +4,8 @@
|
||||
|
||||
<gradient
|
||||
android:angle="180"
|
||||
android:startColor="#735FFE"
|
||||
android:endColor="#8776FF"/>
|
||||
android:startColor="#FFFFA936"
|
||||
android:endColor="#FFFFA936"/>
|
||||
<corners android:radius="12dp"/>
|
||||
|
||||
</shape>
|
9
app/src/main/res/drawable/bg_room_select_game.xml
Normal file
9
app/src/main/res/drawable/bg_room_select_game.xml
Normal file
@@ -0,0 +1,9 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="rectangle">
|
||||
<stroke
|
||||
android:width="1px"
|
||||
android:color="#99ffffff" />
|
||||
<solid android:color="#33000000" />
|
||||
<corners android:radius="15dp" />
|
||||
</shape>
|
@@ -20,7 +20,7 @@
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical"
|
||||
tools:background="#000">
|
||||
tools:background="@color/blue">
|
||||
|
||||
<FrameLayout
|
||||
android:id="@+id/container"
|
||||
@@ -120,7 +120,6 @@
|
||||
android:textSize="9sp"
|
||||
tools:text="8888" />
|
||||
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
@@ -128,9 +127,9 @@
|
||||
<TextView
|
||||
android:id="@+id/tv_follow_room"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="@dimen/dp_23"
|
||||
android:layout_marginStart="@dimen/dp_5"
|
||||
android:layout_marginTop="@dimen/dp_28"
|
||||
android:layout_height="@dimen/dp_25"
|
||||
android:layout_marginStart="@dimen/dp_8"
|
||||
android:layout_marginTop="35dp"
|
||||
android:layout_toEndOf="@+id/ll_room_info"
|
||||
android:background="@drawable/bg_room_follow_room"
|
||||
android:gravity="center"
|
||||
@@ -141,11 +140,45 @@
|
||||
android:textSize="@dimen/sp_13"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/ll_change_game"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignTop="@id/iv_room_share"
|
||||
android:layout_toStartOf="@id/iv_room_share"
|
||||
android:background="@drawable/bg_room_select_game"
|
||||
android:orientation="vertical"
|
||||
android:paddingStart="8dp"
|
||||
android:paddingTop="2dp"
|
||||
android:paddingEnd="8dp"
|
||||
android:paddingBottom="2dp"
|
||||
android:visibility="visible"
|
||||
tools:visibility="visible">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_curr_game"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:drawableEnd="@drawable/ic_room_arrow_type"
|
||||
android:gravity="center"
|
||||
android:includeFontPadding="true"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="12sp" />
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/rv_game"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingBottom="4dp"
|
||||
android:visibility="gone" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/room_more"
|
||||
android:layout_width="42dp"
|
||||
android:layout_height="42dp"
|
||||
android:layout_alignBottom="@+id/ll_room_info"
|
||||
android:layout_width="25dp"
|
||||
android:layout_height="25dp"
|
||||
android:layout_alignBottom="@+id/room_back"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:layout_marginEnd="3dp"
|
||||
android:layout_marginBottom="0dp"
|
||||
@@ -158,9 +191,9 @@
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_room_share"
|
||||
android:layout_width="42dp"
|
||||
android:layout_height="42dp"
|
||||
android:layout_alignBottom="@+id/ll_room_info"
|
||||
android:layout_width="25dp"
|
||||
android:layout_height="25dp"
|
||||
android:layout_alignBottom="@+id/room_back"
|
||||
android:layout_marginEnd="3dp"
|
||||
android:layout_toStartOf="@id/room_more"
|
||||
android:paddingStart="10dp"
|
||||
|
25
app/src/main/res/layout/item_room_select_game.xml
Normal file
25
app/src/main/res/layout/item_room_select_game.xml
Normal file
@@ -0,0 +1,25 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical">
|
||||
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1px"
|
||||
android:layout_marginTop="4dp"
|
||||
android:layout_marginBottom="4dp"
|
||||
android:background="@color/white_transparent_60" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_name"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:lines="1"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="12dp"
|
||||
tools:text="碰碰我最强" />
|
||||
|
||||
</LinearLayout>
|
@@ -302,7 +302,7 @@ public class MWTeamRoomMessageAct extends BaseMessageActivity implements IMWTeam
|
||||
roomInfo.getAudioQuality(),
|
||||
roomInfo.getLimitType(),roomInfo.isPureMode(),
|
||||
roomInfo.getType(),
|
||||
roomInfo.getGameId())
|
||||
roomInfo.getMgId())
|
||||
.compose(bindToLifecycle())
|
||||
.subscribe(new BeanObserver<RoomInfo>() {
|
||||
@Override
|
||||
|
@@ -330,7 +330,7 @@ public class MiniWorldTeamMessageActivity extends BaseMessageActivity implements
|
||||
roomInfo.getLimitType(),
|
||||
roomInfo.isPureMode(),
|
||||
roomInfo.getType(),
|
||||
roomInfo.getGameId())
|
||||
roomInfo.getMgId())
|
||||
.compose(bindToLifecycle())
|
||||
.subscribe(new BeanObserver<RoomInfo>() {
|
||||
@Override
|
||||
|
@@ -13,6 +13,7 @@ public class HomeRoomInfo implements MultiItemEntity {
|
||||
public static final int TYPE_BANNER = 2;
|
||||
public String roomPwd;
|
||||
private long uid;
|
||||
private long roomUid;
|
||||
private long roomId;
|
||||
private int micUserCount;
|
||||
private int onlineNum;
|
||||
|
@@ -886,7 +886,7 @@ public final class AvRoomDataManager {
|
||||
if (roomInfo == null) {
|
||||
return false;
|
||||
}
|
||||
return roomInfo.isOpenGame;
|
||||
return roomInfo.getType() == RoomInfo.ROOMTYPE_GAME;
|
||||
}
|
||||
|
||||
public boolean isOpenPureMode() {
|
||||
|
@@ -188,7 +188,9 @@ public class RoomInfo implements Parcelable,Serializable {
|
||||
|
||||
private boolean isReselect;
|
||||
|
||||
private long gameId;
|
||||
private long mgId;
|
||||
|
||||
private String mgName;
|
||||
// /**
|
||||
// * 房间角标
|
||||
// */
|
||||
|
@@ -3,7 +3,7 @@ package com.yizhuan.xchat_android_core.room.game
|
||||
data class GameInfo(
|
||||
val isShow: Boolean = false,
|
||||
val mgId: String = "",
|
||||
val name: String = "",
|
||||
var name: String = "",
|
||||
val pic: String = "",
|
||||
val remark: String = "",
|
||||
val seq: Int = 0,
|
||||
|
Reference in New Issue
Block a user