交友小黑屋礼物价格。
This commit is contained in:
@@ -2952,12 +2952,14 @@ class RoomActivity : BaseMvpActivity<RoomPresenter?, ActivityRoomBinding?>(),
|
||||
var isSkip = false
|
||||
for (activity in ActivityUtils.getActivityList()) {
|
||||
if (activity !is RoomActivity && activity !is TransparentActivity) {
|
||||
LogUtils.e("这是返回到上一页","这是要跳转的activity:"+activity::class.java.name)
|
||||
singleTaskToActivity(activity::class.java)
|
||||
isSkip = true
|
||||
break
|
||||
}
|
||||
}
|
||||
if (!isSkip) {
|
||||
LogUtils.e("这是返回到上一页","这是要跳转的activity:"+isSkip)
|
||||
singleTaskToActivity(MainActivity::class.java)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,7 +13,7 @@ class PrivateContacts {
|
||||
|
||||
fun wallet(list:List<String>,walletBean: WalletBean?)
|
||||
|
||||
fun sendGiftResult(success:Boolean,imageView: ImageView)
|
||||
fun sendGiftResult(success:Boolean,idx: Int)
|
||||
|
||||
fun getGiftList(list: List<RoonGiftModel>)
|
||||
|
||||
@@ -25,7 +25,7 @@ class PrivateContacts {
|
||||
|
||||
fun getGiftList(roomId: String)
|
||||
|
||||
fun sendGift(mRoomId:String,giftId: String,mUserId:String,imageView: ImageView)
|
||||
fun sendGift(mRoomId:String,giftId: String,mUserId:String,idx: Int)
|
||||
|
||||
fun exitRoom(roomId: String?, userId: String?)
|
||||
|
||||
|
||||
@@ -7,6 +7,7 @@ import android.os.CountDownTimer
|
||||
import android.view.View
|
||||
import android.view.animation.LinearInterpolator
|
||||
import android.widget.ImageView
|
||||
import android.widget.TextView
|
||||
import com.blankj.utilcode.util.ActivityUtils
|
||||
import com.blankj.utilcode.util.LogUtils
|
||||
import com.blankj.utilcode.util.TimeUtils
|
||||
@@ -60,6 +61,7 @@ class RoomPrivateFragment(var mRoomInfoResp: RoomInfoResp?) :
|
||||
private var giftList: MutableList<RoonGiftModel> = arrayListOf()
|
||||
|
||||
private var giftViewList: MutableList<ImageView> = arrayListOf()
|
||||
private var giftTViewList: MutableList<TextView> = arrayListOf()
|
||||
|
||||
private var mCountDownTimer: CountDownTimer? = null
|
||||
|
||||
@@ -69,6 +71,7 @@ class RoomPrivateFragment(var mRoomInfoResp: RoomInfoResp?) :
|
||||
|
||||
override fun initView() {
|
||||
giftViewList.clear()
|
||||
giftTViewList.clear()
|
||||
giftViewList.add(mBinding?.ivGift1!!)
|
||||
giftViewList.add(mBinding?.ivGift2!!)
|
||||
giftViewList.add(mBinding?.ivGift3!!)
|
||||
@@ -76,7 +79,14 @@ class RoomPrivateFragment(var mRoomInfoResp: RoomInfoResp?) :
|
||||
giftViewList.add(mBinding?.ivGift5!!)
|
||||
giftViewList.add(mBinding?.ivGift6!!)
|
||||
|
||||
giftViewList.forEach { it ->
|
||||
giftTViewList.add(mBinding?.tvGift1!!)
|
||||
giftTViewList.add(mBinding?.tvGift2!!)
|
||||
giftTViewList.add(mBinding?.tvGift3!!)
|
||||
giftTViewList.add(mBinding?.tvGift4!!)
|
||||
giftTViewList.add(mBinding?.tvGift5!!)
|
||||
giftTViewList.add(mBinding?.tvGift6!!)
|
||||
|
||||
giftViewList.forEachIndexed { index, it ->
|
||||
it.setOnClickListener {
|
||||
if (sendGiftResult) {
|
||||
ToastUtils.showShort("手太快了,正在发送中...")
|
||||
@@ -84,8 +94,11 @@ class RoomPrivateFragment(var mRoomInfoResp: RoomInfoResp?) :
|
||||
}
|
||||
val sendGiftUserId = mBinding.rpwv2.pitBean.user_id
|
||||
|
||||
MvpPre.sendGift(mRoomId, it.tag.toString(), sendGiftUserId,it as ImageView)
|
||||
MvpPre.sendGift(mRoomId, it.tag.toString(), sendGiftUserId,index)
|
||||
it.visibility = View.INVISIBLE
|
||||
|
||||
giftTViewList[index].visibility = View.INVISIBLE
|
||||
|
||||
sendGiftResult = true
|
||||
}
|
||||
}
|
||||
@@ -176,12 +189,18 @@ class RoomPrivateFragment(var mRoomInfoResp: RoomInfoResp?) :
|
||||
|
||||
}
|
||||
|
||||
override fun sendGiftResult(success: Boolean,itemImage: ImageView) {
|
||||
@SuppressLint("SetTextI18n")
|
||||
override fun sendGiftResult(success: Boolean, idx: Int) {
|
||||
sendGiftResult = false
|
||||
|
||||
val itemImage = giftViewList[idx]
|
||||
val itemTextView = giftTViewList[idx]
|
||||
|
||||
// 随机选择一个礼物
|
||||
val showList = giftList.shuffled().take(1)
|
||||
val price = showList[0].gift_price.toInt()
|
||||
|
||||
itemTextView.text = price.toString()
|
||||
// 根据价格设置不同的宽高
|
||||
val (width, height) = when {
|
||||
price > 500 -> Pair(64, 64)
|
||||
@@ -204,8 +223,10 @@ class RoomPrivateFragment(var mRoomInfoResp: RoomInfoResp?) :
|
||||
.load(showList[0].base_image)
|
||||
.into(itemImage)
|
||||
itemImage.visibility = View.VISIBLE
|
||||
giftTViewList[idx].visibility = View.INVISIBLE
|
||||
}
|
||||
|
||||
@SuppressLint("SetTextI18n")
|
||||
override fun getGiftList(list: List<RoonGiftModel>) {
|
||||
if (list.isEmpty())
|
||||
return
|
||||
@@ -225,6 +246,7 @@ class RoomPrivateFragment(var mRoomInfoResp: RoomInfoResp?) :
|
||||
}else{
|
||||
showList[showList.size - 1].gift_price.toInt()
|
||||
}
|
||||
giftTViewList[i].text = price.toString()
|
||||
|
||||
itemImage.tag = if (showList.size > i){
|
||||
showList[i].gift_id
|
||||
@@ -255,6 +277,7 @@ class RoomPrivateFragment(var mRoomInfoResp: RoomInfoResp?) :
|
||||
Observable.timer(delay, TimeUnit.MILLISECONDS)
|
||||
.observeOn(AndroidSchedulers.mainThread()).subscribe {
|
||||
startSmallFloatingAnimation(giftViewList[i]) // 延迟后执行动画
|
||||
startSmallFloatingAnimation(giftTViewList[i]) // 延迟后执行动画
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
||||
@@ -44,7 +44,7 @@ class PrivatePresenter(context: Context, val view: PrivateContacts.View?) :
|
||||
})
|
||||
}
|
||||
|
||||
override fun sendGift(mRoomId:String,giftId: String,mUserId:String,imageView: ImageView) {
|
||||
override fun sendGift(mRoomId:String,giftId: String,mUserId:String,idx:Int) {
|
||||
RetrofitClient.getInstance().roomGift(mRoomId,giftId,"1",mUserId,"1","","","",object : BaseObserver<RoomGiftData>() {
|
||||
override fun onSubscribe(d: Disposable) {
|
||||
}
|
||||
@@ -53,7 +53,7 @@ class PrivatePresenter(context: Context, val view: PrivateContacts.View?) :
|
||||
if (MvpRef == null) {
|
||||
MvpRef = WeakReference(view)
|
||||
}
|
||||
MvpRef.get()?.sendGiftResult(true,imageView)
|
||||
MvpRef.get()?.sendGiftResult(true,idx)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
@@ -170,6 +170,18 @@
|
||||
app:layout_constraintEnd_toEndOf="@id/guide_line_midd"
|
||||
app:layout_constraintStart_toStartOf="@id/guide_line_left"
|
||||
app:layout_constraintTop_toTopOf="@id/guide_line_h_3" />
|
||||
<TextView
|
||||
android:id="@+id/tv_gift_1"
|
||||
android:drawableLeft="@mipmap/jinb"
|
||||
android:text="0"
|
||||
android:textColor="#FFDBEB23"
|
||||
android:textSize="@dimen/sp_12"
|
||||
android:drawablePadding="@dimen/dp_2"
|
||||
app:layout_constraintTop_toBottomOf="@id/iv_gift_1"
|
||||
app:layout_constraintStart_toStartOf="@id/guide_line_left"
|
||||
app:layout_constraintEnd_toEndOf="@id/guide_line_midd"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"/>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_gift_2"
|
||||
@@ -181,6 +193,19 @@
|
||||
app:layout_constraintStart_toStartOf="@id/guide_line_midd"
|
||||
app:layout_constraintTop_toTopOf="@id/guide_line_h_3" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_gift_2"
|
||||
android:drawableLeft="@mipmap/jinb"
|
||||
android:text="0"
|
||||
android:textColor="#FFDBEB23"
|
||||
android:textSize="@dimen/sp_12"
|
||||
android:drawablePadding="@dimen/dp_2"
|
||||
app:layout_constraintTop_toBottomOf="@id/iv_gift_2"
|
||||
app:layout_constraintStart_toStartOf="@id/guide_line_midd"
|
||||
app:layout_constraintEnd_toEndOf="@id/guide_line_right"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"/>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_gift_6"
|
||||
android:layout_width="wrap_content"
|
||||
@@ -191,6 +216,19 @@
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="@id/guide_line_h_4" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_gift_6"
|
||||
android:drawableLeft="@mipmap/jinb"
|
||||
android:text="0"
|
||||
android:textColor="#FFDBEB23"
|
||||
android:textSize="@dimen/sp_12"
|
||||
android:drawablePadding="@dimen/dp_2"
|
||||
app:layout_constraintTop_toBottomOf="@id/iv_gift_6"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="@id/guide_line_left"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"/>
|
||||
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_gift_5"
|
||||
@@ -202,6 +240,19 @@
|
||||
app:layout_constraintStart_toStartOf="@id/guide_line_left"
|
||||
app:layout_constraintTop_toTopOf="@id/guide_line_h_5" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_gift_5"
|
||||
android:drawableLeft="@mipmap/jinb"
|
||||
android:text="0"
|
||||
android:textColor="#FFDBEB23"
|
||||
android:textSize="@dimen/sp_12"
|
||||
android:drawablePadding="@dimen/dp_2"
|
||||
app:layout_constraintTop_toBottomOf="@id/iv_gift_5"
|
||||
app:layout_constraintStart_toStartOf="@id/guide_line_left"
|
||||
app:layout_constraintEnd_toEndOf="@id/guide_line_midd"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"/>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_gift_4"
|
||||
android:layout_width="wrap_content"
|
||||
@@ -212,7 +263,18 @@
|
||||
app:layout_constraintStart_toStartOf="@id/guide_line_midd"
|
||||
app:layout_constraintTop_toTopOf="@id/guide_line_h_5" />
|
||||
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_gift_4"
|
||||
android:drawableLeft="@mipmap/jinb"
|
||||
android:text="0"
|
||||
android:textColor="#FFDBEB23"
|
||||
android:textSize="@dimen/sp_12"
|
||||
android:drawablePadding="@dimen/dp_2"
|
||||
app:layout_constraintTop_toBottomOf="@id/iv_gift_4"
|
||||
app:layout_constraintStart_toStartOf="@id/guide_line_midd"
|
||||
app:layout_constraintEnd_toEndOf="@id/guide_line_right"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"/>
|
||||
<ImageView
|
||||
android:id="@+id/iv_gift_3"
|
||||
android:layout_width="wrap_content"
|
||||
@@ -223,6 +285,19 @@
|
||||
app:layout_constraintStart_toStartOf="@id/guide_line_right"
|
||||
app:layout_constraintTop_toTopOf="@id/guide_line_h_4" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_gift_3"
|
||||
android:drawableLeft="@mipmap/jinb"
|
||||
android:text="0"
|
||||
android:textColor="#FFDBEB23"
|
||||
android:textSize="@dimen/sp_12"
|
||||
android:drawablePadding="@dimen/dp_2"
|
||||
app:layout_constraintTop_toBottomOf="@id/iv_gift_3"
|
||||
app:layout_constraintStart_toStartOf="@id/guide_line_right"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"/>
|
||||
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
</layout>
|
||||
Reference in New Issue
Block a user