邀请记录增加详情接口 修改礼物价格显示
This commit is contained in:
@@ -5,11 +5,27 @@ import com.yizhuan.xchat_android_core.relation.cp.UserCpListEntity
|
||||
|
||||
object CpDataParser {
|
||||
fun inviteMsg2cpListEntity(msgEntity: CpInviteInfo) = UserCpListEntity(
|
||||
msgEntity.acceptUid, msgEntity.acceptAvatar, msgEntity.acceptNick,
|
||||
msgEntity.acceptGender, msgEntity.replyExpireTime.toLong(), msgEntity.declaration,
|
||||
msgEntity.cpId,msgEntity.replyExpireTime,0, msgEntity.inviteUid, msgEntity.inviteAvatar, msgEntity.inviteNick,
|
||||
msgEntity.inviteGender, 0, msgEntity.propsId, msgEntity.propsImg,
|
||||
msgEntity.propsName, msgEntity.propsPrice, 0, 0, msgEntity.replyExpireTime.toLong()
|
||||
msgEntity.acceptUid,
|
||||
msgEntity.acceptAvatar,
|
||||
msgEntity.acceptNick,
|
||||
msgEntity.acceptGender,
|
||||
msgEntity.replyExpireTime.toLong(),
|
||||
msgEntity.declaration,
|
||||
msgEntity.cpId,
|
||||
msgEntity.replyExpireTime,
|
||||
0,
|
||||
msgEntity.inviteUid,
|
||||
msgEntity.inviteAvatar,
|
||||
msgEntity.inviteNick,
|
||||
msgEntity.inviteGender,
|
||||
0,
|
||||
msgEntity.propsId,
|
||||
msgEntity.propsImg,
|
||||
msgEntity.propsName,
|
||||
msgEntity.propsPrice,
|
||||
0,
|
||||
0,
|
||||
msgEntity.replyExpireTime.toLong()
|
||||
)
|
||||
|
||||
/**
|
||||
|
@@ -59,6 +59,9 @@ class CpInviteRecordActivity : BaseBindingActivity<ActivityCpInviteRecordBinding
|
||||
mBinding.swipeRefresh.isRefreshing = false
|
||||
}
|
||||
}
|
||||
vm.cpInviteDetailData.observe(this) {
|
||||
showReplyDialog(it)
|
||||
}
|
||||
}
|
||||
|
||||
private fun showReplyDialog(item: UserCpListEntity) {
|
||||
@@ -72,6 +75,10 @@ class CpInviteRecordActivity : BaseBindingActivity<ActivityCpInviteRecordBinding
|
||||
override fun onRefuse() {
|
||||
showConfirmDialog(item, false)
|
||||
}
|
||||
|
||||
override fun onTimeOut() {
|
||||
queryRecord(type)
|
||||
}
|
||||
}
|
||||
openDialog()
|
||||
}
|
||||
@@ -81,7 +88,7 @@ class CpInviteRecordActivity : BaseBindingActivity<ActivityCpInviteRecordBinding
|
||||
adapter = InviteRecordAdapter(this)
|
||||
adapter.onVisitClickListener = object : InviteRecordAdapter.OnVisitClickListener {
|
||||
override fun onVisitClick(item: UserCpListEntity) {
|
||||
showReplyDialog(item)
|
||||
vm.getCpInviteDetail(item.cpId)
|
||||
}
|
||||
}
|
||||
val layoutManager = LinearLayoutManager(this, LinearLayoutManager.VERTICAL, false)
|
||||
@@ -109,7 +116,7 @@ class CpInviteRecordActivity : BaseBindingActivity<ActivityCpInviteRecordBinding
|
||||
val shb = CpViewHelper.getColorSpan(
|
||||
"是否${if (isAgree) "同意" else "拒绝"}与${item.inviteUserNick}成为CP?\n",
|
||||
Color.parseColor("#4C5AF1"),
|
||||
5, item.inviteUserNick.length
|
||||
5, 5 + item.inviteUserNick.length
|
||||
)
|
||||
if (isAgree) {
|
||||
val str = "(同意将自动拒绝其他邀请)"
|
||||
|
@@ -67,8 +67,12 @@ class CpInvitePageDialog(context: Context) : View.OnClickListener,
|
||||
hint = builder
|
||||
}
|
||||
|
||||
binding.tvPrice.apply {
|
||||
CpViewHelper.setInviteGiftPriceStyle(context, invitePageEntity?.propsPrice ?: "", this)
|
||||
invitePageEntity?.let {
|
||||
CpViewHelper.setInviteGiftPriceStyle(
|
||||
context,
|
||||
it.propsPrice.toInt().toString(),
|
||||
binding.tvPrice
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -47,7 +47,11 @@ class CpInviteReplyDialog(context: Context) :
|
||||
0,
|
||||
data.inviteUserNick.length
|
||||
)
|
||||
CpViewHelper.setInviteGiftPriceStyle(context, data.propsPrice, binding.tvPrice)
|
||||
CpViewHelper.setInviteGiftPriceStyle(
|
||||
context,
|
||||
data.propsPrice.toInt().toString(),
|
||||
binding.tvPrice
|
||||
)
|
||||
binding.tvDeclaration.text = data.declaration
|
||||
ImageLoadUtilsV2.loadImage(binding.ivGift, cpInviteData?.propsImg)
|
||||
}
|
||||
@@ -84,7 +88,12 @@ class CpInviteReplyDialog(context: Context) :
|
||||
}
|
||||
|
||||
override fun onNext(t: Long) {
|
||||
val remain = (r - t).toInt()
|
||||
var remain = (r - t).toInt()
|
||||
if (remain <= 0) {
|
||||
remain = 0
|
||||
stopCountDown()
|
||||
listener?.onTimeOut()
|
||||
}
|
||||
val h = remain / 3600
|
||||
val m = (remain % 3600) / 60
|
||||
val s = remain % 3600 % 60
|
||||
@@ -118,5 +127,6 @@ class CpInviteReplyDialog(context: Context) :
|
||||
interface ReplyListener {
|
||||
fun onAgree()
|
||||
fun onRefuse()
|
||||
fun onTimeOut()//计时过期
|
||||
}
|
||||
}
|
@@ -102,4 +102,13 @@ interface Api {
|
||||
suspend fun cpTaskProcess(
|
||||
@Query("uid") uid: Long
|
||||
): ServiceResult<CpTaskEntity>
|
||||
|
||||
/**
|
||||
* 邀请记录详情
|
||||
* /user/couple/cpRecordDetail
|
||||
*/
|
||||
@GET("/user/couple/cpRecordDetail")
|
||||
suspend fun inviteRecordDetail(
|
||||
@Query("cpId") cpId: Int
|
||||
): ServiceResult<UserCpListEntity>
|
||||
}
|
@@ -62,6 +62,10 @@ object CpModel : BaseModel() {
|
||||
launchRequest {
|
||||
api.cpTaskProcess(uid)
|
||||
}
|
||||
suspend fun cpInviteDetail(cpId: Int): UserCpListEntity? =
|
||||
launchRequest {
|
||||
api.inviteRecordDetail(cpId)
|
||||
}
|
||||
|
||||
|
||||
}
|
@@ -39,6 +39,10 @@ class CpViewModel : BaseViewModel() {
|
||||
private val _cpTaskData: MutableLiveData<CpTaskEntity> = MutableLiveData()
|
||||
val cpTaskData: LiveData<CpTaskEntity> = _cpTaskData
|
||||
|
||||
//记录详情
|
||||
private val _cpInviteDetailData: MutableLiveData<UserCpListEntity> = MutableLiveData()
|
||||
val cpInviteDetailData: LiveData<UserCpListEntity> = _cpInviteDetailData
|
||||
|
||||
fun getCpInvitePageData(acceptUid: Long) {
|
||||
_loadingLiveData.value = true
|
||||
safeLaunch(
|
||||
@@ -175,6 +179,16 @@ class CpViewModel : BaseViewModel() {
|
||||
)
|
||||
}
|
||||
|
||||
fun getCpInviteDetail(cpId:Int){
|
||||
safeLaunch(
|
||||
onError = dealCpDataError,
|
||||
block = {
|
||||
_cpInviteDetailData.value = CpModel.cpInviteDetail(cpId)
|
||||
_loadingLiveData.value = false
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
private val dealCpDataError: (e: Throwable) -> Unit = {
|
||||
_loadingLiveData.value = false
|
||||
it.message.toast()
|
||||
|
@@ -81,7 +81,7 @@
|
||||
android:layout_marginTop="1dp"
|
||||
android:background="@drawable/bg_invite_dialog_price"
|
||||
android:gravity="center"
|
||||
android:text="邀请函\n52000钻石"
|
||||
tools:text="邀请函\n52000钻石"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="@dimen/sp_13"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
|
@@ -21,7 +21,7 @@ data class CpInviteInfo(
|
||||
val propsId: Int = 0,
|
||||
val propsName: String = "",
|
||||
val propsImg: String = "",
|
||||
val propsPrice: String = "",
|
||||
val propsPrice: Double=0.0,
|
||||
val recommenTxtList: List<String>? = null,
|
||||
val declaration: String = ""
|
||||
)
|
@@ -17,7 +17,7 @@ data class CpInvitePageEntity(
|
||||
val propsId: Int=0,
|
||||
val propsImg: String="",
|
||||
val propsName: String="",
|
||||
val propsPrice: String="",
|
||||
val propsPrice: Double=0.0,
|
||||
val recommenTxtList:List<String>?=null,
|
||||
val recommenTxt:String=""
|
||||
)
|
@@ -1,15 +1,17 @@
|
||||
package com.yizhuan.xchat_android_core.relation.cp
|
||||
|
||||
import com.google.gson.annotations.SerializedName
|
||||
|
||||
data class UserCpListEntity(
|
||||
val acceptUid: Long = 0,
|
||||
val acceptUserAvatar: String = "",
|
||||
val acceptUserNick: String = "",
|
||||
val acceptUserSex: Int = 0,//1-男 2女
|
||||
val createTime: Long=0,
|
||||
val createTime: Long = 0,
|
||||
val declaration: String = "",//关系誓言
|
||||
val cpId: Int = 0,//邀请记录id
|
||||
val replyExpireTime: Int = 0,
|
||||
val acceptTime:Long=0,
|
||||
val acceptTime: Long = 0,
|
||||
val inviteUid: Long = 0,//邀请人uid
|
||||
val inviteUserAvatar: String = "",//邀请方头像
|
||||
val inviteUserNick: String = "",
|
||||
@@ -18,7 +20,7 @@ data class UserCpListEntity(
|
||||
val propsId: Int = 0,
|
||||
val propsImg: String = "",
|
||||
val propsName: String = "",
|
||||
val propsPrice: String = "",
|
||||
val propsPrice: Double = 0.0,
|
||||
val state: Int = 0,//状态:1-邀请中,2-CP中,3-拒绝,4-解绑中,5-解绑完成
|
||||
val unboundUid: Int = 0,//解绑人
|
||||
val updateTime: Long = 0
|
||||
|
Reference in New Issue
Block a user