update 粉丝团

This commit is contained in:
zlzw 2023-08-04 14:25:49 +08:00
parent fae0d01dc2
commit fe921e25bb
13 changed files with 87 additions and 38 deletions

View File

@ -37,6 +37,16 @@ public class LiveGiftBean {
@JSONField(name = "blind_box_type") @JSONField(name = "blind_box_type")
private int blind_box_type = 0; 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() { public int getBlind_box_type() {
return blind_box_type; return blind_box_type;
} }

View File

@ -70,6 +70,8 @@ public class UserBean implements Parcelable {
private int user_info_complete; private int user_info_complete;
//粉丝团等级 //粉丝团等级
private int fansLevel; private int fansLevel;
//粉丝团进场皮肤
private String fansEnterRoomUrl;
public int getUserInfoComplete() { public int getUserInfoComplete() {
return user_info_complete; return user_info_complete;
@ -88,6 +90,14 @@ public class UserBean implements Parcelable {
this.fansLevel = fansLevel; this.fansLevel = fansLevel;
} }
public String getFansEnterRoomUrl() {
return fansEnterRoomUrl;
}
public void setFansEnterRoomUrl(String fansEnterRoomUrl) {
this.fansEnterRoomUrl = fansEnterRoomUrl;
}
public boolean isRandomPk() { public boolean isRandomPk() {
return randomPk; return randomPk;
} }

View File

@ -947,7 +947,7 @@ public abstract class LiveActivity extends AbsActivity implements SocketMessageL
onCoinChanged(coin); onCoinChanged(coin);
} }
String[] data = new String[]{obj.getString("barragetoken")}; String[] data = new String[]{obj.getString("barragetoken")};
SocketRyChatUtil.sendDanmuMessage(mLiveUid, contents,22); SocketRyChatUtil.sendDanmuMessage(mLiveUid, contents,obj.getIntValue("level_fans"));
} else { } else {
ToastUtil.show(msg); ToastUtil.show(msg);
} }

View File

@ -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);
}

View File

@ -4,7 +4,9 @@ import android.content.Context;
import android.util.Log; import android.util.Log;
import android.view.ViewGroup; import android.view.ViewGroup;
import com.yunbao.common.views.AbsViewHolder;
import com.yunbao.live.bean.LiveDanMuBean; import com.yunbao.live.bean.LiveDanMuBean;
import com.yunbao.live.interfaces.IDanmuActionListener;
import com.yunbao.live.views.DanmuViewHolder; import com.yunbao.live.views.DanmuViewHolder;
import com.yunbao.live.views.FansDanmuViewHolder; 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 Context mContext;
private ViewGroup mDanmuContainer; private ViewGroup mDanmuContainer;
@ -59,7 +61,7 @@ public class LiveDanmuPresenter implements DanmuViewHolder.ActionListener {
} }
} }
if (danmuHolder == null) { if (danmuHolder == null) {
if (bean.getContent().startsWith("#")) { if (bean.getFensLevel() >= 16) {
danmuHolder = new FansDanmuViewHolder(mContext, mDanmuContainer); danmuHolder = new FansDanmuViewHolder(mContext, mDanmuContainer);
} else { } else {
danmuHolder = new DanmuViewHolder(mContext, mDanmuContainer); danmuHolder = new DanmuViewHolder(mContext, mDanmuContainer);
@ -107,7 +109,7 @@ public class LiveDanmuPresenter implements DanmuViewHolder.ActionListener {
} }
@Override @Override
public void onAnimEnd(DanmuViewHolder vh) { public void onAnimEnd(AbsViewHolder vh) {
if (mQueue.size() == 0) { if (mQueue.size() == 0) {
if (vh != null) { if (vh != null) {
vh.release(); vh.release();

View File

@ -913,6 +913,8 @@ public class SocketRyClient {
chatBean.setMedalNmae(obj.getString("medal_name")); chatBean.setMedalNmae(obj.getString("medal_name"));
chatBean.setUserNiceName(obj.getString("user_nicename"));//名字 chatBean.setUserNiceName(obj.getString("user_nicename"));//名字
FansMedalBean fansMedalBean = CommonAppConfig.getInstance().getAnchorFansMedal(obj.getIntValue("medal_level")); 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) if (fansMedalBean != null)
chatBean.setMedalLevelImageUrl(fansMedalBean.getThumb()); chatBean.setMedalLevelImageUrl(fansMedalBean.getThumb());
mListener.onEnterRoom(new LiveEnterRoomBean(u, chatBean)); mListener.onEnterRoom(new LiveEnterRoomBean(u, chatBean));

View File

@ -18,6 +18,7 @@ import com.yunbao.common.utils.ScreenDimenUtil;
import com.yunbao.common.views.AbsViewHolder; import com.yunbao.common.views.AbsViewHolder;
import com.yunbao.live.R; import com.yunbao.live.R;
import com.yunbao.live.bean.LiveDanMuBean; import com.yunbao.live.bean.LiveDanMuBean;
import com.yunbao.live.interfaces.IDanmuActionListener;
/** /**
* Created by cxf on 2017/8/25. * Created by cxf on 2017/8/25.
@ -40,7 +41,7 @@ public class DanmuViewHolder extends AbsViewHolder {
private Animator.AnimatorListener mAnimatorListener; private Animator.AnimatorListener mAnimatorListener;
private boolean mCanNext;//是否可以有下一个 private boolean mCanNext;//是否可以有下一个
private boolean mIdle;//是否空闲 private boolean mIdle;//是否空闲
private ActionListener mActionListener; private IDanmuActionListener mActionListener;
private int mLineNum; private int mLineNum;
public DanmuViewHolder(Context context, ViewGroup parentView) { public DanmuViewHolder(Context context, ViewGroup parentView) {
@ -115,7 +116,7 @@ public class DanmuViewHolder extends AbsViewHolder {
mIdle = idle; mIdle = idle;
} }
public void setActionListener(ActionListener actionListener) { public void setActionListener(IDanmuActionListener actionListener) {
mActionListener = actionListener; mActionListener = actionListener;
} }
@ -127,9 +128,4 @@ public class DanmuViewHolder extends AbsViewHolder {
mActionListener = null; mActionListener = null;
} }
public interface ActionListener {
void onCanNext(int lineNum);
void onAnimEnd(DanmuViewHolder vh);
}
} }

View File

@ -15,9 +15,9 @@ import com.yunbao.common.bean.LevelBean;
import com.yunbao.common.glide.ImgLoader; import com.yunbao.common.glide.ImgLoader;
import com.yunbao.common.utils.DpUtil; import com.yunbao.common.utils.DpUtil;
import com.yunbao.common.utils.ScreenDimenUtil; import com.yunbao.common.utils.ScreenDimenUtil;
import com.yunbao.common.views.AbsViewHolder;
import com.yunbao.live.R; import com.yunbao.live.R;
import com.yunbao.live.bean.LiveDanMuBean; import com.yunbao.live.bean.LiveDanMuBean;
import com.yunbao.live.interfaces.IDanmuActionListener;
/** /**
* Created by cxf on 2017/8/25. * Created by cxf on 2017/8/25.
@ -40,7 +40,7 @@ public class FansDanmuViewHolder extends DanmuViewHolder {
private Animator.AnimatorListener mAnimatorListener; private Animator.AnimatorListener mAnimatorListener;
private boolean mCanNext;//是否可以有下一个 private boolean mCanNext;//是否可以有下一个
private boolean mIdle;//是否空闲 private boolean mIdle;//是否空闲
private ActionListener mActionListener; private IDanmuActionListener mActionListener;
private int mLineNum; private int mLineNum;
public FansDanmuViewHolder(Context context, ViewGroup parentView) { public FansDanmuViewHolder(Context context, ViewGroup parentView) {
@ -116,7 +116,7 @@ public class FansDanmuViewHolder extends DanmuViewHolder {
mIdle = idle; mIdle = idle;
} }
public void setActionListener(ActionListener actionListener) { public void setActionListener(IDanmuActionListener actionListener) {
mActionListener = actionListener; mActionListener = actionListener;
} }
@ -128,10 +128,4 @@ public class FansDanmuViewHolder extends DanmuViewHolder {
mActionListener = null; mActionListener = null;
} }
public interface ActionListener {
void onCanNext(int lineNum);
void onAnimEnd(FansDanmuViewHolder vh);
}
} }

View File

@ -324,7 +324,8 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
private View btnEvent; private View btnEvent;
private LinearLayout lt_trickery; private LinearLayout lt_trickery;
private TextView tv_trickery_time; 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 RecyclerView fastMsgRecyclerView;
private LiveRoomFastMessageRecyclerViewAdapter fastMessageRecyclerViewAdapter; private LiveRoomFastMessageRecyclerViewAdapter fastMessageRecyclerViewAdapter;
@ -907,7 +908,7 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
btn_event2 = (LinearLayout) findViewById(R.id.btn_event2); btn_event2 = (LinearLayout) findViewById(R.id.btn_event2);
btn_event4 = (LinearLayout) findViewById(R.id.btn_event4); btn_event4 = (LinearLayout) findViewById(R.id.btn_event4);
enterRoomLeave = (FrameLayout) findViewById(R.id.enter_room_leave); 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); enterRoomBg = (FrameLayout) findViewById(R.id.enter_room_bg);
enterRoomLeave2 = (LinearLayout) findViewById(R.id.enter_room_leave2); enterRoomLeave2 = (LinearLayout) findViewById(R.id.enter_room_leave2);
mBanner1 = (Banner) findViewById(R.id.banner1); 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())); userName.setText(String.format(mContext.getString(R.string.come_hint), model.getUserNiceName()));
ImgLoader.display(mContext, model.getAvatar(), imageAvatar); ImgLoader.display(mContext, model.getAvatar(), imageAvatar);
int level = model.getLevel(); int level = model.getLevel();
model.setFansLevel(11); if (!StringUtil.isEmpty(model.getFansEnterRoomUrl())) {
if (model.getFansLevel() > 10) { showFansGroupEnterRoom(model);
showFansGroupEnterRoom();
return; return;
} }
if (level < 50) { 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(() -> { fans_enter_room_leave.post(() -> {
TextView userName = fans_enter_room_leave.findViewById(R.id.user_name); TextView userName = fans_enter_room_leave.findViewById(R.id.user_name);
userName.setText(Html.fromHtml(String.format("@<font color='#99D5FF'>%s</font> 粉絲團成員歡迎進房", "测试"))); ImageView bg = fans_enter_room_leave.findViewById(R.id.bg);
new LoadDian9TuUtil().loadDian9Tu(mContext, fans_enter_room_leave,
"https://downs.yaoulive.com/20230322/g5_.9.png" userName.setText(Html.fromHtml(String.format("@<font color='#99D5FF'>%s</font> %s",
, 1); model.getUserNiceName(),
mContext.getString(R.string.live_fans_group_enter_room)
)));
ImgLoader.display(mContext, model.getFansEnterRoomUrl(), bg);
fans_enter_room_leave.setVisibility(View.VISIBLE); fans_enter_room_leave.setVisibility(View.VISIBLE);
TranslateAnimation animationTranslate = new TranslateAnimation(DeviceUtils.getScreenWidth((Activity) mContext), 0, 0, 0); TranslateAnimation animationTranslate = new TranslateAnimation(DeviceUtils.getScreenWidth((Activity) mContext), 0, 0, 0);
AnimationSet animationSet1 = new AnimationSet(true); AnimationSet animationSet1 = new AnimationSet(true);
@ -4928,7 +4932,6 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
@Override @Override
public void onAnimationEnd(Animation animation) { public void onAnimationEnd(Animation animation) {
mLiveRoomHandler.postDelayed(() -> hideFansGroupEnter(), 3000);
} }
@Override @Override

View File

@ -1096,6 +1096,7 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe
public void run() { public void run() {
if (mLiveRoomViewHolder != null) { if (mLiveRoomViewHolder != null) {
mLiveRoomViewHolder.hideHighGrade(); mLiveRoomViewHolder.hideHighGrade();
mLiveRoomViewHolder.hideFansGroupEnter();
} }
enterRoomLeaveHandler.post(enterRoomLeaveRunnable); enterRoomLeaveHandler.post(enterRoomLeaveRunnable);
} }
@ -1120,7 +1121,7 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe
LiveChatBean liveChatBean = bean.getLiveChatBean(); LiveChatBean liveChatBean = bean.getLiveChatBean();
LiveUserGiftBean liveUserGiftBean = bean.getUserBean(); LiveUserGiftBean liveUserGiftBean = bean.getUserBean();
int level = liveUserGiftBean.getLevel(); int level = liveUserGiftBean.getLevel();
if (level >= 30) { if (level >= 30 || liveUserGiftBean.getFansLevel() >= 10) {
//高等级飘屏 //高等级飘屏
liveUserGiftBean.setUserNiceName(liveChatBean.getUserNiceName()); liveUserGiftBean.setUserNiceName(liveChatBean.getUserNiceName());
enterRoomModel.add(liveUserGiftBean); enterRoomModel.add(liveUserGiftBean);

View File

@ -1,19 +1,37 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" <androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/fans_enter_room_bg" android:id="@+id/fans_enter_room_bg"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="24dp" android:layout_height="wrap_content"
android:orientation="horizontal"> android:orientation="horizontal">
<ImageView
android:id="@+id/bg"
android:layout_width="0dp"
android:layout_height="0dp"
android:scaleType="fitXY"
android:src="@mipmap/live_zt"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<TextView <TextView
android:id="@+id/user_name" android:id="@+id/user_name"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginStart="4dp" android:layout_marginStart="15dp"
android:layout_marginEnd="6dp" android:layout_marginTop="10dp"
android:layout_marginEnd="10dp"
android:layout_marginBottom="8dp"
android:text="@string/come_hint" android:text="@string/come_hint"
android:textColor="#fff" android:textColor="#fff"
android:textSize="12sp" /> android:textSize="12sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</FrameLayout> </androidx.constraintlayout.widget.ConstraintLayout>

View File

@ -113,4 +113,6 @@
<string name="live_fans_group_buy_title">The Perfect GiftPack</string> <string name="live_fans_group_buy_title">The Perfect GiftPack</string>
<string name="live_fans_group_buy_info">Purchase a %s Diamond Specific Gift And Receive ALimited Resource</string> <string name="live_fans_group_buy_info">Purchase a %s Diamond Specific Gift And Receive ALimited Resource</string>
<string name="live_fans_group_buy_buy">Diamond Purchase</string> <string name="live_fans_group_buy_buy">Diamond Purchase</string>
<string name="live_fans_group_enter_room">Welcome fan group to enter the room</string>
<string name="live_fans_group_send_gift_tips">Fan group level Of Lv%s Can send this gift</string>
</resources> </resources>

View File

@ -111,4 +111,6 @@
<string name="live_fans_group_buy_title">的臻愛禮包</string> <string name="live_fans_group_buy_title">的臻愛禮包</string>
<string name="live_fans_group_buy_info">購買可獲得%s鑽特定禮物同時可獲得限定資源</string> <string name="live_fans_group_buy_info">購買可獲得%s鑽特定禮物同時可獲得限定資源</string>
<string name="live_fans_group_buy_buy">%s鑽購買</string> <string name="live_fans_group_buy_buy">%s鑽購買</string>
<string name="live_fans_group_enter_room">粉絲團成員歡迎進房</string>
<string name="live_fans_group_send_gift_tips">粉絲團等級達到 Lv%s 可送出該禮物</string>
</resources> </resources>