1:在酒吧房小黑屋中,点击送礼添加二次弹窗,并且在点击退出房间的时候,添加二次弹框确认
This commit is contained in:
@@ -19,15 +19,18 @@ import com.xscm.modulemain.activity.room.activity.RoomActivity
|
|||||||
import com.xscm.modulemain.activity.room.contacts.PrivateContacts
|
import com.xscm.modulemain.activity.room.contacts.PrivateContacts
|
||||||
import com.xscm.modulemain.activity.room.presenter.PrivatePresenter
|
import com.xscm.modulemain.activity.room.presenter.PrivatePresenter
|
||||||
import com.xscm.modulemain.databinding.FragmentRoomPrivateBinding
|
import com.xscm.modulemain.databinding.FragmentRoomPrivateBinding
|
||||||
|
import com.xscm.modulemain.dialog.barRoom.PrivateGiftDialog
|
||||||
import com.xscm.moduleutil.base.BaseMvpFragment
|
import com.xscm.moduleutil.base.BaseMvpFragment
|
||||||
import com.xscm.moduleutil.base.CommonAppContext
|
import com.xscm.moduleutil.base.CommonAppContext
|
||||||
import com.xscm.moduleutil.bean.RoomMessageEvent
|
import com.xscm.moduleutil.bean.RoomMessageEvent
|
||||||
import com.xscm.moduleutil.bean.RoonGiftModel
|
import com.xscm.moduleutil.bean.RoonGiftModel
|
||||||
import com.xscm.moduleutil.bean.WalletBean
|
import com.xscm.moduleutil.bean.WalletBean
|
||||||
import com.xscm.moduleutil.bean.room.RoomCpUserBean
|
import com.xscm.moduleutil.bean.room.RoomCpUserBean
|
||||||
|
import com.xscm.moduleutil.bean.room.RoomGiveGiftModel
|
||||||
import com.xscm.moduleutil.bean.room.RoomInfoResp
|
import com.xscm.moduleutil.bean.room.RoomInfoResp
|
||||||
import com.xscm.moduleutil.bean.room.RoomPitBean
|
import com.xscm.moduleutil.bean.room.RoomPitBean
|
||||||
import com.xscm.moduleutil.bean.room.RoomUserBean
|
import com.xscm.moduleutil.bean.room.RoomUserBean
|
||||||
|
import com.xscm.moduleutil.dialog.ConfirmDialog
|
||||||
import com.xscm.moduleutil.listener.MessageExListenerSingleton
|
import com.xscm.moduleutil.listener.MessageExListenerSingleton
|
||||||
import com.xscm.moduleutil.rtc.AgoraManager
|
import com.xscm.moduleutil.rtc.AgoraManager
|
||||||
import io.reactivex.Observable
|
import io.reactivex.Observable
|
||||||
@@ -71,6 +74,9 @@ class RoomPrivateFragment(var mRoomInfoResp: RoomInfoResp?) :
|
|||||||
|
|
||||||
private var sendGiftResult = false
|
private var sendGiftResult = false
|
||||||
|
|
||||||
|
private var privateGiftDialog: PrivateGiftDialog? = null
|
||||||
|
private var dialogPrivate = false
|
||||||
|
|
||||||
override fun initView() {
|
override fun initView() {
|
||||||
giftViewList.clear()
|
giftViewList.clear()
|
||||||
giftTViewList.clear()
|
giftTViewList.clear()
|
||||||
@@ -94,14 +100,33 @@ class RoomPrivateFragment(var mRoomInfoResp: RoomInfoResp?) :
|
|||||||
ToastUtils.showShort("手太快了,正在发送中...")
|
ToastUtils.showShort("手太快了,正在发送中...")
|
||||||
return@setOnClickListener
|
return@setOnClickListener
|
||||||
}
|
}
|
||||||
|
|
||||||
val sendGiftUserId = mBinding.rpwv2.pitBean.user_id
|
val sendGiftUserId = mBinding.rpwv2.pitBean.user_id
|
||||||
|
if (dialogPrivate) {
|
||||||
|
MvpPre.sendGift(mRoomId, it.tag.toString(), sendGiftUserId, index)
|
||||||
|
it.visibility = View.INVISIBLE
|
||||||
|
giftTViewList[index].visibility = View.INVISIBLE
|
||||||
|
sendGiftResult = true
|
||||||
|
} else {
|
||||||
|
if (privateGiftDialog == null) {
|
||||||
|
privateGiftDialog = PrivateGiftDialog(
|
||||||
|
ActivityUtils.getTopActivity()
|
||||||
|
)
|
||||||
|
}
|
||||||
|
privateGiftDialog?.show(
|
||||||
|
giftTViewList[index].tag.toString(),
|
||||||
|
giftTViewList[index].text.toString().toInt()
|
||||||
|
)
|
||||||
|
privateGiftDialog?.setOnConfirmListener { isSelected ->
|
||||||
|
dialogPrivate = isSelected
|
||||||
|
MvpPre.sendGift(mRoomId, it.tag.toString(), sendGiftUserId, index)
|
||||||
|
it.visibility = View.INVISIBLE
|
||||||
|
giftTViewList[index].visibility = View.INVISIBLE
|
||||||
|
sendGiftResult = true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
MvpPre.sendGift(mRoomId, it.tag.toString(), sendGiftUserId,index)
|
|
||||||
it.visibility = View.INVISIBLE
|
|
||||||
|
|
||||||
giftTViewList[index].visibility = View.INVISIBLE
|
|
||||||
|
|
||||||
sendGiftResult = true
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -109,8 +134,24 @@ class RoomPrivateFragment(var mRoomInfoResp: RoomInfoResp?) :
|
|||||||
mBinding?.tvHeartNum?.text = mRoomInfoResp?.room_info?.hot_value
|
mBinding?.tvHeartNum?.text = mRoomInfoResp?.room_info?.hot_value
|
||||||
|
|
||||||
mBinding?.tvBack?.setOnClickListener {
|
mBinding?.tvBack?.setOnClickListener {
|
||||||
//返回到上一个房间
|
ConfirmDialog(
|
||||||
MvpPre?.exitRoom(mRoomId,mUserInfo?.user_id.toString())
|
ActivityUtils.getTopActivity(),
|
||||||
|
"温馨提示",
|
||||||
|
"是否退出当前交友小屋?",
|
||||||
|
"确定",
|
||||||
|
"取消",
|
||||||
|
{
|
||||||
|
//返回到上一个房间
|
||||||
|
MvpPre?.exitRoom(mRoomId, mUserInfo?.user_id.toString())
|
||||||
|
},
|
||||||
|
{
|
||||||
|
|
||||||
|
},
|
||||||
|
false,
|
||||||
|
0
|
||||||
|
).show()
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// 定义两个 RoomPitBean 对象,分别用于显示在 roomMakeWheat1 和 roomMakeWheat2
|
// 定义两个 RoomPitBean 对象,分别用于显示在 roomMakeWheat1 和 roomMakeWheat2
|
||||||
@@ -172,7 +213,8 @@ class RoomPrivateFragment(var mRoomInfoResp: RoomInfoResp?) :
|
|||||||
|
|
||||||
fun roomTypeSwitch(mRoomInfoResp: RoomInfoResp) {
|
fun roomTypeSwitch(mRoomInfoResp: RoomInfoResp) {
|
||||||
this.mRoomInfoResp = mRoomInfoResp
|
this.mRoomInfoResp = mRoomInfoResp
|
||||||
|
sendGiftResult = false
|
||||||
|
dialogPrivate = false
|
||||||
mUserInfo = this.mRoomInfoResp?.user_info
|
mUserInfo = this.mRoomInfoResp?.user_info
|
||||||
mRoomId = this.mRoomInfoResp?.room_info?.room_id!!
|
mRoomId = this.mRoomInfoResp?.room_info?.room_id!!
|
||||||
cpUserBean = this.mRoomInfoResp?.cp_user
|
cpUserBean = this.mRoomInfoResp?.cp_user
|
||||||
@@ -221,6 +263,7 @@ class RoomPrivateFragment(var mRoomInfoResp: RoomInfoResp?) :
|
|||||||
// 设置 padding(左、上、右、下)
|
// 设置 padding(左、上、右、下)
|
||||||
itemImage.setPadding(paddingPx, paddingPx, paddingPx, paddingPx)
|
itemImage.setPadding(paddingPx, paddingPx, paddingPx, paddingPx)
|
||||||
itemImage.tag = showList[0].gift_id
|
itemImage.tag = showList[0].gift_id
|
||||||
|
giftTViewList[idx].tag = showList[0].gift_name
|
||||||
Glide.with(itemImage)
|
Glide.with(itemImage)
|
||||||
.load(showList[0].base_image)
|
.load(showList[0].base_image)
|
||||||
.into(itemImage)
|
.into(itemImage)
|
||||||
@@ -237,22 +280,23 @@ class RoomPrivateFragment(var mRoomInfoResp: RoomInfoResp?) :
|
|||||||
|
|
||||||
val showList = if (giftList.size > 5) {
|
val showList = if (giftList.size > 5) {
|
||||||
list.shuffled().take(6)
|
list.shuffled().take(6)
|
||||||
}else{
|
} else {
|
||||||
list.shuffled().take(giftList.size-1)
|
list.shuffled().take(giftList.size - 1)
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i in showList.indices) {
|
for (i in showList.indices) {
|
||||||
val itemImage = giftViewList[i]
|
val itemImage = giftViewList[i]
|
||||||
val price = if (showList.size > i){
|
val price = if (showList.size > i) {
|
||||||
showList[i].gift_price.toInt()
|
showList[i].gift_price.toInt()
|
||||||
}else{
|
} else {
|
||||||
showList[showList.size - 1].gift_price.toInt()
|
showList[showList.size - 1].gift_price.toInt()
|
||||||
}
|
}
|
||||||
giftTViewList[i].text = price.toString()
|
giftTViewList[i].text = price.toString()
|
||||||
|
giftTViewList[i].tag = showList[i].gift_name
|
||||||
|
|
||||||
itemImage.tag = if (showList.size > i){
|
itemImage.tag = if (showList.size > i) {
|
||||||
showList[i].gift_id
|
showList[i].gift_id
|
||||||
}else{
|
} else {
|
||||||
showList[showList.size - 1].gift_id
|
showList[showList.size - 1].gift_id
|
||||||
}
|
}
|
||||||
// 根据价格设置不同的宽高
|
// 根据价格设置不同的宽高
|
||||||
@@ -294,7 +338,7 @@ class RoomPrivateFragment(var mRoomInfoResp: RoomInfoResp?) :
|
|||||||
// "lxj",
|
// "lxj",
|
||||||
// ("退出房间时间:" + TimeUtils.date2String(Date())).toString() + ":退出的roomId" + mRoomId, "需要加入的房间:"+AgoraManager.getInstance().lastRoomId
|
// ("退出房间时间:" + TimeUtils.date2String(Date())).toString() + ":退出的roomId" + mRoomId, "需要加入的房间:"+AgoraManager.getInstance().lastRoomId
|
||||||
// )
|
// )
|
||||||
MessageExListenerSingleton.quitGroup(mRoomId)
|
// MessageExListenerSingleton.quitGroup(mRoomId)
|
||||||
//// (activity as RoomActivity).quit()
|
//// (activity as RoomActivity).quit()
|
||||||
//// CommonAppContext.getInstance().isPlaying = false
|
//// CommonAppContext.getInstance().isPlaying = false
|
||||||
//// CommonAppContext.getInstance().isShow = false
|
//// CommonAppContext.getInstance().isShow = false
|
||||||
|
|||||||
@@ -0,0 +1,96 @@
|
|||||||
|
package com.xscm.modulemain.dialog.barRoom
|
||||||
|
|
||||||
|
import android.content.Context
|
||||||
|
import android.view.Gravity
|
||||||
|
import android.view.ViewGroup
|
||||||
|
import com.blankj.utilcode.util.ScreenUtils
|
||||||
|
import com.xscm.modulemain.R
|
||||||
|
import com.xscm.modulemain.databinding.DialogFlirtatiousBinding
|
||||||
|
import com.xscm.modulemain.databinding.DialogPrivateBinding
|
||||||
|
import com.xscm.moduleutil.bean.WalletBean
|
||||||
|
import com.xscm.moduleutil.color.ThemeableDrawableUtils
|
||||||
|
import com.xscm.moduleutil.http.BaseObserver
|
||||||
|
import com.xscm.moduleutil.http.RetrofitClient
|
||||||
|
import com.xscm.moduleutil.utils.ColorManager
|
||||||
|
import com.xscm.moduleutil.utils.SpUtil
|
||||||
|
import com.xscm.moduleutil.widget.dialog.BaseDialog
|
||||||
|
import io.reactivex.disposables.Disposable
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 项目名称:羽声语音
|
||||||
|
* 时间:2026/1/13 23:24
|
||||||
|
* 用途:酒吧房交友小屋送礼添加弹框
|
||||||
|
*/
|
||||||
|
class PrivateGiftDialog (context: Context) :
|
||||||
|
BaseDialog<DialogPrivateBinding>(context, com.xscm.moduleutil.R.style.BaseDialogStyleH) {
|
||||||
|
|
||||||
|
// 定义回调接口
|
||||||
|
private var onConfirmCallback: ((Boolean) -> Unit)? = null
|
||||||
|
private var isSelected: Boolean = false
|
||||||
|
// 设置回调接口的方法
|
||||||
|
fun setOnConfirmListener(callback: (Boolean) -> Unit): PrivateGiftDialog {
|
||||||
|
onConfirmCallback = callback
|
||||||
|
return this
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun getLayoutId(): Int {
|
||||||
|
return R.layout.dialog_private
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun initView() {
|
||||||
|
setupWindow()
|
||||||
|
ThemeableDrawableUtils.setThemeableRoundedBackground(
|
||||||
|
mBinding.tvConfirm,
|
||||||
|
ColorManager.getInstance().primaryColorInt,
|
||||||
|
53
|
||||||
|
)
|
||||||
|
mBinding.tvConfirm.setTextColor(ColorManager.getInstance().buttonColorInt)
|
||||||
|
// 设置点击事件
|
||||||
|
mBinding.ivClose.setOnClickListener {
|
||||||
|
dismiss()
|
||||||
|
}
|
||||||
|
mBinding.tvConfirm.setOnClickListener {
|
||||||
|
onConfirmCallback?.invoke(isSelected)
|
||||||
|
dismiss()
|
||||||
|
}
|
||||||
|
mBinding.tvCancel.setOnClickListener {
|
||||||
|
dismiss()
|
||||||
|
}
|
||||||
|
mBinding.vCheckbox.setOnClickListener {
|
||||||
|
it.isSelected = !it.isSelected
|
||||||
|
isSelected = it.isSelected
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fun show(giftName: String, sexy_coin: Int) {
|
||||||
|
super.show()
|
||||||
|
mBinding.tvTitle.text = "确认送出 ${giftName} 礼物吗?共计需要 ${sexy_coin}个 金币。"
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun initData() {
|
||||||
|
// 初始化数据,如果需要的话
|
||||||
|
RetrofitClient.getInstance().wallet(object : BaseObserver<WalletBean>() {
|
||||||
|
override fun onSubscribe(d: Disposable) {
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onNext(t: WalletBean) {
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private fun setupWindow() {
|
||||||
|
val window = window ?: return
|
||||||
|
window.setGravity(Gravity.CENTER)
|
||||||
|
window.setLayout(
|
||||||
|
(ScreenUtils.getScreenWidth() * 315f / 375).toInt(),
|
||||||
|
ViewGroup.LayoutParams.WRAP_CONTENT
|
||||||
|
)
|
||||||
|
window.setBackgroundDrawableResource(android.R.color.transparent)
|
||||||
|
|
||||||
|
val params = window.attributes
|
||||||
|
params.windowAnimations = com.xscm.moduleutil.R.style.BaseDialogStyleH
|
||||||
|
window.attributes = params
|
||||||
|
}
|
||||||
|
}
|
||||||
119
MainModule/src/main/res/layout/dialog_private.xml
Normal file
119
MainModule/src/main/res/layout/dialog_private.xml
Normal file
@@ -0,0 +1,119 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<layout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
|
|
||||||
|
>
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:background="@drawable/bg_r16_fff"
|
||||||
|
android:orientation="vertical">
|
||||||
|
<!-- 标题栏 -->
|
||||||
|
<RelativeLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="@dimen/dp_50">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_centerInParent="true"
|
||||||
|
android:text="温馨提示"
|
||||||
|
android:textColor="@color/color_FF333333"
|
||||||
|
android:textSize="@dimen/sp_16"
|
||||||
|
android:textStyle="bold" />
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/iv_close"
|
||||||
|
android:layout_width="@dimen/dp_20"
|
||||||
|
android:layout_height="@dimen/dp_20"
|
||||||
|
android:layout_alignParentEnd="true"
|
||||||
|
android:layout_centerVertical="true"
|
||||||
|
android:layout_marginEnd="@dimen/dp_15"
|
||||||
|
android:tint="@color/color_FF999999"
|
||||||
|
android:src="@mipmap/gb" />
|
||||||
|
</RelativeLayout>
|
||||||
|
|
||||||
|
<!-- 内容区域 -->
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:orientation="vertical"
|
||||||
|
android:layout_marginHorizontal="@dimen/dp_16"
|
||||||
|
>
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/tv_title"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="@dimen/dp_6"
|
||||||
|
android:gravity="center_vertical"
|
||||||
|
android:paddingEnd="@dimen/dp_12"
|
||||||
|
android:hint="确定要撩一撩台上的 夏沫002 吗?共计需要 10个 金币。"
|
||||||
|
android:textColor="@color/color_FF333333"
|
||||||
|
android:textSize="@dimen/sp_14" />
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginVertical="@dimen/dp_20"
|
||||||
|
android:orientation="horizontal">
|
||||||
|
|
||||||
|
<View
|
||||||
|
android:id="@+id/v_checkbox"
|
||||||
|
android:layout_width="@dimen/dp_20"
|
||||||
|
android:layout_height="@dimen/dp_20"
|
||||||
|
android:background="@drawable/select_checkbox"
|
||||||
|
android:focusable="false"
|
||||||
|
android:clickable="true"/>
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/tv_option"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_gravity="center_vertical"
|
||||||
|
android:layout_marginStart="@dimen/dp_5"
|
||||||
|
android:textSize="@dimen/sp_14"
|
||||||
|
android:text="确认后,此交友小屋不在弹出"
|
||||||
|
android:textColor="@color/color_FF999999"
|
||||||
|
/>
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
<!-- 按钮区域 -->
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:orientation="horizontal"
|
||||||
|
android:paddingStart="@dimen/dp_20"
|
||||||
|
android:paddingEnd="@dimen/dp_20"
|
||||||
|
android:paddingBottom="@dimen/dp_20">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/tv_cancel"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="@dimen/dp_40"
|
||||||
|
android:layout_marginEnd="@dimen/dp_10"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:background="@drawable/bg_r53_f3f3f3"
|
||||||
|
android:gravity="center"
|
||||||
|
android:text="取消"
|
||||||
|
android:textColor="@color/color_FF999999"
|
||||||
|
android:textSize="@dimen/sp_14" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/tv_confirm"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="@dimen/dp_40"
|
||||||
|
android:layout_marginStart="@dimen/dp_10"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:background="@drawable/bg_r53_0dffb9"
|
||||||
|
android:backgroundTint="#3ABC6D"
|
||||||
|
android:gravity="center"
|
||||||
|
android:text="确定"
|
||||||
|
android:textColor="@color/white"
|
||||||
|
android:textSize="@dimen/sp_14" />
|
||||||
|
</LinearLayout>
|
||||||
|
</LinearLayout>
|
||||||
|
</layout>
|
||||||
@@ -28,8 +28,8 @@ isBuildModule=false
|
|||||||
#org.gradle.deamon=false
|
#org.gradle.deamon=false
|
||||||
android.injected.testOnly=false
|
android.injected.testOnly=false
|
||||||
|
|
||||||
APP_VERSION_NAME=1.0.9.7
|
APP_VERSION_NAME=1.0.9.8
|
||||||
APP_VERSION_CODE=87
|
APP_VERSION_CODE=88
|
||||||
|
|
||||||
org.gradle.jvm.toolchain.useLegacyAdapters=false
|
org.gradle.jvm.toolchain.useLegacyAdapters=false
|
||||||
#org.gradle.java.home=C\:\\Users\\qx\\.jdks\\ms-17.0.15
|
#org.gradle.java.home=C\:\\Users\\qx\\.jdks\\ms-17.0.15
|
||||||
|
|||||||
Reference in New Issue
Block a user