From 302b7899701171a0d6812b095d8c524b58f2d6cb Mon Sep 17 00:00:00 2001 From: 18401019693 Date: Fri, 15 Dec 2023 14:03:42 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A4=9A=E4=BA=BAPk=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../presenter/LiveRyLinkMicPkPresenter.java | 21 +++++++++++-------- .../yunbao/live/views/LiveRoomViewHolder.java | 14 +++++++------ .../yunbao/main/activity/MainActivity.java | 8 +++++-- 3 files changed, 26 insertions(+), 17 deletions(-) diff --git a/live/src/main/java/com/yunbao/live/presenter/LiveRyLinkMicPkPresenter.java b/live/src/main/java/com/yunbao/live/presenter/LiveRyLinkMicPkPresenter.java index 95406d0a0..60325da49 100644 --- a/live/src/main/java/com/yunbao/live/presenter/LiveRyLinkMicPkPresenter.java +++ b/live/src/main/java/com/yunbao/live/presenter/LiveRyLinkMicPkPresenter.java @@ -1,6 +1,5 @@ package com.yunbao.live.presenter; -import static com.blankj.utilcode.util.SnackbarUtils.dismiss; import static com.lzy.okgo.utils.HttpUtils.runOnUiThread; import static com.yunbao.common.Constants.SOCKET_LINK_MIC_PK; import static com.yunbao.common.Constants.SOCKET_LIVE_DRPK; @@ -38,7 +37,6 @@ import android.widget.TextView; import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONObject; -import com.blankj.utilcode.util.ViewUtils; import com.tencent.trtc.TRTCCloud; import com.yunbao.common.CommonAppConfig; import com.yunbao.common.bean.LiveInfoModel; @@ -858,7 +856,7 @@ public class LiveRyLinkMicPkPresenter implements View.OnClickListener { @Override public void onSuccess(RCRTCOtherRoom rcrtcOtherRoom) { rcrtcOtherRoom.registerOtherRoomEventsListener(otherRoomEventsListener); - ToastUtil.show(WordUtil.isNewZh()?"接受成功":"Success"); + ToastUtil.show(WordUtil.isNewZh() ? "接受成功" : "Success"); new Handler(Looper.getMainLooper()).post(new Runnable() { public void run() { for (int i = 0; i < rcrtcOtherRoom.getRemoteUsers().size(); i++) { @@ -977,7 +975,7 @@ public class LiveRyLinkMicPkPresenter implements View.OnClickListener { @Override public void onSuccess(RCRTCOtherRoom rcrtcOtherRoom) { rcrtcOtherRoom.registerOtherRoomEventsListener(otherRoomEventsListener); - ToastUtil.show(WordUtil.isNewZh()?"接受成功":"Success"); + ToastUtil.show(WordUtil.isNewZh() ? "接受成功" : "Success"); new Handler(Looper.getMainLooper()).post(new Runnable() { public void run() { Log.e("ry", liveid + "来了!!!!" + rcrtcOtherRoom.getRemoteUsers().size()); @@ -1660,7 +1658,7 @@ public class LiveRyLinkMicPkPresenter implements View.OnClickListener { } Log.e("ry", "多人接受成功" + mApplyUid); - ToastUtil.show(WordUtil.isNewZh()?"接受成功":"Success"); + ToastUtil.show(WordUtil.isNewZh() ? "接受成功" : "Success"); //遍历远端用户列表 for (int i = 0; i < rcrtcOtherRoom.getRemoteUsers().size(); i++) { Log.e("ry", rcrtcOtherRoom.getRemoteUsers().get(i).getUserId() + "收到rcrtcOtherRoom" + rcrtcOtherRoom.getRemoteUsers().size()); @@ -1697,7 +1695,7 @@ public class LiveRyLinkMicPkPresenter implements View.OnClickListener { @Override public void onError(String error) { - ToastUtil.show(WordUtil.isNewZh()?"抱歉!出錯了!":"i \\'m sorry! An error occurred"); + ToastUtil.show(WordUtil.isNewZh() ? "抱歉!出錯了!" : "i \\'m sorry! An error occurred"); } }); @@ -2332,7 +2330,7 @@ public class LiveRyLinkMicPkPresenter implements View.OnClickListener { * 主播与主播PK 断开连麦PK的回调 */ public void onLinkMicPkClose(int i) { - Log.e("ry",mPkUid+"aaaaqwqw"+i); + Log.e("ry", mPkUid + "aaaaqwqw" + i); PKing = false; LiveRyAnchorActivity.isDRPK = 0; @@ -2500,11 +2498,11 @@ public class LiveRyLinkMicPkPresenter implements View.OnClickListener { * 更新Pk分数 */ public void upDataPkScore(JSONArray pkScores, String uid, int time) { - String userID1 = (String) imageGrade1.getTag(); String userID2 = (String) imageGrade2.getTag(); String userID4 = (String) imageGrade4.getTag(); if (livePushRyViewHolder.timeTitle.getVisibility() == View.GONE) { + mHandler.removeMessages(WHAT_PK_TIME2); RelativeLayout.LayoutParams layoutParams = (RelativeLayout.LayoutParams) livePushRyViewHolder.timeTitle.getLayoutParams(); layoutParams.topMargin = DpUtil.dp2px(123); livePushRyViewHolder.timeTitle.setLayoutParams(layoutParams); @@ -2512,7 +2510,12 @@ public class LiveRyLinkMicPkPresenter implements View.OnClickListener { String pkTime = StringUtil.getDurationText(time * 1000); livePushRyViewHolder.textTime.setText(String.format(mContext.getString(R.string.pk_time), pkTime)); mPkTimeCount = time; - pkCountdownTimer(); + if (time>0){ + String s1 = StringUtil.getDurationText(mPkTimeCount * 1000); + livePushRyViewHolder.textTime.setText(String.format(mContext.getString(R.string.pk_time), s1)); + mHandler.sendEmptyMessage(WHAT_PK_TIME2); + } + } int pkScoreSize = pkScores.size(); if (pkScoreSize == 3) { diff --git a/live/src/main/java/com/yunbao/live/views/LiveRoomViewHolder.java b/live/src/main/java/com/yunbao/live/views/LiveRoomViewHolder.java index f8f72c04a..b6da2cd0a 100644 --- a/live/src/main/java/com/yunbao/live/views/LiveRoomViewHolder.java +++ b/live/src/main/java/com/yunbao/live/views/LiveRoomViewHolder.java @@ -5013,6 +5013,7 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis } public void upDataPkScore(JSONArray pkScores, int time) { + isShowGif = true; if (detailsView == null) { detailsView = LayoutInflater.from(mContext).inflate(R.layout.view_live_pk_details, null); @@ -5053,7 +5054,12 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis } }); - + countdownHandler.removeCallbacks(countdownRunnable); + if (time > 0) { + mPkTimeCount = time; + timeTitle.setVisibility(View.VISIBLE); + countdownHandler.post(countdownRunnable); + } } for (int i = 0; i < pkScores.size(); i++) { @@ -5119,11 +5125,7 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis } } - if (time > 0) { - mPkTimeCount = time; - timeTitle.setVisibility(View.VISIBLE); - countdownHandler.postAtTime(countdownRunnable, getNextSecondTime()); - } + textPkName2.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { diff --git a/main/src/main/java/com/yunbao/main/activity/MainActivity.java b/main/src/main/java/com/yunbao/main/activity/MainActivity.java index e9c2814d8..dc787e261 100644 --- a/main/src/main/java/com/yunbao/main/activity/MainActivity.java +++ b/main/src/main/java/com/yunbao/main/activity/MainActivity.java @@ -91,7 +91,6 @@ import com.yunbao.common.utils.DialogUitl; import com.yunbao.common.utils.DpUtil; import com.yunbao.common.utils.GiftCacheUtil; import com.yunbao.common.utils.GoogleUtils; -import com.yunbao.common.utils.L; import com.yunbao.common.utils.LiveRoomCheckLivePresenter; import com.yunbao.common.utils.LocationUtil; import com.yunbao.common.utils.ProcessResultUtil; @@ -1302,7 +1301,12 @@ public class MainActivity extends AbsActivity implements MainAppBarLayoutListene messageNumber = event.getNumber(); if (event.getNumber() > 0) { v_table_redpoint.setVisibility(View.VISIBLE); - v_table_redpoint.setText(event.getNumber() + ""); + if (event.getNumber() > 99) { + v_table_redpoint.setText("99+"); + } else { + v_table_redpoint.setText(event.getNumber() + ""); + } + } else { v_table_redpoint.setVisibility(View.GONE); v_table_redpoint.setText("");