修复:连送重新选择礼物或者包裹按钮不消失问题

This commit is contained in:
18401019693 2024-01-24 15:47:19 +08:00
parent 45fd56ba66
commit dd64568fdf
2 changed files with 36 additions and 60 deletions

View File

@ -9,9 +9,9 @@ ext {
] ]
manifestPlaceholders = [ manifestPlaceholders = [
// //
// serverHost : "https://napi.yaoulive.com", serverHost : "https://napi.yaoulive.com",
// //
serverHost : " https://ceshi.yaoulive.com", // serverHost : " https://ceshi.yaoulive.com",
// //

View File

@ -249,6 +249,7 @@ public class LiveGiftPopup extends AbsDialogFragment {
transaction.commitAllowingStateLoss(); transaction.commitAllowingStateLoss();
isWrap = true; isWrap = true;
findViewById(R.id.red_point).setVisibility(View.GONE); findViewById(R.id.red_point).setVisibility(View.GONE);
hideLianBtn();
} }
}); });
//连送 //连送
@ -756,6 +757,13 @@ public class LiveGiftPopup extends AbsDialogFragment {
} else { } else {
LiveHttpUtil.sendGift("0", mLiveUid, mStream, liveGiftModel.getId(), mCount, isContactGift, callback); 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 int mLianCountDownCount;//连送倒计时的数字
private Handler lianSongHandler = new Handler();
private Runnable lianSongRunnable = new Runnable() { private void showLianBtn() {
mBtnSendGroup.removeCallbacks(newLianSongRunnable);
mBtnSendGroup.setVisibility(View.VISIBLE);
giftSendLayout.setVisibility(View.INVISIBLE);
mLianCountDownCount = 5;
mBtnSendGroup.post(newLianSongRunnable);
}
/**
* 新连送回调
*/
private Runnable newLianSongRunnable = new Runnable() {
@Override @Override
public void run() { 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) { if (mLianCountDownCount == 0) {
hideLianBtn(); hideLianBtn();
} else { } else {
mLianCountDownCount--;
if (mLianText != null) { if (mLianText != null) {
mLianText.setText(mLianCountDownCount + "s"); mLianText.setText(mLianCountDownCount + "s");
lianSongHandler.postDelayed(lianSongRunnable, 1000); mBtnSendGroup.postDelayed(newLianSongRunnable, 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;
}
}
/** /**
* 隐藏连送按钮 包裹 * 隐藏连送按钮 包裹
*/ */
private void hideLianBtn() { private void hideLianBtn() {
mBtnSendGroup.setVisibility(View.INVISIBLE); mBtnSendGroup.setVisibility(View.INVISIBLE);
giftSendLayout.setVisibility(View.VISIBLE); giftSendLayout.setVisibility(View.VISIBLE);
lianSongHandler.removeCallbacks(lianSongRunnable); mBtnSendGroup.removeCallbacks(newLianSongRunnable);
mShowLianBtn = false;
getCoin(); getCoin();
LiveNetManager.get(mContext) LiveNetManager.get(mContext)
.getGiftNamingInfo(liveGiftModel.getId() + "", new com.yunbao.common.http.base.HttpCallback<GiftNamingInfoModel>() { .getGiftNamingInfo(liveGiftModel.getId() + "", new com.yunbao.common.http.base.HttpCallback<GiftNamingInfoModel>() {
@Override @Override
@ -999,7 +981,7 @@ public class LiveGiftPopup extends AbsDialogFragment {
} else { } else {
operateImage.setVisibility(View.GONE); operateImage.setVisibility(View.GONE);
} }
hideLianBtn();
} }
@Subscribe(threadMode = ThreadMode.MAIN) @Subscribe(threadMode = ThreadMode.MAIN)
@ -1385,13 +1367,7 @@ public class LiveGiftPopup extends AbsDialogFragment {
goldText.setText(goldCoin); goldText.setText(goldCoin);
} }
if (!mGiftBean.getSwf().contains("svga")) {
showLianBtn();
}
if (mGiftBean.getType() == 7) {
showLianBtn();
}
// //刷新包裹列表wrap_gift_num -1:表示数量没有变化 // //刷新包裹列表wrap_gift_num -1:表示数量没有变化
// mObjGiftSendback = obj; // mObjGiftSendback = obj;