6 Commits 4a5a68a32e ... ae1caa3a70

Autor SHA1 Mensagem Data
  tongmengxiao ae1caa3a70 fix: 多人入场动画展示 5 meses atrás
  tongmengxiao 2f70172fdb fix: 麦位 5 meses atrás
  tongmengxiao 170002e495 feat: delete ssl 5 meses atrás
  tongmengxiao 70084c70d6 feat: delete push 5 meses atrás
  tongmengxiao c2a5510012 fix: 商城bug 5 meses atrás
  tongmengxiao 266044fe6f fix: 麦位占位图 5 meses atrás

+ 1 - 1
app/src/main/java/com/swago/app/SplashActivity.kt

@@ -77,7 +77,7 @@ class SplashActivity : AppCompatActivity() {
 
         if(!File(UrlConstant.appGameRootPath + File.separator + 8 + File.separator + "index.html").exists()){
             FileUtil.copyAssetFile(AppContext.getContext() , "com-swago-magical-piggy.zip" , File(UrlConstant.appGameRootPath + File.separator + 8 + File.separator + "com-swago-magical-piggy.zip"))
-            SpUtil.putInt("8", 33)
+            SpUtil.putInt("8", 34)
             val t = UrlConstant.appGameRootPath + File.separator + 8
             FileUtil.upZipFile(UrlConstant.appGameRootPath + File.separator + 8 + File.separator + "com-swago-magical-piggy.zip" , t + File.separator)
         }

+ 0 - 1
app/src/main/java/com/swago/app/SwagoApp.kt

@@ -51,7 +51,6 @@ class SwagoApp : Application() {
             Firebase.crashlytics.setUserId(it.user_account)
         }
         Firebase.crashlytics.setCrashlyticsCollectionEnabled(!BuildConfig.DEBUG)
-        pushCrash()
         ActivityManagerUtil.get().init(this)
         ARouter.init(this)
         //svga缓存

BIN
baseswago/src/main/assets/com-swago-magical-piggy.zip


+ 0 - 1
baseswago/src/main/java/com/swago/baseswago/http/RetrofitManager.kt

@@ -32,7 +32,6 @@ object RetrofitManager {
         if (BuildConfig.DEBUG) {
             okHttpClientBuilder.addInterceptor(ChuckerInterceptor(AppContext.getContext()))
         }
-        setSSLSocketFactory(okHttpClientBuilder)
         okHttpClientBuilder.addInterceptor(SwagoInterceptor())
         okHttpClientBuilder.retryOnConnectionFailure(true)
         okHttpClientBuilder.connectTimeout(30000, TimeUnit.MILLISECONDS)

+ 2 - 2
baseswago/src/main/java/com/swago/baseswago/inter/RoomApi.kt

@@ -102,7 +102,7 @@ interface RoomApi {
     suspend fun getRoomUser(
         @Field("room_id") room_id: String,
         @Field("page") page: Int = 1,
-        @Field("page_size") page_size: Int = 5
+        @Field("page_size") page_size: Int = 10
     ): RoomUserModel
 
     /**
@@ -113,7 +113,7 @@ interface RoomApi {
     suspend fun getHouseRoomUser(
         @Field("room_id") room_id: String,
         @Field("page") page: Int = 1,
-        @Field("page_size") page_size: Int = 5
+        @Field("page_size") page_size: Int = 10
     ): RoomUserModel
 
     /**

+ 10 - 0
baseswago/src/main/java/com/swago/baseswago/model/live/RoomModel.java

@@ -58,6 +58,8 @@ public class RoomModel {
     private String badge_special;
     private String chat_special;
 
+    private String broadcast_head_special;
+
     private CusNewMsgBean<RoomUserChangeModel> join_im_data;
 
     public String getRtc_token() {
@@ -315,4 +317,12 @@ public class RoomModel {
     public void setChat_special(String chat_special) {
         this.chat_special = chat_special;
     }
+
+    public String getBroadcast_head_special() {
+        return broadcast_head_special;
+    }
+
+    public void setBroadcast_head_special(String broadcast_head_special) {
+        this.broadcast_head_special = broadcast_head_special;
+    }
 }

BIN
baseswago/src/main/res/mipmap-xxhdpi/ic_audio_lock.jpg


BIN
baseswago/src/main/res/mipmap-xxhdpi/ic_audio_lock.png


BIN
baseswago/src/main/res/mipmap-xxhdpi/ic_audio_seat.jpg


BIN
baseswago/src/main/res/mipmap-xxhdpi/ic_audio_seat.png


+ 2 - 2
room/src/main/java/com/swago/room/adapter/RoomUserAdapter.kt

@@ -31,9 +31,9 @@ class RoomUserAdapter : BaseQuickAdapter<RoomUserModel.ListBean,BaseViewHolder>(
                 .placeholder(R.mipmap.default_avatar)
                 .error(R.mipmap.default_avatar).into(ivAvatar)
 
-            if (!item.android_head_special.isNullOrEmpty()){
+            if (!item.android_head_special.isNullOrEmpty() || !item.head_special.isNullOrEmpty()){
                 svgAvatar.visibility = View.VISIBLE
-                svgaParser.decodeFromURL(URL(item.android_head_special), object :SVGAParser.ParseCompletion{
+                svgaParser.decodeFromURL(URL(if (item.android_head_special.isNullOrEmpty()) item.head_special else item.android_head_special), object :SVGAParser.ParseCompletion{
                     override fun onComplete(videoItem: SVGAVideoEntity) {
                         val drawable = SVGADrawable(videoItem)
                         svgAvatar.setImageDrawable(drawable)

+ 36 - 8
room/src/main/java/com/swago/room/audio/AudioSeatAdapter.kt

@@ -1,5 +1,6 @@
 package com.swago.room.audio
 
+import android.graphics.drawable.Drawable
 import android.view.View
 import com.chad.library.adapter.base.BaseQuickAdapter
 import com.chad.library.adapter.base.BaseViewHolder
@@ -9,6 +10,7 @@ import com.opensource.svgaplayer.SVGAParser
 import com.opensource.svgaplayer.SVGAVideoEntity
 import com.swago.baseswago.cusview.SwagoImageView
 import com.swago.baseswago.model.live.audio.AudioSeatModel
+import com.swago.baseswago.util.LogUtil
 import com.swago.room.R
 import java.net.URL
 
@@ -17,6 +19,18 @@ class AudioSeatAdapter :
     private val svgaParser by lazy {
         SVGAParser(mContext)
     }
+
+    private val svgaVideoEntityMap: MutableMap<Int, OldSeatModel?> = mutableMapOf(
+        0 to null,
+        1 to null,
+        2 to null,
+        3 to null,
+        4 to null,
+        5 to null,
+        6 to null,
+        7 to null
+    )
+
     override fun convert(helper: BaseViewHolder?, item: AudioSeatModel?) {
         helper?.apply {
             item?.let {
@@ -32,6 +46,7 @@ class AudioSeatAdapter :
                         itemView.findViewById<SwagoImageView>(R.id.ivImageView)
                             .loadImage(R.mipmap.ic_audio_seat)
                     }
+                    svgaVideoEntityMap[adapterPosition] = null
                     svgAvatar.visibility = View.INVISIBLE
                 } else {
                     itemView.findViewById<SwagoImageView>(R.id.ivImageView)
@@ -58,20 +73,31 @@ class AudioSeatAdapter :
                         }
 
                     }
-
-                    if (!it.head_special.isNullOrEmpty()){
+                    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)
+                        if (svgaVideoEntityMap[adapterPosition] == null || svgaVideoEntityMap[adapterPosition]?.url != item.head_special){
+                            svgaParser.decodeFromURL(URL(it.head_special), object :SVGAParser.ParseCompletion{
+                                override fun onComplete(videoItem: SVGAVideoEntity) {
+                                    val drawable = SVGADrawable(videoItem)
+                                    svgaVideoEntityMap[adapterPosition] = OldSeatModel(videoItem,it.head_special)
+                                    svgAvatar.setImageDrawable(drawable)
+                                    svgAvatar.startAnimation()
+                                }
+
+                                override fun onError() {
+                                }
+                            })
+                        } else {
+                            svgaVideoEntityMap[adapterPosition]?.let { oldSeat ->
+                                val drawable = SVGADrawable(oldSeat.drawable)
                                 svgAvatar.setImageDrawable(drawable)
                                 svgAvatar.startAnimation()
                             }
 
-                            override fun onError() {
-                            }
-                        })
+                        }
+
                     } else {
+                        svgaVideoEntityMap[adapterPosition] = null
                         svgAvatar.visibility = View.INVISIBLE
                     }
 
@@ -80,4 +106,6 @@ class AudioSeatAdapter :
         }
 
     }
+
+    data class  OldSeatModel(val drawable: SVGAVideoEntity,val url:String?)
 }

+ 1 - 1
room/src/main/java/com/swago/room/bean/UserRoomModel.kt

@@ -200,7 +200,7 @@ class UserRoomModel : IRoomInfo {
 
     override fun getHeadSpecial(): String {
         return if (RoleType.user == SwagoRoomManager.roleType) {
-            momentModel?.head_special ?: ""
+            roomModel?.broadcast_head_special ?: ""
         } else {
             roomModel?.head_special ?: ""
         }

+ 0 - 1
room/src/main/java/com/swago/room/dialog/AudienceListDialog.kt

@@ -73,7 +73,6 @@ class AudienceListDialog : BaseListDialogFragment<DialogAudienceListBinding,Room
                } else {
                    adapter.loadMoreEnd()
                }
-
            }
        }
 

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

@@ -33,6 +33,8 @@ class XSvgPlayer : ConstraintLayout {
      */
     var isPlaying = false
 
+    var callbackExecuted = true
+
     constructor(context: Context) : super(context)
     constructor(context: Context, mAttributeSet: AttributeSet?) : super(context, mAttributeSet){
         initView(context)
@@ -98,8 +100,10 @@ class XSvgPlayer : ConstraintLayout {
         }
         svgaParser!!.let {
             LogUtil.d("svgPlayer","xxx--$isPlaying")
+            callbackExecuted = false
             it.decodeFromURL(URL(userJoinRoomBean.androidJoinSpecial),object:SVGAParser.ParseCompletion{
                 override fun onComplete(videoItem: SVGAVideoEntity) {
+                    callbackExecuted = true
                     binding!!.apply {
                         val drawable = SVGADrawable(videoItem)
                         svgaImageView.visibility = View.VISIBLE
@@ -117,6 +121,7 @@ class XSvgPlayer : ConstraintLayout {
                 }
 
                 override fun onError() {
+                    callbackExecuted = true
                     binding?.apply {
                         isPlaying = false
                         LogUtil.d("svgPlayer","onError--$isPlaying")
@@ -126,6 +131,14 @@ class XSvgPlayer : ConstraintLayout {
                 }
             })
 
+            handler.postDelayed({
+                if (!callbackExecuted){
+                    playJoinRoomSvga(userJoinRoomBean)
+                    LogUtil.d("JoinAnimalManager","callbackExecuted")
+                }
+
+            },7000)
+
         }
     }
 

+ 1 - 0
room/src/main/res/layout/activity_anchor_room.xml

@@ -171,6 +171,7 @@
             android:orientation="horizontal"
             android:visibility="gone"
             tools:visibility="visible"
+            android:layoutDirection="ltr"
             android:layout_marginBottom="10dp"
             app:layout_constraintBottom_toTopOf="@+id/ll_change"
             app:layout_constraintEnd_toEndOf="parent"

+ 104 - 0
user/src/main/java/com/swago/user/store/BaseStoreDFragment.kt

@@ -0,0 +1,104 @@
+package com.swago.user.store
+
+import android.os.Bundle
+import android.view.Gravity
+import android.view.LayoutInflater
+import android.view.View
+import android.view.ViewGroup
+import androidx.fragment.app.DialogFragment
+import androidx.fragment.app.FragmentManager
+import androidx.viewbinding.ViewBinding
+import com.gyf.immersionbar.ImmersionBar
+import com.swago.baseswago.R
+import java.lang.reflect.ParameterizedType
+
+/**
+ *@date 2021/8/27 17:00
+ *description:
+ */
+abstract class BaseStoreDFragment<T : ViewBinding> : DialogFragment() {
+
+    private var _binding: T? = null
+    val binding get() = _binding
+
+    private var mAmount = 0.5f
+    private var gravity = Gravity.CENTER
+    private var canCancel = true
+    private var mHeight = ViewGroup.LayoutParams.WRAP_CONTENT
+
+    override fun onCreate(savedInstanceState: Bundle?) {
+        super.onCreate(savedInstanceState)
+        setStyle(STYLE_NORMAL, R.style.cusDialogStyle)
+    }
+
+    override fun onStart() {
+        super.onStart()
+        //设置宽度
+        val attrs = dialog?.window?.attributes
+        attrs?.width = ViewGroup.LayoutParams.MATCH_PARENT
+        attrs?.height = mHeight
+        dialog?.window?.attributes = attrs
+        dialog?.window?.setGravity(gravity)
+        dialog?.window?.setDimAmount(mAmount)
+        dialog?.setCanceledOnTouchOutside(canCancel)
+    }
+
+    override fun onCreateView(
+        inflater: LayoutInflater,
+        container: ViewGroup?,
+        savedInstanceState: Bundle?
+    ): View? {
+        _binding = getViewBindingForFragment(inflater, container)
+        return binding?.root
+    }
+
+    override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
+        super.onViewCreated(view, savedInstanceState)
+        ImmersionBar.with(this).init()
+        initOther()
+        initLiveData()
+    }
+    abstract fun initOther()
+    abstract fun initLiveData()
+    fun setGravity(gravity: Int){
+        this.gravity = gravity
+    }
+
+    fun setDimAmount(amount: Float) {
+        mAmount = amount
+    }
+
+    fun setCanCancel(canCancel:Boolean){
+        this.canCancel = canCancel
+    }
+
+    fun setHeightMatchParent(){
+        mHeight = ViewGroup.LayoutParams.MATCH_PARENT
+    }
+
+    @Suppress("UNCHECKED_CAST")
+    fun getViewBindingForFragment(layoutInflater: LayoutInflater, container: ViewGroup?): T {
+        val type = javaClass.genericSuperclass as ParameterizedType
+        val aClass = type.actualTypeArguments[0] as Class<*>
+        val method = aClass.getDeclaredMethod("inflate", LayoutInflater::class.java)
+        return method.invoke(null, layoutInflater) as T
+    }
+
+    override fun show(manager: FragmentManager, tag: String?) {
+        try {
+            //在每个add事务前增加一个remove事务,防止连续的add
+            manager.beginTransaction().remove(this).commit()
+            super.show(manager,tag)
+        } catch (e: Exception) {
+            //同一实例使用不同的tag会异常,这里捕获一下
+            e.printStackTrace()
+        }
+    }
+
+
+
+    override fun onDestroyView() {
+        super.onDestroyView()
+        _binding = null
+    }
+}

+ 41 - 39
user/src/main/java/com/swago/user/store/StoreBuyDialog.kt

@@ -14,6 +14,7 @@ import com.opensource.svgaplayer.SVGAVideoEntity
 import com.swago.baseswago.dialog.BaseXDFragment
 import com.swago.baseswago.model.mine.StoreItemBean
 import com.swago.baseswago.util.AppContext
+import com.swago.baseswago.util.LogUtil
 import com.swago.baseswago.util.NoDoubleClickListener
 import com.swago.loadUrl
 import com.swago.user.R
@@ -22,25 +23,26 @@ import com.swago.user.vm.StoreVm
 import java.io.File
 import java.net.URL
 
-class StoreBuyDialog : BaseXDFragment<DialogStoreDetailBinding>(){
+class StoreBuyDialog : BaseStoreDFragment<DialogStoreDetailBinding>() {
     private val storeVm by viewModels<StoreVm>()
 
     private var svgaParser: SVGAParser? = null
-    var storeBean: StoreItemBean ?= null
-    var storeType:Int = 0
-    var buySuccessFun:(()->Unit)? = null
+    var storeBean: StoreItemBean? = null
+    var storeType: Int = 0
+    var buySuccessFun: (() -> Unit)? = null
+
     init {
         setGravity(Gravity.BOTTOM)
         setDimAmount(0.5f)
         setCanCancel(true)
     }
 
-    companion object{
-        fun newInstance(bean: StoreItemBean,storeType:Int): StoreBuyDialog {
+    companion object {
+        fun newInstance(bean: StoreItemBean, storeType: Int): StoreBuyDialog {
             val dialog = StoreBuyDialog()
             val bundle = Bundle()
-            bundle.putParcelable("data" , bean)
-            bundle.putInt("storeType",storeType)
+            bundle.putParcelable("data", bean)
+            bundle.putInt("storeType", storeType)
             dialog.arguments = bundle
             return dialog
         }
@@ -51,63 +53,63 @@ class StoreBuyDialog : BaseXDFragment<DialogStoreDetailBinding>(){
         svgaParser = SVGAParser(activity)
         arguments?.let {
             storeBean = it.getParcelable("data")
-            storeType = it.getInt("storeType",0)
+            storeType = it.getInt("storeType", 0)
         }
         storeBean?.let {
-            binding.tvName.text = it.product_name
-            binding.tvCoin.text = "${it.product_coin}"
-            if (storeType == 1){
-                binding.ivIcon.visibility = View.GONE
-                binding.svgContent.visibility = View.VISIBLE
-                binding.svgAvatar.visibility = View.GONE
+            binding?.tvName?.text = it.product_name
+            binding?.tvCoin?.text = "${it.product_coin}"
+            if (storeType == 1) {
+                binding?.ivIcon?.visibility = View.GONE
+                binding?.svgContent?.visibility = View.VISIBLE
+                binding?.svgAvatar?.visibility = View.GONE
                 it.product_svg_url?.let { svgUrl ->
-                    svgaParser?.decodeFromURL(URL(svgUrl), object : SVGAParser.ParseCompletion{
+                    svgaParser?.decodeFromURL(URL(svgUrl), object : SVGAParser.ParseCompletion {
                         override fun onComplete(videoItem: SVGAVideoEntity) {
                             val drawable = SVGADrawable(videoItem)
-                            binding.svgContent.visibility = View.VISIBLE
-                            binding.svgAvatar.visibility = View.GONE
-                            binding.svgContent.setImageDrawable(drawable)
-                            binding.svgContent.startAnimation()
+                            binding?.svgContent?.setImageDrawable(drawable)
+                            binding?.svgContent?.startAnimation()
+
+
                         }
+
                         override fun onError() {
                         }
                     })
                 }
 
-            } else if (storeType == 2){
-                binding.ivIcon.visibility = View.GONE
-                binding.svgContent.visibility = View.GONE
-                binding.svgAvatar.visibility = View.VISIBLE
+            } else if (storeType == 2) {
+                binding?.ivIcon?.visibility = View.GONE
+                binding?.svgContent?.visibility = View.GONE
+                binding?.svgAvatar?.visibility = View.VISIBLE
                 it.product_svg_url?.let { svgUrl ->
-                    svgaParser?.decodeFromURL(URL(svgUrl), object : SVGAParser.ParseCompletion{
+                    svgaParser?.decodeFromURL(URL(svgUrl), object : SVGAParser.ParseCompletion {
                         override fun onComplete(videoItem: SVGAVideoEntity) {
                             val drawable = SVGADrawable(videoItem)
-                            binding.svgContent.visibility = View.GONE
-                            binding.svgAvatar.visibility = View.VISIBLE
-                            binding.svgAvatar.setImageDrawable(drawable)
-                            binding.svgAvatar.startAnimation()
+                            binding?.svgAvatar?.setImageDrawable(drawable)
+                            binding?.svgAvatar?.startAnimation()
                         }
+
                         override fun onError() {
                         }
                     })
                 }
 
-            }else {
-                binding.svgContent.visibility = View.GONE
-                binding.svgAvatar.visibility = View.GONE
-                binding.ivIcon.visibility = View.VISIBLE
+            } 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)
+                    binding?.ivIcon?.loadUrl(AppContext.getContext(), imageUrl)
                 }
             }
         }
     }
 
     override fun initLiveData() {
-        binding.tvBuy.setOnClickListener(object: NoDoubleClickListener(){
+        binding?.tvBuy?.setOnClickListener(object : NoDoubleClickListener() {
             override fun onClick() {
                 storeBean?.let {
-                    if (it.product_status ==1){
+                    if (it.product_status == 1) {
                         Toast.makeText(
                             AppContext.getContext(),
                             AppContext.getContext().resources.getString(R.string.this_product_has_been_purchased),
@@ -120,12 +122,12 @@ class StoreBuyDialog : BaseXDFragment<DialogStoreDetailBinding>(){
 
             }
         })
-        binding.svgContent.setOnClickListener {
+        binding?.svgContent?.setOnClickListener {
             dismissAllowingStateLoss()
         }
 
-        storeVm.buyProductSuccess.observe(this){
-            if (it){
+        storeVm.buyProductSuccess.observe(this) {
+            if (it) {
                 buySuccessFun?.invoke()
             }
             dismissAllowingStateLoss()