Selaa lähdekoodia

1.修改禅道bug

王鹏鹏 2 vuotta sitten
vanhempi
commit
670b7c2f57

+ 5 - 1
game/src/main/java/com/yingyangfly/game/play/PlayGameActivity.kt

@@ -656,7 +656,11 @@ class PlayGameActivity : BaseMVVMActivity<ActivityPlayGameBinding, PlayGameViewM
         )
         completionTrainingDialog.onDialogClickListener = {
             runOnUiThread {
-                JumpUtil.jumpActivity(RouterUrlCommon.home, mContext)
+                if (TextUtils.equals("D", playClass)) {
+                    finish()
+                } else {
+                    JumpUtil.jumpActivity(RouterUrlCommon.home, mContext)
+                }
             }
         }
         completionTrainingDialog.show(

+ 4 - 0
home/src/main/java/com/yingyangfly/home/activity/HomeActivity.kt

@@ -844,6 +844,10 @@ class HomeActivity : BaseMVVMActivity<ActivityHomeBinding, HomeViewModel>(), Vie
                                 RxBus.get().send(RxBusCodes.doctorReception)
                             }
 
+                            "live", "gameDetails", "endLive" -> {
+                                Log.e("wpp", "直播消息,此处不做处理")
+                            }
+
                             else -> {
                                 showTaskDialog(messageBean)
                             }

+ 51 - 68
livebroadcast/src/main/java/com/yingyang/livebroadcast/activity/detail/LiveBroadcastActivity.kt

@@ -130,10 +130,7 @@ class LiveBroadcastActivity :
         }
 
         override fun onWarning(
-            player: V2TXLivePlayer?,
-            code: Int,
-            msg: String?,
-            extraInfo: Bundle?
+            player: V2TXLivePlayer?, code: Int, msg: String?, extraInfo: Bundle?
         ) {
             super.onWarning(player, code, msg, extraInfo)
             when (code) {
@@ -155,9 +152,7 @@ class LiveBroadcastActivity :
         }
 
         override fun onVideoPlaying(
-            player: V2TXLivePlayer?,
-            firstPlay: Boolean,
-            extraInfo: Bundle?
+            player: V2TXLivePlayer?, firstPlay: Boolean, extraInfo: Bundle?
         ) {
             super.onVideoPlaying(player, firstPlay, extraInfo)
         }
@@ -171,20 +166,24 @@ class LiveBroadcastActivity :
                     v.startAnimation(getScaleAnimation())
                 }
             }
+
             MotionEvent.ACTION_UP -> {
                 v.startAnimation(getEndAnimation())
                 when (v.id) {
                     R.id.backLayout -> {
                         finish()
                     }
+
                     R.id.btnYes -> {
-                        liveYesorno("0")
+                        liveYesOrNo("0")
                     }
+
                     R.id.btnNo -> {
-                        liveYesorno("1")
+                        liveYesOrNo("1")
                     }
                 }
             }
+
             MotionEvent.ACTION_CANCEL -> {
                 if (v.id == R.id.backLayout || v.id == R.id.btnYes || v.id == R.id.btnNo) {
                     v.startAnimation(getEndAnimation())
@@ -214,9 +213,7 @@ class LiveBroadcastActivity :
             //直播间心跳上回传报错
             CrashReport.postCatchedException(
                 Throwable(
-                    User.getName() +
-                            "直播间心跳上回传报错,直播间信息:" + liveId + " ,用户信息:" + User.getUserId() + "  \n" +
-                            User.getName() + " ,错误信息:" + it
+                    User.getName() + "直播间心跳上回传报错,直播间信息:" + liveId + " ,用户信息:" + User.getUserId() + "  \n" + User.getName() + " ,错误信息:" + it
                 )
             )
         }, success = {
@@ -227,8 +224,8 @@ class LiveBroadcastActivity :
     /**
      * 直播统计是和否
      */
-    private fun liveYesorno(status: String) {
-        viewModel.liveYesorno(liveId, status, fail = {
+    private fun liveYesOrNo(status: String) {
+        viewModel.liveYesOrNo(liveId, status, fail = {
             it.toast()
         }, success = {
             binding {
@@ -246,36 +243,31 @@ class LiveBroadcastActivity :
             runOnUiThread {
                 if (msg != null) {
                     Log.e("wpp", "6-------------------------------" + GsonUtil.GsonString(msg))
-                    if (msg.isRead.not()) {
-                        makeMessageAsRead(msg)
-                        if (msg.elemType == V2TIMMessage.V2TIM_ELEM_TYPE_CUSTOM) {
-                            val customElem = msg.customElem
-                            if (customElem != null && customElem.data != null) {
-                                val data = String(customElem.data)
-                                val description = customElem.description
-                                if (TextUtils.isEmpty(data).not()) {
-                                    val messageBean =
-                                        GsonUtil.GsonToBean(data, MessageBean::class.java)
-                                    if (messageBean != null) {
-                                        if (TextUtils.isEmpty(description).not()) {
-                                            messageBean.description = description
+                    makeMessageAsRead(msg)
+                    if (msg.elemType == V2TIMMessage.V2TIM_ELEM_TYPE_CUSTOM) {
+                        val customElem = msg.customElem
+                        if (customElem != null && customElem.data != null) {
+                            val data = String(customElem.data)
+                            val description = customElem.description
+                            if (TextUtils.isEmpty(data).not()) {
+                                val messageBean = GsonUtil.GsonToBean(data, MessageBean::class.java)
+                                if (messageBean != null) {
+                                    if (TextUtils.isEmpty(description).not()) {
+                                        messageBean.description = description
+                                    }
+                                    when (messageBean.businessID) {
+                                        "live" -> {
+                                            binding.statusLayout.visibility = View.VISIBLE
                                         }
-                                        when (messageBean.businessID) {
-                                            "live" -> {
-                                                binding.statusLayout.visibility = View.VISIBLE
-                                            }
 
-                                            "gameDetails" -> {
-                                                if (TextUtils.isEmpty(messageBean.description)
-                                                        .not()
-                                                ) {
-                                                    showGameTasksDialog(messageBean.description)
-                                                }
+                                        "gameDetails" -> {
+                                            if (TextUtils.isEmpty(messageBean.description).not()) {
+                                                showGameTasksDialog(messageBean.description)
                                             }
+                                        }
 
-                                            "endLive" -> {
-                                                endLive()
-                                            }
+                                        "endLive" -> {
+                                            endLive()
                                         }
                                     }
                                 }
@@ -291,17 +283,19 @@ class LiveBroadcastActivity :
      * 消息改成已读
      */
     private fun makeMessageAsRead(msg: V2TIMMessage) {
-        V2TIMManager.getConversationManager().cleanConversationUnreadMessageCount(
-            String.format("c2c_%s", msg.sender),
-            0,
-            0,
-            object : V2TIMCallback {
-                override fun onSuccess() {
-                }
+        runOnUiThread {
+            V2TIMManager.getConversationManager()
+                .cleanConversationUnreadMessageCount(String.format("c2c_%s", msg.sender),
+                    0,
+                    0,
+                    object : V2TIMCallback {
+                        override fun onSuccess() {
+                        }
 
-                override fun onError(p0: Int, p1: String?) {
-                }
-            })
+                        override fun onError(p0: Int, p1: String?) {
+                        }
+                    })
+        }
     }
 
     /**
@@ -323,10 +317,8 @@ class LiveBroadcastActivity :
     private fun gotoGameView(gameTasksBean: GameTasksBean) {
         runOnUiThread {
             ARouter.getInstance().build(RouterUrlCommon.playGame)
-                .withString("gameCode", gameTasksBean.gameCode)
-                .withString("playClass", "D")
-                .withString("gameName", gameTasksBean.gameName)
-                .withString("url", gameTasksBean.url)
+                .withString("gameCode", gameTasksBean.gameCode).withString("playClass", "D")
+                .withString("gameName", gameTasksBean.gameName).withString("url", gameTasksBean.url)
                 .withString("gameType", gameTasksBean.gameType)
                 .withString("gameTotalScore", gameTasksBean.gameTotalScore)
                 .withString("gameInbetweenImage", gameTasksBean.gameInbetweenImage)
@@ -334,8 +326,7 @@ class LiveBroadcastActivity :
                 .withString("gameShortDesn", gameTasksBean.gameShortDesn)
                 .withString("fullFlag", gameTasksBean.fullFlag)
                 .withString("frameImg", gameTasksBean.frameImg)
-                .withTransition(R.anim.leftin, R.anim.leftout)
-                .navigation(mContext)
+                .withTransition(R.anim.leftin, R.anim.leftout).navigation(mContext)
         }
     }
 
@@ -361,8 +352,7 @@ class LiveBroadcastActivity :
                 finish()
             }
             messageDialog.show(
-                supportFragmentManager,
-                "taskFragment"
+                supportFragmentManager, "taskFragment"
             )
         }
     }
@@ -388,17 +378,10 @@ class LiveBroadcastActivity :
      */
     private fun tipsDialog(content: String) {
         runOnUiThread {
-            TipsDialog.TipDialogBuilder()
-                .title("提示")
-                .content(content)
-                .leftBtnText("取消")
-                .rightBtnText("确认")
-                .leftClick({
-                }, true)
-                .rightClick({
+            TipsDialog.TipDialogBuilder().title("提示").content(content).leftBtnText("取消")
+                .rightBtnText("确认").leftClick({}, true).rightClick({
                     finish()
-                }, true)
-                .show(supportFragmentManager)
+                }, true).show(supportFragmentManager)
         }
     }
 }

+ 2 - 2
livebroadcast/src/main/java/com/yingyang/livebroadcast/activity/detail/LiveBroadcastDetailViewModel.kt

@@ -36,7 +36,7 @@ class LiveBroadcastDetailViewModel : BaseViewModel() {
     /**
      * 直播统计心跳上报
      */
-    fun liveYesorno(
+    fun liveYesOrNo(
         id: String,
         status: String,
         fail: ((msg: String) -> Unit)? = null,
@@ -48,7 +48,7 @@ class LiveBroadcastDetailViewModel : BaseViewModel() {
             yesOrNo = status
         }
         val body = XUtils.createJson(GsonUtil.GsonString(requestBean))
-        LIVEBROADCAST_API.liveYesorno(body)
+        LIVEBROADCAST_API.liveYesOrNo(body)
     }.runUI(
         success,
         fail

+ 1 - 1
livebroadcast/src/main/java/com/yingyang/livebroadcast/net/LivebroadcastApiService.kt

@@ -30,5 +30,5 @@ interface LivebroadcastApiService {
      * 直播统计是和否
      */
     @POST("live/yesorno")
-    suspend fun liveYesorno(@Body requestBody: RequestBody): BaseResp<Unit>
+    suspend fun liveYesOrNo(@Body requestBody: RequestBody): BaseResp<Unit>
 }