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 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/activity/LiveAudienceActivity.java b/live/src/main/java/com/yunbao/live/activity/LiveAudienceActivity.java index 514cb1db4..fdcda64ed 100644 --- a/live/src/main/java/com/yunbao/live/activity/LiveAudienceActivity.java +++ b/live/src/main/java/com/yunbao/live/activity/LiveAudienceActivity.java @@ -418,6 +418,8 @@ public class LiveAudienceActivity extends LiveActivity { } else if (Micing == 2) { manager.micIngTypeTwo(mLiveBean, mLiveType, mLiveTypeVal); } else { + manager.exitLiveRoom(); + manager.onRemove(); super.onBackPressed(); } @@ -438,6 +440,7 @@ public class LiveAudienceActivity extends LiveActivity { @Override protected void onDestroy() { super.onDestroy(); + Bus.getOff(this); L.e("LiveAudienceActivity-------onDestroy------->"); } @@ -703,7 +706,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/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 c826be3c7..40bc9ab06 100644 --- a/live/src/main/java/com/yunbao/live/views/LiveRoomViewHolder.java +++ b/live/src/main/java/com/yunbao/live/views/LiveRoomViewHolder.java @@ -116,7 +116,6 @@ import java.util.Random; 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; @@ -253,6 +252,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); @@ -853,11 +854,11 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis }); loadWishlistData(); //打开活动窗口 - ViewClicksAntiShake.clicksAntiShake(wishListLayout, () -> startActivity(new Intent(mContext, ZhuangBanActivity.class).putExtra("url", ""))); + ViewClicksAntiShake.clicksAntiShake(wishListLayout, () -> mContext.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 -> { //点击的消息发送出去 @@ -1044,24 +1045,25 @@ 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); - wishIndex.setText((i + 1) + "/" + wishlist.size()); + wishIndex.setText(wishlist.get(i).getWishlistNumP()); wishListFlipper.addView(wish); } wishListFlipper.startFlipping(); }); } - /** * 初始化小时榜。 * 等待接口 @@ -1088,6 +1090,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(); @@ -1441,7 +1460,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); } @@ -1796,13 +1815,12 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis if (bean == null) { return; } - if (mLiveEnterRoomAnimPresenter != null) { mLiveEnterRoomAnimPresenter.enterRoom(bean); } 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; @@ -1816,10 +1834,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 73988ca0a..dcb2227fb 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; @@ -576,7 +576,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())) { @@ -597,13 +597,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()); } + } } 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" />