酒吧交友房 getGiftList 防止越界 2。
This commit is contained in:
@@ -10,6 +10,7 @@ import android.widget.ImageView
|
||||
import com.blankj.utilcode.util.ActivityUtils
|
||||
import com.blankj.utilcode.util.LogUtils
|
||||
import com.blankj.utilcode.util.TimeUtils
|
||||
import com.blankj.utilcode.util.ToastUtils
|
||||
import com.bumptech.glide.Glide
|
||||
import com.orhanobut.logger.Logger
|
||||
import com.xscm.modulemain.R
|
||||
@@ -26,7 +27,6 @@ import com.xscm.moduleutil.bean.room.RoomInfoResp
|
||||
import com.xscm.moduleutil.bean.room.RoomPitBean
|
||||
import com.xscm.moduleutil.bean.room.RoomUserBean
|
||||
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
|
||||
@@ -65,6 +65,7 @@ class RoomPrivateFragment(var mRoomInfoResp: RoomInfoResp?) :
|
||||
|
||||
private var cpUserBean: RoomCpUserBean? = mRoomInfoResp?.cp_user
|
||||
|
||||
private var sendGiftResult = false
|
||||
|
||||
override fun initView() {
|
||||
giftViewList.clear()
|
||||
@@ -77,9 +78,15 @@ class RoomPrivateFragment(var mRoomInfoResp: RoomInfoResp?) :
|
||||
|
||||
giftViewList.forEach { it ->
|
||||
it.setOnClickListener {
|
||||
if (sendGiftResult) {
|
||||
ToastUtils.showShort("手太快了,正在发送中...")
|
||||
return@setOnClickListener
|
||||
}
|
||||
val sendGiftUserId = mBinding.rpwv2.pitBean.user_id
|
||||
|
||||
MvpPre.sendGift(mRoomId, it.tag.toString(), sendGiftUserId,it as ImageView)
|
||||
it.visibility = View.INVISIBLE
|
||||
sendGiftResult = true
|
||||
}
|
||||
}
|
||||
|
||||
@@ -170,6 +177,8 @@ class RoomPrivateFragment(var mRoomInfoResp: RoomInfoResp?) :
|
||||
}
|
||||
|
||||
override fun sendGiftResult(success: Boolean,itemImage: ImageView) {
|
||||
sendGiftResult = false
|
||||
|
||||
// 随机选择一个礼物
|
||||
val showList = giftList.shuffled().take(1)
|
||||
val price = showList[0].gift_price.toInt()
|
||||
@@ -203,7 +212,7 @@ class RoomPrivateFragment(var mRoomInfoResp: RoomInfoResp?) :
|
||||
if (giftList.isEmpty()) {
|
||||
giftList = list.toMutableList()
|
||||
|
||||
val showList = if (giftList.size > 6) {
|
||||
val showList = if (giftList.size > 5) {
|
||||
list.shuffled().take(6)
|
||||
}else{
|
||||
list.shuffled().take(giftList.size-1)
|
||||
@@ -211,7 +220,6 @@ class RoomPrivateFragment(var mRoomInfoResp: RoomInfoResp?) :
|
||||
|
||||
for (i in showList.indices) {
|
||||
val itemImage = giftViewList[i]
|
||||
|
||||
val price = if (showList.size > i){
|
||||
showList[i].gift_price.toInt()
|
||||
}else{
|
||||
|
||||
Reference in New Issue
Block a user