房间内按钮礼物显示异常优化
This commit is contained in:
@@ -9,7 +9,6 @@ import android.annotation.SuppressLint
|
||||
import android.app.ActivityManager
|
||||
import android.app.AlertDialog
|
||||
import android.content.Context
|
||||
import android.content.DialogInterface
|
||||
import android.content.Intent
|
||||
import android.content.pm.ActivityInfo
|
||||
import android.content.res.Configuration
|
||||
@@ -45,8 +44,6 @@ import android.widget.TextView
|
||||
import androidx.activity.OnBackPressedCallback
|
||||
import androidx.constraintlayout.widget.ConstraintLayout
|
||||
import androidx.core.content.ContextCompat
|
||||
import androidx.fragment.app.DialogFragment
|
||||
import androidx.fragment.app.Fragment
|
||||
import androidx.fragment.app.FragmentManager
|
||||
import androidx.recyclerview.widget.LinearLayoutManager
|
||||
import com.alibaba.android.arouter.facade.annotation.Autowired
|
||||
@@ -178,6 +175,8 @@ import com.xscm.moduleutil.widget.ViewUtils
|
||||
import com.xscm.moduleutil.widget.ViewUtils.OnViewCreatedListener
|
||||
import com.xscm.moduleutil.widget.floatingView.Floa
|
||||
import io.agora.musiccontentcenter.Music
|
||||
import io.reactivex.Observable
|
||||
import io.reactivex.android.schedulers.AndroidSchedulers
|
||||
import io.reactivex.disposables.Disposable
|
||||
import org.greenrobot.eventbus.EventBus
|
||||
import org.greenrobot.eventbus.Subscribe
|
||||
@@ -189,6 +188,7 @@ import java.lang.ref.WeakReference
|
||||
import java.nio.charset.StandardCharsets
|
||||
import java.util.Arrays
|
||||
import java.util.Date
|
||||
import java.util.concurrent.TimeUnit
|
||||
import java.util.stream.Collectors
|
||||
|
||||
@Route(path = ARouteConstants.ROOM_DETAILS)
|
||||
@@ -281,8 +281,7 @@ class RoomActivity : BaseMvpActivity<RoomPresenter?, ActivityRoomBinding?>(),
|
||||
taskId = intent.getStringExtra("taskId")
|
||||
mRoomInfoResp = roomInfoResp
|
||||
}
|
||||
setView(mRoomInfoResp,true)
|
||||
toActivity(TransparentActivity::class.java)
|
||||
setView(mRoomInfoResp, true)
|
||||
LogUtils.e("RoomActivity", "onNewIntent")
|
||||
}
|
||||
|
||||
@@ -706,6 +705,7 @@ class RoomActivity : BaseMvpActivity<RoomPresenter?, ActivityRoomBinding?>(),
|
||||
// 获取并显示stubButtons2布局
|
||||
val stub = mBinding!!.roomTop.stubButtons2
|
||||
stub.visibility = View.VISIBLE
|
||||
requestLayout(stub)
|
||||
// 获取结束按钮和延时按钮的ImageView控件
|
||||
val imActionJs = mBinding!!.roomTop.imActionJs.findViewById<ImageView>(R.id.im_action_js)
|
||||
val imActionYs = mBinding!!.roomTop.imActionYs.findViewById<ImageView>(R.id.im_action_ys)
|
||||
@@ -745,6 +745,7 @@ class RoomActivity : BaseMvpActivity<RoomPresenter?, ActivityRoomBinding?>(),
|
||||
|
||||
fun isInAuctionTopBtVisible(isShow: Boolean) {
|
||||
mBinding!!.roomTop.stubButtons2.visibility = if (isShow) View.VISIBLE else View.GONE
|
||||
requestLayout(mBinding!!.roomTop.stubButtons2)
|
||||
}
|
||||
|
||||
|
||||
@@ -753,11 +754,15 @@ class RoomActivity : BaseMvpActivity<RoomPresenter?, ActivityRoomBinding?>(),
|
||||
if (visible) View.VISIBLE else View.INVISIBLE
|
||||
mBinding!!.roomTop.imActionYs.visibility =
|
||||
if (visible) View.VISIBLE else View.INVISIBLE
|
||||
|
||||
requestLayout(mBinding!!.roomTop.imActionJs)
|
||||
requestLayout(mBinding!!.roomTop.imActionYs)
|
||||
}
|
||||
|
||||
fun upJs(visible: Boolean) {
|
||||
mBinding!!.roomTop.imActionJs.visibility =
|
||||
if (visible) View.VISIBLE else View.INVISIBLE
|
||||
requestLayout(mBinding!!.roomTop.imActionJs)
|
||||
}
|
||||
|
||||
// 根据传入的visible参数设置JS按钮的可见性
|
||||
@@ -765,6 +770,7 @@ class RoomActivity : BaseMvpActivity<RoomPresenter?, ActivityRoomBinding?>(),
|
||||
fun upYs(visible: Boolean) {
|
||||
mBinding!!.roomTop.imActionYs.visibility =
|
||||
if (visible) View.VISIBLE else View.INVISIBLE
|
||||
requestLayout(mBinding!!.roomTop.imActionYs)
|
||||
}
|
||||
|
||||
/** 最小化 */
|
||||
@@ -891,33 +897,33 @@ class RoomActivity : BaseMvpActivity<RoomPresenter?, ActivityRoomBinding?>(),
|
||||
override fun onSelfInfoUpdated(info: V2TIMUserFullInfo?) {}
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets up the room view with the provided room information response.
|
||||
*
|
||||
* @param resp The room information response object containing room details
|
||||
* @param isSwitchRoomType Flag indicating if room type is being switched (default: false)
|
||||
*/
|
||||
/**
|
||||
* Sets up the room view with the provided room information response.
|
||||
*
|
||||
* @param resp The room information response object containing room details
|
||||
* @param isSwitchRoomType Flag indicating if room type is being switched (default: false)
|
||||
*/
|
||||
@SuppressLint("CheckResult")
|
||||
private fun setView(resp: RoomInfoResp?, isSwitchRoomType: Boolean = false) {
|
||||
// Return early if response is null
|
||||
// Return early if response is null
|
||||
if (resp == null)
|
||||
return
|
||||
// Update room info in app state manager and local instance
|
||||
// Update room info in app state manager and local instance
|
||||
AppStateManager.getInstance().roomInfo = resp
|
||||
this.mRoomInfoResp = resp
|
||||
val roomBean = resp.room_info
|
||||
// Log room info for debugging
|
||||
// Log room info for debugging
|
||||
LogUtils.e("setView_mRoomBean", resp.toString())
|
||||
// Set user and owner information
|
||||
// Set user and owner information
|
||||
this.mRoomUserBean = resp.user_info
|
||||
this.mRoomOwnerBean = resp.room_owner
|
||||
this.roomId = roomBean.room_id
|
||||
|
||||
// Load room cover image and set room details
|
||||
// Load room cover image and set room details
|
||||
ImageUtils.loadHeadCC(resp.room_info.room_cover, mBinding!!.roomTop.avatar)
|
||||
mBinding!!.roomTop.name.text = roomBean.room_name
|
||||
mBinding!!.roomTop.idVal.text = "ID:" + roomBean.room_number
|
||||
// Handle follow button visibility based on user role
|
||||
// Handle follow button visibility based on user role
|
||||
if (mRoomUserBean?.getIs_room_owner() == 1) {
|
||||
mBinding!!.roomTop.btnFollow.visibility = View.GONE
|
||||
} else {
|
||||
@@ -928,19 +934,19 @@ class RoomActivity : BaseMvpActivity<RoomPresenter?, ActivityRoomBinding?>(),
|
||||
mBinding!!.roomTop.btnFollow.text = ""
|
||||
}
|
||||
}
|
||||
// Set online number display
|
||||
// Set online number display
|
||||
number = roomBean.online_number
|
||||
mBinding!!.roomTop.tvNum.text = number.toString() + ""
|
||||
|
||||
// Set initial view if not switching room type
|
||||
// Set initial view if not switching room type
|
||||
if (!isSwitchRoomType) {
|
||||
setviewyc(true)
|
||||
}
|
||||
|
||||
|
||||
// Log room join action
|
||||
// Log room join action
|
||||
LogUtils.e("加入", roomId)
|
||||
// Build comma-separated user IDs from pit list
|
||||
// Build comma-separated user IDs from pit list
|
||||
val userIds = StringBuilder()
|
||||
if (mRoomInfoResp?.room_info?.pit_list != null) {
|
||||
for (i in mRoomInfoResp?.room_info?.pit_list!!.indices) {
|
||||
@@ -953,7 +959,7 @@ class RoomActivity : BaseMvpActivity<RoomPresenter?, ActivityRoomBinding?>(),
|
||||
}
|
||||
}
|
||||
}
|
||||
// Update app context with room information
|
||||
// Update app context with room information
|
||||
CommonAppContext.getInstance().isPlaying = true
|
||||
CommonAppContext.getInstance().playId = roomId
|
||||
CommonAppContext.getInstance().playName = mRoomInfoResp?.room_info?.room_name
|
||||
@@ -961,7 +967,7 @@ class RoomActivity : BaseMvpActivity<RoomPresenter?, ActivityRoomBinding?>(),
|
||||
CommonAppContext.getInstance().playCover = resp.room_info.room_cover
|
||||
CommonAppContext.getInstance().showSelf = resp.is_show_self == 1
|
||||
|
||||
// Update follow button appearance based on collection status
|
||||
// Update follow button appearance based on collection status
|
||||
if (mRoomUserBean?.getIs_collect() == 1) {
|
||||
mBinding!!.roomTop.btnFollow.background =
|
||||
resources.getDrawable(com.xscm.moduleutil.R.mipmap.yishouc)
|
||||
@@ -975,23 +981,23 @@ class RoomActivity : BaseMvpActivity<RoomPresenter?, ActivityRoomBinding?>(),
|
||||
mBinding!!.roomTop.btnFollow.setTextColor(ColorManager.getInstance().buttonColorInt)
|
||||
mBinding!!.roomTop.btnFollow.text = "收藏"
|
||||
}
|
||||
// Set music type based on room type
|
||||
// Set music type based on room type
|
||||
if ((roomBean.type_id == "3" || roomBean.type_id == "1" || roomBean.type_id == "4") && roomBean.label_id == "2") {
|
||||
AgoraManager.getInstance().isBjMusic = false
|
||||
} else {
|
||||
AgoraManager.getInstance().isBjMusic = true
|
||||
}
|
||||
|
||||
// Update user permissions
|
||||
// Update user permissions
|
||||
userPermissionChange()
|
||||
|
||||
// Hide PK and misc views for specific room types
|
||||
// Hide PK and misc views for specific room types
|
||||
if (resp.room_info.type_id == "7" || resp.room_info.type_id == "2") {
|
||||
mBinding!!.rlPk.visibility = View.GONE
|
||||
mBinding!!.rlMisc.visibility = View.GONE
|
||||
}
|
||||
|
||||
// Handle lucky draw countdown visibility
|
||||
// Handle lucky draw countdown visibility
|
||||
if (mRoomInfoResp?.gift_cycle?.xlh_info?.xlh_status == "1") {
|
||||
mBinding?.xlhRk?.visibility = View.VISIBLE
|
||||
xlhDjs(mRoomInfoResp?.gift_cycle?.xlh_info?.end_time)
|
||||
@@ -1000,7 +1006,7 @@ class RoomActivity : BaseMvpActivity<RoomPresenter?, ActivityRoomBinding?>(),
|
||||
releaseCountDownTimer1()
|
||||
}
|
||||
|
||||
// Show/hide hourly ranking based on settings
|
||||
// Show/hide hourly ranking based on settings
|
||||
if (mRoomInfoResp?.hour_ranking_open == 1) {
|
||||
mBinding!!.clXsb.visibility = View.VISIBLE
|
||||
} else {
|
||||
@@ -1023,6 +1029,15 @@ class RoomActivity : BaseMvpActivity<RoomPresenter?, ActivityRoomBinding?>(),
|
||||
MvpPre?.roomRedPackets(roomId)
|
||||
|
||||
roomBtnShowIsHide()
|
||||
|
||||
softRebuildUI()
|
||||
Observable.timer(1000, TimeUnit.MILLISECONDS).observeOn(
|
||||
AndroidSchedulers.mainThread()
|
||||
).subscribe { aLong: Long? ->
|
||||
if (ActivityUtils.getTopActivity() is RoomActivity) {
|
||||
toActivity(TransparentActivity::class.java)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1182,11 +1197,14 @@ class RoomActivity : BaseMvpActivity<RoomPresenter?, ActivityRoomBinding?>(),
|
||||
circularProgress!!.progress = 1000 // 显示进度条,2025年7月19日11:23:37将这个从下面的方法提起到这里,
|
||||
startGiftProgressTime()
|
||||
mBinding!!.giftShowLayout.visibility = View.VISIBLE
|
||||
requestLayout(mBinding!!.giftShowLayout)
|
||||
softRebuildUI()
|
||||
}
|
||||
|
||||
private fun hideGiftGiveProgress() {
|
||||
LogUtils.e("hideGiftGiveProgress")
|
||||
mBinding!!.giftShowLayout.visibility = View.GONE
|
||||
requestLayout(mBinding!!.giftShowLayout)
|
||||
if (giftCountTimer != null) {
|
||||
giftCountTimer!!.cancel()
|
||||
giftCountTimer = null
|
||||
@@ -1317,6 +1335,8 @@ class RoomActivity : BaseMvpActivity<RoomPresenter?, ActivityRoomBinding?>(),
|
||||
val text = messageEvent.text
|
||||
|
||||
if (msgType == EMMessageInfo.QXRoomMessageTypeGift) {
|
||||
bgEffectView?.invalidate()
|
||||
bgEffectView?.requestLayout()
|
||||
|
||||
GiftDisplayManager.getInstance().setupDisplayView(mBinding?.giftContainer)
|
||||
|
||||
@@ -1514,6 +1534,7 @@ class RoomActivity : BaseMvpActivity<RoomPresenter?, ActivityRoomBinding?>(),
|
||||
}
|
||||
} else if (msgType == EMMessageInfo.QXRoomMessageTypeSignStartText) {
|
||||
roomFragment?.handleRoomMessage(messageEvent)
|
||||
softRebuildUI()
|
||||
} else if (msgType == EMMessageInfo.QXRoomMessageTypeSignMaxUserText) {
|
||||
roomFragment?.handleRoomMessage(messageEvent)
|
||||
} else if (msgType == EMMessageInfo.QXRoomMessageTypeSignEndText) {
|
||||
@@ -1643,7 +1664,7 @@ class RoomActivity : BaseMvpActivity<RoomPresenter?, ActivityRoomBinding?>(),
|
||||
roomFragment?.upRoomInfoData(mRoomInfoResp)
|
||||
roomFragment!!.handleRoomMessage(messageEvent)
|
||||
// 执行换麦逻辑
|
||||
roomBtnShowIsHide( mRoomInfoResp?.room_info?.pit_list!![toPitNumber.toInt() - 1].user_id.toInt())
|
||||
roomBtnShowIsHide(mRoomInfoResp?.room_info?.pit_list!![toPitNumber.toInt() - 1].user_id.toInt())
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1673,6 +1694,8 @@ class RoomActivity : BaseMvpActivity<RoomPresenter?, ActivityRoomBinding?>(),
|
||||
}
|
||||
|
||||
EventBus.getDefault().post(roomSettingEvent)
|
||||
|
||||
softRebuildUI()
|
||||
}
|
||||
|
||||
private fun handleMsgType1013(messageEvent: RoomMessageEvent, text: T?) {
|
||||
@@ -1717,8 +1740,12 @@ class RoomActivity : BaseMvpActivity<RoomPresenter?, ActivityRoomBinding?>(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
CommonAppContext.getInstance().isMai = false
|
||||
|
||||
CommonAppContext.getInstance().onlineMap.clear()
|
||||
MvpPre!!.postRoomInfo(roomId)
|
||||
softRebuildUI()
|
||||
}
|
||||
|
||||
private fun handleMsgType124(messageEvent: RoomMessageEvent, text: T?) {
|
||||
@@ -1847,7 +1874,7 @@ class RoomActivity : BaseMvpActivity<RoomPresenter?, ActivityRoomBinding?>(),
|
||||
2 -> {
|
||||
if (mRoomInfoResp?.room_info?.pit_list!![0].user_id.equals(mRoomInfoResp?.user_info?.user_id.toString())) {
|
||||
mRoomInfoResp?.user_info?.pit_number = 9
|
||||
}else{
|
||||
} else {
|
||||
mRoomInfoResp?.user_info?.pit_number = 0
|
||||
}
|
||||
mRoomInfoResp?.room_auction = RoomAuction()
|
||||
@@ -1883,8 +1910,8 @@ class RoomActivity : BaseMvpActivity<RoomPresenter?, ActivityRoomBinding?>(),
|
||||
if (auction.user_id.equals(mRoomInfoResp?.user_info?.user_id.toString())) {
|
||||
if (mRoomInfoResp?.room_info?.pit_list!![0].user_id.equals(mRoomInfoResp?.user_info?.user_id.toString())) {
|
||||
userId = -1
|
||||
}else{
|
||||
userId = auction.user_id.toInt()
|
||||
} else {
|
||||
userId = auction.user_id.toInt()
|
||||
}
|
||||
mRoomInfoResp?.user_info?.pit_number = 1
|
||||
|
||||
@@ -1955,6 +1982,7 @@ class RoomActivity : BaseMvpActivity<RoomPresenter?, ActivityRoomBinding?>(),
|
||||
val gift = GiftBean()
|
||||
gift.gift_id = ""
|
||||
gift.play_image = roomMessageEvent.text.jia_jia
|
||||
setupEffectView()
|
||||
QXGiftPlayerManager.getInstance(this)
|
||||
.displayFullEffectView(roomMessageEvent.text.jia_jia)
|
||||
}
|
||||
@@ -2267,7 +2295,7 @@ class RoomActivity : BaseMvpActivity<RoomPresenter?, ActivityRoomBinding?>(),
|
||||
val pitArr: MutableList<RoomPitBean> = ArrayList()
|
||||
for (j in text.list.indices) {
|
||||
val roomPitBean = getRoomPitBean(messageEvent, j)
|
||||
if(roomPitBean.user_id.equals(mRoomInfoResp?.user_info?.user_id.toString())){
|
||||
if (roomPitBean.user_id.equals(mRoomInfoResp?.user_info?.user_id.toString())) {
|
||||
mRoomInfoResp?.user_info?.pit_number = roomPitBean.pit_number.toInt()
|
||||
roomBtnShowIsHide(mRoomInfoResp?.user_info?.user_id!!)
|
||||
}
|
||||
@@ -2496,6 +2524,7 @@ class RoomActivity : BaseMvpActivity<RoomPresenter?, ActivityRoomBinding?>(),
|
||||
fun setvisibTop(`is`: Boolean) {
|
||||
mBinding!!.roomTop.root.visibility =
|
||||
if (`is`) View.VISIBLE else View.GONE
|
||||
requestLayout(mBinding!!.roomTop.root)
|
||||
}
|
||||
|
||||
fun setUserInfo() {
|
||||
@@ -2716,7 +2745,10 @@ class RoomActivity : BaseMvpActivity<RoomPresenter?, ActivityRoomBinding?>(),
|
||||
}
|
||||
|
||||
private fun minimizeToBackground() {
|
||||
LogUtils.e("RoomActivity", "minimizeToBackground:"+roomId +",play:"+CommonAppContext.getInstance().playId)
|
||||
LogUtils.e(
|
||||
"RoomActivity",
|
||||
"minimizeToBackground:" + roomId + ",play:" + CommonAppContext.getInstance().playId
|
||||
)
|
||||
isMinimized = true
|
||||
// 保存最小化状态和房间ID
|
||||
saveMinimizeState()
|
||||
@@ -2824,6 +2856,7 @@ class RoomActivity : BaseMvpActivity<RoomPresenter?, ActivityRoomBinding?>(),
|
||||
fun clFirstCharge(voive: Boolean) {
|
||||
mBinding!!.clFirstCharge.visibility =
|
||||
if (voive) View.VISIBLE else View.GONE
|
||||
requestLayout(mBinding!!.clFirstCharge)
|
||||
}
|
||||
|
||||
private fun setVoiveState(voive: Boolean) {
|
||||
@@ -2878,9 +2911,9 @@ class RoomActivity : BaseMvpActivity<RoomPresenter?, ActivityRoomBinding?>(),
|
||||
|
||||
if (userId == 0 && !CommonAppContext.getInstance().isMai) {
|
||||
switchMic(2)
|
||||
}else if (mRoomInfoResp?.user_info?.user_id == userId && !CommonAppContext.getInstance().isMai) {
|
||||
} else if (mRoomInfoResp?.user_info?.user_id == userId && !CommonAppContext.getInstance().isMai) {
|
||||
switchMic(2)
|
||||
}else if (voive){
|
||||
} else if (CommonAppContext.getInstance().isMai) {
|
||||
switchMic(1)
|
||||
}
|
||||
} else {
|
||||
@@ -2910,7 +2943,8 @@ class RoomActivity : BaseMvpActivity<RoomPresenter?, ActivityRoomBinding?>(),
|
||||
mBinding?.ivSoundEffects?.visibility = View.GONE
|
||||
mBinding?.rlPk?.visibility = View.GONE
|
||||
}
|
||||
|
||||
requestLayout(mBinding!!.rlPk)
|
||||
requestLayout(mBinding!!.rlMai)
|
||||
}
|
||||
|
||||
|
||||
@@ -3271,6 +3305,7 @@ class RoomActivity : BaseMvpActivity<RoomPresenter?, ActivityRoomBinding?>(),
|
||||
val gift = GiftBean()
|
||||
gift.gift_id = ""
|
||||
gift.play_image = event.ride_url
|
||||
softRebuildUI()
|
||||
QXGiftPlayerManager.getInstance(this).displayFullEffectView(event.ride_url)
|
||||
}
|
||||
}
|
||||
@@ -4284,6 +4319,21 @@ class RoomActivity : BaseMvpActivity<RoomPresenter?, ActivityRoomBinding?>(),
|
||||
}
|
||||
}
|
||||
|
||||
//局部刷新
|
||||
private fun requestLayout(view: View) {
|
||||
view.invalidate()
|
||||
view.requestLayout()
|
||||
mBinding?.llBottom?.invalidate()
|
||||
mBinding?.llBottom?.requestLayout()
|
||||
}
|
||||
|
||||
//整体刷新
|
||||
private fun softRebuildUI() {
|
||||
window.decorView.post {
|
||||
window.decorView.requestLayout()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private val CLICK_INTERVAL: Long = 500 // 500ms内不允许重复点击
|
||||
private var lastClickTime: Long = 0
|
||||
|
||||
Reference in New Issue
Block a user