tongmengxiao 6 months ago
parent
commit
87f8430518

+ 2 - 1
baseswago/src/main/java/com/swago/baseswago/model/live/audio/AudioSendGiftModel.kt

@@ -30,7 +30,8 @@ data class AudioSendGiftModel(
     val senderAvatar:String,
     val im_data: ImData,
     val isCombo: Int,
-    val senderCode: String
+    val senderCode: String,
+    val androidHeadSpecial: String
 )
 
 data class Receiver(

+ 9 - 0
baseswago/src/main/java/com/swago/baseswago/model/live/gift/IMGiftModel.java

@@ -57,6 +57,7 @@ public class IMGiftModel implements IPiaoTiao {
     private String userWealthJingyanValue;
 
     private String nextWealthNeedJingyan;
+    private String androidHeadSpecial;
 
     public String getRoomId() {
         return roomId;
@@ -250,4 +251,12 @@ public class IMGiftModel implements IPiaoTiao {
     public void setNextWealthNeedJingyan(String nextWealthNeedJingyan) {
         this.nextWealthNeedJingyan = nextWealthNeedJingyan;
     }
+
+    public String getAndroidHeadSpecial() {
+        return androidHeadSpecial;
+    }
+
+    public void setAndroidHeadSpecial(String androidHeadSpecial) {
+        this.androidHeadSpecial = androidHeadSpecial;
+    }
 }

+ 29 - 7
home/src/main/java/com/swago/home/MessageFragment.kt

@@ -13,6 +13,8 @@ import com.swago.baseswago.constant.ARouteConstant
 import com.swago.baseswago.dialog.ChoiceDialogFragment
 import com.swago.baseswago.fragment.BaseXFragment
 import com.swago.baseswago.util.AppContext
+import com.swago.baseswago.util.DianJiuUtil
+import com.swago.baseswago.util.LogUtil
 import com.swago.baseswago.util.NoDoubleClickListener
 import com.swago.home.databinding.FragmentMessageBinding
 import com.swago.home.official.OfficialMessageActivity
@@ -29,6 +31,7 @@ class MessageFragment : BaseXFragment<FragmentMessageBinding>() {
     private val userVm by viewModels<UserVm>()
     private val officialVm by activityViewModels<OfficialVm>()
     private var conversationInfo: ConversationInfo ?= null
+    private var jumpDetail = true
 
     override fun loadData() {
         officialVm.getMsgSum()
@@ -89,13 +92,32 @@ class MessageFragment : BaseXFragment<FragmentMessageBinding>() {
             }
         }
         userVm.otherUserInfoLiveData.observe(this){
-            ARouter.getInstance().build(ARouteConstant.Home.chatDetail)
-                .withInt("type", V2TIMConversation.V2TIM_C2C)
-                .withString("account", conversationInfo?.id)
-                .withString("chatName", conversationInfo?.title)
-                .withString("chatSpecial" , it.android_chat_special)
-                .withString("headSpecial" , it.android_head_special)
-                .navigation()
+            LogUtil.d("otherUserInfoLiveData")
+            if (it != null && jumpDetail){
+                jumpDetail = false
+                ARouter.getInstance().build(ARouteConstant.Home.chatDetail)
+                    .withInt("type", V2TIMConversation.V2TIM_C2C)
+                    .withString("account", conversationInfo?.id)
+                    .withString("chatName", conversationInfo?.title)
+                    .withString("chatSpecial" , it.android_chat_special)
+                    .withString("headSpecial" , it.android_head_special)
+                    .navigation()
+
+//                if (!it.android_chat_special.isNullOrEmpty()){
+//                    DianJiuUtil.loadDian9Tu(AppContext.getContext() ,it.android_head_special){}
+//                }
+//                if (!UserInfo.getUserInfo()?.android_chat_special.isNullOrEmpty()){
+//                    UserInfo.getUserInfo()?.android_chat_special?.let {chatUrl ->
+//                        DianJiuUtil.loadDian9Tu(AppContext.getContext() ,chatUrl){}
+//                    }
+//                }
+            }
+
         }
     }
+
+    override fun onResume() {
+        super.onResume()
+        jumpDetail = true
+    }
 }

+ 2 - 2
home/src/main/res/layout/fragment_mine.xml

@@ -363,7 +363,7 @@
             android:id="@+id/tvXStore"
             android:layout_width="wrap_content"
             android:layout_height="wrap_content"
-            android:drawableTop="@mipmap/icon_my_store"
+            android:drawableTop="@mipmap/icon_my_outfit"
             android:drawablePadding="2dp"
             android:text="@string/mall"
             android:textColor="#131B23"
@@ -378,7 +378,7 @@
             android:id="@+id/tvXoutfit"
             android:layout_width="wrap_content"
             android:layout_height="wrap_content"
-            android:drawableTop="@mipmap/icon_my_outfit"
+            android:drawableTop="@mipmap/icon_my_store"
             android:drawablePadding="2dp"
             android:text="@string/dress_up"
             android:textColor="#131B23"

+ 4 - 0
room/src/main/java/com/swago/room/audio/AudioSeatAdapter.kt

@@ -1,5 +1,6 @@
 package com.swago.room.audio
 
+import android.view.View
 import com.chad.library.adapter.base.BaseQuickAdapter
 import com.chad.library.adapter.base.BaseViewHolder
 import com.opensource.svgaplayer.SVGADrawable
@@ -58,6 +59,7 @@ class AudioSeatAdapter :
                     }
 
                     if (!it.head_special.isNullOrEmpty()){
+                        svgAvatar.visibility = View.VISIBLE
                         svgaParser.decodeFromURL(URL(it.head_special), object :SVGAParser.ParseCompletion{
                             override fun onComplete(videoItem: SVGAVideoEntity) {
                                 val drawable = SVGADrawable(videoItem)
@@ -68,6 +70,8 @@ class AudioSeatAdapter :
                             override fun onError() {
                             }
                         })
+                    } else {
+                        svgAvatar.visibility = View.INVISIBLE
                     }
 
                 }

+ 23 - 4
room/src/main/java/com/swago/room/base/BaseComFragment.kt

@@ -249,7 +249,6 @@ abstract class BaseComFragment<T : FragmentBaseComBinding> : BaseXFragment<T>(),
             while (isActive){
                 SwagoRoomManager.iRoomInfo?.let {
                     if (it.getRoomType() == RoomType.AUDIO.type){
-                        LogUtil.d("coroutineScope BaseComFragment ")
                         roomVm.getAudioList(it.getAnchorId(), 2)
                     }
                 }
@@ -477,7 +476,24 @@ abstract class BaseComFragment<T : FragmentBaseComBinding> : BaseXFragment<T>(),
                 this.showUserInfo = {userid ->
                    PersonDataDFragment.newInstance(userid,
                        isAnchor = false,
-                       inRoom = true).show(this@BaseComFragment.childFragmentManager,"PersonDataDFragment")
+                       inRoom = true).apply {
+                       this.openGiftIconDialog = { nickName, userId ,nickIcon->
+                           openGiftDialog(nickName, userId)
+                       }
+                       this.sendMsgInRoom = {
+                           if (isForbid) {
+                               Toast.makeText(
+                                   AppContext.getContext(),
+                                   AppContext.getContext().resources.getString(
+                                       R.string.you_are_been_forbid
+                                   ),
+                                   Toast.LENGTH_SHORT
+                               ).show()
+                           } else {
+                               openSendMessageDialog("@${it} ")
+                           }
+                       }
+                   }.show(this@BaseComFragment.childFragmentManager,"PersonDataDFragment")
                 }
             }.show(childFragmentManager, "AudienceListDialog")
         }
@@ -550,8 +566,11 @@ abstract class BaseComFragment<T : FragmentBaseComBinding> : BaseXFragment<T>(),
         //语音房麦位列表数据
         roomVm.audioSeatListLiveData.observe(this) {
             if (it != null) {
-                audioSeatAdapter.setNewData(it)
-                initMaiPosition()
+                if (audioSeatAdapter.data !=  it){
+                    audioSeatAdapter.setNewData(it)
+                    initMaiPosition()
+                }
+
             }
         }
 

+ 3 - 0
room/src/main/java/com/swago/room/gift/audio/MaiUserAdapter.kt

@@ -31,6 +31,7 @@ class MaiUserAdapter : BaseQuickAdapter<MaiUserInfo, BaseViewHolder>(R.layout.it
                     view.visibility = View.GONE
                 }
                 if (!TextUtils.isEmpty(it.head_special)){
+                    svgaImageView.visibility = View.VISIBLE
                     svgaParser.decodeFromURL(URL(item.head_special), object : SVGAParser.ParseCompletion{
                         override fun onComplete(videoItem: SVGAVideoEntity) {
                             val drawable = SVGADrawable(videoItem)
@@ -41,6 +42,8 @@ class MaiUserAdapter : BaseQuickAdapter<MaiUserInfo, BaseViewHolder>(R.layout.it
                         override fun onError() {
                         }
                     })
+                } else {
+                    svgaImageView.visibility = View.INVISIBLE
                 }
             }
         }

+ 0 - 5
room/src/main/java/com/swago/room/gift/control/XSvgPlayer.kt

@@ -117,11 +117,6 @@ class XSvgPlayer : ConstraintLayout {
                         nextSvgPlay?.invoke()
                     }
                 }
-            },object:SVGAParser.PlayCallback{
-                override fun onPlay(file: List<File>) {
-                    LogUtil.d("svgPlayer","onPlay--${file.size}")
-                }
-
             })
 
         }

+ 13 - 0
room/src/main/java/com/swago/room/giftdandao/GiftDanDaoView.kt

@@ -30,6 +30,7 @@ import com.swago.room.BuildConfig
 import com.swago.room.R
 import com.swago.room.databinding.ViewItemGiftBinding
 import java.io.File
+import java.net.URL
 
 /**
  *@date 2022/1/22 16:57
@@ -89,6 +90,18 @@ class GiftDanDaoView : FrameLayout {
                 .error(R.mipmap.default_avatar)
                 .into(ivGiftIcon)
 
+            if (!imGiftModel.androidHeadSpecial.isNullOrEmpty()){
+                svgParser?.decodeFromURL(URL(imGiftModel.androidHeadSpecial), object : SVGAParser.ParseCompletion{
+                    override fun onComplete(videoItem: SVGAVideoEntity) {
+                        val drawable = SVGADrawable(videoItem)
+                        svgAvatar.setImageDrawable(drawable)
+                        svgAvatar.startAnimation()
+                    }
+                    override fun onError() {
+                    }
+                })
+            }
+
             tvSenderName.text = imGiftModel.senderName
             if (!tvSenderName.isSelected) {
                 tvSenderName.isSelected = true

+ 1 - 0
room/src/main/java/com/swago/room/vm/MsgVm.kt

@@ -701,6 +701,7 @@ class MsgVm(application: Application) : AbsMsgVm(application) {
                                 imGiftModel.senderAvatar = it.senderAvatar
                                 imGiftModel.isCombo = it.isCombo
                                 imGiftModel.senderCode = it.senderCode
+                                imGiftModel.androidHeadSpecial = it.androidHeadSpecial
                                 imGiftModel.receiverUserId = receiverUserId.toString()
                                 showGiftDanDao?.invoke(imGiftModel)
                             } else {

+ 24 - 7
user/src/main/java/com/swago/user/store/StoreBuyDialog.kt

@@ -3,11 +3,13 @@ package com.swago.user.store
 import android.os.Bundle
 import android.view.Gravity
 import android.view.View
+import android.view.View.OnClickListener
 import android.widget.Toast
 import androidx.activity.viewModels
 import androidx.fragment.app.viewModels
 import com.opensource.svgaplayer.SVGADrawable
 import com.opensource.svgaplayer.SVGAParser
+import com.opensource.svgaplayer.SVGASoundManager
 import com.opensource.svgaplayer.SVGAVideoEntity
 import com.swago.baseswago.dialog.BaseXDFragment
 import com.swago.baseswago.model.mine.StoreItemBean
@@ -25,6 +27,7 @@ class StoreBuyDialog : BaseXDFragment<DialogStoreDetailBinding>(){
 
     private var svgaParser: SVGAParser? = null
     var storeBean: StoreItemBean ?= null
+    var storeType:Int = 0
     var buySuccessFun:(()->Unit)? = null
     init {
         setGravity(Gravity.BOTTOM)
@@ -33,10 +36,11 @@ class StoreBuyDialog : BaseXDFragment<DialogStoreDetailBinding>(){
     }
 
     companion object{
-        fun newInstance(bean: StoreItemBean): StoreBuyDialog {
+        fun newInstance(bean: StoreItemBean,storeType:Int): StoreBuyDialog {
             val dialog = StoreBuyDialog()
             val bundle = Bundle()
             bundle.putParcelable("data" , bean)
+            bundle.putInt("storeType",storeType)
             dialog.arguments = bundle
             return dialog
         }
@@ -47,17 +51,28 @@ class StoreBuyDialog : BaseXDFragment<DialogStoreDetailBinding>(){
         svgaParser = SVGAParser(activity)
         arguments?.let {
             storeBean = it.getParcelable("data")
+            storeType = it.getInt("storeType",0)
         }
         storeBean?.let {
             binding.tvName.text = it.product_name
             binding.tvCoin.text = "${it.product_coin}"
-            if (!it.product_svg_url.isNullOrEmpty() && it.product_svg_url?.endsWith(".svga") == true){
+            if (storeType == 1 || storeType == 2){
                 binding.ivIcon.visibility = View.GONE
                 svgaParser?.decodeFromURL(URL(it.product_svg_url), object : SVGAParser.ParseCompletion{
                     override fun onComplete(videoItem: SVGAVideoEntity) {
                         val drawable = SVGADrawable(videoItem)
-                        binding.svgContent.setImageDrawable(drawable)
-                        binding.svgContent.startAnimation()
+                        if (storeType == 1){
+                            binding.svgContent.visibility = View.VISIBLE
+                            binding.svgAvatar.visibility = View.GONE
+                            binding.svgContent.setImageDrawable(drawable)
+                            binding.svgContent.startAnimation()
+                        } else {
+                            binding.svgContent.visibility = View.GONE
+                            binding.svgAvatar.visibility = View.VISIBLE
+                            binding.svgAvatar.setImageDrawable(drawable)
+                            binding.svgAvatar.startAnimation()
+                        }
+
                     }
 
                     override fun onError() {
@@ -65,14 +80,13 @@ class StoreBuyDialog : BaseXDFragment<DialogStoreDetailBinding>(){
                     }
                 })
             } else {
+                binding.svgContent.visibility = View.GONE
+                binding.svgAvatar.visibility = View.GONE
                 binding.ivIcon.visibility = View.VISIBLE
                 it.product_url?.let { imageUrl ->
                     binding.ivIcon.loadUrl(AppContext.getContext(),imageUrl)
                 }
             }
-
-
-
         }
     }
 
@@ -95,5 +109,8 @@ class StoreBuyDialog : BaseXDFragment<DialogStoreDetailBinding>(){
 
             }
         })
+        binding.svgContent.setOnClickListener {
+            dismissAllowingStateLoss()
+        }
     }
 }

+ 4 - 4
user/src/main/java/com/swago/user/store/StoreListActivity.kt

@@ -280,7 +280,7 @@ class StoreListActivity : BaseXActivity<ActivityStoreListBinding>() {
         }
         enterAdapter.setOnItemClickListener { _, _, position ->
             if (type == 1){
-                StoreBuyDialog.newInstance(enterAdapter.data[position]).apply {
+                StoreBuyDialog.newInstance(enterAdapter.data[position],1).apply {
                     this.buySuccessFun = {
                         enterAdapter.data[position].product_status = 1
                         enterAdapter.notifyItemChanged(position)
@@ -298,7 +298,7 @@ class StoreListActivity : BaseXActivity<ActivityStoreListBinding>() {
         }
         avatarAdapter.setOnItemClickListener { _, _, position ->
             if (type == 1){
-                StoreBuyDialog.newInstance(avatarAdapter.data[position]).apply {
+                StoreBuyDialog.newInstance(avatarAdapter.data[position],2).apply {
                     this.buySuccessFun = {
                         avatarAdapter.data[position].product_status = 1
                         avatarAdapter.notifyItemChanged(position)
@@ -316,7 +316,7 @@ class StoreListActivity : BaseXActivity<ActivityStoreListBinding>() {
         }
         badgeAdapter.setOnItemClickListener { _, _, position ->
             if (type == 1){
-                StoreBuyDialog.newInstance(badgeAdapter.data[position]).apply {
+                StoreBuyDialog.newInstance(badgeAdapter.data[position],3).apply {
                     this.buySuccessFun = {
                         badgeAdapter.data[position].product_status = 1
                         badgeAdapter.notifyItemChanged(position)
@@ -334,7 +334,7 @@ class StoreListActivity : BaseXActivity<ActivityStoreListBinding>() {
         }
         bubbleAdapter.setOnItemClickListener { _, _, position ->
             if (type == 1){
-                StoreBuyDialog.newInstance(bubbleAdapter.data[position]).apply {
+                StoreBuyDialog.newInstance(bubbleAdapter.data[position],4).apply {
                     this.buySuccessFun = {
                         bubbleAdapter.data[position].product_status = 1
                         bubbleAdapter.notifyItemChanged(position)

+ 28 - 4
user/src/main/res/layout/dialog_store_detail.xml

@@ -24,14 +24,38 @@
             android:paddingBottom="24dp"
             app:layout_constraintBottom_toBottomOf="parent">
 
-            <ImageView
-                android:id="@+id/ivIcon"
+            <androidx.constraintlayout.widget.ConstraintLayout
+                android:id="@+id/clIcon"
                 android:layout_width="wrap_content"
                 android:layout_height="wrap_content"
                 app:layout_constraintEnd_toEndOf="parent"
                 app:layout_constraintStart_toStartOf="parent"
                 android:layout_marginTop="12dp"
-                app:layout_constraintTop_toTopOf="parent"/>
+                app:layout_constraintTop_toTopOf="parent">
+                <ImageView
+                    android:id="@+id/ivIcon"
+                    android:layout_width="wrap_content"
+                    android:layout_height="wrap_content"
+                    app:layout_constraintEnd_toEndOf="parent"
+                    app:layout_constraintStart_toStartOf="parent"
+                    app:layout_constraintBottom_toBottomOf="parent"
+                    app:layout_constraintTop_toTopOf="parent"/>
+
+                <com.opensource.svgaplayer.SVGAImageView
+                    android:id="@+id/svg_avatar"
+                    android:layout_width="200dp"
+                    android:layout_height="200dp"
+                    app:autoPlay="true"
+                    app:fillMode="Forward"
+                    android:visibility="gone"
+                    app:layout_constraintEnd_toEndOf="parent"
+                    app:layout_constraintStart_toStartOf="parent"
+                    app:layout_constraintBottom_toBottomOf="parent"
+                    app:layout_constraintTop_toTopOf="parent"
+                    app:loopCount="0" />
+            </androidx.constraintlayout.widget.ConstraintLayout>
+
+
 
             <com.swago.baseswago.cusview.MediumTextView
                 android:id="@+id/tv_name"
@@ -43,7 +67,7 @@
                 android:layout_marginTop="@dimen/dp_10"
                 app:layout_constraintEnd_toEndOf="parent"
                 app:layout_constraintStart_toStartOf="parent"
-                app:layout_constraintTop_toBottomOf="@+id/ivIcon"
+                app:layout_constraintTop_toBottomOf="@+id/clIcon"
                 tools:text="fgg" />
 
             <com.swago.baseswago.cusview.MediumTextView