新增创建房间弹窗

This commit is contained in:
huangjian
2021-12-08 18:42:59 +08:00
parent 9489e22315
commit c15d6848e8
35 changed files with 449 additions and 179 deletions

View File

@@ -107,7 +107,9 @@ public class CpRoomInviteActivity extends BaseBindingActivity<ActivityCpRoomInvi
roomInfo.isHasAnimationEffect(),
roomInfo.getAudioQuality(),
limitType,
roomInfo.isPureMode());
roomInfo.isPureMode(),
roomInfo.getType(),
roomInfo.getGameId());
} else {
return model.updateByAdmin(roomInfo.getUid(), roomInfo.title,
roomInfo.getRoomDesc(),

View File

@@ -265,7 +265,9 @@ public class RoomSettingActivity extends BaseMvpActivity<IRoomSettingView, RoomS
AuthModel.get().getTicket(),
giftEffect,
binding.switchAudio.isChecked() ? 2 : 1,
roomInfo.getLimitType(), roomInfo.isPureMode())
roomInfo.getLimitType(), roomInfo.isPureMode(),
roomInfo.getType(),
roomInfo.getGameId())
.compose(bindToLifecycle())
.subscribe(observer);
StatisticManager.Instance().sortLogFileByLastModified();

View File

@@ -121,7 +121,8 @@ public class RoomTitleEditActivity extends BaseBindingActivity<ActivityRoomTitle
if (AvRoomDataManager.get().isRoomOwner()) {
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())
ticket, info.isHasAnimationEffect(), info.getAudioQuality(), info.getLimitType(),info.isPureMode(), info.getType(),
info.getGameId())
.subscribe(this);
mDisposable.add(disposable);

View File

@@ -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
}
}

View File

@@ -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)
}
}

View File

@@ -85,11 +85,9 @@ public class RoomImposeDialog extends BottomSheetDialog implements View.OnClickL
context.startActivity(new Intent(context, CpRoomInviteActivity.class));
dismiss();
// updateRoomInfo("", roomInfo,RoomInfo.IS_INVITE);
break;
case R.id.tv_friend:
StatisticManager.Instance().onEvent(StatisticsProtocol.Event.roomcp_roomlimit_friends_click, "仅好友进入");
updateRoomInfo("", roomInfo, RoomInfo.IS_FRIEND);
break;
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) {
//更新房间接口调用成功后会发事件RoomEvent.ROOM_INFO_UPDATE
RoomSettingModel model = new RoomSettingModel();
// if (AvRoomDataManager.get().isRoomOwner()){
model.updateRoomInfo(roomInfo.title,
roomInfo.getRoomDesc(),
roomInfo.getIntroduction(),
@@ -140,7 +137,9 @@ public class RoomImposeDialog extends BottomSheetDialog implements View.OnClickL
roomInfo.isHasAnimationEffect(),
roomInfo.getAudioQuality(),
limitType,
roomInfo.isPureMode())
roomInfo.isPureMode(),
roomInfo.getType(),
roomInfo.getGameId())
.subscribe(new DontWarnObserver<RoomInfo>() {
@Override
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();
}
}

View File

@@ -213,13 +213,6 @@ public class HomePartyFragment extends AbsRoomFragment implements View.OnClickLi
@SuppressLint("CheckResult")
@Override
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) {
AvRoomDataManager.get().mIsNeedGiftEffect = AvRoomDataManager.get().mCurrentRoomInfo.isHasAnimationEffect();
@@ -330,6 +323,19 @@ public class HomePartyFragment extends AbsRoomFragment implements View.OnClickLi
public void updateView() {
RoomInfo currentRoomInfo = AvRoomDataManager.get().mCurrentRoomInfo;
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);
updateHasAnimationEffect();
roomTitle.setText(RegexUtil.getPrintableString(currentRoomInfo.getTitle()));

View File

@@ -20,7 +20,7 @@ abstract class BaseDialog<T : ViewBinding> : RxDialogFragment() {
val binding get() = _binding!!
open var width = ScreenUtil.getDialogWidth()
var height = WindowManager.LayoutParams.WRAP_CONTENT
var gravity = Gravity.CENTER
open var gravity = Gravity.CENTER
override fun onStart() {
super.onStart()

View File

@@ -16,6 +16,7 @@ import com.idlefish.flutterboost.FlutterBoost;
import com.yizhuan.erban.MainActivity;
import com.yizhuan.erban.R;
import com.yizhuan.erban.UIHelper;
import com.yizhuan.erban.avroom.dialog.CreateRoomDialog;
import com.yizhuan.erban.base.BaseFragment;
import com.yizhuan.erban.databinding.FragmentMeBinding;
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.NobleProtocol;
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.protocol.StatisticsProtocol;
import com.yizhuan.xchat_android_core.user.UserModel;

View File

@@ -16,34 +16,41 @@ import androidx.core.content.ContextCompat;
import com.yizhuan.erban.MainActivity;
import com.yizhuan.erban.R;
import com.yizhuan.erban.avroom.activity.AVRoomActivity;
import com.yizhuan.erban.avroom.dialog.CreateRoomDialog;
import com.yizhuan.erban.base.BaseActivity;
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.xchat_android_core.UriProvider;
import com.yizhuan.xchat_android_core.auth.AuthModel;
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.room.bean.RoomInfo;
import com.yizhuan.xchat_android_core.room.model.AvRoomModel;
import com.yizhuan.xchat_android_core.statistic.StatisticManager;
import com.yizhuan.xchat_android_core.statistic.protocol.StatisticsProtocol;
import com.yizhuan.xchat_android_core.room.model.RoomSettingModel;
import com.yizhuan.xchat_android_core.user.UserModel;
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.net.rxnet.callback.CallBack;
import com.yizhuan.xchat_android_library.utils.SingleToastUtil;
public class OpenRoomHelper {
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();
if (userInfo != null && !userInfo.isCertified()) {
switch (CertificationModel.get().getCertificationType()) {
default:
case CER_TYPE_NONE:
openNormalRoom(activity);
requestOpenRoom(activity, type, gameId);
break;
case CER_TYPE_FORCE:
activity.getDialogManager().showTipsDialog(getCertificationTips(activity),
@@ -63,7 +70,7 @@ public class OpenRoomHelper {
new DialogManager.OkCancelDialogListener() {
@Override
public void onCancel() {
openNormalRoom(activity);
requestOpenRoom(activity, type, gameId);
}
@Override
@@ -76,18 +83,7 @@ public class OpenRoomHelper {
break;
}
} else {
openNormalRoom(activity);
}
}
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);
requestOpenRoom(activity, type, gameId);
}
}
@@ -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)
.compose(RxHelper.bindActivity(activity))
.subscribe(new DontWarnObserver<RoomInfo>() {
@@ -111,19 +108,25 @@ public class OpenRoomHelper {
public void acceptThrowable(RoomInfo roomInfo, Throwable throwable) {
super.acceptThrowable(roomInfo, throwable);
if (roomInfo != null) {
if (roomInfo.isValid()) {
requestOpenRoomResult(activity, MainFragmentPresenter.OPEN_ROOM_SUCCESS, roomInfo);
if (roomInfo.isReselect()) {
activity.getDialogManager().dismissDialog();
new CreateRoomDialog().show(activity);
} 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 {
if (throwable instanceof PmRoomLimitException) {
requestOpenRoomResult(activity, MainFragmentPresenter.OPEN_ROOM_FAIL_PM_LIMIT_TIME,
throwable.getMessage());
onOpenRoomPmLimit(activity, throwable.getMessage());
} else if (!TextUtils.isEmpty(throwable.getMessage())) {
requestOpenRoomResult(activity, MainFragmentPresenter.OPEN_ROOM_FAIL,
throwable.getMessage());
onOpenRoomFail(activity, 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")
private static void openRoom(BaseActivity activity, RoomInfo roomInfo) {
private static void openRoom(BaseActivity activity, RoomInfo roomInfo, int type, long gameId) {
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))
.subscribe((roomResult, throwable) -> {
if (throwable != null) {
onOpenRoomFail(activity, throwable.getMessage());
} else if (roomResult != null && roomResult.isSuccess()) {
requestOpenRoomResult(activity, MainFragmentPresenter.OPEN_ROOM_SUCCESS, roomInfo);
onOpenRoomSuccess(activity, roomInfo);
} else if (roomResult != null && !roomResult.isSuccess()) {
if (roomResult.getCode() == 1500) {
requestOpenRoomResult(activity, MainFragmentPresenter.OPEN_ROOM_FAIL_ALREADY_OPENED_ROOM, roomInfo);
onOpenRoomSuccess(activity, roomInfo);
} else {
onOpenRoomFail(activity, roomResult.getError());
}
@@ -153,50 +193,22 @@ public class OpenRoomHelper {
});
}
/**
* 请求退出房间
*/
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 onOpenRoomSuccess(BaseActivity activity, RoomInfo roomInfo) {
activity.getDialogManager().dismissDialog();
AVRoomActivity.start(activity, roomInfo.getUid());
}
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();
if (openRoomFailType == MainFragmentPresenter.OPEN_ROOM_SUCCESS) {
RoomInfo roomInfo = (RoomInfo) arg[0];
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]);
}
}
if (activity instanceof MainActivity) {
((MainActivity) activity).handleOpenRoomWhenPmLimit(error);
}
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 26 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 26 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 492 B

View File

@@ -4,8 +4,8 @@
<corners android:radius="100dp" />
<gradient
android:angle="180"
android:endColor="#ffbcddff"
android:startColor="#ffd6bef7"
android:endColor="#4DFFA936"
android:startColor="#4DFFCB47"
android:type="linear"
android:useLevel="true" />
</shape>

View File

@@ -2,27 +2,27 @@
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_pressed="true">
<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>
</item>
<item android:state_focused="true">
<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" />
</shape>
</item>
<item android:state_enabled="false">
<shape android:shape="rectangle">
<solid android:color="#FF4C4C6A" />
<solid android:color="#FFD2D5D7" />
<corners android:radius="100dp" />
</shape>
</item>
<item>
<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" />
</shape>
</item>

View 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>

View 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>

View 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>

View 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>

View File

@@ -1,56 +1,103 @@
<?xml version="1.0" encoding="utf-8"?>
<layout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
<androidx.constraintlayout.widget.ConstraintLayout 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="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
android:background="@drawable/shape_white_bottom_12dp"
android:orientation="vertical">
<data>
</data>
<LinearLayout
android:layout_width="311dp"
<TextView
android:id="@+id/tv_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
android:background="@drawable/shape_white_20dp_round">
android:layout_marginStart="16dp"
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_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginTop="27dp">
android:background="@drawable/selector_room_party"
android:button="@null" />
<TextView
android:id="@+id/tv_normal"
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"
<RadioButton
android:id="@+id/rb_game_room"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginTop="20dp"
android:text="房间说明>"
android:textColor="@color/appColor"
android:textSize="12sp"
android:layout_marginBottom="16dp" />
</LinearLayout>
</layout>
android:background="@drawable/selector_room_game"
android:button="@null" />
</RadioGroup>
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/rv_game"
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>

View 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>

View File

@@ -491,7 +491,7 @@
<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_39D0EB">#39D0EB</color>

View File

@@ -300,7 +300,9 @@ public class MWTeamRoomMessageAct extends BaseMessageActivity implements IMWTeam
AuthModel.get().getTicket(),
roomInfo.isHasAnimationEffect(),
roomInfo.getAudioQuality(),
roomInfo.getLimitType(),roomInfo.isPureMode())
roomInfo.getLimitType(),roomInfo.isPureMode(),
roomInfo.getType(),
roomInfo.getGameId())
.compose(bindToLifecycle())
.subscribe(new BeanObserver<RoomInfo>() {
@Override

View File

@@ -327,7 +327,10 @@ public class MiniWorldTeamMessageActivity extends BaseMessageActivity implements
AuthModel.get().getTicket(),
roomInfo.isHasAnimationEffect(),
roomInfo.getAudioQuality(),
roomInfo.getLimitType(), roomInfo.isPureMode())
roomInfo.getLimitType(),
roomInfo.isPureMode(),
roomInfo.getType(),
roomInfo.getGameId())
.compose(bindToLifecycle())
.subscribe(new BeanObserver<RoomInfo>() {
@Override

View File

@@ -208,7 +208,7 @@ public class MWTeamMessagePresenter {
@SuppressLint("CheckResult")
private void openRoom() {
avRoomModel.openRoom(
AuthModel.get().getCurrentUid(), roomType, null, null, null, null)
AuthModel.get().getCurrentUid(), roomType, null, null, null, null,0)
// .compose(bindToLifecycle())
.subscribe((roomResult, throwable) -> {
if (throwable != null) {

View File

@@ -22,6 +22,7 @@
</data>
<RelativeLayout
android:layout_marginTop="75dp"
android:layout_width="match_parent"
android:layout_height="match_parent">

View File

@@ -18,10 +18,12 @@ import lombok.ToString;
@Data
@ToString
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_LIGHT_CHAT = 2;//轻聊房
public static final int ROOMTYPE_HOME_PARTY = 3;//轰趴房
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_SELECT = "2";//心动选人
@@ -184,6 +186,9 @@ public class RoomInfo implements Parcelable,Serializable {
*/
private String audioSdkType;
private boolean isReselect;
private long gameId;
// /**
// * 房间角标
// */

View File

@@ -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
)

View File

@@ -22,6 +22,12 @@ object GameModel : BaseModel() {
.compose(RxHelper.handleSchAndExce())
}
fun getGameList(): Single<List<GameInfo>> {
return api.getGameList()
.compose(RxHelper.handleBeanData())
.compose(RxHelper.handleSchAndExce())
}
suspend fun getHomeBanner(type: String): List<BannerInfo>? =
launchRequest {
api.apiHomeBanner(
@@ -35,6 +41,16 @@ object GameModel : BaseModel() {
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
): Single<ServiceResult<GameCodeInfo>>
/**
* 首页Banner
*

View File

@@ -503,7 +503,7 @@ public class AvRoomModel extends RoomBaseModel implements IAvRoomModel {
@Override
public Single<RoomResult> requestRoomResult(String uid, int pageType) {
return mRoomService.getRoomInfo(uid, AuthModel.get().getCurrentUid())
.timeout(10, TimeUnit.SECONDS)
.timeout(60, TimeUnit.SECONDS)
.compose(RxHelper.handleSchAndExce())
.doOnSuccess(roomResult -> {
if (roomResult != null && roomResult.isSuccess() && roomResult.getData() != null) {

View File

@@ -720,7 +720,7 @@ public class RoomBaseModel extends BaseModel implements IRoomBaseModel {
*/
@Override
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)) {
return UserModel.get().getUserInfo(uid)
.flatMap(new Function<UserInfo, SingleSource<RoomResult>>() {

View File

@@ -75,9 +75,21 @@ public class RoomSettingModel extends BaseMvpModel {
* @param label 标签名字
* @param tagId 标签id
*/
public Single<RoomInfo> updateRoomInfo(String title, String desc, String introduction, String pwd, String label,
int tagId, long uid, String ticket, boolean hasEffect, int audio, String limitType, boolean isPureMode) {
return mRoomSettingService.updateRoomInfo(title, desc, introduction, pwd, label, tagId, uid, hasEffect, audio, limitType, isPureMode)
public Single<RoomInfo> updateRoomInfo(String title,
String desc,
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())
.unsubscribeOn(Schedulers.io())
.onErrorResumeNext(this.<RoomInfo>getSingleCommonExceptionFunction())
@@ -124,13 +136,13 @@ public class RoomSettingModel extends BaseMvpModel {
public Single<RoomInfo> updateRoomPureMode(long roomUid, String title, String desc,
String introduction, String pwd, String label,
int tagId, boolean hasEffect, int audio, boolean isPureMode) {
return mRoomSettingService.updateRoomPureMode(roomUid, title, desc, introduction, pwd, label,
tagId, AuthModel.get().getCurrentUid(), hasEffect, audio, isPureMode)
.subscribeOn(Schedulers.io())
.unsubscribeOn(Schedulers.io())
.onErrorResumeNext(this.<RoomInfo>getSingleCommonExceptionFunction())
.flatMap(this.<RoomInfo>getSingleFunction())
.observeOn(AndroidSchedulers.mainThread());
return mRoomSettingService.updateRoomPureMode(roomUid, title, desc, introduction, pwd, label,
tagId, AuthModel.get().getCurrentUid(), hasEffect, audio, isPureMode)
.subscribeOn(Schedulers.io())
.unsubscribeOn(Schedulers.io())
.onErrorResumeNext(this.<RoomInfo>getSingleCommonExceptionFunction())
.flatMap(this.<RoomInfo>getSingleFunction())
.observeOn(AndroidSchedulers.mainThread());
}
/**
@@ -166,7 +178,6 @@ public class RoomSettingModel extends BaseMvpModel {
}
/**
*
* @param roomUid 房主uid
*/
public Single<String> leaveModeOpen(long roomUid) {
@@ -183,7 +194,6 @@ public class RoomSettingModel extends BaseMvpModel {
}
/**
*
* @param roomUid 房主uid
*/
public Single<String> leaveModeClose(long roomUid) {
@@ -203,7 +213,8 @@ public class RoomSettingModel extends BaseMvpModel {
/**
* 请求所有的标签列表数据
*4.18更改接口传房间uid
* 4.18更改接口传房间uid
*
* @return
*/
@FormUrlEncoded
@@ -230,7 +241,9 @@ public class RoomSettingModel extends BaseMvpModel {
@Field("hasAnimationEffect") boolean hasAnimationEffect,
@Field("audioQuality") int audioQuality,
@Field("limitType") String limitType,
@Field("isPureMode") boolean isPureMode);
@Field("isPureMode") boolean isPureMode,
@Field("type") int type,
@Field("mgId") long gameId);
/**
* 更新房间设置信息

View File

@@ -170,7 +170,7 @@ public interface IRoomBaseModel extends IModel {
* rewardId当type为2时必填如rewardId
*/
Single<RoomResult> openRoom(long uid, int type, String title, String roomDesc,
String backPic, String rewardId);
String backPic, String rewardId, long gameId);
/**
*关闭公屏