1:修改网络初始化的时候,放在点击了弹框后在进行
2:添加礼物墙展示用户信息功能
This commit is contained in:
@@ -0,0 +1,151 @@
|
||||
package com.xscm.modulemain.dialog
|
||||
|
||||
import android.app.Dialog
|
||||
import android.content.Context
|
||||
import android.view.Gravity
|
||||
import android.view.LayoutInflater
|
||||
import android.view.ViewGroup
|
||||
import com.blankj.utilcode.util.ScreenUtils
|
||||
import com.scwang.smartrefresh.layout.api.RefreshLayout
|
||||
import com.scwang.smartrefresh.layout.listener.OnRefreshLoadMoreListener
|
||||
import com.xscm.modulemain.R
|
||||
import com.xscm.modulemain.adapter.GiftWallListAdapter
|
||||
import com.xscm.modulemain.databinding.DialogEmotionPickerBinding
|
||||
import com.xscm.modulemain.databinding.DialogGiftWallListBinding
|
||||
import com.xscm.moduleutil.bean.GiftWallUserBean
|
||||
import com.xscm.moduleutil.http.BaseObserver
|
||||
import com.xscm.moduleutil.http.RetrofitClient
|
||||
import com.xscm.moduleutil.widget.dialog.BaseDialog
|
||||
import io.reactivex.disposables.Disposable
|
||||
|
||||
/**
|
||||
* 项目名称:羽声语音
|
||||
* 时间:2026/1/22 18:55
|
||||
* 用途:礼物墙展示人员信息
|
||||
*/
|
||||
class GiftWallListDialog(
|
||||
context: Context
|
||||
|
||||
) : Dialog(context, com.xscm.moduleutil.R.style.BaseDialogStyleH) {
|
||||
|
||||
var page: Int = 1
|
||||
var userId: String = ""
|
||||
var giftId: String = ""
|
||||
var giftName: String = ""
|
||||
var userSize: Int = 0
|
||||
private var mBinding: DialogGiftWallListBinding =
|
||||
DialogGiftWallListBinding.inflate(LayoutInflater.from(context))
|
||||
|
||||
init {
|
||||
setContentView(mBinding.root)
|
||||
|
||||
// 设置对话框从底部弹出
|
||||
window?.setGravity(Gravity.CENTER)
|
||||
// 设置对话框的宽度为屏幕宽度
|
||||
window?.setLayout(
|
||||
(ScreenUtils.getScreenWidth() * 348f / 375).toInt(),
|
||||
ViewGroup.LayoutParams.WRAP_CONTENT
|
||||
)
|
||||
// 添加动画效果
|
||||
window?.setWindowAnimations(com.xscm.moduleutil.R.style.DialogAnimationt)
|
||||
setCancelable(false)
|
||||
setCanceledOnTouchOutside(false)
|
||||
}
|
||||
|
||||
|
||||
private fun initView() {
|
||||
mBinding.ivClose.setOnClickListener {
|
||||
dismiss()
|
||||
}
|
||||
|
||||
mBinding.tvTitle.text = giftName
|
||||
mBinding.tvName.text = giftName
|
||||
mBinding.tvUserNum.text = userSize.toString()
|
||||
|
||||
mBinding.rvGiftWall.adapter = GiftWallListAdapter()
|
||||
|
||||
}
|
||||
|
||||
private fun initData() {
|
||||
|
||||
mBinding.smartRefreshLayout.setOnRefreshLoadMoreListener(object :
|
||||
OnRefreshLoadMoreListener {
|
||||
override fun onRefresh(refreshLayout: RefreshLayout) {
|
||||
page = 1
|
||||
setHttp(page)
|
||||
}
|
||||
|
||||
override fun onLoadMore(refreshLayout: RefreshLayout) {
|
||||
page++
|
||||
setHttp(page)
|
||||
}
|
||||
|
||||
})
|
||||
setHttp(page)
|
||||
}
|
||||
|
||||
private fun setAdapterDetails(giftWallUserItemBean: List<GiftWallUserBean.GiftWallUserItemBean>) {
|
||||
if (page == 1) {
|
||||
(mBinding.rvGiftWall.adapter as GiftWallListAdapter).setNewData(giftWallUserItemBean)
|
||||
} else {
|
||||
|
||||
val adapter = mBinding.rvGiftWall.adapter as GiftWallListAdapter
|
||||
val currentData = adapter.data
|
||||
|
||||
// 过滤掉重复的数据
|
||||
val newData = giftWallUserItemBean.filter { newItem ->
|
||||
currentData.none { existingItem ->
|
||||
// 假设GiftWallUserItemBean有id字段用于比较
|
||||
existingItem.user_id == newItem.user_id
|
||||
}
|
||||
}
|
||||
|
||||
// 只有当有新数据时才添加
|
||||
if (newData.isNotEmpty()) {
|
||||
adapter.addData(newData)
|
||||
} else {
|
||||
page = 1
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private fun setHttp(page: Int) {
|
||||
|
||||
RetrofitClient.getInstance()
|
||||
.giftWallUserList(userId, giftId, page, object : BaseObserver<GiftWallUserBean>() {
|
||||
|
||||
|
||||
override fun onSubscribe(d: Disposable) {
|
||||
}
|
||||
|
||||
override fun onNext(t: GiftWallUserBean) {
|
||||
|
||||
mBinding.tvNum.text = t.count.toString()
|
||||
if (t.users.isNotEmpty()) {
|
||||
setAdapterDetails(t.users)
|
||||
}
|
||||
}
|
||||
})
|
||||
mBinding.smartRefreshLayout.finishRefresh()
|
||||
mBinding.smartRefreshLayout.finishLoadMore()
|
||||
}
|
||||
|
||||
fun show(
|
||||
userId: String,
|
||||
giftId: String,
|
||||
giftName: String,
|
||||
userSize: Int
|
||||
) {
|
||||
this.userSize = userSize
|
||||
this.userId = userId
|
||||
this.giftId = giftId
|
||||
this.giftName = giftName
|
||||
|
||||
super.show()
|
||||
|
||||
initView()
|
||||
initData()
|
||||
}
|
||||
|
||||
}
|
||||
@@ -34,6 +34,7 @@ import com.xscm.modulemain.activity.WebViewActivity;
|
||||
import com.xscm.moduleutil.base.CommonAppContext;
|
||||
import com.xscm.moduleutil.base.WebUrlConstants;
|
||||
import com.xscm.moduleutil.bean.BlindBoxStatus;
|
||||
import com.xscm.moduleutil.bean.GiftLabelBean;
|
||||
import com.xscm.moduleutil.dialog.ConfirmDialog;
|
||||
import com.xscm.moduleutil.event.EffectEvent;
|
||||
import com.xscm.moduleutil.event.FloatingScreenEvent;
|
||||
@@ -899,6 +900,10 @@ public class RoomSettingFragment extends BaseMvpDialogFragment<RoomSettingPresen
|
||||
(giftBagId == 12 && filteredList.get(j).getChildren().get(k).getType() == RoomSettingBean.QXRoomSettingTypeRoomTimeSpace)) {
|
||||
if (status != 1) {
|
||||
filteredList.get(j).getChildren().remove(k);
|
||||
}else {
|
||||
if (SpUtil.getShelf() == 1) {
|
||||
filteredList.get(j).getChildren().remove(k);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user