退出房间
This commit is contained in:
@@ -1582,12 +1582,14 @@ class RoomActivity : BaseMvpActivity<RoomPresenter?, ActivityRoomBinding?>(),
|
||||
roomFragment?.handleRoomMessage(messageEvent)
|
||||
} else if (msgType == EMMessageInfo.QXRoomMessageTypeFlirtatiousRoom) {//酒吧房约她进入小黑屋
|
||||
if (mRoomInfoResp?.user_info?.user_id.toString() == messageEvent.text.user_id
|
||||
|| mRoomInfoResp?.user_info?.user_id.toString() == messageEvent.text.meet_user_id) {
|
||||
if (mRoomInfoResp?.user_info?.pit_number !=0) {
|
||||
|| mRoomInfoResp?.user_info?.user_id.toString() == messageEvent.text.meet_user_id
|
||||
) {
|
||||
if (mRoomInfoResp?.user_info?.pit_number != 0) {
|
||||
MvpPre?.downPit(roomId, mRoomInfoResp?.user_info?.pit_number.toString())
|
||||
}
|
||||
MvpPre?.postRoomInfo(messageEvent.text.room_id)
|
||||
if (publicScreenFragment != null){
|
||||
AgoraManager.getInstance().lastRoomId = roomId
|
||||
MvpPre?.getRoomIn(messageEvent.text.room_id,"")
|
||||
if (publicScreenFragment != null) {
|
||||
MessageExListenerSingleton.getInstance().joinGroup(messageEvent.text.room_id)
|
||||
publicScreenFragment?.setupExMessageListener()
|
||||
}
|
||||
@@ -2271,6 +2273,10 @@ class RoomActivity : BaseMvpActivity<RoomPresenter?, ActivityRoomBinding?>(),
|
||||
updateCharmForAllPitBeans("")
|
||||
roomFragment!!.upFriendList(mRoomInfoResp?.room_info?.pit_list)
|
||||
}
|
||||
|
||||
//酒吧房用
|
||||
if (publicScreenFragment != null)
|
||||
publicScreenFragment?.isPriRoom = false
|
||||
}
|
||||
|
||||
private fun updateCharmForAllPitBeans(charm: String) {
|
||||
|
||||
@@ -1,11 +1,9 @@
|
||||
package com.xscm.modulemain.activity.room.contacts
|
||||
|
||||
import android.app.Activity
|
||||
import android.media.Image
|
||||
import android.widget.ImageView
|
||||
import com.xscm.moduleutil.activity.IPresenter
|
||||
import com.xscm.moduleutil.activity.IView
|
||||
import com.xscm.moduleutil.bean.GiftBean
|
||||
import com.xscm.moduleutil.bean.RoonGiftModel
|
||||
import com.xscm.moduleutil.bean.WalletBean
|
||||
|
||||
@@ -18,6 +16,8 @@ class PrivateContacts {
|
||||
fun sendGiftResult(success:Boolean,imageView: ImageView)
|
||||
|
||||
fun getGiftList(list: List<RoonGiftModel>)
|
||||
|
||||
fun exitRoom()
|
||||
}
|
||||
|
||||
interface Ipre : IPresenter{
|
||||
@@ -27,6 +27,8 @@ class PrivateContacts {
|
||||
|
||||
fun sendGift(mRoomId:String,giftId: String,mUserId:String,imageView: ImageView)
|
||||
|
||||
fun exitRoom(roomId: String?, userId: String?)
|
||||
|
||||
fun wallet(list:List<String>)
|
||||
|
||||
|
||||
|
||||
@@ -74,7 +74,7 @@ public class ChatRoomFragment extends BaseMvpFragment<ChatRoomPresenter, RoomFra
|
||||
private MessageListenerSingleton.PublicScreenMessageListener messageListener;
|
||||
private MessageExListenerSingleton.PublicScreenMessageListener messageExListener;
|
||||
@Setter
|
||||
private boolean isPriRoom = false;
|
||||
public boolean isPriRoom = false;
|
||||
|
||||
// 在需要的地方调用 Activity 的方法
|
||||
public void someMethod() {
|
||||
@@ -176,6 +176,7 @@ public class ChatRoomFragment extends BaseMvpFragment<ChatRoomPresenter, RoomFra
|
||||
* 设置消息监听器
|
||||
*/
|
||||
public void setupExMessageListener() {
|
||||
isPriRoom = true;
|
||||
// 创建并添加监听器
|
||||
messageExListener = message -> {
|
||||
// 确保在主线程更新 UI
|
||||
@@ -472,11 +473,11 @@ public class ChatRoomFragment extends BaseMvpFragment<ChatRoomPresenter, RoomFra
|
||||
if (message.getRoomId() == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (roomId == null || (!message.getRoomId().contains(roomId) && message.getMsgType() != 125)) {
|
||||
return;
|
||||
if (!isPriRoom){
|
||||
if (roomId == null || (!message.getRoomId().contains(roomId) && message.getMsgType() != 125)) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// 使用Handler将消息处理放到消息队列中,避免阻塞
|
||||
synchronized (queueLock) {
|
||||
if (messageHandler.hasMessages(MSG_HANDLE_ROOM_MESSAGE)) {
|
||||
|
||||
@@ -8,9 +8,12 @@ import android.view.View
|
||||
import android.view.animation.LinearInterpolator
|
||||
import android.widget.ImageView
|
||||
import com.blankj.utilcode.util.ActivityUtils
|
||||
import com.blankj.utilcode.util.LogUtils
|
||||
import com.blankj.utilcode.util.TimeUtils
|
||||
import com.bumptech.glide.Glide
|
||||
import com.orhanobut.logger.Logger
|
||||
import com.xscm.modulemain.R
|
||||
import com.xscm.modulemain.activity.room.activity.RoomActivity
|
||||
import com.xscm.modulemain.activity.room.contacts.PrivateContacts
|
||||
import com.xscm.modulemain.activity.room.presenter.PrivatePresenter
|
||||
import com.xscm.modulemain.databinding.FragmentRoomPrivateBinding
|
||||
@@ -26,8 +29,10 @@ import com.xscm.moduleutil.listener.MessageExListenerSingleton
|
||||
import com.xscm.moduleutil.listener.MessageListenerSingleton
|
||||
import io.reactivex.Observable
|
||||
import io.reactivex.android.schedulers.AndroidSchedulers
|
||||
import java.util.Date
|
||||
import java.util.concurrent.TimeUnit
|
||||
|
||||
|
||||
class RoomPrivateFragment(var mRoomInfoResp: RoomInfoResp?) :
|
||||
BaseMvpFragment<PrivatePresenter, FragmentRoomPrivateBinding>(), PrivateContacts.View {
|
||||
|
||||
@@ -83,7 +88,7 @@ class RoomPrivateFragment(var mRoomInfoResp: RoomInfoResp?) :
|
||||
|
||||
mBinding?.tvBack?.setOnClickListener {
|
||||
//返回到上一个房间
|
||||
|
||||
MvpPre?.exitRoom(mRoomId,mUserInfo?.user_id.toString())
|
||||
}
|
||||
|
||||
// 定义两个 RoomPitBean 对象,分别用于显示在 roomMakeWheat1 和 roomMakeWheat2
|
||||
@@ -232,6 +237,18 @@ class RoomPrivateFragment(var mRoomInfoResp: RoomInfoResp?) :
|
||||
}
|
||||
}
|
||||
|
||||
override fun exitRoom() {
|
||||
if (activity is RoomActivity) {
|
||||
LogUtils.e(
|
||||
"lxj",
|
||||
("退出房间时间:" + TimeUtils.date2String(Date())).toString() + ":退出的roomId" + mRoomId
|
||||
)
|
||||
MessageExListenerSingleton.quitGroup(mRoomId)
|
||||
(activity as RoomActivity).quit()
|
||||
(activity as RoomActivity).jiaR()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
fun startSmallFloatingAnimation(view: View, floatRangeDp: Float = 10f) {
|
||||
// 1. 计算飘动范围(默认 ±10dp,可调整)
|
||||
|
||||
@@ -168,7 +168,6 @@ class RoomPubFragment(var mRoomInfoResp: RoomInfoResp?) :
|
||||
view.pitBean.user_id,
|
||||
mRoomId
|
||||
).show()
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -2,16 +2,13 @@ package com.xscm.modulemain.activity.room.presenter
|
||||
|
||||
import android.content.Context
|
||||
import android.widget.ImageView
|
||||
import com.xscm.modulemain.activity.room.contacts.MentorShipContacts
|
||||
import com.xscm.modulemain.activity.room.contacts.PrivateContacts
|
||||
import com.xscm.modulemain.activity.room.contacts.PubContacts
|
||||
import com.xscm.moduleutil.bean.RoomGiftData
|
||||
import com.xscm.moduleutil.bean.RoonGiftModel
|
||||
import com.xscm.moduleutil.bean.WalletBean
|
||||
import com.xscm.moduleutil.http.BaseObserver
|
||||
import com.xscm.moduleutil.http.RetrofitClient
|
||||
import com.xscm.moduleutil.presenter.BasePresenter
|
||||
import com.xscm.moduleutil.presenter.RewardGiftContacts
|
||||
import io.reactivex.disposables.Disposable
|
||||
import java.lang.ref.WeakReference
|
||||
|
||||
@@ -63,6 +60,21 @@ class PrivatePresenter(context: Context, val view: PrivateContacts.View?) :
|
||||
})
|
||||
}
|
||||
|
||||
override fun exitRoom(roomId: String?, userId: String?) {
|
||||
RetrofitClient.getInstance().quitRoom(roomId, userId, object : BaseObserver<String?>() {
|
||||
override fun onSubscribe(d: Disposable) {
|
||||
addDisposable(d)
|
||||
}
|
||||
|
||||
override fun onNext(string: String) {
|
||||
if (MvpRef == null) {
|
||||
MvpRef = WeakReference<PrivateContacts.View>(view)
|
||||
}
|
||||
MvpRef.get()?.exitRoom()
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
override fun wallet(list:List<String>) {
|
||||
RetrofitClient.getInstance().wallet(object : BaseObserver<WalletBean?>() {
|
||||
|
||||
@@ -83,16 +83,16 @@ class RoomPubWheatView : BaseWheatView {
|
||||
"9" -> {
|
||||
iv_tag_type?.visibility = View.VISIBLE
|
||||
iv_tag_type?.setImageResource(com.xscm.moduleutil.R.mipmap.zc)
|
||||
tv_time?.visibility = View.GONE
|
||||
ll_bottom?.visibility = View.GONE
|
||||
tv_time?.visibility = View.INVISIBLE
|
||||
ll_bottom?.visibility = View.INVISIBLE
|
||||
iv_custom_gift?.visibility = View.GONE
|
||||
}
|
||||
|
||||
"10" -> {
|
||||
iv_tag_type?.visibility = View.VISIBLE
|
||||
iv_tag_type?.setImageResource(com.xscm.moduleutil.R.mipmap.jb)
|
||||
tv_time?.visibility = View.GONE
|
||||
ll_bottom?.visibility = View.GONE
|
||||
tv_time?.visibility = View.INVISIBLE
|
||||
ll_bottom?.visibility = View.INVISIBLE
|
||||
iv_custom_gift?.visibility = View.GONE
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user