fix:调整房间底部加号-红点提示逻辑:单独处理房间类型的功能提示
fix:修复游戏房未能返回之前房间类型问题
This commit is contained in:
@@ -11,6 +11,7 @@ import com.chwl.app.databinding.RoomTypeSwitchActivityBinding
|
||||
import com.chwl.app.home.helper.OpenRoomHelper
|
||||
import com.chwl.core.manager.AvRoomDataManager
|
||||
import com.chwl.core.room.bean.RoomInfo
|
||||
import com.chwl.core.super_admin.util.SuperAdminUtil
|
||||
import com.chwl.library.utils.ResUtil
|
||||
import com.chwl.library.utils.SingleToastUtil
|
||||
import com.example.lib_utils.ktx.singleClick
|
||||
@@ -23,6 +24,23 @@ class RoomTypeSwitchActivity : BaseViewBindingActivity<RoomTypeSwitchActivityBin
|
||||
private var selectType: Int? = null
|
||||
|
||||
companion object {
|
||||
fun isCanSwitch(): Boolean {
|
||||
if (SuperAdminUtil.isSuperAdmin()) {
|
||||
return false
|
||||
}
|
||||
if (AvRoomDataManager.get().roomType != RoomInfo.ROOMTYPE_HOME_PARTY && AvRoomDataManager.get().roomType != RoomInfo.ROOMTYPE_PARTY && AvRoomDataManager.get().roomType != RoomInfo.ROOMTYPE_REVELRY) {
|
||||
return false
|
||||
}
|
||||
if (AvRoomDataManager.get().isDatingMode) {
|
||||
return false
|
||||
}
|
||||
val roomInfo = AvRoomDataManager.get().mCurrentRoomInfo
|
||||
if (roomInfo == null || roomInfo.isPermitRoom == 1) {
|
||||
return false
|
||||
}
|
||||
return AvRoomDataManager.get().isManager
|
||||
}
|
||||
|
||||
fun start(context: Context) {
|
||||
context.startActivity(Intent(context, RoomTypeSwitchActivity::class.java))
|
||||
}
|
||||
|
@@ -561,22 +561,7 @@ public class RoomOperationDialog extends BottomSheetDialog {
|
||||
* @param optAdapter
|
||||
*/
|
||||
private void addRoomTypeSwitchAction(OptAdapter optAdapter) {
|
||||
if (SuperAdminUtil.isSuperAdmin()) {
|
||||
return;
|
||||
}
|
||||
if (AvRoomDataManager.get().getRoomType() != RoomInfo.ROOMTYPE_HOME_PARTY
|
||||
&& AvRoomDataManager.get().getRoomType() != RoomInfo.ROOMTYPE_PARTY
|
||||
&& AvRoomDataManager.get().getRoomType() != RoomInfo.ROOMTYPE_REVELRY) {
|
||||
return;
|
||||
}
|
||||
if (AvRoomDataManager.get().isDatingMode()) {
|
||||
return;
|
||||
}
|
||||
RoomInfo roomInfo = AvRoomDataManager.get().mCurrentRoomInfo;
|
||||
if (roomInfo == null || roomInfo.getIsPermitRoom() == 1) {
|
||||
return;
|
||||
}
|
||||
if (AvRoomDataManager.get().isManager()) {
|
||||
if (RoomTypeSwitchActivity.Companion.isCanSwitch()) {
|
||||
optAdapter.addData(new OptAction(R.drawable.icon_room_type_switch,
|
||||
getContext().getResources().getString(R.string.room_type), () -> RoomTypeSwitchActivity.Companion.start(getContext())));
|
||||
}
|
||||
|
@@ -116,10 +116,14 @@ class GameRoomFragment : BaseRoomFragment<IGameRoomView?, GameRoomPresenter?>(),
|
||||
dialogManager.showOkCancelDialog(
|
||||
getString(R.string.room_switch_standard_room_tips)
|
||||
) {
|
||||
var type = AvRoomDataManager.get().mCurrentRoomInfo?.oldType
|
||||
if (type == null || type <= 0) {
|
||||
type = RoomInfo.ROOMTYPE_HOME_PARTY
|
||||
}
|
||||
OpenRoomHelper.updateRoomInfo(
|
||||
baseActivity,
|
||||
AvRoomDataManager.get().mCurrentRoomInfo,
|
||||
RoomInfo.ROOMTYPE_HOME_PARTY,
|
||||
type,
|
||||
0,
|
||||
false
|
||||
)
|
||||
|
@@ -20,6 +20,7 @@ import android.widget.TextView;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import com.chwl.app.avroom.activity.RoomTypeSwitchActivity;
|
||||
import com.chwl.app.avroom.dialog.RoomGameplayDialog;
|
||||
import com.chwl.core.utils.extension.StringExtensionKt;
|
||||
import com.netease.nim.uikit.api.NimUIKit;
|
||||
@@ -57,8 +58,9 @@ public class BottomView extends LinearLayout implements View.OnClickListener {
|
||||
/**
|
||||
* 有新功能,加1
|
||||
*/
|
||||
private static final int NEW_OPTION = 2;
|
||||
private static final int NEW_OPTION = 1;
|
||||
private static final String SH_NEW_OPTION = "sh_new_option";
|
||||
private static final String NEW_OPTION_ROOM_TYPE = "new_option_room_type";
|
||||
|
||||
private BottomViewListenerWrapper wrapper;
|
||||
private ImageView openMic;
|
||||
@@ -156,6 +158,9 @@ public class BottomView extends LinearLayout implements View.OnClickListener {
|
||||
|
||||
if (newOption == NEW_OPTION) {
|
||||
sendMagic.setImageResource(R.drawable.room_menu_ic_more);
|
||||
if (isRemindOptionForRoomType()) {
|
||||
sendMagic.setImageResource(R.drawable.room_menu_ic_more_new);
|
||||
}
|
||||
} else {
|
||||
sendMagic.setImageResource(R.drawable.room_menu_ic_more_new);
|
||||
}
|
||||
@@ -168,6 +173,29 @@ public class BottomView extends LinearLayout implements View.OnClickListener {
|
||||
}
|
||||
}
|
||||
|
||||
private boolean isRemindOptionForRoomType() {
|
||||
boolean isReminded = (boolean) SharedPreferenceUtils.get(NEW_OPTION_ROOM_TYPE, false);
|
||||
if (isReminded) {
|
||||
return false;
|
||||
}
|
||||
if (RoomTypeSwitchActivity.Companion.isCanSwitch()) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private boolean updateOptionForRoomType() {
|
||||
boolean isReminded = (boolean) SharedPreferenceUtils.get(NEW_OPTION_ROOM_TYPE, false);
|
||||
if (isReminded) {
|
||||
return false;
|
||||
}
|
||||
if (RoomTypeSwitchActivity.Companion.isCanSwitch()) {
|
||||
SharedPreferenceUtils.put(NEW_OPTION_ROOM_TYPE, true);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Subscribe(threadMode = ThreadMode.MAIN)
|
||||
public void onReceiveRecentContactChanged(List<RecentContact> imMessages) {
|
||||
setRoomMessageUnread(IMMessageManager.get().queryUnreadMsg());
|
||||
@@ -295,12 +323,14 @@ public class BottomView extends LinearLayout implements View.OnClickListener {
|
||||
}
|
||||
break;
|
||||
case R.id.icon_room_send_magic:
|
||||
|
||||
int newOption = (int) SharedPreferenceUtils.get(SH_NEW_OPTION, 0);
|
||||
if (newOption != NEW_OPTION) {
|
||||
SharedPreferenceUtils.put(SH_NEW_OPTION, NEW_OPTION);
|
||||
setMagicBtnEnable(true);
|
||||
}
|
||||
if (updateOptionForRoomType()) {
|
||||
setMagicBtnEnable(true);
|
||||
}
|
||||
|
||||
if (wrapper != null) {
|
||||
wrapper.onMoreBtnClick();
|
||||
|
@@ -49,6 +49,7 @@ public class RoomInfo implements Parcelable,Serializable {
|
||||
//头像
|
||||
private String avatar;
|
||||
private int type;
|
||||
private int oldType;
|
||||
|
||||
/** 房间主题 */
|
||||
private String roomDesc;
|
||||
@@ -221,6 +222,7 @@ public class RoomInfo implements Parcelable,Serializable {
|
||||
mgMicNum = in.readInt();
|
||||
clearScreenTime = in.readLong();
|
||||
serialValue = in.readDouble();
|
||||
oldType = in.readInt();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -286,6 +288,7 @@ public class RoomInfo implements Parcelable,Serializable {
|
||||
dest.writeInt(mgMicNum);
|
||||
dest.writeLong(clearScreenTime);
|
||||
dest.writeDouble(serialValue);
|
||||
dest.writeInt(oldType);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
Reference in New Issue
Block a user