From 45ae3b16248ff479a2f379130b1ac25ade124683 Mon Sep 17 00:00:00 2001 From: Martin <13046765170@163.com> Date: Fri, 14 Jun 2024 17:39:42 +0800 Subject: [PATCH] =?UTF-8?q?add[=E8=BD=AE=E7=9B=98=E6=95=B4=E8=9B=8A]?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/yunbao/common/http/PDLiveApi.java | 5 ++- .../live/dialog/LivePrankDialogFragment.java | 8 ++-- .../yunbao/live/socket/SocketRyClient.java | 38 +++++++++---------- .../yunbao/live/views/LiveRoomViewHolder.java | 9 ++++- 4 files changed, 34 insertions(+), 26 deletions(-) diff --git a/common/src/main/java/com/yunbao/common/http/PDLiveApi.java b/common/src/main/java/com/yunbao/common/http/PDLiveApi.java index 6a6373442..a7b3a1d52 100644 --- a/common/src/main/java/com/yunbao/common/http/PDLiveApi.java +++ b/common/src/main/java/com/yunbao/common/http/PDLiveApi.java @@ -525,8 +525,9 @@ public interface PDLiveApi { @Query("anchor_id") String anchor_id, @Query("status") String status, @Query("prank_json") String prank_json, - @Query("is_cleared") String is_cleared, - @Query("prank_type") String prank_type + @Query("prank_type") String prank_type, + @Query("is_cleared") String is_cleared + ); /** diff --git a/live/src/main/java/com/yunbao/live/dialog/LivePrankDialogFragment.java b/live/src/main/java/com/yunbao/live/dialog/LivePrankDialogFragment.java index 99437fdc0..00ffe4b9b 100644 --- a/live/src/main/java/com/yunbao/live/dialog/LivePrankDialogFragment.java +++ b/live/src/main/java/com/yunbao/live/dialog/LivePrankDialogFragment.java @@ -232,7 +232,7 @@ public class LivePrankDialogFragment extends AbsDialogFragment implements View.O if ((int) mPrankBtn.getTag() == 0) { setPrankConfig(); } else { - setGiftBean(recyclerAdapter.getList()); + setGiftBean(recyclerAdapter.getList(),"0"); } } }); @@ -251,7 +251,7 @@ public class LivePrankDialogFragment extends AbsDialogFragment implements View.O mPrankBtn.setVisibility(View.VISIBLE); mBtnAddGift.setVisibility(View.VISIBLE); mGiftNotDate.setVisibility(View.VISIBLE); - setGiftBean(recyclerAdapter.getList()); + setGiftBean(recyclerAdapter.getList(),"1"); } ToastUtil.show(WordUtil.isNewZh()?"清空成功!":"Cleared successfully!"); } @@ -413,9 +413,9 @@ public class LivePrankDialogFragment extends AbsDialogFragment implements View.O }); } - private void setGiftBean(List prankGiftBeans) { + private void setGiftBean(List prankGiftBeans,String is_cleared) { JSONArray prankJson = getJsonObjects(prankGiftBeans); - LiveNetManager.get(mContext).setPrankGift(mLiveUid, giftSwitch1Btn.getTag().equals("true") ? "1" : "0", new Gson().toJson(prankJson), giftTypeNowText.getTag().toString(),"", new HttpCallback() { + LiveNetManager.get(mContext).setPrankGift(mLiveUid, giftSwitch1Btn.getTag().equals("true") ? "1" : "0", new Gson().toJson(prankJson), giftTypeNowText.getTag().toString(),is_cleared, new HttpCallback() { @Override public void onSuccess(PrankHttpTurntableBean data) { initGiftData(); diff --git a/live/src/main/java/com/yunbao/live/socket/SocketRyClient.java b/live/src/main/java/com/yunbao/live/socket/SocketRyClient.java index ff32b5391..9c34e6213 100644 --- a/live/src/main/java/com/yunbao/live/socket/SocketRyClient.java +++ b/live/src/main/java/com/yunbao/live/socket/SocketRyClient.java @@ -308,29 +308,29 @@ public class SocketRyClient { // LogUtils.e("yqw=====>整蛊礼物列表:"+ctString); JsonObject jsonObject = jsonElement.getAsJsonObject(); String content = WordUtil.isNewZh() ? jsonObject.get("msg").getAsString() : jsonObject.get("msg_en").getAsString(); - - String is_complete = jsonObject.get("is_complete").getAsString(); //0.未达成整蛊需要的数量 1.已达成整蛊 - String user_name = jsonObject.get("user_name").getAsString(); //用户昵称 - String gift_name = WordUtil.isNewZh()?jsonObject.get("gift_name").getAsString():jsonObject.get("gift_name_en").getAsString(); //礼物名称 - String prank_content = jsonObject.get("prank_content").getAsString(); //整蛊内容 - String gift_count = jsonObject.get("gift_count").getAsString(); // 礼物数量 - - if(is_complete.equals("1")){ - LiveChatBean chatBean = new LiveChatBean(); - chatBean.setUserNiceName(user_name); - chatBean.setGiftName(gift_name); - chatBean.setHot_num(gift_count); - chatBean.setContent(prank_content); - chatBean.setType(TYPE_TO_ANCHOR_PRANK_GIFT); - mListener.onChat(chatBean, 1); + if(jsonObject.get("is_complete")!=null){ + String is_complete = jsonObject.get("is_complete").getAsString(); //0.未达成整蛊需要的数量 1.已达成整蛊 + String user_name = jsonObject.get("user_name").getAsString(); //用户昵称 + String gift_name = WordUtil.isNewZh()?jsonObject.get("gift_name").getAsString():jsonObject.get("gift_name_en").getAsString(); //礼物名称 + String prank_content = jsonObject.get("prank_content").getAsString(); //整蛊内容 + String gift_count = jsonObject.get("gift_count").getAsString(); // 礼物数量 + if(is_complete.equals("1")){ + LiveChatBean chatBean = new LiveChatBean(); + chatBean.setUserNiceName(user_name); + chatBean.setGiftName(gift_name); + chatBean.setHot_num(gift_count); + chatBean.setContent(prank_content); + chatBean.setType(TYPE_TO_ANCHOR_PRANK_GIFT); + mListener.onChat(chatBean, 1); + } }else{ if (!TextUtils.isEmpty(content)){ systemChatMessage2(content); } - if("完成1次!".equals(jsonObject.get("msg").getAsString())){ - Toast toast = Toast.makeText(mContext,WordUtil.isNewZh()?jsonObject.get("msg").getAsString():jsonObject.get("msg_en").getAsString(),Toast.LENGTH_LONG); - toast.show(); - } + } + if("完成1次!".equals(jsonObject.get("msg").getAsString())){ + Toast toast = Toast.makeText(mContext,WordUtil.isNewZh()?jsonObject.get("msg").getAsString():jsonObject.get("msg_en").getAsString(),Toast.LENGTH_LONG); + toast.show(); } mListener.onUpdatePrankProgress(ctString); } 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 5727dd396..d6ed5200f 100644 --- a/live/src/main/java/com/yunbao/live/views/LiveRoomViewHolder.java +++ b/live/src/main/java/com/yunbao/live/views/LiveRoomViewHolder.java @@ -1775,10 +1775,14 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis prank_group.setVisibility(View.GONE); prank_small_icon.setVisibility(View.GONE); } + if(CommonAppConfig.getInstance().getUid().equals(mLiveUid)){ + return; + } if (Integer.parseInt(ctString.getString("prank_turntable_status")) == 0){ prank_group_turntable_icon.setVisibility(View.GONE); }else { - ZeusKt.visible(prank_group_turntable_icon); + prank_group_turntable_icon.setVisibility(View.VISIBLE); + //ZeusKt.visible(prank_group_turntable_icon); } }else { //送整蛊礼物更新 @@ -1834,6 +1838,9 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis private void setPrankList(int status,int mPrankType,int prankTurntableStatus){ // LogUtils.e("yqw=====>显示转盘icon:是否显示:"+(prankTurntableStatus == 1)+",是否在倒计时"+(lt_trickery.getVisibility() == View.VISIBLE)); if (prankTurntableStatus == 1 && lt_trickery.getVisibility() == View.GONE){ + if(CommonAppConfig.getInstance().getUid().equals(mLiveUid)){ + return; + } prank_group_turntable_icon.setVisibility(View.VISIBLE); }else { prank_group_turntable_icon.setVisibility(View.GONE);