From 6316f9489eff339cf1c0eba36be3122b1e29b926 Mon Sep 17 00:00:00 2001 From: 18401019693 Date: Mon, 29 Aug 2022 13:24:51 +0800 Subject: [PATCH 1/4] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=EF=BC=9A=20=E5=BF=83?= =?UTF-8?q?=E6=84=BF=E5=8D=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../live/activity/LiveAudienceActivity.java | 3 +++ .../com/yunbao/live/bean/WishlistItemModel.java | 4 ++++ .../yunbao/live/views/LiveRoomViewHolder.java | 17 +++++++++-------- .../yunbao/live/views/PortraitLiveManager.java | 2 +- 4 files changed, 17 insertions(+), 9 deletions(-) diff --git a/live/src/main/java/com/yunbao/live/activity/LiveAudienceActivity.java b/live/src/main/java/com/yunbao/live/activity/LiveAudienceActivity.java index f1e61654e..d73238318 100644 --- a/live/src/main/java/com/yunbao/live/activity/LiveAudienceActivity.java +++ b/live/src/main/java/com/yunbao/live/activity/LiveAudienceActivity.java @@ -417,6 +417,8 @@ public class LiveAudienceActivity extends LiveActivity { } else if (Micing == 2) { manager.micIngTypeTwo(mLiveBean, mLiveType, mLiveTypeVal); } else { + manager.exitLiveRoom(); + manager.onRemove(); super.onBackPressed(); } @@ -437,6 +439,7 @@ public class LiveAudienceActivity extends LiveActivity { @Override protected void onDestroy() { super.onDestroy(); + Bus.getOff(this); L.e("LiveAudienceActivity-------onDestroy------->"); } diff --git a/live/src/main/java/com/yunbao/live/bean/WishlistItemModel.java b/live/src/main/java/com/yunbao/live/bean/WishlistItemModel.java index 2ff070c13..676fd1e4e 100644 --- a/live/src/main/java/com/yunbao/live/bean/WishlistItemModel.java +++ b/live/src/main/java/com/yunbao/live/bean/WishlistItemModel.java @@ -115,4 +115,8 @@ public class WishlistItemModel extends BaseModel { this.wishlistProgress = wishlistProgress; return this; } + + public String getWishlistNumP() { + return wishlistProgress + "/" + wishlistNum; + } } 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 95d865260..c22a101fa 100644 --- a/live/src/main/java/com/yunbao/live/views/LiveRoomViewHolder.java +++ b/live/src/main/java/com/yunbao/live/views/LiveRoomViewHolder.java @@ -855,8 +855,8 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis ViewClicksAntiShake.clicksAntiShake(wishListLayout, () -> startActivity(new Intent(mContext, ZhuangBanActivity.class).putExtra("url", ""))); //打招呼消息 fastMsgRecyclerView = (RecyclerView) findViewById(R.id.room_fast_msg); - fastMsgRecyclerView.setLayoutManager(new LinearLayoutManager(mContext,LinearLayoutManager.HORIZONTAL,false)); - fastMessageRecyclerViewAdapter=new LiveRoomFastMessageRecyclerViewAdapter(mContext); + fastMsgRecyclerView.setLayoutManager(new LinearLayoutManager(mContext, LinearLayoutManager.HORIZONTAL, false)); + fastMessageRecyclerViewAdapter = new LiveRoomFastMessageRecyclerViewAdapter(mContext); fastMsgRecyclerView.setAdapter(fastMessageRecyclerViewAdapter); fastMessageRecyclerViewAdapter.setMessageListener(msg -> { //点击的消息发送出去 @@ -1053,7 +1053,7 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis ImageView wishPic = wish.findViewById(R.id.wish_pic); TextView wishIndex = wish.findViewById(R.id.wish_index); ImgLoader.display(mContext, wishlist.get(i).getWishlistIcon(), wishPic); - wishIndex.setText((i + 1) + "/" + wishlist.size()); + wishIndex.setText(wishlist.get(i).getWishlistNumP()); wishListFlipper.addView(wish); } wishListFlipper.startFlipping(); @@ -1415,7 +1415,7 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis private void setGuardIcon(LiveUserGiftBean guard) { if (guard != null) { - nowGuardUser=guard; + nowGuardUser = guard; ImgLoader.displayAvatar(mContext, guard.getAvatar(), userGuard); gift_svga.setVisibility(View.VISIBLE); } @@ -1494,7 +1494,7 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis } else if (i == R.id.ft_hot_add) { ((LiveActivity) mContext).openHotListWindow(1); } else if (i == R.id.user_guard) { - // ((LiveActivity) mContext).openUserMoreListWindow(2, true); + // ((LiveActivity) mContext).openUserMoreListWindow(2, true); ((LiveActivity) mContext).openGuardListWindow(); } @@ -1775,7 +1775,7 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis } room_hot.setText(formatBigNum.formatBigNum(bean.getLiveChatBean().getHot_num())); LiveUserGiftBean chatBean = bean.getUserBean(); - if(chatBean!=null&&nowGuardUser!=null) { + if (chatBean != null && nowGuardUser != null) { LiveUserGiftBean tmp = null; if (chatBean.getGuardType() != 0 && chatBean.getGuardType() > nowGuardUser.getGuardType()) { tmp = chatBean; @@ -1788,10 +1788,11 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis /** * 用户离开房间 + * * @param bean 用户 */ - public void onExitRoom(UserBean bean){ - // getGuardInfo(); + public void onExitRoom(UserBean bean) { + // getGuardInfo(); } /** 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 7ceb67d56..430a1f6c9 100644 --- a/live/src/main/java/com/yunbao/live/views/PortraitLiveManager.java +++ b/live/src/main/java/com/yunbao/live/views/PortraitLiveManager.java @@ -1259,7 +1259,7 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe mEnd = true; //断开socket - if (mSocketRyClient != null) { + if (mSocketRyClient != null) { mSocketRyClient.disConnect(); } mSocketRyClient = null; From 4c074264fb1349be7059cdf482b067b1672d3aa5 Mon Sep 17 00:00:00 2001 From: 18401019693 Date: Mon, 29 Aug 2022 13:44:03 +0800 Subject: [PATCH 2/4] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=EF=BC=9A=20=E5=BF=83?= =?UTF-8?q?=E6=84=BF=E5=8D=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/yunbao/live/activity/LiveAudienceActivity.java | 2 +- .../src/main/java/com/yunbao/live/views/LiveRoomViewHolder.java | 2 -- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/live/src/main/java/com/yunbao/live/activity/LiveAudienceActivity.java b/live/src/main/java/com/yunbao/live/activity/LiveAudienceActivity.java index d73238318..be020fe84 100644 --- a/live/src/main/java/com/yunbao/live/activity/LiveAudienceActivity.java +++ b/live/src/main/java/com/yunbao/live/activity/LiveAudienceActivity.java @@ -704,7 +704,7 @@ public class LiveAudienceActivity extends LiveActivity { bundle.putString(Constants.LIVE_UID, mLiveUid); fragment4Audience.setArguments(bundle); if (mContext instanceof LiveAudienceActivity) { - fragment4Audience.show(((LiveAudienceActivity) mContext).getSupportFragmentManager(), "LiveWishListDialogFragmentAudience"); + fragment4Audience.show(((LiveAudienceActivity) mContext).getSupportFragmentManager(), "LiveWishListDialogFragment4Audience"); } break; case OPEN_PARAMETERS: 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 c22a101fa..77311ccca 100644 --- a/live/src/main/java/com/yunbao/live/views/LiveRoomViewHolder.java +++ b/live/src/main/java/com/yunbao/live/views/LiveRoomViewHolder.java @@ -851,8 +851,6 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis } }); loadWishlistData(); - //打开活动窗口 - ViewClicksAntiShake.clicksAntiShake(wishListLayout, () -> startActivity(new Intent(mContext, ZhuangBanActivity.class).putExtra("url", ""))); //打招呼消息 fastMsgRecyclerView = (RecyclerView) findViewById(R.id.room_fast_msg); fastMsgRecyclerView.setLayoutManager(new LinearLayoutManager(mContext, LinearLayoutManager.HORIZONTAL, false)); From e2cd64ec0f9248d94e32628f69685fb695dcaeec Mon Sep 17 00:00:00 2001 From: 18401019693 Date: Mon, 29 Aug 2022 13:51:13 +0800 Subject: [PATCH 3/4] =?UTF-8?q?=E8=83=8C=E6=99=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- common/src/main/res/drawable/bg_live_tota.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common/src/main/res/drawable/bg_live_tota.xml b/common/src/main/res/drawable/bg_live_tota.xml index 97920b7a7..c56735473 100644 --- a/common/src/main/res/drawable/bg_live_tota.xml +++ b/common/src/main/res/drawable/bg_live_tota.xml @@ -1,5 +1,5 @@ - + \ No newline at end of file From 623e17ae4ec7f02047ca85bcbd5169e31b5f8257 Mon Sep 17 00:00:00 2001 From: 18401019693 Date: Mon, 29 Aug 2022 15:26:58 +0800 Subject: [PATCH 4/4] =?UTF-8?q?=E5=BF=83=E6=84=BF=E5=8D=95=E5=88=B7?= =?UTF-8?q?=E6=96=B0=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" />