라이브 - 공지 UI 수정
This commit is contained in:
@@ -454,7 +454,6 @@ class LiveRoomActivity : BaseActivity<ActivityLiveRoomBinding>(ActivityLiveRoomB
|
||||
dialog.show(screenWidth)
|
||||
}
|
||||
binding.tvNotification.setOnClickListener { viewModel.toggleShowNotice() }
|
||||
binding.rlNotice.setOnClickListener { viewModel.toggleExpandNotice() }
|
||||
|
||||
binding.tvBgSwitch.setOnClickListener { viewModel.toggleBackgroundImage() }
|
||||
binding.llDonation.setOnClickListener {
|
||||
@@ -821,17 +820,9 @@ class LiveRoomActivity : BaseActivity<ActivityLiveRoomBinding>(ActivityLiveRoomB
|
||||
|
||||
viewModel.isShowNotice.observe(this) {
|
||||
if (it) {
|
||||
binding.rlNotice.visibility = View.VISIBLE
|
||||
binding.llNotice.visibility = View.VISIBLE
|
||||
} else {
|
||||
binding.rlNotice.visibility = View.GONE
|
||||
}
|
||||
}
|
||||
|
||||
viewModel.isExpandNotice.observe(this) {
|
||||
binding.tvNotice.maxLines = if (it) {
|
||||
Int.MAX_VALUE
|
||||
} else {
|
||||
1
|
||||
binding.llNotice.visibility = View.GONE
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1146,10 +1137,14 @@ class LiveRoomActivity : BaseActivity<ActivityLiveRoomBinding>(ActivityLiveRoomB
|
||||
isMicrophoneMute = !isMicrophoneMute
|
||||
agora.muteLocalAudioStream(isMicrophoneMute)
|
||||
|
||||
if (isMicrophoneMute) {
|
||||
speakerListAdapter.muteSpeakers.add(SharedPreferenceManager.userId.toInt())
|
||||
if (SharedPreferenceManager.userId == viewModel.roomInfoResponse.creatorId) {
|
||||
setMuteSpeakerCreator(isMicrophoneMute)
|
||||
} else {
|
||||
speakerListAdapter.muteSpeakers.remove(SharedPreferenceManager.userId.toInt())
|
||||
if (isMicrophoneMute) {
|
||||
speakerListAdapter.muteSpeakers.add(SharedPreferenceManager.userId.toInt())
|
||||
} else {
|
||||
speakerListAdapter.muteSpeakers.remove(SharedPreferenceManager.userId.toInt())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1459,6 +1454,14 @@ class LiveRoomActivity : BaseActivity<ActivityLiveRoomBinding>(ActivityLiveRoomB
|
||||
}
|
||||
}
|
||||
|
||||
private fun setMuteSpeakerCreator(isMute: Boolean) {
|
||||
binding.ivMute.visibility = if (isMute) {
|
||||
View.VISIBLE
|
||||
} else {
|
||||
View.GONE
|
||||
}
|
||||
}
|
||||
|
||||
private val rtcEventHandler = object : IRtcEngineEventHandler() {
|
||||
@SuppressLint("NotifyDataSetChanged")
|
||||
override fun onAudioVolumeIndication(
|
||||
@@ -1512,12 +1515,16 @@ class LiveRoomActivity : BaseActivity<ActivityLiveRoomBinding>(ActivityLiveRoomB
|
||||
override fun onUserMuteAudio(uid: Int, muted: Boolean) {
|
||||
super.onUserMuteAudio(uid, muted)
|
||||
handler.post {
|
||||
if (muted) {
|
||||
speakerListAdapter.muteSpeakers.add(uid)
|
||||
if (uid == viewModel.roomInfoResponse.creatorId.toInt()) {
|
||||
setMuteSpeakerCreator(muted)
|
||||
} else {
|
||||
speakerListAdapter.muteSpeakers.remove(uid)
|
||||
if (muted) {
|
||||
speakerListAdapter.muteSpeakers.add(uid)
|
||||
} else {
|
||||
speakerListAdapter.muteSpeakers.remove(uid)
|
||||
}
|
||||
speakerListAdapter.notifyDataSetChanged()
|
||||
}
|
||||
speakerListAdapter.notifyDataSetChanged()
|
||||
}
|
||||
Logger.e("onUserMuteAudio - uid: $uid, muted: $muted")
|
||||
}
|
||||
|
@@ -50,14 +50,10 @@ class LiveRoomViewModel(
|
||||
val toastLiveData: LiveData<String?>
|
||||
get() = _toastLiveData
|
||||
|
||||
private val _isShowNotice = MutableLiveData(true)
|
||||
private val _isShowNotice = MutableLiveData(false)
|
||||
val isShowNotice: LiveData<Boolean>
|
||||
get() = _isShowNotice
|
||||
|
||||
private val _isExpandNotice = MutableLiveData(false)
|
||||
val isExpandNotice: LiveData<Boolean>
|
||||
get() = _isExpandNotice
|
||||
|
||||
private val _totalDonationCan = MutableLiveData(0)
|
||||
val totalDonationCan: LiveData<Int>
|
||||
get() = _totalDonationCan
|
||||
@@ -361,11 +357,6 @@ class LiveRoomViewModel(
|
||||
|
||||
fun toggleShowNotice() {
|
||||
_isShowNotice.value = !isShowNotice.value!!
|
||||
_isExpandNotice.value = false
|
||||
}
|
||||
|
||||
fun toggleExpandNotice() {
|
||||
_isExpandNotice.value = !isExpandNotice.value!!
|
||||
}
|
||||
|
||||
fun toggleBackgroundImage() {
|
||||
|
Reference in New Issue
Block a user