From 623e17ae4ec7f02047ca85bcbd5169e31b5f8257 Mon Sep 17 00:00:00 2001 From: 18401019693 Date: Mon, 29 Aug 2022 15:26:58 +0800 Subject: [PATCH] =?UTF-8?q?=E5=BF=83=E6=84=BF=E5=8D=95=E5=88=B7=E6=96=B0?= =?UTF-8?q?=E6=95=B0=E9=87=8F=E8=BF=9B=E5=BA=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../imrongcloud/RongcloudIMManager.java | 4 +-- config.gradle | 4 +-- .../yunbao/live/views/LiveRoomViewHolder.java | 25 ++++++++++++++++--- .../live/views/PortraitLiveManager.java | 10 +++++--- live/src/main/res/layout/view_wish_list.xml | 4 +-- 5 files changed, 34 insertions(+), 13 deletions(-) diff --git a/common/src/main/java/com/yunbao/common/manager/imrongcloud/RongcloudIMManager.java b/common/src/main/java/com/yunbao/common/manager/imrongcloud/RongcloudIMManager.java index 4494d6149..d7f055a1e 100644 --- a/common/src/main/java/com/yunbao/common/manager/imrongcloud/RongcloudIMManager.java +++ b/common/src/main/java/com/yunbao/common/manager/imrongcloud/RongcloudIMManager.java @@ -32,9 +32,9 @@ import static com.yunbao.common.CommonAppContext.isReady; */ public class RongcloudIMManager { //融云开发者平台注册app唯一识别符 - public static final String RONG_IM_KEY = "uwd1c0sxu1p71"; +// public static final String RONG_IM_KEY = "uwd1c0sxu1p71"; //测试环境 -// public static final String RONG_IM_KEY = "pvxdm17jpd3hr"; + public static final String RONG_IM_KEY = "pvxdm17jpd3hr"; private static final String CLASSNAME = "RongcloudIMManager"; diff --git a/config.gradle b/config.gradle index 7d7250467..cf3f0a090 100644 --- a/config.gradle +++ b/config.gradle @@ -10,9 +10,9 @@ ext { manifestPlaceholders = [ //正式 - serverHost : "https://napi.yaoulive.com", +// serverHost : "https://napi.yaoulive.com", //測試 -// serverHost : "https://ceshi.yaoulive.com", + serverHost : "https://ceshi.yaoulive.com", //腾讯地图 txMapAppKey : "EOZBZ-ASLCU-4XPV3-BDCHZ-4E3Q7-H4BWB", 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 77311ccca..f30e929ab 100644 --- a/live/src/main/java/com/yunbao/live/views/LiveRoomViewHolder.java +++ b/live/src/main/java/com/yunbao/live/views/LiveRoomViewHolder.java @@ -3,7 +3,6 @@ package com.yunbao.live.views; import android.app.Activity; import android.app.Dialog; import android.content.Context; -import android.content.Intent; import android.graphics.Outline; import android.os.Bundle; import android.os.Handler; @@ -115,7 +114,6 @@ import java.util.List; import pl.droidsonroids.gif.GifImageView; -import static com.blankj.utilcode.util.ActivityUtils.startActivity; import static com.yunbao.common.CommonAppContext.logger; import static com.yunbao.common.CommonAppContext.mFirebaseAnalytics; @@ -252,6 +250,8 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis private LiveRoomFastMessageRecyclerViewAdapter fastMessageRecyclerViewAdapter; private LiveUserGiftBean nowGuardUser; + private ViewFlipper wishListFlipper; + private List wishlist = new ArrayList<>(); public LiveRoomViewHolder(boolean isRys, int forActivity, Context context, ViewGroup parentView, GifImageView gifImageView, SVGAImageView svgaImageView, ViewGroup liveGiftPrizePoolContainer, WindowManager windowManager) { super(context, parentView); @@ -1040,14 +1040,16 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis */ public void initWishList(List wishlist) { if (wishlist.size() > 0) { + this.wishlist = wishlist; wishListLayout.setVisibility(View.VISIBLE); } else { wishListLayout.setVisibility(View.GONE); } ((Activity) mContext).runOnUiThread(() -> { - ViewFlipper wishListFlipper = (ViewFlipper) findViewById(R.id.wish_list); + wishListFlipper = (ViewFlipper) findViewById(R.id.wish_list); for (int i = 0; i < wishlist.size(); i++) { View wish = LayoutInflater.from(mContext).inflate(R.layout.view_wish_list, null); + wish.setTag(wishlist.get(i).getId()); ImageView wishPic = wish.findViewById(R.id.wish_pic); TextView wishIndex = wish.findViewById(R.id.wish_index); ImgLoader.display(mContext, wishlist.get(i).getWishlistIcon(), wishPic); @@ -1060,6 +1062,23 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis } + /** + * 更新心愿单进度 + * + * @param giftId 礼物ID + * @param giftCount 礼物数量 + */ + public void updataWishList(String giftId, int giftCount) { + for (WishlistItemModel model : wishlist) { + if (TextUtils.equals(giftId, model.getLid())) { + int number = Integer.parseInt(model.getWishlistProgress()) + giftCount; + model.setWishlistProgress(String.valueOf(number)); + } + } + wishListFlipper.removeAllViews(); + initWishList(wishlist); + } + //点击头像 private void clickAvatar() { livePKUserListBean = new LivePKUserListBean(); diff --git a/live/src/main/java/com/yunbao/live/views/PortraitLiveManager.java b/live/src/main/java/com/yunbao/live/views/PortraitLiveManager.java index 430a1f6c9..6fdac214a 100644 --- a/live/src/main/java/com/yunbao/live/views/PortraitLiveManager.java +++ b/live/src/main/java/com/yunbao/live/views/PortraitLiveManager.java @@ -164,7 +164,7 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe private boolean mFirstConnectSocket;//是否是第一次连接成功socket private int liveBg; private LiveImDeletUtil liveImDeletUtil; - private List greetings = new ArrayList<>(); + private List greetings = new ArrayList<>(); public PortraitLiveManager(Activity context, Intent intent) { this.mContext = context; @@ -575,7 +575,7 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe mLiveLinkMicPresenter.onAudienceLeaveRoom(bean); } try { - if(mLiveRoomViewHolder!=null){ + if (mLiveRoomViewHolder != null) { mLiveRoomViewHolder.onExitRoom(bean); if (mLiveRoomViewHolder.room_hot != null) { if (!"".equals(bean.getHot_num()) && !"0".equals(bean.getHot_num())) { @@ -596,13 +596,15 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe mLiveRoomViewHolder.showGuardGifMessage(bean); } } else { + if (mLiveRoomViewHolder != null) { if (bean.getmLiveUId().equals(bean.getRoomnum())) { mLiveRoomViewHolder.insertChat(bean.getLiveChatBean(), 1); } mLiveRoomViewHolder.showGiftMessage(bean, false); - + mLiveRoomViewHolder.updataWishList(bean.getGiftId(), bean.getGiftCount()); } + } } @@ -1259,7 +1261,7 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe mEnd = true; //断开socket - if (mSocketRyClient != null) { + if (mSocketRyClient != null) { mSocketRyClient.disConnect(); } mSocketRyClient = null; diff --git a/live/src/main/res/layout/view_wish_list.xml b/live/src/main/res/layout/view_wish_list.xml index 947d56c08..63ce6c19d 100644 --- a/live/src/main/res/layout/view_wish_list.xml +++ b/live/src/main/res/layout/view_wish_list.xml @@ -7,8 +7,8 @@ + android:layout_width="17dp" + android:layout_height="17dp" />