新增创建房间弹窗
This commit is contained in:
@@ -107,7 +107,9 @@ public class CpRoomInviteActivity extends BaseBindingActivity<ActivityCpRoomInvi
|
|||||||
roomInfo.isHasAnimationEffect(),
|
roomInfo.isHasAnimationEffect(),
|
||||||
roomInfo.getAudioQuality(),
|
roomInfo.getAudioQuality(),
|
||||||
limitType,
|
limitType,
|
||||||
roomInfo.isPureMode());
|
roomInfo.isPureMode(),
|
||||||
|
roomInfo.getType(),
|
||||||
|
roomInfo.getGameId());
|
||||||
} else {
|
} else {
|
||||||
return model.updateByAdmin(roomInfo.getUid(), roomInfo.title,
|
return model.updateByAdmin(roomInfo.getUid(), roomInfo.title,
|
||||||
roomInfo.getRoomDesc(),
|
roomInfo.getRoomDesc(),
|
||||||
|
@@ -265,7 +265,9 @@ public class RoomSettingActivity extends BaseMvpActivity<IRoomSettingView, RoomS
|
|||||||
AuthModel.get().getTicket(),
|
AuthModel.get().getTicket(),
|
||||||
giftEffect,
|
giftEffect,
|
||||||
binding.switchAudio.isChecked() ? 2 : 1,
|
binding.switchAudio.isChecked() ? 2 : 1,
|
||||||
roomInfo.getLimitType(), roomInfo.isPureMode())
|
roomInfo.getLimitType(), roomInfo.isPureMode(),
|
||||||
|
roomInfo.getType(),
|
||||||
|
roomInfo.getGameId())
|
||||||
.compose(bindToLifecycle())
|
.compose(bindToLifecycle())
|
||||||
.subscribe(observer);
|
.subscribe(observer);
|
||||||
StatisticManager.Instance().sortLogFileByLastModified();
|
StatisticManager.Instance().sortLogFileByLastModified();
|
||||||
|
@@ -121,7 +121,8 @@ public class RoomTitleEditActivity extends BaseBindingActivity<ActivityRoomTitle
|
|||||||
if (AvRoomDataManager.get().isRoomOwner()) {
|
if (AvRoomDataManager.get().isRoomOwner()) {
|
||||||
mDialogManager.showProgressDialog(this);
|
mDialogManager.showProgressDialog(this);
|
||||||
Disposable disposable = roomSettingModel.updateRoomInfo(info.title, desc, introduction, info.roomPwd, info.getRoomTag(), info.tagId, currentUid,
|
Disposable disposable = roomSettingModel.updateRoomInfo(info.title, desc, introduction, info.roomPwd, info.getRoomTag(), info.tagId, currentUid,
|
||||||
ticket, info.isHasAnimationEffect(), info.getAudioQuality(), info.getLimitType(),info.isPureMode())
|
ticket, info.isHasAnimationEffect(), info.getAudioQuality(), info.getLimitType(),info.isPureMode(), info.getType(),
|
||||||
|
info.getGameId())
|
||||||
.subscribe(this);
|
.subscribe(this);
|
||||||
|
|
||||||
mDisposable.add(disposable);
|
mDisposable.add(disposable);
|
||||||
|
@@ -0,0 +1,18 @@
|
|||||||
|
package com.yizhuan.erban.avroom.adapter
|
||||||
|
|
||||||
|
import android.widget.ImageView
|
||||||
|
import com.chad.library.adapter.base.BaseQuickAdapter
|
||||||
|
import com.chad.library.adapter.base.BaseViewHolder
|
||||||
|
import com.yizhuan.erban.R
|
||||||
|
import com.yizhuan.erban.ui.utils.load
|
||||||
|
import com.yizhuan.xchat_android_core.room.game.GameInfo
|
||||||
|
|
||||||
|
class CreateRoomGameAdapter :
|
||||||
|
BaseQuickAdapter<GameInfo, BaseViewHolder>(R.layout.item_room_create_game) {
|
||||||
|
|
||||||
|
override fun convert(helper: BaseViewHolder, item: GameInfo) {
|
||||||
|
helper.getView<ImageView>(R.id.iv_cover).load(item.pic,12f)
|
||||||
|
helper.itemView.isSelected = item.isSelect
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@@ -0,0 +1,98 @@
|
|||||||
|
package com.yizhuan.erban.avroom.dialog
|
||||||
|
|
||||||
|
import android.annotation.SuppressLint
|
||||||
|
import android.view.Gravity
|
||||||
|
import android.view.WindowManager
|
||||||
|
import androidx.core.view.isInvisible
|
||||||
|
import androidx.core.view.isVisible
|
||||||
|
import androidx.recyclerview.widget.LinearLayoutManager
|
||||||
|
import com.yizhuan.erban.avroom.adapter.CreateRoomGameAdapter
|
||||||
|
import com.yizhuan.erban.base.BaseActivity
|
||||||
|
import com.yizhuan.erban.base.BaseDialog
|
||||||
|
import com.yizhuan.erban.databinding.DialogCreateRoomBinding
|
||||||
|
import com.yizhuan.erban.home.helper.OpenRoomHelper
|
||||||
|
import com.yizhuan.erban.ui.utils.RVDelegate
|
||||||
|
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.utils.toast
|
||||||
|
|
||||||
|
class CreateRoomDialog : BaseDialog<DialogCreateRoomBinding>() {
|
||||||
|
|
||||||
|
private lateinit var rvDelegate: RVDelegate<GameInfo>
|
||||||
|
private val gameAdapter = CreateRoomGameAdapter()
|
||||||
|
private var selectIndex = -1
|
||||||
|
|
||||||
|
override var width = WindowManager.LayoutParams.MATCH_PARENT
|
||||||
|
override var gravity = Gravity.BOTTOM
|
||||||
|
|
||||||
|
@SuppressLint("CheckResult")
|
||||||
|
override fun init() {
|
||||||
|
|
||||||
|
binding.rvGame.itemAnimator = null
|
||||||
|
rvDelegate = RVDelegate.Builder<GameInfo>()
|
||||||
|
.setAdapter(gameAdapter)
|
||||||
|
.setRecyclerView(binding.rvGame)
|
||||||
|
.setLayoutManager(LinearLayoutManager(context, LinearLayoutManager.HORIZONTAL, false))
|
||||||
|
.build()
|
||||||
|
|
||||||
|
gameAdapter.setOnItemClickListener { _, _, position ->
|
||||||
|
if (selectIndex != -1) {
|
||||||
|
gameAdapter.data.getOrNull(selectIndex)?.isSelect = false
|
||||||
|
gameAdapter.notifyItemChanged(selectIndex)
|
||||||
|
}
|
||||||
|
selectIndex = position
|
||||||
|
gameAdapter.data.getOrNull(selectIndex)?.isSelect = true
|
||||||
|
gameAdapter.notifyItemChanged(selectIndex)
|
||||||
|
checkCreateEnable()
|
||||||
|
}
|
||||||
|
|
||||||
|
binding.rbGameRoom.setOnCheckedChangeListener { _, isChecked ->
|
||||||
|
checkCreateEnable()
|
||||||
|
if (isChecked) {
|
||||||
|
binding.rvGame.isVisible = true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
binding.rbPartyRoom.setOnCheckedChangeListener { _, isChecked ->
|
||||||
|
checkCreateEnable()
|
||||||
|
if (isChecked) {
|
||||||
|
binding.rvGame.isInvisible = true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
binding.tvCreate.setOnClickListener {
|
||||||
|
dismissAllowingStateLoss()
|
||||||
|
if (binding.rbPartyRoom.isChecked) {
|
||||||
|
OpenRoomHelper.openHomePartyRoom(requireActivity() as BaseActivity)
|
||||||
|
} else {
|
||||||
|
if (selectIndex != -1) {
|
||||||
|
OpenRoomHelper.openRoom(
|
||||||
|
requireActivity() as BaseActivity, RoomInfo.ROOMTYPE_GAME,
|
||||||
|
gameAdapter.data[selectIndex].mgId.toLong()
|
||||||
|
)
|
||||||
|
} else {
|
||||||
|
"请选择一个游戏!".toast()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
binding.ivClose.setOnClickListener {
|
||||||
|
dismissAllowingStateLoss()
|
||||||
|
}
|
||||||
|
|
||||||
|
GameModel.getGameList()
|
||||||
|
.compose(bindToLifecycle())
|
||||||
|
.subscribe(
|
||||||
|
{
|
||||||
|
rvDelegate.setNewData(it)
|
||||||
|
}, {
|
||||||
|
rvDelegate.loadErr(true)
|
||||||
|
}
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun checkCreateEnable() {
|
||||||
|
binding.tvCreate.isEnabled = binding.rbPartyRoom.isChecked ||
|
||||||
|
(binding.rbGameRoom.isChecked && selectIndex != -1)
|
||||||
|
}
|
||||||
|
}
|
@@ -85,11 +85,9 @@ public class RoomImposeDialog extends BottomSheetDialog implements View.OnClickL
|
|||||||
|
|
||||||
context.startActivity(new Intent(context, CpRoomInviteActivity.class));
|
context.startActivity(new Intent(context, CpRoomInviteActivity.class));
|
||||||
dismiss();
|
dismiss();
|
||||||
// updateRoomInfo("", roomInfo,RoomInfo.IS_INVITE);
|
|
||||||
break;
|
break;
|
||||||
case R.id.tv_friend:
|
case R.id.tv_friend:
|
||||||
StatisticManager.Instance().onEvent(StatisticsProtocol.Event.roomcp_roomlimit_friends_click, "仅好友进入");
|
StatisticManager.Instance().onEvent(StatisticsProtocol.Event.roomcp_roomlimit_friends_click, "仅好友进入");
|
||||||
|
|
||||||
updateRoomInfo("", roomInfo, RoomInfo.IS_FRIEND);
|
updateRoomInfo("", roomInfo, RoomInfo.IS_FRIEND);
|
||||||
break;
|
break;
|
||||||
case R.id.tv_pwd:
|
case R.id.tv_pwd:
|
||||||
@@ -128,7 +126,6 @@ public class RoomImposeDialog extends BottomSheetDialog implements View.OnClickL
|
|||||||
private void updateRoomInfo(String encryptPwd, RoomInfo roomInfo, String limitType) {
|
private void updateRoomInfo(String encryptPwd, RoomInfo roomInfo, String limitType) {
|
||||||
//更新房间接口调用成功后,会发事件RoomEvent.ROOM_INFO_UPDATE
|
//更新房间接口调用成功后,会发事件RoomEvent.ROOM_INFO_UPDATE
|
||||||
RoomSettingModel model = new RoomSettingModel();
|
RoomSettingModel model = new RoomSettingModel();
|
||||||
// if (AvRoomDataManager.get().isRoomOwner()){
|
|
||||||
model.updateRoomInfo(roomInfo.title,
|
model.updateRoomInfo(roomInfo.title,
|
||||||
roomInfo.getRoomDesc(),
|
roomInfo.getRoomDesc(),
|
||||||
roomInfo.getIntroduction(),
|
roomInfo.getIntroduction(),
|
||||||
@@ -140,7 +137,9 @@ public class RoomImposeDialog extends BottomSheetDialog implements View.OnClickL
|
|||||||
roomInfo.isHasAnimationEffect(),
|
roomInfo.isHasAnimationEffect(),
|
||||||
roomInfo.getAudioQuality(),
|
roomInfo.getAudioQuality(),
|
||||||
limitType,
|
limitType,
|
||||||
roomInfo.isPureMode())
|
roomInfo.isPureMode(),
|
||||||
|
roomInfo.getType(),
|
||||||
|
roomInfo.getGameId())
|
||||||
.subscribe(new DontWarnObserver<RoomInfo>() {
|
.subscribe(new DontWarnObserver<RoomInfo>() {
|
||||||
@Override
|
@Override
|
||||||
public void accept(RoomInfo roomInfo, String error) {
|
public void accept(RoomInfo roomInfo, String error) {
|
||||||
@@ -155,27 +154,6 @@ public class RoomImposeDialog extends BottomSheetDialog implements View.OnClickL
|
|||||||
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
// }else {
|
|
||||||
// model.updateByAdmin(roomInfo.getUid(),roomInfo.title,
|
|
||||||
// roomInfo.getRoomDesc(),
|
|
||||||
// encryptPwd,
|
|
||||||
// roomInfo.getRoomTag(),
|
|
||||||
// roomInfo.tagId,
|
|
||||||
// AuthModel.get().getCurrentUid(),
|
|
||||||
// AuthModel.get().getTicket(),
|
|
||||||
// roomInfo.isHasAnimationEffect(),
|
|
||||||
// roomInfo.getAudioQuality(),
|
|
||||||
// limitType)
|
|
||||||
// .subscribe(new Consumer<RoomInfo>() {
|
|
||||||
// @Override
|
|
||||||
// public void accept(RoomInfo roomInfo) throws Exception {
|
|
||||||
// if (!limitType.equals(RoomInfo.IS_INVITE)){
|
|
||||||
// SingleToastUtil.showToast("设置成功");
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// });
|
|
||||||
// }
|
|
||||||
|
|
||||||
dismiss();
|
dismiss();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -213,13 +213,6 @@ public class HomePartyFragment extends AbsRoomFragment implements View.OnClickLi
|
|||||||
@SuppressLint("CheckResult")
|
@SuppressLint("CheckResult")
|
||||||
@Override
|
@Override
|
||||||
public void initiate() {
|
public void initiate() {
|
||||||
roomFragment = GameRoomFragment.newInstance(isRoomMin);
|
|
||||||
//roomFragment = HomePartyRoomFragment.newInstance(isRoomMin);
|
|
||||||
|
|
||||||
getChildFragmentManager()
|
|
||||||
.beginTransaction()
|
|
||||||
.replace(R.id.container, roomFragment)
|
|
||||||
.commitAllowingStateLoss();
|
|
||||||
|
|
||||||
if (!AvRoomDataManager.get().haveSelfChange && AvRoomDataManager.get().mCurrentRoomInfo != null) {
|
if (!AvRoomDataManager.get().haveSelfChange && AvRoomDataManager.get().mCurrentRoomInfo != null) {
|
||||||
AvRoomDataManager.get().mIsNeedGiftEffect = AvRoomDataManager.get().mCurrentRoomInfo.isHasAnimationEffect();
|
AvRoomDataManager.get().mIsNeedGiftEffect = AvRoomDataManager.get().mCurrentRoomInfo.isHasAnimationEffect();
|
||||||
@@ -330,6 +323,19 @@ public class HomePartyFragment extends AbsRoomFragment implements View.OnClickLi
|
|||||||
public void updateView() {
|
public void updateView() {
|
||||||
RoomInfo currentRoomInfo = AvRoomDataManager.get().mCurrentRoomInfo;
|
RoomInfo currentRoomInfo = AvRoomDataManager.get().mCurrentRoomInfo;
|
||||||
if (currentRoomInfo != null) {
|
if (currentRoomInfo != null) {
|
||||||
|
|
||||||
|
if (currentRoomInfo.getType() == RoomInfo.ROOMTYPE_GAME &&
|
||||||
|
!(roomFragment instanceof GameRoomFragment)) {
|
||||||
|
roomFragment = GameRoomFragment.newInstance(isRoomMin);
|
||||||
|
} else if (!(roomFragment instanceof HomePartyRoomFragment)) {
|
||||||
|
roomFragment = HomePartyRoomFragment.newInstance(isRoomMin);
|
||||||
|
}
|
||||||
|
|
||||||
|
getChildFragmentManager()
|
||||||
|
.beginTransaction()
|
||||||
|
.replace(R.id.container, roomFragment)
|
||||||
|
.commitAllowingStateLoss();
|
||||||
|
|
||||||
gameMainBinding.setRoomInfo(currentRoomInfo);
|
gameMainBinding.setRoomInfo(currentRoomInfo);
|
||||||
updateHasAnimationEffect();
|
updateHasAnimationEffect();
|
||||||
roomTitle.setText(RegexUtil.getPrintableString(currentRoomInfo.getTitle()));
|
roomTitle.setText(RegexUtil.getPrintableString(currentRoomInfo.getTitle()));
|
||||||
|
@@ -20,7 +20,7 @@ abstract class BaseDialog<T : ViewBinding> : RxDialogFragment() {
|
|||||||
val binding get() = _binding!!
|
val binding get() = _binding!!
|
||||||
open var width = ScreenUtil.getDialogWidth()
|
open var width = ScreenUtil.getDialogWidth()
|
||||||
var height = WindowManager.LayoutParams.WRAP_CONTENT
|
var height = WindowManager.LayoutParams.WRAP_CONTENT
|
||||||
var gravity = Gravity.CENTER
|
open var gravity = Gravity.CENTER
|
||||||
|
|
||||||
override fun onStart() {
|
override fun onStart() {
|
||||||
super.onStart()
|
super.onStart()
|
||||||
|
@@ -16,6 +16,7 @@ import com.idlefish.flutterboost.FlutterBoost;
|
|||||||
import com.yizhuan.erban.MainActivity;
|
import com.yizhuan.erban.MainActivity;
|
||||||
import com.yizhuan.erban.R;
|
import com.yizhuan.erban.R;
|
||||||
import com.yizhuan.erban.UIHelper;
|
import com.yizhuan.erban.UIHelper;
|
||||||
|
import com.yizhuan.erban.avroom.dialog.CreateRoomDialog;
|
||||||
import com.yizhuan.erban.base.BaseFragment;
|
import com.yizhuan.erban.base.BaseFragment;
|
||||||
import com.yizhuan.erban.databinding.FragmentMeBinding;
|
import com.yizhuan.erban.databinding.FragmentMeBinding;
|
||||||
import com.yizhuan.erban.decoration.view.MyDecorationActivity;
|
import com.yizhuan.erban.decoration.view.MyDecorationActivity;
|
||||||
@@ -41,6 +42,7 @@ import com.yizhuan.xchat_android_core.manager.RelationShipEvent;
|
|||||||
import com.yizhuan.xchat_android_core.noble.NobleInfo;
|
import com.yizhuan.xchat_android_core.noble.NobleInfo;
|
||||||
import com.yizhuan.xchat_android_core.noble.NobleProtocol;
|
import com.yizhuan.xchat_android_core.noble.NobleProtocol;
|
||||||
import com.yizhuan.xchat_android_core.noble.NobleUtil;
|
import com.yizhuan.xchat_android_core.noble.NobleUtil;
|
||||||
|
import com.yizhuan.xchat_android_core.room.bean.RoomInfo;
|
||||||
import com.yizhuan.xchat_android_core.statistic.StatisticManager;
|
import com.yizhuan.xchat_android_core.statistic.StatisticManager;
|
||||||
import com.yizhuan.xchat_android_core.statistic.protocol.StatisticsProtocol;
|
import com.yizhuan.xchat_android_core.statistic.protocol.StatisticsProtocol;
|
||||||
import com.yizhuan.xchat_android_core.user.UserModel;
|
import com.yizhuan.xchat_android_core.user.UserModel;
|
||||||
|
@@ -16,34 +16,41 @@ import androidx.core.content.ContextCompat;
|
|||||||
import com.yizhuan.erban.MainActivity;
|
import com.yizhuan.erban.MainActivity;
|
||||||
import com.yizhuan.erban.R;
|
import com.yizhuan.erban.R;
|
||||||
import com.yizhuan.erban.avroom.activity.AVRoomActivity;
|
import com.yizhuan.erban.avroom.activity.AVRoomActivity;
|
||||||
|
import com.yizhuan.erban.avroom.dialog.CreateRoomDialog;
|
||||||
import com.yizhuan.erban.base.BaseActivity;
|
import com.yizhuan.erban.base.BaseActivity;
|
||||||
import com.yizhuan.erban.common.widget.dialog.DialogManager;
|
import com.yizhuan.erban.common.widget.dialog.DialogManager;
|
||||||
import com.yizhuan.erban.home.presenter.MainFragmentPresenter;
|
|
||||||
import com.yizhuan.erban.ui.webview.CommonWebViewActivity;
|
import com.yizhuan.erban.ui.webview.CommonWebViewActivity;
|
||||||
import com.yizhuan.xchat_android_core.UriProvider;
|
import com.yizhuan.xchat_android_core.UriProvider;
|
||||||
import com.yizhuan.xchat_android_core.auth.AuthModel;
|
import com.yizhuan.xchat_android_core.auth.AuthModel;
|
||||||
import com.yizhuan.xchat_android_core.certification.CertificationModel;
|
import com.yizhuan.xchat_android_core.certification.CertificationModel;
|
||||||
import com.yizhuan.xchat_android_core.manager.AvRoomDataManager;
|
|
||||||
import com.yizhuan.xchat_android_core.patriarch.exception.PmRoomLimitException;
|
import com.yizhuan.xchat_android_core.patriarch.exception.PmRoomLimitException;
|
||||||
import com.yizhuan.xchat_android_core.room.bean.RoomInfo;
|
import com.yizhuan.xchat_android_core.room.bean.RoomInfo;
|
||||||
import com.yizhuan.xchat_android_core.room.model.AvRoomModel;
|
import com.yizhuan.xchat_android_core.room.model.AvRoomModel;
|
||||||
import com.yizhuan.xchat_android_core.statistic.StatisticManager;
|
import com.yizhuan.xchat_android_core.room.model.RoomSettingModel;
|
||||||
import com.yizhuan.xchat_android_core.statistic.protocol.StatisticsProtocol;
|
|
||||||
import com.yizhuan.xchat_android_core.user.UserModel;
|
import com.yizhuan.xchat_android_core.user.UserModel;
|
||||||
import com.yizhuan.xchat_android_core.user.bean.UserInfo;
|
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.DontWarnObserver;
|
||||||
import com.yizhuan.xchat_android_core.utils.net.RxHelper;
|
import com.yizhuan.xchat_android_core.utils.net.RxHelper;
|
||||||
import com.yizhuan.xchat_android_library.net.rxnet.callback.CallBack;
|
import com.yizhuan.xchat_android_library.utils.SingleToastUtil;
|
||||||
|
|
||||||
public class OpenRoomHelper {
|
public class OpenRoomHelper {
|
||||||
|
|
||||||
public static void openRoom(BaseActivity activity) {
|
public static void openRoom(BaseActivity activity) {
|
||||||
|
openRoom(activity, RoomInfo.ROOMTYPE_DEFAULT, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void openHomePartyRoom(BaseActivity activity) {
|
||||||
|
openRoom(activity, RoomInfo.ROOMTYPE_HOME_PARTY, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void openRoom(BaseActivity activity, int type, long gameId) {
|
||||||
UserInfo userInfo = UserModel.get().getCacheLoginUserInfo();
|
UserInfo userInfo = UserModel.get().getCacheLoginUserInfo();
|
||||||
if (userInfo != null && !userInfo.isCertified()) {
|
if (userInfo != null && !userInfo.isCertified()) {
|
||||||
switch (CertificationModel.get().getCertificationType()) {
|
switch (CertificationModel.get().getCertificationType()) {
|
||||||
default:
|
default:
|
||||||
case CER_TYPE_NONE:
|
case CER_TYPE_NONE:
|
||||||
openNormalRoom(activity);
|
requestOpenRoom(activity, type, gameId);
|
||||||
break;
|
break;
|
||||||
case CER_TYPE_FORCE:
|
case CER_TYPE_FORCE:
|
||||||
activity.getDialogManager().showTipsDialog(getCertificationTips(activity),
|
activity.getDialogManager().showTipsDialog(getCertificationTips(activity),
|
||||||
@@ -63,7 +70,7 @@ public class OpenRoomHelper {
|
|||||||
new DialogManager.OkCancelDialogListener() {
|
new DialogManager.OkCancelDialogListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onCancel() {
|
public void onCancel() {
|
||||||
openNormalRoom(activity);
|
requestOpenRoom(activity, type, gameId);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -76,18 +83,7 @@ public class OpenRoomHelper {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
openNormalRoom(activity);
|
requestOpenRoom(activity, type, gameId);
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private static void openNormalRoom(BaseActivity activity) {
|
|
||||||
StatisticManager.Instance().onEvent(StatisticsProtocol.Event.game_homepage_createroom_ordinary_click, "创建普通房");
|
|
||||||
RoomInfo roomInfo = AvRoomDataManager.get().mCurrentRoomInfo;
|
|
||||||
if (roomInfo != null && roomInfo.getUid() == AuthModel.get().getCurrentUid()) {
|
|
||||||
AVRoomActivity.start(activity, roomInfo.getUid());
|
|
||||||
} else {
|
|
||||||
activity.getDialogManager().showProgressDialog(activity, activity.getString(R.string.waiting_text));
|
|
||||||
requestOpenRoom(activity);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -103,7 +99,8 @@ public class OpenRoomHelper {
|
|||||||
/**
|
/**
|
||||||
* 开启房间
|
* 开启房间
|
||||||
*/
|
*/
|
||||||
public static void requestOpenRoom(BaseActivity activity) {
|
public static void requestOpenRoom(BaseActivity activity, int type, long gameId) {
|
||||||
|
activity.getDialogManager().showProgressDialog(activity, activity.getString(R.string.waiting_text));
|
||||||
AvRoomModel.get().requestRoomInfoV2(String.valueOf(AuthModel.get().getCurrentUid()), 0)
|
AvRoomModel.get().requestRoomInfoV2(String.valueOf(AuthModel.get().getCurrentUid()), 0)
|
||||||
.compose(RxHelper.bindActivity(activity))
|
.compose(RxHelper.bindActivity(activity))
|
||||||
.subscribe(new DontWarnObserver<RoomInfo>() {
|
.subscribe(new DontWarnObserver<RoomInfo>() {
|
||||||
@@ -111,19 +108,25 @@ public class OpenRoomHelper {
|
|||||||
public void acceptThrowable(RoomInfo roomInfo, Throwable throwable) {
|
public void acceptThrowable(RoomInfo roomInfo, Throwable throwable) {
|
||||||
super.acceptThrowable(roomInfo, throwable);
|
super.acceptThrowable(roomInfo, throwable);
|
||||||
if (roomInfo != null) {
|
if (roomInfo != null) {
|
||||||
if (roomInfo.isValid()) {
|
if (roomInfo.isReselect()) {
|
||||||
requestOpenRoomResult(activity, MainFragmentPresenter.OPEN_ROOM_SUCCESS, roomInfo);
|
activity.getDialogManager().dismissDialog();
|
||||||
|
new CreateRoomDialog().show(activity);
|
||||||
} else {
|
} else {
|
||||||
openRoom(activity, roomInfo);
|
if (roomInfo.isValid()) {
|
||||||
|
if (type == RoomInfo.ROOMTYPE_DEFAULT || roomInfo.getType() == type) {
|
||||||
|
onOpenRoomSuccess(activity, roomInfo);
|
||||||
|
} else {
|
||||||
|
updateRoomInfo(activity, roomInfo, type, gameId);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
openRoom(activity, roomInfo, type, gameId);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (throwable instanceof PmRoomLimitException) {
|
if (throwable instanceof PmRoomLimitException) {
|
||||||
requestOpenRoomResult(activity, MainFragmentPresenter.OPEN_ROOM_FAIL_PM_LIMIT_TIME,
|
onOpenRoomPmLimit(activity, throwable.getMessage());
|
||||||
throwable.getMessage());
|
|
||||||
} else if (!TextUtils.isEmpty(throwable.getMessage())) {
|
} else if (!TextUtils.isEmpty(throwable.getMessage())) {
|
||||||
requestOpenRoomResult(activity, MainFragmentPresenter.OPEN_ROOM_FAIL,
|
onOpenRoomFail(activity, throwable.getMessage());
|
||||||
throwable.getMessage());
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -131,19 +134,56 @@ public class OpenRoomHelper {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static void updateRoomInfo(BaseActivity activity, RoomInfo roomInfo, int type, long gameId) {
|
||||||
|
RoomSettingModel roomSettingModel = new RoomSettingModel();
|
||||||
|
roomSettingModel.updateRoomInfo(
|
||||||
|
roomInfo.getTitle(),
|
||||||
|
roomInfo.getRoomDesc(),
|
||||||
|
roomInfo.getIntroduction(),
|
||||||
|
roomInfo.roomPwd,
|
||||||
|
roomInfo.getRoomTypeLable(),
|
||||||
|
roomInfo.tagId,
|
||||||
|
AuthModel.get().getCurrentUid(),
|
||||||
|
AuthModel.get().getTicket(),
|
||||||
|
roomInfo.isHasAnimationEffect(),
|
||||||
|
roomInfo.getAudioQuality(),
|
||||||
|
roomInfo.getLimitType(),
|
||||||
|
roomInfo.isPureMode(),
|
||||||
|
type,
|
||||||
|
gameId)
|
||||||
|
.compose(RxHelper.bindContext(activity))
|
||||||
|
.subscribe(new BeanObserver<RoomInfo>() {
|
||||||
|
@Override
|
||||||
|
public void onErrorMsg(String error) {
|
||||||
|
onOpenRoomFail(activity, error);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onSuccess(@NonNull RoomInfo roomInfo) {
|
||||||
|
openRoom(activity, roomInfo, type, gameId);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
@SuppressLint("CheckResult")
|
@SuppressLint("CheckResult")
|
||||||
private static void openRoom(BaseActivity activity, RoomInfo roomInfo) {
|
private static void openRoom(BaseActivity activity, RoomInfo roomInfo, int type, long gameId) {
|
||||||
AvRoomModel.get().openRoom(
|
AvRoomModel.get().openRoom(
|
||||||
AuthModel.get().getCurrentUid(), roomInfo.getType(), roomInfo.getTitle(), roomInfo.getRoomDesc(), roomInfo.getBackPic(), null)
|
AuthModel.get().getCurrentUid(),
|
||||||
|
type == RoomInfo.ROOMTYPE_DEFAULT ? roomInfo.getType() : type,
|
||||||
|
roomInfo.getTitle(),
|
||||||
|
roomInfo.getRoomDesc(),
|
||||||
|
roomInfo.getBackPic(),
|
||||||
|
null,
|
||||||
|
gameId)
|
||||||
.compose(RxHelper.bindActivity(activity))
|
.compose(RxHelper.bindActivity(activity))
|
||||||
.subscribe((roomResult, throwable) -> {
|
.subscribe((roomResult, throwable) -> {
|
||||||
if (throwable != null) {
|
if (throwable != null) {
|
||||||
onOpenRoomFail(activity, throwable.getMessage());
|
onOpenRoomFail(activity, throwable.getMessage());
|
||||||
} else if (roomResult != null && roomResult.isSuccess()) {
|
} else if (roomResult != null && roomResult.isSuccess()) {
|
||||||
requestOpenRoomResult(activity, MainFragmentPresenter.OPEN_ROOM_SUCCESS, roomInfo);
|
onOpenRoomSuccess(activity, roomInfo);
|
||||||
} else if (roomResult != null && !roomResult.isSuccess()) {
|
} else if (roomResult != null && !roomResult.isSuccess()) {
|
||||||
if (roomResult.getCode() == 1500) {
|
if (roomResult.getCode() == 1500) {
|
||||||
requestOpenRoomResult(activity, MainFragmentPresenter.OPEN_ROOM_FAIL_ALREADY_OPENED_ROOM, roomInfo);
|
onOpenRoomSuccess(activity, roomInfo);
|
||||||
} else {
|
} else {
|
||||||
onOpenRoomFail(activity, roomResult.getError());
|
onOpenRoomFail(activity, roomResult.getError());
|
||||||
}
|
}
|
||||||
@@ -153,50 +193,22 @@ public class OpenRoomHelper {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
private static void onOpenRoomSuccess(BaseActivity activity, RoomInfo roomInfo) {
|
||||||
* 请求退出房间
|
activity.getDialogManager().dismissDialog();
|
||||||
*/
|
AVRoomActivity.start(activity, roomInfo.getUid());
|
||||||
public static void requestExitRoom(BaseActivity activity, RoomInfo roomInfo) {
|
|
||||||
AvRoomModel.get().exitRoom(new CallBack<RoomInfo>() {
|
|
||||||
@Override
|
|
||||||
public void onSuccess(RoomInfo data) {
|
|
||||||
openRoom(activity, roomInfo);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onFail(int code, String error) {
|
|
||||||
requestOpenRoomResult(activity, MainFragmentPresenter.OPEN_ROOM_FAIL, error);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void onOpenRoomFail(BaseActivity activity, String error) {
|
private static void onOpenRoomFail(BaseActivity activity, String error) {
|
||||||
requestOpenRoomResult(activity, MainFragmentPresenter.OPEN_ROOM_FAIL, error);
|
activity.getDialogManager().dismissDialog();
|
||||||
|
SingleToastUtil.showToast(error);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void requestOpenRoomResult(BaseActivity activity, int openRoomFailType, Object... arg) {
|
private static void onOpenRoomPmLimit(BaseActivity activity, String error) {
|
||||||
activity.getDialogManager().dismissDialog();
|
activity.getDialogManager().dismissDialog();
|
||||||
if (openRoomFailType == MainFragmentPresenter.OPEN_ROOM_SUCCESS) {
|
if (activity instanceof MainActivity) {
|
||||||
RoomInfo roomInfo = (RoomInfo) arg[0];
|
((MainActivity) activity).handleOpenRoomWhenPmLimit(error);
|
||||||
AVRoomActivity.start(activity, roomInfo.getUid());
|
|
||||||
} else if (openRoomFailType == MainFragmentPresenter.OPEN_ROOM_FAIL_TYPE_IN_ROOM) {
|
|
||||||
RoomInfo roomInfo = (RoomInfo) arg[0];
|
|
||||||
activity.getDialogManager().showProgressDialog(activity, "请稍后...");
|
|
||||||
requestExitRoom(activity, roomInfo);
|
|
||||||
} else if (openRoomFailType == MainFragmentPresenter.OPEN_ROOM_FAIL) {
|
|
||||||
String error = (String) arg[0];
|
|
||||||
activity.toast(error);
|
|
||||||
} else if (openRoomFailType == MainFragmentPresenter.OPEN_ROOM_FAIL_ALREADY_OPENED_ROOM) {
|
|
||||||
RoomInfo roomInfo = (RoomInfo) arg[0];
|
|
||||||
AVRoomActivity.start(activity, roomInfo.getUid());
|
|
||||||
} else if (openRoomFailType == MainFragmentPresenter.OPEN_ROOM_FAIL_PM_LIMIT_TIME) {
|
|
||||||
if (activity instanceof MainActivity) {
|
|
||||||
if (arg != null && arg.length > 0 && arg[0] instanceof String) {
|
|
||||||
((MainActivity) activity).handleOpenRoomWhenPmLimit((String) arg[0]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
BIN
app/src/main/res/drawable-xhdpi/bg_room_game_checked.png
Normal file
BIN
app/src/main/res/drawable-xhdpi/bg_room_game_checked.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 26 KiB |
BIN
app/src/main/res/drawable-xhdpi/bg_room_game_unchecked.png
Normal file
BIN
app/src/main/res/drawable-xhdpi/bg_room_game_unchecked.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 24 KiB |
BIN
app/src/main/res/drawable-xhdpi/bg_room_party_checked.png
Normal file
BIN
app/src/main/res/drawable-xhdpi/bg_room_party_checked.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 26 KiB |
BIN
app/src/main/res/drawable-xhdpi/bg_room_party_unchecked.png
Normal file
BIN
app/src/main/res/drawable-xhdpi/bg_room_party_unchecked.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 24 KiB |
BIN
app/src/main/res/drawable-xhdpi/ic_room_create_close.png
Normal file
BIN
app/src/main/res/drawable-xhdpi/ic_room_create_close.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 492 B |
@@ -4,8 +4,8 @@
|
|||||||
<corners android:radius="100dp" />
|
<corners android:radius="100dp" />
|
||||||
<gradient
|
<gradient
|
||||||
android:angle="180"
|
android:angle="180"
|
||||||
android:endColor="#ffbcddff"
|
android:endColor="#4DFFA936"
|
||||||
android:startColor="#ffd6bef7"
|
android:startColor="#4DFFCB47"
|
||||||
android:type="linear"
|
android:type="linear"
|
||||||
android:useLevel="true" />
|
android:useLevel="true" />
|
||||||
</shape>
|
</shape>
|
@@ -2,27 +2,27 @@
|
|||||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
<item android:state_pressed="true">
|
<item android:state_pressed="true">
|
||||||
<shape android:shape="rectangle">
|
<shape android:shape="rectangle">
|
||||||
<gradient android:angle="180" android:endColor="#FF218EFF" android:startColor="#FF7727E4" android:type="linear" android:useLevel="true" /> <corners android:radius="100dp" />
|
<gradient android:angle="180" android:endColor="#FFFFA936" android:startColor="#FFFFCB47" android:type="linear" android:useLevel="true" /> <corners android:radius="100dp" />
|
||||||
</shape>
|
</shape>
|
||||||
</item>
|
</item>
|
||||||
|
|
||||||
<item android:state_focused="true">
|
<item android:state_focused="true">
|
||||||
<shape android:shape="rectangle">
|
<shape android:shape="rectangle">
|
||||||
<gradient android:angle="180" android:endColor="#FF218EFF" android:startColor="#FF7727E4" android:type="linear" android:useLevel="true" />
|
<gradient android:angle="180" android:endColor="#FFFFA936" android:startColor="#FFFFCB47" android:type="linear" android:useLevel="true" />
|
||||||
<corners android:radius="100dp" />
|
<corners android:radius="100dp" />
|
||||||
</shape>
|
</shape>
|
||||||
</item>
|
</item>
|
||||||
|
|
||||||
<item android:state_enabled="false">
|
<item android:state_enabled="false">
|
||||||
<shape android:shape="rectangle">
|
<shape android:shape="rectangle">
|
||||||
<solid android:color="#FF4C4C6A" />
|
<solid android:color="#FFD2D5D7" />
|
||||||
<corners android:radius="100dp" />
|
<corners android:radius="100dp" />
|
||||||
</shape>
|
</shape>
|
||||||
</item>
|
</item>
|
||||||
|
|
||||||
<item>
|
<item>
|
||||||
<shape android:shape="rectangle">
|
<shape android:shape="rectangle">
|
||||||
<gradient android:angle="180" android:endColor="#FF218EFF" android:startColor="#FF7727E4" android:type="linear" android:useLevel="true" />
|
<gradient android:angle="180" android:endColor="#FFFFA936" android:startColor="#FFFFCB47" android:type="linear" android:useLevel="true" />
|
||||||
<corners android:radius="100dp" />
|
<corners android:radius="100dp" />
|
||||||
</shape>
|
</shape>
|
||||||
</item>
|
</item>
|
||||||
|
5
app/src/main/res/drawable/selector_room_game.xml
Normal file
5
app/src/main/res/drawable/selector_room_game.xml
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
<item android:drawable="@drawable/bg_room_game_checked" android:state_checked="true" />
|
||||||
|
<item android:drawable="@drawable/bg_room_game_unchecked" />
|
||||||
|
</selector>
|
13
app/src/main/res/drawable/selector_room_game_item.xml
Normal file
13
app/src/main/res/drawable/selector_room_game_item.xml
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
|
||||||
|
<item android:state_selected="true">
|
||||||
|
<shape android:shape="rectangle">
|
||||||
|
<stroke android:width="2dp" android:color="@color/app_248cfe" />
|
||||||
|
<solid android:color="@color/transparent" />
|
||||||
|
<corners android:radius="12dp" />
|
||||||
|
</shape>
|
||||||
|
</item>
|
||||||
|
<item android:drawable="@color/transparent" android:state_selected="false" />
|
||||||
|
|
||||||
|
</selector>
|
5
app/src/main/res/drawable/selector_room_party.xml
Normal file
5
app/src/main/res/drawable/selector_room_party.xml
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
<item android:drawable="@drawable/bg_room_party_checked" android:state_checked="true" />
|
||||||
|
<item android:drawable="@drawable/bg_room_party_unchecked" />
|
||||||
|
</selector>
|
10
app/src/main/res/drawable/shape_white_bottom_12dp.xml
Normal file
10
app/src/main/res/drawable/shape_white_bottom_12dp.xml
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:shape="rectangle">
|
||||||
|
|
||||||
|
<solid android:color="@color/white" />
|
||||||
|
|
||||||
|
<corners
|
||||||
|
android:topLeftRadius="12dp"
|
||||||
|
android:topRightRadius="12dp" />
|
||||||
|
</shape>
|
@@ -1,56 +1,103 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<layout xmlns:android="http://schemas.android.com/apk/res/android"
|
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
xmlns:app="http://schemas.android.com/apk/res-auto">
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_gravity="bottom"
|
||||||
|
android:background="@drawable/shape_white_bottom_12dp"
|
||||||
|
android:orientation="vertical">
|
||||||
|
|
||||||
<data>
|
<TextView
|
||||||
|
android:id="@+id/tv_title"
|
||||||
</data>
|
android:layout_width="wrap_content"
|
||||||
|
|
||||||
<LinearLayout
|
|
||||||
android:layout_width="311dp"
|
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:orientation="vertical"
|
android:layout_marginStart="16dp"
|
||||||
android:background="@drawable/shape_white_20dp_round">
|
android:layout_marginTop="16dp"
|
||||||
|
android:layout_marginBottom="24dp"
|
||||||
|
android:text="新建房间"
|
||||||
|
android:textColor="@color/color_333333"
|
||||||
|
android:textSize="16sp"
|
||||||
|
app:layout_constraintBottom_toTopOf="@id/tv_play_type"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
|
|
||||||
<LinearLayout
|
<ImageView
|
||||||
|
android:id="@+id/iv_close"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginEnd="11dp"
|
||||||
|
android:src="@drawable/ic_room_create_close"
|
||||||
|
app:layout_constraintBottom_toBottomOf="@id/tv_title"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="@id/tv_title" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/tv_play_type"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginStart="16dp"
|
||||||
|
android:layout_marginBottom="6dp"
|
||||||
|
android:text="房间玩法"
|
||||||
|
android:textColor="#ff666666"
|
||||||
|
android:textSize="12sp"
|
||||||
|
app:layout_constraintBottom_toTopOf="@id/rg_type"
|
||||||
|
app:layout_constraintStart_toStartOf="parent" />
|
||||||
|
|
||||||
|
<RadioGroup
|
||||||
|
android:id="@+id/rg_type"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginStart="10dp"
|
||||||
|
android:orientation="horizontal"
|
||||||
|
android:layout_marginBottom="10dp"
|
||||||
|
app:layout_constraintBottom_toTopOf="@id/rv_game"
|
||||||
|
app:layout_constraintStart_toStartOf="parent">
|
||||||
|
|
||||||
|
<RadioButton
|
||||||
|
android:id="@+id/rb_party_room"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_gravity="center_horizontal"
|
android:background="@drawable/selector_room_party"
|
||||||
android:layout_marginTop="27dp">
|
android:button="@null" />
|
||||||
|
|
||||||
<TextView
|
<RadioButton
|
||||||
android:id="@+id/tv_normal"
|
android:id="@+id/rb_game_room"
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_marginRight="69dp"
|
|
||||||
android:drawableTop="@drawable/ic_normal_room"
|
|
||||||
android:gravity="center_horizontal"
|
|
||||||
android:text="普通房"
|
|
||||||
android:textColor="@color/color_333333"
|
|
||||||
android:textSize="14dp"
|
|
||||||
app:layout_constraintTop_toTopOf="parent" />
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/tv_cp"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:drawableTop="@drawable/ic_accompany"
|
|
||||||
android:gravity="center_horizontal"
|
|
||||||
android:text="陪伴房"
|
|
||||||
android:textColor="@color/color_333333"
|
|
||||||
android:textSize="14dp"
|
|
||||||
app:layout_constraintTop_toTopOf="parent" />
|
|
||||||
</LinearLayout>
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/tv_explain"
|
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_gravity="center_horizontal"
|
android:background="@drawable/selector_room_game"
|
||||||
android:layout_marginTop="20dp"
|
android:button="@null" />
|
||||||
android:text="房间说明>"
|
|
||||||
android:textColor="@color/appColor"
|
</RadioGroup>
|
||||||
android:textSize="12sp"
|
|
||||||
android:layout_marginBottom="16dp" />
|
<androidx.recyclerview.widget.RecyclerView
|
||||||
</LinearLayout>
|
android:id="@+id/rv_game"
|
||||||
</layout>
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="118dp"
|
||||||
|
android:layout_marginBottom="55dp"
|
||||||
|
android:clipToPadding="true"
|
||||||
|
android:paddingStart="8dp"
|
||||||
|
android:paddingEnd="8dp"
|
||||||
|
android:visibility="invisible"
|
||||||
|
app:layout_constraintBottom_toTopOf="@id/tv_create"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/tv_create"
|
||||||
|
android:layout_width="240dp"
|
||||||
|
android:layout_height="40dp"
|
||||||
|
android:layout_marginBottom="58dp"
|
||||||
|
android:background="@drawable/common_btn_bg"
|
||||||
|
android:enabled="false"
|
||||||
|
android:gravity="center"
|
||||||
|
android:includeFontPadding="false"
|
||||||
|
android:text="创建房间"
|
||||||
|
android:textColor="@color/white"
|
||||||
|
android:textSize="16sp"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent" />
|
||||||
|
|
||||||
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
|
|
||||||
|
19
app/src/main/res/layout/item_room_create_game.xml
Normal file
19
app/src/main/res/layout/item_room_create_game.xml
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<FrameLayout 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:layout_marginStart="2dp"
|
||||||
|
android:layout_marginEnd="2dp"
|
||||||
|
android:background="@drawable/selector_room_game_item">
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/iv_cover"
|
||||||
|
android:layout_width="90dp"
|
||||||
|
android:layout_height="110dp"
|
||||||
|
android:layout_margin="4dp"
|
||||||
|
android:scaleType="centerCrop"
|
||||||
|
android:src="@drawable/default_cover" />
|
||||||
|
|
||||||
|
</FrameLayout>
|
@@ -491,7 +491,7 @@
|
|||||||
<color name="color_9af5ef">#9af5ef</color>
|
<color name="color_9af5ef">#9af5ef</color>
|
||||||
|
|
||||||
<!-- 音游主题色 -->
|
<!-- 音游主题色 -->
|
||||||
<color name="color_7154EE">#248cfe</color>
|
<color name="color_7154EE">#FFA936</color>
|
||||||
|
|
||||||
<color name="color_39EBDF">#39EBDF</color>
|
<color name="color_39EBDF">#39EBDF</color>
|
||||||
<color name="color_39D0EB">#39D0EB</color>
|
<color name="color_39D0EB">#39D0EB</color>
|
||||||
|
@@ -300,7 +300,9 @@ public class MWTeamRoomMessageAct extends BaseMessageActivity implements IMWTeam
|
|||||||
AuthModel.get().getTicket(),
|
AuthModel.get().getTicket(),
|
||||||
roomInfo.isHasAnimationEffect(),
|
roomInfo.isHasAnimationEffect(),
|
||||||
roomInfo.getAudioQuality(),
|
roomInfo.getAudioQuality(),
|
||||||
roomInfo.getLimitType(),roomInfo.isPureMode())
|
roomInfo.getLimitType(),roomInfo.isPureMode(),
|
||||||
|
roomInfo.getType(),
|
||||||
|
roomInfo.getGameId())
|
||||||
.compose(bindToLifecycle())
|
.compose(bindToLifecycle())
|
||||||
.subscribe(new BeanObserver<RoomInfo>() {
|
.subscribe(new BeanObserver<RoomInfo>() {
|
||||||
@Override
|
@Override
|
||||||
|
@@ -327,7 +327,10 @@ public class MiniWorldTeamMessageActivity extends BaseMessageActivity implements
|
|||||||
AuthModel.get().getTicket(),
|
AuthModel.get().getTicket(),
|
||||||
roomInfo.isHasAnimationEffect(),
|
roomInfo.isHasAnimationEffect(),
|
||||||
roomInfo.getAudioQuality(),
|
roomInfo.getAudioQuality(),
|
||||||
roomInfo.getLimitType(), roomInfo.isPureMode())
|
roomInfo.getLimitType(),
|
||||||
|
roomInfo.isPureMode(),
|
||||||
|
roomInfo.getType(),
|
||||||
|
roomInfo.getGameId())
|
||||||
.compose(bindToLifecycle())
|
.compose(bindToLifecycle())
|
||||||
.subscribe(new BeanObserver<RoomInfo>() {
|
.subscribe(new BeanObserver<RoomInfo>() {
|
||||||
@Override
|
@Override
|
||||||
|
@@ -208,7 +208,7 @@ public class MWTeamMessagePresenter {
|
|||||||
@SuppressLint("CheckResult")
|
@SuppressLint("CheckResult")
|
||||||
private void openRoom() {
|
private void openRoom() {
|
||||||
avRoomModel.openRoom(
|
avRoomModel.openRoom(
|
||||||
AuthModel.get().getCurrentUid(), roomType, null, null, null, null)
|
AuthModel.get().getCurrentUid(), roomType, null, null, null, null,0)
|
||||||
// .compose(bindToLifecycle())
|
// .compose(bindToLifecycle())
|
||||||
.subscribe((roomResult, throwable) -> {
|
.subscribe((roomResult, throwable) -> {
|
||||||
if (throwable != null) {
|
if (throwable != null) {
|
||||||
|
@@ -22,6 +22,7 @@
|
|||||||
</data>
|
</data>
|
||||||
|
|
||||||
<RelativeLayout
|
<RelativeLayout
|
||||||
|
android:layout_marginTop="75dp"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent">
|
android:layout_height="match_parent">
|
||||||
|
|
||||||
|
@@ -18,10 +18,12 @@ import lombok.ToString;
|
|||||||
@Data
|
@Data
|
||||||
@ToString
|
@ToString
|
||||||
public class RoomInfo implements Parcelable,Serializable {
|
public class RoomInfo implements Parcelable,Serializable {
|
||||||
|
public static final int ROOMTYPE_DEFAULT = -1;//使用服务器的房间类型
|
||||||
public static final int ROOMTYPE_AUCTION = 1;//竞拍房间
|
public static final int ROOMTYPE_AUCTION = 1;//竞拍房间
|
||||||
public static final int ROOMTYPE_LIGHT_CHAT = 2;//轻聊房
|
public static final int ROOMTYPE_LIGHT_CHAT = 2;//轻聊房
|
||||||
public static final int ROOMTYPE_HOME_PARTY = 3;//轰趴房
|
public static final int ROOMTYPE_HOME_PARTY = 3;//轰趴房
|
||||||
public static final int ROOMTYPE_CP = 5;//陪伴房
|
public static final int ROOMTYPE_CP = 5;//陪伴房
|
||||||
|
public static final int ROOMTYPE_GAME = 7;//游戏房
|
||||||
|
|
||||||
public static final String DATING_STATE_FLOW = "1";//嘉宾交流
|
public static final String DATING_STATE_FLOW = "1";//嘉宾交流
|
||||||
public static final String DATING_STATE_SELECT = "2";//心动选人
|
public static final String DATING_STATE_SELECT = "2";//心动选人
|
||||||
@@ -184,6 +186,9 @@ public class RoomInfo implements Parcelable,Serializable {
|
|||||||
*/
|
*/
|
||||||
private String audioSdkType;
|
private String audioSdkType;
|
||||||
|
|
||||||
|
private boolean isReselect;
|
||||||
|
|
||||||
|
private long gameId;
|
||||||
// /**
|
// /**
|
||||||
// * 房间角标
|
// * 房间角标
|
||||||
// */
|
// */
|
||||||
|
@@ -0,0 +1,11 @@
|
|||||||
|
package com.yizhuan.xchat_android_core.room.game
|
||||||
|
|
||||||
|
data class GameInfo(
|
||||||
|
val isShow: Boolean = false,
|
||||||
|
val mgId: String = "",
|
||||||
|
val name: String = "",
|
||||||
|
val pic: String = "",
|
||||||
|
val remark: String = "",
|
||||||
|
val seq: Int = 0,
|
||||||
|
var isSelect: Boolean = false
|
||||||
|
)
|
@@ -22,6 +22,12 @@ object GameModel : BaseModel() {
|
|||||||
.compose(RxHelper.handleSchAndExce())
|
.compose(RxHelper.handleSchAndExce())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun getGameList(): Single<List<GameInfo>> {
|
||||||
|
return api.getGameList()
|
||||||
|
.compose(RxHelper.handleBeanData())
|
||||||
|
.compose(RxHelper.handleSchAndExce())
|
||||||
|
}
|
||||||
|
|
||||||
suspend fun getHomeBanner(type: String): List<BannerInfo>? =
|
suspend fun getHomeBanner(type: String): List<BannerInfo>? =
|
||||||
launchRequest {
|
launchRequest {
|
||||||
api.apiHomeBanner(
|
api.apiHomeBanner(
|
||||||
@@ -35,6 +41,16 @@ object GameModel : BaseModel() {
|
|||||||
|
|
||||||
private interface Api {
|
private interface Api {
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* @param uid
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@POST("/miniGame/record/miniGameList")
|
||||||
|
fun getGameList(
|
||||||
|
): Single<ServiceResult<List<GameInfo>>>
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
@@ -47,6 +63,7 @@ object GameModel : BaseModel() {
|
|||||||
@Field("uid") uid: Long
|
@Field("uid") uid: Long
|
||||||
): Single<ServiceResult<GameCodeInfo>>
|
): Single<ServiceResult<GameCodeInfo>>
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 首页Banner
|
* 首页Banner
|
||||||
*
|
*
|
||||||
|
@@ -503,7 +503,7 @@ public class AvRoomModel extends RoomBaseModel implements IAvRoomModel {
|
|||||||
@Override
|
@Override
|
||||||
public Single<RoomResult> requestRoomResult(String uid, int pageType) {
|
public Single<RoomResult> requestRoomResult(String uid, int pageType) {
|
||||||
return mRoomService.getRoomInfo(uid, AuthModel.get().getCurrentUid())
|
return mRoomService.getRoomInfo(uid, AuthModel.get().getCurrentUid())
|
||||||
.timeout(10, TimeUnit.SECONDS)
|
.timeout(60, TimeUnit.SECONDS)
|
||||||
.compose(RxHelper.handleSchAndExce())
|
.compose(RxHelper.handleSchAndExce())
|
||||||
.doOnSuccess(roomResult -> {
|
.doOnSuccess(roomResult -> {
|
||||||
if (roomResult != null && roomResult.isSuccess() && roomResult.getData() != null) {
|
if (roomResult != null && roomResult.isSuccess() && roomResult.getData() != null) {
|
||||||
|
@@ -720,7 +720,7 @@ public class RoomBaseModel extends BaseModel implements IRoomBaseModel {
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public Single<RoomResult> openRoom(long uid, int type, String title, String roomDesc,
|
public Single<RoomResult> openRoom(long uid, int type, String title, String roomDesc,
|
||||||
String backPic, String rewardId) {
|
String backPic, String rewardId,long gameId) {
|
||||||
if (TextUtils.isEmpty(title)) {
|
if (TextUtils.isEmpty(title)) {
|
||||||
return UserModel.get().getUserInfo(uid)
|
return UserModel.get().getUserInfo(uid)
|
||||||
.flatMap(new Function<UserInfo, SingleSource<RoomResult>>() {
|
.flatMap(new Function<UserInfo, SingleSource<RoomResult>>() {
|
||||||
|
@@ -75,9 +75,21 @@ public class RoomSettingModel extends BaseMvpModel {
|
|||||||
* @param label 标签名字
|
* @param label 标签名字
|
||||||
* @param tagId 标签id
|
* @param tagId 标签id
|
||||||
*/
|
*/
|
||||||
public Single<RoomInfo> updateRoomInfo(String title, String desc, String introduction, String pwd, String label,
|
public Single<RoomInfo> updateRoomInfo(String title,
|
||||||
int tagId, long uid, String ticket, boolean hasEffect, int audio, String limitType, boolean isPureMode) {
|
String desc,
|
||||||
return mRoomSettingService.updateRoomInfo(title, desc, introduction, pwd, label, tagId, uid, hasEffect, audio, limitType, isPureMode)
|
String introduction,
|
||||||
|
String pwd,
|
||||||
|
String label,
|
||||||
|
int tagId,
|
||||||
|
long uid,
|
||||||
|
String ticket,
|
||||||
|
boolean hasEffect,
|
||||||
|
int audio,
|
||||||
|
String limitType,
|
||||||
|
boolean isPureMode,
|
||||||
|
int type,
|
||||||
|
long gameId) {
|
||||||
|
return mRoomSettingService.updateRoomInfo(title, desc, introduction, pwd, label, tagId, uid, hasEffect, audio, limitType, isPureMode, type, gameId)
|
||||||
.subscribeOn(Schedulers.io())
|
.subscribeOn(Schedulers.io())
|
||||||
.unsubscribeOn(Schedulers.io())
|
.unsubscribeOn(Schedulers.io())
|
||||||
.onErrorResumeNext(this.<RoomInfo>getSingleCommonExceptionFunction())
|
.onErrorResumeNext(this.<RoomInfo>getSingleCommonExceptionFunction())
|
||||||
@@ -124,13 +136,13 @@ public class RoomSettingModel extends BaseMvpModel {
|
|||||||
public Single<RoomInfo> updateRoomPureMode(long roomUid, String title, String desc,
|
public Single<RoomInfo> updateRoomPureMode(long roomUid, String title, String desc,
|
||||||
String introduction, String pwd, String label,
|
String introduction, String pwd, String label,
|
||||||
int tagId, boolean hasEffect, int audio, boolean isPureMode) {
|
int tagId, boolean hasEffect, int audio, boolean isPureMode) {
|
||||||
return mRoomSettingService.updateRoomPureMode(roomUid, title, desc, introduction, pwd, label,
|
return mRoomSettingService.updateRoomPureMode(roomUid, title, desc, introduction, pwd, label,
|
||||||
tagId, AuthModel.get().getCurrentUid(), hasEffect, audio, isPureMode)
|
tagId, AuthModel.get().getCurrentUid(), hasEffect, audio, isPureMode)
|
||||||
.subscribeOn(Schedulers.io())
|
.subscribeOn(Schedulers.io())
|
||||||
.unsubscribeOn(Schedulers.io())
|
.unsubscribeOn(Schedulers.io())
|
||||||
.onErrorResumeNext(this.<RoomInfo>getSingleCommonExceptionFunction())
|
.onErrorResumeNext(this.<RoomInfo>getSingleCommonExceptionFunction())
|
||||||
.flatMap(this.<RoomInfo>getSingleFunction())
|
.flatMap(this.<RoomInfo>getSingleFunction())
|
||||||
.observeOn(AndroidSchedulers.mainThread());
|
.observeOn(AndroidSchedulers.mainThread());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -166,7 +178,6 @@ public class RoomSettingModel extends BaseMvpModel {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
|
||||||
* @param roomUid 房主uid
|
* @param roomUid 房主uid
|
||||||
*/
|
*/
|
||||||
public Single<String> leaveModeOpen(long roomUid) {
|
public Single<String> leaveModeOpen(long roomUid) {
|
||||||
@@ -183,7 +194,6 @@ public class RoomSettingModel extends BaseMvpModel {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
|
||||||
* @param roomUid 房主uid
|
* @param roomUid 房主uid
|
||||||
*/
|
*/
|
||||||
public Single<String> leaveModeClose(long roomUid) {
|
public Single<String> leaveModeClose(long roomUid) {
|
||||||
@@ -203,7 +213,8 @@ public class RoomSettingModel extends BaseMvpModel {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 请求所有的标签列表数据
|
* 请求所有的标签列表数据
|
||||||
*4.18更改接口,传房间uid
|
* 4.18更改接口,传房间uid
|
||||||
|
*
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@FormUrlEncoded
|
@FormUrlEncoded
|
||||||
@@ -230,7 +241,9 @@ public class RoomSettingModel extends BaseMvpModel {
|
|||||||
@Field("hasAnimationEffect") boolean hasAnimationEffect,
|
@Field("hasAnimationEffect") boolean hasAnimationEffect,
|
||||||
@Field("audioQuality") int audioQuality,
|
@Field("audioQuality") int audioQuality,
|
||||||
@Field("limitType") String limitType,
|
@Field("limitType") String limitType,
|
||||||
@Field("isPureMode") boolean isPureMode);
|
@Field("isPureMode") boolean isPureMode,
|
||||||
|
@Field("type") int type,
|
||||||
|
@Field("mgId") long gameId);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 更新房间设置信息
|
* 更新房间设置信息
|
||||||
|
@@ -170,7 +170,7 @@ public interface IRoomBaseModel extends IModel {
|
|||||||
* rewardId:当type为2时,必填如rewardId
|
* rewardId:当type为2时,必填如rewardId
|
||||||
*/
|
*/
|
||||||
Single<RoomResult> openRoom(long uid, int type, String title, String roomDesc,
|
Single<RoomResult> openRoom(long uid, int type, String title, String roomDesc,
|
||||||
String backPic, String rewardId);
|
String backPic, String rewardId, long gameId);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*关闭公屏
|
*关闭公屏
|
||||||
|
Reference in New Issue
Block a user