From dd64568fdfcdfc1c074e9428e9411c019091bd46 Mon Sep 17 00:00:00 2001 From: 18401019693 Date: Wed, 24 Jan 2024 15:47:19 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=EF=BC=9A=E8=BF=9E=E9=80=81?= =?UTF-8?q?=E9=87=8D=E6=96=B0=E9=80=89=E6=8B=A9=E7=A4=BC=E7=89=A9=E6=88=96?= =?UTF-8?q?=E8=80=85=E5=8C=85=E8=A3=B9=E6=8C=89=E9=92=AE=E4=B8=8D=E6=B6=88?= =?UTF-8?q?=E5=A4=B1=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config.gradle | 4 +- .../com/yunbao/live/dialog/LiveGiftPopup.java | 92 +++++++------------ 2 files changed, 36 insertions(+), 60 deletions(-) diff --git a/config.gradle b/config.gradle index 58279b97c..9e6022e26 100644 --- a/config.gradle +++ b/config.gradle @@ -9,9 +9,9 @@ ext { ] manifestPlaceholders = [ //正式、 -// serverHost : "https://napi.yaoulive.com", + serverHost : "https://napi.yaoulive.com", // 测试 - serverHost : " https://ceshi.yaoulive.com", +// serverHost : " https://ceshi.yaoulive.com", //百度语音识别 diff --git a/live/src/main/java/com/yunbao/live/dialog/LiveGiftPopup.java b/live/src/main/java/com/yunbao/live/dialog/LiveGiftPopup.java index f4f4e0ff1..b7da267e2 100644 --- a/live/src/main/java/com/yunbao/live/dialog/LiveGiftPopup.java +++ b/live/src/main/java/com/yunbao/live/dialog/LiveGiftPopup.java @@ -249,6 +249,7 @@ public class LiveGiftPopup extends AbsDialogFragment { transaction.commitAllowingStateLoss(); isWrap = true; findViewById(R.id.red_point).setVisibility(View.GONE); + hideLianBtn(); } }); //;连送 @@ -756,6 +757,13 @@ public class LiveGiftPopup extends AbsDialogFragment { } else { LiveHttpUtil.sendGift("0", mLiveUid, mStream, liveGiftModel.getId(), mCount, isContactGift, callback); } + if (!liveGiftModel.getSwf().contains("svga")) { + showLianBtn(); + } + if (liveGiftModel.getType() == 7) { + showLianBtn(); + + } } } @@ -781,68 +789,42 @@ public class LiveGiftPopup extends AbsDialogFragment { //连送逻辑 private int mLianCountDownCount;//连送倒计时的数字 - private Handler lianSongHandler = new Handler(); - private Runnable lianSongRunnable = new Runnable() { - @Override - public void run() { - if (removeRunnable) { - lianSongHandler.removeCallbacks(lianSongRunnable); - if (mLianText != null) { - mLianText.setText("5s"); - } - mLianCountDownCount = 5; - lianSongHandler.postDelayed(lianSongRunnable, 1000); - removeRunnable = false; - } else { - mLianCountDownCount--; - if (mLianCountDownCount == 0) { - hideLianBtn(); - } else { - if (mLianText != null) { - mLianText.setText(mLianCountDownCount + "s"); - lianSongHandler.postDelayed(lianSongRunnable, 1000); - } - } - } - - } - }; - - /** - * 显示连送按钮 - */ - private boolean mShowLianBtn = false; - private boolean removeRunnable = false; private void showLianBtn() { - - - if (mShowLianBtn) { - removeRunnable = true; - } else { - if (mLianText != null) { - mLianText.setText("5s"); - } - mLianCountDownCount = 5; - lianSongHandler.postDelayed(lianSongRunnable, 1000); - mBtnSendGroup.setVisibility(View.VISIBLE); - giftSendLayout.setVisibility(View.INVISIBLE); - mShowLianBtn = true; - } - - + mBtnSendGroup.removeCallbacks(newLianSongRunnable); + mBtnSendGroup.setVisibility(View.VISIBLE); + giftSendLayout.setVisibility(View.INVISIBLE); + mLianCountDownCount = 5; + mBtnSendGroup.post(newLianSongRunnable); } + /** + * 新连送回调 + */ + private Runnable newLianSongRunnable = new Runnable() { + + @Override + public void run() { + if (mLianCountDownCount == 0) { + hideLianBtn(); + } else { + mLianCountDownCount--; + if (mLianText != null) { + mLianText.setText(mLianCountDownCount + "s"); + mBtnSendGroup.postDelayed(newLianSongRunnable, 1000); + } + } + } + }; + /** * 隐藏连送按钮 包裹 */ private void hideLianBtn() { mBtnSendGroup.setVisibility(View.INVISIBLE); giftSendLayout.setVisibility(View.VISIBLE); - lianSongHandler.removeCallbacks(lianSongRunnable); - mShowLianBtn = false; + mBtnSendGroup.removeCallbacks(newLianSongRunnable); getCoin(); - LiveNetManager.get(mContext) .getGiftNamingInfo(liveGiftModel.getId() + "", new com.yunbao.common.http.base.HttpCallback() { @Override @@ -999,7 +981,7 @@ public class LiveGiftPopup extends AbsDialogFragment { } else { operateImage.setVisibility(View.GONE); } - + hideLianBtn(); } @Subscribe(threadMode = ThreadMode.MAIN) @@ -1385,13 +1367,7 @@ public class LiveGiftPopup extends AbsDialogFragment { goldText.setText(goldCoin); } - if (!mGiftBean.getSwf().contains("svga")) { - showLianBtn(); - } - if (mGiftBean.getType() == 7) { - showLianBtn(); - } // //刷新包裹列表wrap_gift_num -1:表示数量没有变化 // mObjGiftSendback = obj;