邀请列表查看详情数据格式不一致导致无法显示昵称的问题
This commit is contained in:
@@ -1,48 +1,51 @@
|
||||
package com.yizhuan.erban.relation.cp
|
||||
|
||||
import com.yizhuan.xchat_android_core.relation.cp.CpInviteDetailEntity
|
||||
import com.yizhuan.xchat_android_core.relation.cp.CpInviteInfo
|
||||
import com.yizhuan.xchat_android_core.relation.cp.UserCpListEntity
|
||||
|
||||
object CpDataParser {
|
||||
fun inviteMsg2cpListEntity(msgEntity: CpInviteInfo) = UserCpListEntity(
|
||||
msgEntity.acceptUid,
|
||||
fun inviteMsg2cpDetailEntity(msgEntity: CpInviteInfo) = CpInviteDetailEntity(
|
||||
msgEntity.acceptAvatar,
|
||||
msgEntity.acceptNick,
|
||||
msgEntity.acceptGender,
|
||||
msgEntity.replyExpireTime.toLong(),
|
||||
msgEntity.declaration,
|
||||
msgEntity.acceptNick,
|
||||
msgEntity.acceptUid,
|
||||
msgEntity.cpId,
|
||||
msgEntity.replyExpireTime,
|
||||
0,
|
||||
msgEntity.inviteUid,
|
||||
msgEntity.declaration,
|
||||
msgEntity.inviteAvatar,
|
||||
msgEntity.inviteNick,
|
||||
msgEntity.inviteGender,
|
||||
0,
|
||||
msgEntity.inviteNick,
|
||||
msgEntity.inviteUid,
|
||||
msgEntity.propsId,
|
||||
msgEntity.propsImg,
|
||||
msgEntity.propsName,
|
||||
msgEntity.propsPrice,
|
||||
0,
|
||||
0,
|
||||
msgEntity.replyExpireTime.toLong()
|
||||
msgEntity.recommenTxtList,
|
||||
msgEntity.replyExpireTime
|
||||
)
|
||||
|
||||
/**
|
||||
* val replyExpireTime: String,
|
||||
val inviteUid: Long,
|
||||
val inviteAvatar: String,
|
||||
val inviteNick: String,
|
||||
val inviteGender: Int,
|
||||
val acceptUid: Long,
|
||||
val acceptAvatar: String,
|
||||
val acceptNick: String,
|
||||
val acceptGender: Int,
|
||||
val propsId: Int,
|
||||
val propsName: String,
|
||||
val propsImg: String,
|
||||
val propsPrice: String,
|
||||
val recommenTxtList: List<String>,
|
||||
val recommenTxt: String
|
||||
* data class CpInviteDetailEntity(
|
||||
*
|
||||
val acceptAvatar: String? = "",
|
||||
val acceptGender: Int = 1,
|
||||
val acceptNick: String = "",
|
||||
val acceptUid: Long = 0,
|
||||
|
||||
val cpId: Int = 0,
|
||||
val declaration: String = "",
|
||||
|
||||
val inviteAvatar: String? = null,
|
||||
val inviteGender: Int = 1,
|
||||
val inviteNick: String = "",
|
||||
val inviteUid: Long = 0,
|
||||
|
||||
val propsId: Int = 0,
|
||||
val propsImg: String = "",
|
||||
val propsName: String = "",
|
||||
val propsPrice: Double = 0.0,
|
||||
val recommenTxtList: List<String>? = null,
|
||||
val replyExpireTime: Int = 0
|
||||
)
|
||||
*/
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -19,6 +19,7 @@ import com.yizhuan.erban.relation.cp.dialog.CpInviteReplyDialog
|
||||
import com.yizhuan.erban.relation.cp.viewmodel.CpViewModel
|
||||
import com.yizhuan.erban.ui.widget.dialog.CommonTipDialog
|
||||
import com.yizhuan.xchat_android_core.relation.cp.CpBindUnbindEvent
|
||||
import com.yizhuan.xchat_android_core.relation.cp.CpInviteDetailEntity
|
||||
import com.yizhuan.xchat_android_core.relation.cp.UserCpListEntity
|
||||
import com.yizhuan.xchat_android_library.annatation.ActLayoutRes
|
||||
import org.greenrobot.eventbus.EventBus
|
||||
@@ -37,7 +38,7 @@ class CpInviteRecordActivity : BaseBindingActivity<ActivityCpInviteRecordBinding
|
||||
val needAlert = intent.getBooleanExtra("needAlert", false)
|
||||
if (needAlert) {
|
||||
CpDataManager.get().cpInviteInfo?.let {
|
||||
showReplyDialog(CpDataParser.inviteMsg2cpListEntity(it))
|
||||
showReplyDialog(CpDataParser.inviteMsg2cpDetailEntity(it))
|
||||
}
|
||||
}
|
||||
initRecyclerView()
|
||||
@@ -64,7 +65,7 @@ class CpInviteRecordActivity : BaseBindingActivity<ActivityCpInviteRecordBinding
|
||||
}
|
||||
}
|
||||
|
||||
private fun showReplyDialog(item: UserCpListEntity) {
|
||||
private fun showReplyDialog(item: CpInviteDetailEntity) {
|
||||
CpInviteReplyDialog(context).apply {
|
||||
cpInviteData = item
|
||||
listener = object : CpInviteReplyDialog.ReplyListener {
|
||||
@@ -112,11 +113,11 @@ class CpInviteRecordActivity : BaseBindingActivity<ActivityCpInviteRecordBinding
|
||||
}
|
||||
}
|
||||
|
||||
private fun showConfirmDialog(item: UserCpListEntity, isAgree: Boolean) {
|
||||
private fun showConfirmDialog(item: CpInviteDetailEntity, isAgree: Boolean) {
|
||||
val shb = CpViewHelper.getColorSpan(
|
||||
"是否${if (isAgree) "同意" else "拒绝"}与${item.inviteUserNick}成为CP?\n",
|
||||
"是否${if (isAgree) "同意" else "拒绝"}与${item.inviteNick}成为CP?\n",
|
||||
Color.parseColor("#4C5AF1"),
|
||||
5, 5 + item.inviteUserNick.length
|
||||
5, 5 + item.inviteNick.length
|
||||
)
|
||||
if (isAgree) {
|
||||
val str = "(同意将自动拒绝其他邀请)"
|
||||
|
@@ -11,8 +11,7 @@ import com.yizhuan.erban.relation.cp.CpViewHelper.getColorSpan
|
||||
import com.yizhuan.erban.relation.extention.toTimeString
|
||||
import com.yizhuan.erban.treasure_box.widget.dialog.BaseBindingDialog
|
||||
import com.yizhuan.erban.ui.utils.ImageLoadUtilsV2
|
||||
import com.yizhuan.erban.utils.TimeUiUtils
|
||||
import com.yizhuan.xchat_android_core.relation.cp.UserCpListEntity
|
||||
import com.yizhuan.xchat_android_core.relation.cp.CpInviteDetailEntity
|
||||
import com.yizhuan.xchat_android_library.annatation.ActLayoutRes
|
||||
import io.reactivex.*
|
||||
import io.reactivex.android.schedulers.AndroidSchedulers
|
||||
@@ -29,7 +28,7 @@ class CpInviteReplyDialog(context: Context) :
|
||||
CompositeDisposable()
|
||||
}
|
||||
|
||||
var cpInviteData: UserCpListEntity? = null
|
||||
var cpInviteData: CpInviteDetailEntity? = null
|
||||
var listener: ReplyListener? = null
|
||||
override fun init() {
|
||||
width = ((292f / 375) * ScreenUtil.screenWidth).toInt()
|
||||
@@ -39,13 +38,13 @@ class CpInviteReplyDialog(context: Context) :
|
||||
}
|
||||
}
|
||||
|
||||
private fun setPage(data: UserCpListEntity) {
|
||||
private fun setPage(data: CpInviteDetailEntity) {
|
||||
|
||||
binding.tvDialogTitle.text = getColorSpan(
|
||||
"${data.inviteUserNick}邀请你达成CP关系,是否同意?",
|
||||
"${data.inviteNick}邀请你达成CP关系,是否同意?",
|
||||
Color.parseColor("#4C5AF1"),
|
||||
0,
|
||||
data.inviteUserNick.length
|
||||
data.inviteNick.length
|
||||
)
|
||||
CpViewHelper.setInviteGiftPriceStyle(
|
||||
context,
|
||||
|
@@ -110,5 +110,5 @@ interface Api {
|
||||
@GET("/user/couple/cpRecordDetail")
|
||||
suspend fun inviteRecordDetail(
|
||||
@Query("cpId") cpId: Int
|
||||
): ServiceResult<UserCpListEntity>
|
||||
): ServiceResult<CpInviteDetailEntity>
|
||||
}
|
@@ -62,7 +62,7 @@ object CpModel : BaseModel() {
|
||||
launchRequest {
|
||||
api.cpTaskProcess(uid)
|
||||
}
|
||||
suspend fun cpInviteDetail(cpId: Int): UserCpListEntity? =
|
||||
suspend fun cpInviteDetail(cpId: Int): CpInviteDetailEntity? =
|
||||
launchRequest {
|
||||
api.inviteRecordDetail(cpId)
|
||||
}
|
||||
|
@@ -40,8 +40,8 @@ class CpViewModel : BaseViewModel() {
|
||||
val cpTaskData: LiveData<CpTaskEntity> = _cpTaskData
|
||||
|
||||
//记录详情
|
||||
private val _cpInviteDetailData: MutableLiveData<UserCpListEntity> = MutableLiveData()
|
||||
val cpInviteDetailData: LiveData<UserCpListEntity> = _cpInviteDetailData
|
||||
private val _cpInviteDetailData: MutableLiveData<CpInviteDetailEntity> = MutableLiveData()
|
||||
val cpInviteDetailData: LiveData<CpInviteDetailEntity> = _cpInviteDetailData
|
||||
|
||||
fun getCpInvitePageData(acceptUid: Long) {
|
||||
_loadingLiveData.value = true
|
||||
@@ -160,6 +160,7 @@ class CpViewModel : BaseViewModel() {
|
||||
}
|
||||
|
||||
fun unBindCp() {
|
||||
_loadingLiveData.value = true
|
||||
safeLaunch(
|
||||
onError = dealCpDataError,
|
||||
block = {
|
||||
@@ -171,6 +172,7 @@ class CpViewModel : BaseViewModel() {
|
||||
}
|
||||
|
||||
fun cpTaskProcess(uid: Long) {
|
||||
_loadingLiveData.value = true
|
||||
safeLaunch(
|
||||
onError = dealCpDataError,
|
||||
block = {
|
||||
@@ -181,6 +183,7 @@ class CpViewModel : BaseViewModel() {
|
||||
}
|
||||
|
||||
fun getCpInviteDetail(cpId:Int){
|
||||
_loadingLiveData.value = true
|
||||
safeLaunch(
|
||||
onError = dealCpDataError,
|
||||
block = {
|
||||
|
@@ -0,0 +1,20 @@
|
||||
package com.yizhuan.xchat_android_core.relation.cp
|
||||
|
||||
data class CpInviteDetailEntity(
|
||||
val acceptAvatar: String? = "",
|
||||
val acceptGender: Int = 1,
|
||||
val acceptNick: String = "",
|
||||
val acceptUid: Long = 0,
|
||||
val cpId: Int = 0,
|
||||
val declaration: String = "",
|
||||
val inviteAvatar: String? = null,
|
||||
val inviteGender: Int = 1,
|
||||
val inviteNick: String = "",
|
||||
val inviteUid: Long = 0,
|
||||
val propsId: Int = 0,
|
||||
val propsImg: String = "",
|
||||
val propsName: String = "",
|
||||
val propsPrice: Double = 0.0,
|
||||
val recommenTxtList: List<String>? = null,
|
||||
val replyExpireTime: Int = 0
|
||||
)
|
@@ -1,7 +1,5 @@
|
||||
package com.yizhuan.xchat_android_core.relation.cp
|
||||
|
||||
import com.google.gson.annotations.SerializedName
|
||||
|
||||
data class UserCpListEntity(
|
||||
val acceptUid: Long = 0,
|
||||
val acceptUserAvatar: String = "",
|
||||
@@ -21,7 +19,7 @@ data class UserCpListEntity(
|
||||
val propsImg: String = "",
|
||||
val propsName: String = "",
|
||||
val propsPrice: Double = 0.0,
|
||||
val state: Int = 0,//状态:1-邀请中,2-CP中,3-拒绝,4-解绑中,5-解绑完成
|
||||
val state: Int = 0,//状态:1-邀请中,2-CP中,3-拒绝,4-解绑中,5-解绑完成 6 已过期
|
||||
val unboundUid: Int = 0,//解绑人
|
||||
val updateTime: Long = 0
|
||||
)
|
Reference in New Issue
Block a user