From fe921e25bb9a9163d8945d8de53b2b184ac8b7ca Mon Sep 17 00:00:00 2001 From: zlzw <583819556@qq.com> Date: Fri, 4 Aug 2023 14:25:49 +0800 Subject: [PATCH] =?UTF-8?q?update=20=E7=B2=89=E4=B8=9D=E5=9B=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/yunbao/common/bean/LiveGiftBean.java | 10 +++++++ .../java/com/yunbao/common/bean/UserBean.java | 10 +++++++ .../yunbao/live/activity/LiveActivity.java | 2 +- .../live/interfaces/IDanmuActionListener.java | 9 ++++++ .../live/presenter/LiveDanmuPresenter.java | 8 +++-- .../yunbao/live/socket/SocketRyClient.java | 2 ++ .../yunbao/live/views/DanmuViewHolder.java | 10 ++----- .../live/views/FansDanmuViewHolder.java | 12 ++------ .../yunbao/live/views/LiveRoomViewHolder.java | 25 +++++++++------- .../live/views/PortraitLiveManager.java | 3 +- .../view_fans_group_enter_room_leave.xml | 30 +++++++++++++++---- live/src/main/res/values-en/strings.xml | 2 ++ live/src/main/res/values/strings.xml | 2 ++ 13 files changed, 87 insertions(+), 38 deletions(-) create mode 100644 live/src/main/java/com/yunbao/live/interfaces/IDanmuActionListener.java diff --git a/common/src/main/java/com/yunbao/common/bean/LiveGiftBean.java b/common/src/main/java/com/yunbao/common/bean/LiveGiftBean.java index c0777d57e..33409755b 100644 --- a/common/src/main/java/com/yunbao/common/bean/LiveGiftBean.java +++ b/common/src/main/java/com/yunbao/common/bean/LiveGiftBean.java @@ -37,6 +37,16 @@ public class LiveGiftBean { @JSONField(name = "blind_box_type") private int blind_box_type = 0; + private int fansGiftLevel=0;//粉丝团礼物等级要求 + + public int getFansGiftLevel() { + return fansGiftLevel; + } + + public void setFansGiftLevel(int fansGiftLevel) { + this.fansGiftLevel = fansGiftLevel; + } + public int getBlind_box_type() { return blind_box_type; } diff --git a/common/src/main/java/com/yunbao/common/bean/UserBean.java b/common/src/main/java/com/yunbao/common/bean/UserBean.java index 29d3101d0..ca4c91489 100644 --- a/common/src/main/java/com/yunbao/common/bean/UserBean.java +++ b/common/src/main/java/com/yunbao/common/bean/UserBean.java @@ -70,6 +70,8 @@ public class UserBean implements Parcelable { private int user_info_complete; //粉丝团等级 private int fansLevel; + //粉丝团进场皮肤 + private String fansEnterRoomUrl; public int getUserInfoComplete() { return user_info_complete; @@ -88,6 +90,14 @@ public class UserBean implements Parcelable { this.fansLevel = fansLevel; } + public String getFansEnterRoomUrl() { + return fansEnterRoomUrl; + } + + public void setFansEnterRoomUrl(String fansEnterRoomUrl) { + this.fansEnterRoomUrl = fansEnterRoomUrl; + } + public boolean isRandomPk() { return randomPk; } diff --git a/live/src/main/java/com/yunbao/live/activity/LiveActivity.java b/live/src/main/java/com/yunbao/live/activity/LiveActivity.java index 46d2c5d6f..e94e1cb0e 100644 --- a/live/src/main/java/com/yunbao/live/activity/LiveActivity.java +++ b/live/src/main/java/com/yunbao/live/activity/LiveActivity.java @@ -947,7 +947,7 @@ public abstract class LiveActivity extends AbsActivity implements SocketMessageL onCoinChanged(coin); } String[] data = new String[]{obj.getString("barragetoken")}; - SocketRyChatUtil.sendDanmuMessage(mLiveUid, contents,22); + SocketRyChatUtil.sendDanmuMessage(mLiveUid, contents,obj.getIntValue("level_fans")); } else { ToastUtil.show(msg); } diff --git a/live/src/main/java/com/yunbao/live/interfaces/IDanmuActionListener.java b/live/src/main/java/com/yunbao/live/interfaces/IDanmuActionListener.java new file mode 100644 index 000000000..a9c314d3a --- /dev/null +++ b/live/src/main/java/com/yunbao/live/interfaces/IDanmuActionListener.java @@ -0,0 +1,9 @@ +package com.yunbao.live.interfaces; + +import com.yunbao.common.views.AbsViewHolder; + +public interface IDanmuActionListener { + void onCanNext(int lineNum); + + void onAnimEnd(AbsViewHolder vh); +} diff --git a/live/src/main/java/com/yunbao/live/presenter/LiveDanmuPresenter.java b/live/src/main/java/com/yunbao/live/presenter/LiveDanmuPresenter.java index 6ae366da7..8f16c3d30 100644 --- a/live/src/main/java/com/yunbao/live/presenter/LiveDanmuPresenter.java +++ b/live/src/main/java/com/yunbao/live/presenter/LiveDanmuPresenter.java @@ -4,7 +4,9 @@ import android.content.Context; import android.util.Log; import android.view.ViewGroup; +import com.yunbao.common.views.AbsViewHolder; import com.yunbao.live.bean.LiveDanMuBean; +import com.yunbao.live.interfaces.IDanmuActionListener; import com.yunbao.live.views.DanmuViewHolder; import com.yunbao.live.views.FansDanmuViewHolder; @@ -17,7 +19,7 @@ import java.util.concurrent.ConcurrentLinkedQueue; * 弹幕 */ -public class LiveDanmuPresenter implements DanmuViewHolder.ActionListener { +public class LiveDanmuPresenter implements IDanmuActionListener { private Context mContext; private ViewGroup mDanmuContainer; @@ -59,7 +61,7 @@ public class LiveDanmuPresenter implements DanmuViewHolder.ActionListener { } } if (danmuHolder == null) { - if (bean.getContent().startsWith("#")) { + if (bean.getFensLevel() >= 16) { danmuHolder = new FansDanmuViewHolder(mContext, mDanmuContainer); } else { danmuHolder = new DanmuViewHolder(mContext, mDanmuContainer); @@ -107,7 +109,7 @@ public class LiveDanmuPresenter implements DanmuViewHolder.ActionListener { } @Override - public void onAnimEnd(DanmuViewHolder vh) { + public void onAnimEnd(AbsViewHolder vh) { if (mQueue.size() == 0) { if (vh != null) { vh.release(); 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 ec79c1033..58d3bf568 100644 --- a/live/src/main/java/com/yunbao/live/socket/SocketRyClient.java +++ b/live/src/main/java/com/yunbao/live/socket/SocketRyClient.java @@ -913,6 +913,8 @@ public class SocketRyClient { chatBean.setMedalNmae(obj.getString("medal_name")); chatBean.setUserNiceName(obj.getString("user_nicename"));//名字 FansMedalBean fansMedalBean = CommonAppConfig.getInstance().getAnchorFansMedal(obj.getIntValue("medal_level")); + u.setFansLevel(obj.getIntValue("medal_level")); + u.setFansEnterRoomUrl(obj.getString("medal_backgroup_thumb")); if (fansMedalBean != null) chatBean.setMedalLevelImageUrl(fansMedalBean.getThumb()); mListener.onEnterRoom(new LiveEnterRoomBean(u, chatBean)); diff --git a/live/src/main/java/com/yunbao/live/views/DanmuViewHolder.java b/live/src/main/java/com/yunbao/live/views/DanmuViewHolder.java index b76b16a71..c4606d746 100644 --- a/live/src/main/java/com/yunbao/live/views/DanmuViewHolder.java +++ b/live/src/main/java/com/yunbao/live/views/DanmuViewHolder.java @@ -18,6 +18,7 @@ import com.yunbao.common.utils.ScreenDimenUtil; import com.yunbao.common.views.AbsViewHolder; import com.yunbao.live.R; import com.yunbao.live.bean.LiveDanMuBean; +import com.yunbao.live.interfaces.IDanmuActionListener; /** * Created by cxf on 2017/8/25. @@ -40,7 +41,7 @@ public class DanmuViewHolder extends AbsViewHolder { private Animator.AnimatorListener mAnimatorListener; private boolean mCanNext;//是否可以有下一个 private boolean mIdle;//是否空闲 - private ActionListener mActionListener; + private IDanmuActionListener mActionListener; private int mLineNum; public DanmuViewHolder(Context context, ViewGroup parentView) { @@ -115,7 +116,7 @@ public class DanmuViewHolder extends AbsViewHolder { mIdle = idle; } - public void setActionListener(ActionListener actionListener) { + public void setActionListener(IDanmuActionListener actionListener) { mActionListener = actionListener; } @@ -127,9 +128,4 @@ public class DanmuViewHolder extends AbsViewHolder { mActionListener = null; } - public interface ActionListener { - void onCanNext(int lineNum); - - void onAnimEnd(DanmuViewHolder vh); - } } diff --git a/live/src/main/java/com/yunbao/live/views/FansDanmuViewHolder.java b/live/src/main/java/com/yunbao/live/views/FansDanmuViewHolder.java index 0a4615b6d..9b786b1c3 100644 --- a/live/src/main/java/com/yunbao/live/views/FansDanmuViewHolder.java +++ b/live/src/main/java/com/yunbao/live/views/FansDanmuViewHolder.java @@ -15,9 +15,9 @@ import com.yunbao.common.bean.LevelBean; import com.yunbao.common.glide.ImgLoader; import com.yunbao.common.utils.DpUtil; import com.yunbao.common.utils.ScreenDimenUtil; -import com.yunbao.common.views.AbsViewHolder; import com.yunbao.live.R; import com.yunbao.live.bean.LiveDanMuBean; +import com.yunbao.live.interfaces.IDanmuActionListener; /** * Created by cxf on 2017/8/25. @@ -40,7 +40,7 @@ public class FansDanmuViewHolder extends DanmuViewHolder { private Animator.AnimatorListener mAnimatorListener; private boolean mCanNext;//是否可以有下一个 private boolean mIdle;//是否空闲 - private ActionListener mActionListener; + private IDanmuActionListener mActionListener; private int mLineNum; public FansDanmuViewHolder(Context context, ViewGroup parentView) { @@ -116,7 +116,7 @@ public class FansDanmuViewHolder extends DanmuViewHolder { mIdle = idle; } - public void setActionListener(ActionListener actionListener) { + public void setActionListener(IDanmuActionListener actionListener) { mActionListener = actionListener; } @@ -128,10 +128,4 @@ public class FansDanmuViewHolder extends DanmuViewHolder { mActionListener = null; } - - public interface ActionListener { - void onCanNext(int lineNum); - - void onAnimEnd(FansDanmuViewHolder vh); - } } 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 704d65622..fecf4c9e4 100644 --- a/live/src/main/java/com/yunbao/live/views/LiveRoomViewHolder.java +++ b/live/src/main/java/com/yunbao/live/views/LiveRoomViewHolder.java @@ -324,7 +324,8 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis private View btnEvent; private LinearLayout lt_trickery; private TextView tv_trickery_time; - private FrameLayout enterRoomLeave, enterRoomBg, fans_enter_room_leave; + private FrameLayout enterRoomLeave, enterRoomBg; + private ConstraintLayout fans_enter_room_leave; private RecyclerView fastMsgRecyclerView; private LiveRoomFastMessageRecyclerViewAdapter fastMessageRecyclerViewAdapter; @@ -907,7 +908,7 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis btn_event2 = (LinearLayout) findViewById(R.id.btn_event2); btn_event4 = (LinearLayout) findViewById(R.id.btn_event4); enterRoomLeave = (FrameLayout) findViewById(R.id.enter_room_leave); - fans_enter_room_leave = (FrameLayout) findViewById(R.id.fans_enter_room_leave); + fans_enter_room_leave = (ConstraintLayout) findViewById(R.id.fans_enter_room_leave); enterRoomBg = (FrameLayout) findViewById(R.id.enter_room_bg); enterRoomLeave2 = (LinearLayout) findViewById(R.id.enter_room_leave2); mBanner1 = (Banner) findViewById(R.id.banner1); @@ -4844,9 +4845,8 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis userName.setText(String.format(mContext.getString(R.string.come_hint), model.getUserNiceName())); ImgLoader.display(mContext, model.getAvatar(), imageAvatar); int level = model.getLevel(); - model.setFansLevel(11); - if (model.getFansLevel() > 10) { - showFansGroupEnterRoom(); + if (!StringUtil.isEmpty(model.getFansEnterRoomUrl())) { + showFansGroupEnterRoom(model); return; } if (level < 50) { @@ -4907,13 +4907,17 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis } - private void showFansGroupEnterRoom() { + private void showFansGroupEnterRoom(LiveUserGiftBean model) { + fans_enter_room_leave.post(() -> { TextView userName = fans_enter_room_leave.findViewById(R.id.user_name); - userName.setText(Html.fromHtml(String.format("@%s 粉絲團成員歡迎進房", "测试"))); - new LoadDian9TuUtil().loadDian9Tu(mContext, fans_enter_room_leave, - "https://downs.yaoulive.com/20230322/g5_.9.png" - , 1); + ImageView bg = fans_enter_room_leave.findViewById(R.id.bg); + + userName.setText(Html.fromHtml(String.format("@%s %s", + model.getUserNiceName(), + mContext.getString(R.string.live_fans_group_enter_room) + ))); + ImgLoader.display(mContext, model.getFansEnterRoomUrl(), bg); fans_enter_room_leave.setVisibility(View.VISIBLE); TranslateAnimation animationTranslate = new TranslateAnimation(DeviceUtils.getScreenWidth((Activity) mContext), 0, 0, 0); AnimationSet animationSet1 = new AnimationSet(true); @@ -4928,7 +4932,6 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis @Override public void onAnimationEnd(Animation animation) { - mLiveRoomHandler.postDelayed(() -> hideFansGroupEnter(), 3000); } @Override 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 1be8185f3..f0c1e6878 100644 --- a/live/src/main/java/com/yunbao/live/views/PortraitLiveManager.java +++ b/live/src/main/java/com/yunbao/live/views/PortraitLiveManager.java @@ -1096,6 +1096,7 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe public void run() { if (mLiveRoomViewHolder != null) { mLiveRoomViewHolder.hideHighGrade(); + mLiveRoomViewHolder.hideFansGroupEnter(); } enterRoomLeaveHandler.post(enterRoomLeaveRunnable); } @@ -1120,7 +1121,7 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe LiveChatBean liveChatBean = bean.getLiveChatBean(); LiveUserGiftBean liveUserGiftBean = bean.getUserBean(); int level = liveUserGiftBean.getLevel(); - if (level >= 30) { + if (level >= 30 || liveUserGiftBean.getFansLevel() >= 10) { //高等级飘屏 liveUserGiftBean.setUserNiceName(liveChatBean.getUserNiceName()); enterRoomModel.add(liveUserGiftBean); diff --git a/live/src/main/res/layout/view_fans_group_enter_room_leave.xml b/live/src/main/res/layout/view_fans_group_enter_room_leave.xml index 38421e1d8..f63163ed1 100644 --- a/live/src/main/res/layout/view_fans_group_enter_room_leave.xml +++ b/live/src/main/res/layout/view_fans_group_enter_room_leave.xml @@ -1,19 +1,37 @@ - + + + android:textSize="12sp" + app:layout_constraintBottom_toBottomOf="parent" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toTopOf="parent" /> - \ No newline at end of file + \ No newline at end of file diff --git a/live/src/main/res/values-en/strings.xml b/live/src/main/res/values-en/strings.xml index acd4cc037..ffc02c448 100644 --- a/live/src/main/res/values-en/strings.xml +++ b/live/src/main/res/values-en/strings.xml @@ -113,4 +113,6 @@ The Perfect GiftPack Purchase a %s Diamond Specific Gift And Receive ALimited Resource Diamond Purchase + Welcome fan group to enter the room + Fan group level Of Lv%s Can send this gift \ No newline at end of file diff --git a/live/src/main/res/values/strings.xml b/live/src/main/res/values/strings.xml index b3fdc3dd2..ae12ea481 100644 --- a/live/src/main/res/values/strings.xml +++ b/live/src/main/res/values/strings.xml @@ -111,4 +111,6 @@ 的臻愛禮包 購買可獲得%s鑽特定禮物,同時可獲得限定資源 %s鑽購買 + 粉絲團成員歡迎進房 + 粉絲團等級達到 Lv%s 可送出該禮物