|
@@ -47,8 +47,18 @@ class ChatDetailActivity : BaseXActivity<ActivityChatDetailBinding>() {
|
|
|
@JvmField
|
|
|
var chatName: String = ""
|
|
|
|
|
|
+ @Autowired(required = true)
|
|
|
+ @JvmField
|
|
|
+ var chatSpecial: String = ""
|
|
|
+
|
|
|
+ @Autowired(required = true)
|
|
|
+ @JvmField
|
|
|
+ var headSpecial: String = ""
|
|
|
+
|
|
|
private var svgaParser:SVGAParser? = null
|
|
|
|
|
|
+ private var messageRecyclerView:MessageLayout?=null
|
|
|
+
|
|
|
override fun onCreate(savedInstanceState: Bundle?) {
|
|
|
super.onCreate(savedInstanceState)
|
|
|
ImmersionBar.with(this)
|
|
@@ -66,9 +76,6 @@ class ChatDetailActivity : BaseXActivity<ActivityChatDetailBinding>() {
|
|
|
ARouter.getInstance().inject(this)
|
|
|
|
|
|
svgaParser = SVGAParser(this)
|
|
|
- if (!TextUtils.isEmpty(account)){
|
|
|
- userVm.getOtherUserInfo(account,"")
|
|
|
- }
|
|
|
val chatInfo = ChatInfo()
|
|
|
chatInfo.type = V2TIMConversation.V2TIM_C2C
|
|
|
chatInfo.chatName = chatName
|
|
@@ -92,7 +99,7 @@ class ChatDetailActivity : BaseXActivity<ActivityChatDetailBinding>() {
|
|
|
SpUtil.putString("user_info", Gson().toJson(it))
|
|
|
}
|
|
|
|
|
|
- val messageRecyclerView = binding.chatLayout.messageLayout
|
|
|
+ messageRecyclerView = binding.chatLayout.messageLayout
|
|
|
messageRecyclerView?.setOnItemClickListener(object : MessageLayout.OnItemLongClickListener{
|
|
|
override fun onMessageLongClick(view: View?, position: Int, messageInfo: MessageInfo?) {
|
|
|
|
|
@@ -131,40 +138,33 @@ class ChatDetailActivity : BaseXActivity<ActivityChatDetailBinding>() {
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- } else {
|
|
|
- messageRecyclerView?.rightBubble = ContextCompat.getDrawable(this ,R.mipmap.bg_chat_purple)
|
|
|
}
|
|
|
|
|
|
- userVm.otherUserInfoLiveData.observe(this){
|
|
|
- if (TextUtils.isEmpty(it.android_chat_special)){
|
|
|
- messageRecyclerView?.leftBubble = ContextCompat.getDrawable(this ,R.mipmap.bg_chat_white)
|
|
|
- } else {
|
|
|
- DianJiuUtil.loadDian9Tu(this ,it.android_chat_special ){ drawable ->
|
|
|
- drawable?.let {
|
|
|
- messageRecyclerView?.leftBubble = it
|
|
|
- }
|
|
|
+ if (!TextUtils.isEmpty(chatSpecial)){
|
|
|
+ DianJiuUtil.loadDian9Tu(this ,chatSpecial){ drawable ->
|
|
|
+ drawable?.let {
|
|
|
+ messageRecyclerView?.leftBubble = it
|
|
|
}
|
|
|
}
|
|
|
- if (!TextUtils.isEmpty(it.android_head_special)){
|
|
|
- svgaParser?.decodeFromURL(URL(it.android_head_special), object :SVGAParser.ParseCompletion{
|
|
|
- override fun onComplete(videoItem: SVGAVideoEntity) {
|
|
|
- val drawable = SVGADrawable(videoItem)
|
|
|
- messageRecyclerView?.leftSvgaAvatar = drawable
|
|
|
- }
|
|
|
+ }
|
|
|
|
|
|
- override fun onError() {
|
|
|
+ if (!TextUtils.isEmpty(headSpecial)){
|
|
|
+ svgaParser?.decodeFromURL(URL(headSpecial), object :SVGAParser.ParseCompletion{
|
|
|
+ override fun onComplete(videoItem: SVGAVideoEntity) {
|
|
|
+ messageRecyclerView?.leftSvgaAvatar = videoItem
|
|
|
+ }
|
|
|
|
|
|
- }
|
|
|
- })
|
|
|
- }
|
|
|
+ override fun onError() {
|
|
|
+
|
|
|
+ }
|
|
|
+ })
|
|
|
}
|
|
|
|
|
|
if (UserInfo.getUserInfo() != null && !TextUtils.isEmpty(UserInfo.getUserInfo()?.android_head_special)){
|
|
|
UserInfo.getUserInfo()?.android_head_special?.let {
|
|
|
svgaParser?.decodeFromURL(URL(it), object :SVGAParser.ParseCompletion{
|
|
|
override fun onComplete(videoItem: SVGAVideoEntity) {
|
|
|
- val drawable = SVGADrawable(videoItem)
|
|
|
- messageRecyclerView?.rightSvgaAvatar = drawable
|
|
|
+ messageRecyclerView?.rightSvgaAvatar = videoItem
|
|
|
}
|
|
|
|
|
|
override fun onError() {
|
|
@@ -185,7 +185,9 @@ class ChatDetailActivity : BaseXActivity<ActivityChatDetailBinding>() {
|
|
|
|
|
|
override fun onDestroy() {
|
|
|
super.onDestroy()
|
|
|
-
|
|
|
+ messageRecyclerView?.leftSvgaAvatar = null
|
|
|
+ messageRecyclerView?.rightSvgaAvatar = null
|
|
|
+ messageRecyclerView = null
|
|
|
}
|
|
|
|
|
|
}
|