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