feat:更新数据的获取逻辑,接入配置按钮的跳转行为

This commit is contained in:
eggmanQQQ
2024-07-26 11:31:15 +08:00
parent f08b6d4577
commit 8fa429aca6
4 changed files with 73 additions and 31 deletions

View File

@@ -63,6 +63,7 @@ import com.chwl.app.music.widget.MusicPlayerView
import com.chwl.app.public_chat.ui.message.HeadlineViewModel
import com.chwl.app.room_chat.activity.RoomMsgActivity
import com.chwl.app.ui.pay.ChargeActivity
import com.chwl.app.ui.webview.CommonWebViewActivity
import com.chwl.app.ui.webview.DialogWebViewActivity
import com.chwl.app.ui.widget.ButtonItem
import com.chwl.app.ui.widget.GiftDialog
@@ -98,6 +99,7 @@ import com.chwl.core.manager.RoomEvent
import com.chwl.core.mentoring_relationship.event.MentoringStopCountingEvent
import com.chwl.core.room.anotherroompk.ShowGiftDialogEvent
import com.chwl.core.room.anotherroompk.ShowUserInfoDialogEvent
import com.chwl.core.room.bean.RightBottomIconConfig
import com.chwl.core.room.bean.RoomIcon
import com.chwl.core.room.bean.RoomInfo
import com.chwl.core.room.event.RoomAtEvent
@@ -797,40 +799,14 @@ open class BaseRoomFragment<V : IBaseRoomView?, P1 : BaseRoomPresenter<V>?> :
when (v.id) {
R.id.iv_config_entrance -> {
val roomInfo = AvRoomDataManager.get().mCurrentRoomInfo ?: return
val configInfo = roomInfo.rightBottomIconConfig ?: return
val configInfo = AvRoomDataManager.get().rightBottomIconConfig ?: return
if (configInfo.skipType == 1) {
playConfigWeb(configInfo.skipUrl)
} else if (configInfo.skipType == 2) {
val roomIcon: RoomIcon = RoomIcon(
skipContent = configInfo.skipUrl,
skipType = 3,
showType = 1,
code = "BAISHUN",
ruleValue = configInfo.reserve)
try {
val url = roomIcon.skipContent
val ruleValue = Gson().fromJson<RoomIcon.RuleValueBean>(
roomIcon.ruleValue,
RoomIcon.RuleValueBean::class.java
)
val config = Gson().fromJson<BaiShunGameConfig>(
ruleValue.RESERVE,
BaiShunGameConfig::class.java
)
if (config != null && url != null) {
config.reloadDynamicParams()
// listener?.onShowBaiShunGame(url, config)
(activity as? AVRoomActivity)?.showBaiShunGame(url, config)
} else {
SingleToastUtil.showToast(R.string.manager_trtc_trtcengineadapter_042)
}
} catch (e: Exception) {
e.printStackTrace()
}
playConfigBaishunGame(configInfo)
}
}
R.id.iv_game -> {
// RoomGameListDialog().show(childFragmentManager, "GAME_LIST")
val dialog = RoomGameplayDialog()
dialog.isOnlyPK = false
dialog.listener = object : RoomGameplayDialog.GameplayDialogListener {
@@ -852,6 +828,38 @@ open class BaseRoomFragment<V : IBaseRoomView?, P1 : BaseRoomPresenter<V>?> :
}
}
private fun playConfigWeb(url: String) {
CommonWebViewActivity.start(mContext, url)
}
private fun playConfigBaishunGame(configInfo: RightBottomIconConfig) {
val roomIcon: RoomIcon = RoomIcon(
skipContent = configInfo.skipUrl,
skipType = 3,
showType = 1,
code = "BAISHUN",
ruleValue = configInfo.reserve)
try {
val url = roomIcon.skipContent
val ruleValue = Gson().fromJson<RoomIcon.RuleValueBean>(
roomIcon.ruleValue,
RoomIcon.RuleValueBean::class.java
)
val config = Gson().fromJson<BaiShunGameConfig>(
ruleValue.RESERVE,
BaiShunGameConfig::class.java
)
if (config != null && url != null) {
config.reloadDynamicParams()
(activity as? AVRoomActivity)?.showBaiShunGame(url, config)
} else {
SingleToastUtil.showToast(R.string.manager_trtc_trtcengineadapter_042)
}
} catch (e: Exception) {
e.printStackTrace()
}
}
private fun sendMsg() {
val message = inputEdit.text.toString().trim()
if (isPublicMessageTab()) {

View File

@@ -11,6 +11,7 @@ import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.lifecycle.MutableLiveData;
import com.chwl.core.room.bean.RightBottomIconConfig;
import com.chwl.core.support.room.AudioRoomContext;
import com.netease.nimlib.sdk.NIMChatRoomSDK;
import com.netease.nimlib.sdk.RequestCallback;
@@ -236,6 +237,8 @@ public final class AvRoomDataManager {
private List<Integer> unlockedRoomAlbumPhotos = new ArrayList<>();
public RightBottomIconConfig rightBottomIconConfig;
private AvRoomDataManager() {
mRoomManagerList = new ArrayList<>();
mRoomFixedMemberList = new ArrayList<>();
@@ -299,6 +302,7 @@ public final class AvRoomDataManager {
redEnvelopeType = roomInfo.getRedEnvelopeType();
hasRoomAlbum = roomInfo.isHasRoomAlbum();
serialValue = roomInfo.getSerialValue();
rightBottomIconConfig = roomInfo.rightBottomIconConfig;
}
/**

View File

@@ -24,6 +24,36 @@ public class RightBottomIconConfig implements Parcelable, Serializable {
reserve = in.readString();
}
@Override
public String toString() {
return "RightBottomIconConfig{" +
"skipType=" + skipType +
", skipUrl='" + skipUrl + '\'' +
", icon2Url='" + icon2Url + '\'' +
", icon1Url='" + icon1Url + '\'' +
", reserve='" + reserve + '\'' +
'}';
}
public void setIcon1Url(String icon1Url) {
this.icon1Url = icon1Url;
}
public void setIcon2Url(String icon2Url) {
this.icon2Url = icon2Url;
}
public void setReserve(String reserve) {
this.reserve = reserve;
}
public void setSkipType(int skipType) {
this.skipType = skipType;
}
public void setSkipUrl(String skipUrl) {
this.skipUrl = skipUrl;
}
public int getSkipType() {
return skipType;
}

View File

@@ -160,7 +160,7 @@ public class RoomInfo implements Parcelable,Serializable {
// 总流水
private double serialValue;
private RightBottomIconConfig rightBottomIconConfig;
public RightBottomIconConfig rightBottomIconConfig;
protected RoomInfo(Parcel in) {
uid = in.readLong();