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 84dd06664..46d2c5d6f 100644 --- a/live/src/main/java/com/yunbao/live/activity/LiveActivity.java +++ b/live/src/main/java/com/yunbao/live/activity/LiveActivity.java @@ -926,7 +926,7 @@ public abstract class LiveActivity extends AbsActivity implements SocketMessageL if (!mIsAnchor) { UserBean u = CommonAppConfig.getInstance().getUserBean(); if (u != null && u.getLevel() < mDanMuLevel) { - ToastUtil.show(String.format(mContext.getString(R.string.live_level_danmu_limit), mDanMuLevel)); + ToastUtil.show(String.format(mContext.getString(R.string.live_level_danmu_limit), mDanMuLevel+"")); return; } } @@ -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); + SocketRyChatUtil.sendDanmuMessage(mLiveUid, contents,22); } else { ToastUtil.show(msg); } diff --git a/live/src/main/java/com/yunbao/live/adapter/LiveChatAdapter.java b/live/src/main/java/com/yunbao/live/adapter/LiveChatAdapter.java index 60177c90e..db43298f9 100644 --- a/live/src/main/java/com/yunbao/live/adapter/LiveChatAdapter.java +++ b/live/src/main/java/com/yunbao/live/adapter/LiveChatAdapter.java @@ -48,6 +48,7 @@ import com.yunbao.common.manager.IMLoginManager; import com.yunbao.common.utils.Bus; import com.yunbao.common.utils.DpUtil; import com.yunbao.common.utils.SpUtil; +import com.yunbao.common.utils.StringUtil; import com.yunbao.common.views.weight.ClipPathCircleImage; import com.yunbao.live.R; import com.yunbao.live.activity.LiveAudienceActivity; @@ -484,6 +485,9 @@ public class LiveChatAdapter extends RecyclerView.Adapter { } } else if (bean.getType() == SYSTEM3_COLOR) { mTextView.setText(Html.fromHtml(bean.getContent())); + if (!StringUtil.isEmpty(bean.getBubble())) { + new LoadDian9TuUtil().loadDian9Tu(mContext, mBg, bean.getBubble(), 1); + } } else { if (bean.getBubble() != null && !bean.getBubble().equals("")) { //加载.9图聊天气泡 diff --git a/live/src/main/java/com/yunbao/live/bean/LiveDanMuBean.java b/live/src/main/java/com/yunbao/live/bean/LiveDanMuBean.java index 0394506cd..63bb433b8 100644 --- a/live/src/main/java/com/yunbao/live/bean/LiveDanMuBean.java +++ b/live/src/main/java/com/yunbao/live/bean/LiveDanMuBean.java @@ -15,6 +15,7 @@ public class LiveDanMuBean { private String userNiceName; private String avatar; private String content; + private int fensLevel; public String getUid() { return uid; @@ -64,4 +65,12 @@ public class LiveDanMuBean { public void setContent(String content) { this.content = content; } + + public int getFensLevel() { + return fensLevel; + } + + public void setFensLevel(int fensLevel) { + this.fensLevel = fensLevel; + } } 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 0e444ea23..6ae366da7 100644 --- a/live/src/main/java/com/yunbao/live/presenter/LiveDanmuPresenter.java +++ b/live/src/main/java/com/yunbao/live/presenter/LiveDanmuPresenter.java @@ -1,10 +1,12 @@ package com.yunbao.live.presenter; import android.content.Context; +import android.util.Log; import android.view.ViewGroup; import com.yunbao.live.bean.LiveDanMuBean; import com.yunbao.live.views.DanmuViewHolder; +import com.yunbao.live.views.FansDanmuViewHolder; import java.util.LinkedList; import java.util.List; @@ -22,6 +24,7 @@ public class LiveDanmuPresenter implements DanmuViewHolder.ActionListener { private boolean[] mLines;//弹幕的轨道 private List mList; private ConcurrentLinkedQueue mQueue; + private static final String TAG = "弹幕"; public LiveDanmuPresenter(Context context, ViewGroup danmuContainer) { mContext = context; @@ -56,7 +59,11 @@ public class LiveDanmuPresenter implements DanmuViewHolder.ActionListener { } } if (danmuHolder == null) { - danmuHolder = new DanmuViewHolder(mContext, mDanmuContainer); + if (bean.getContent().startsWith("#")) { + danmuHolder = new FansDanmuViewHolder(mContext, mDanmuContainer); + } else { + danmuHolder = new DanmuViewHolder(mContext, mDanmuContainer); + } danmuHolder.setActionListener(this); mList.add(danmuHolder); } diff --git a/live/src/main/java/com/yunbao/live/socket/SocketRyChatUtil.java b/live/src/main/java/com/yunbao/live/socket/SocketRyChatUtil.java index 57a56cb9a..635f9e662 100644 --- a/live/src/main/java/com/yunbao/live/socket/SocketRyChatUtil.java +++ b/live/src/main/java/com/yunbao/live/socket/SocketRyChatUtil.java @@ -215,6 +215,9 @@ public class SocketRyChatUtil { * 发送弹幕消息 */ public static void sendDanmuMessage(String mLiveUid, String danmuToken) { + sendDanmuMessage(mLiveUid,danmuToken,0); + } + public static void sendDanmuMessage(String mLiveUid, String danmuToken,int fansLevel) { UserBean u = CommonAppConfig.getInstance().getUserBean(); if (u == null) { return; @@ -227,6 +230,7 @@ public class SocketRyChatUtil { .param("uname", u.getUserNiceName()) .param("uid", u.getId()) .param("uhead", u.getAvatar()) + .param("fansLevel",fansLevel) .param("ct", danmuToken); msg.create(); String targetId = "g" + mLiveUid; 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 427a8439a..ec79c1033 100644 --- a/live/src/main/java/com/yunbao/live/socket/SocketRyClient.java +++ b/live/src/main/java/com/yunbao/live/socket/SocketRyClient.java @@ -402,6 +402,9 @@ public class SocketRyClient { liveDanMuBean2.setAvatar(map.getString("uhead")); liveDanMuBean2.setUserNiceName(map.getString("uname")); liveDanMuBean2.setContent(map.getString("ct")); + if(map.containsKey("fansLevel")){ + liveDanMuBean2.setFensLevel(map.getInteger("fansLevel")); + } mListener.onSendDanMu(liveDanMuBean2); break; case Constants.SOCKET_LEAVE_ROOM://离开房间 diff --git a/live/src/main/java/com/yunbao/live/views/FansDanmuViewHolder.java b/live/src/main/java/com/yunbao/live/views/FansDanmuViewHolder.java new file mode 100644 index 000000000..0a4615b6d --- /dev/null +++ b/live/src/main/java/com/yunbao/live/views/FansDanmuViewHolder.java @@ -0,0 +1,137 @@ +package com.yunbao.live.views; + +import android.animation.Animator; +import android.animation.AnimatorListenerAdapter; +import android.animation.ValueAnimator; +import android.content.Context; +import android.graphics.Color; +import android.view.ViewGroup; +import android.view.animation.LinearInterpolator; +import android.widget.ImageView; +import android.widget.TextView; + +import com.yunbao.common.CommonAppConfig; +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; + +/** + * Created by cxf on 2017/8/25. + * 弹幕 + */ + +public class FansDanmuViewHolder extends DanmuViewHolder { + + private static final float SPEED = 0.2f;//弹幕的速度,这个值越小,弹幕走的越慢 + private static final int MARGIN_TOP = DpUtil.dp2px(150); + private static final int SPACE = DpUtil.dp2px(50); + private static final int DP_15 = DpUtil.dp2px(15); + private ImageView mAvatar; + private TextView mName; + private TextView mContent; + private int mScreenWidth;//屏幕宽度 + private int mWidth;//控件的宽度 + private ValueAnimator mAnimator; + private ValueAnimator.AnimatorUpdateListener mUpdateListener; + private Animator.AnimatorListener mAnimatorListener; + private boolean mCanNext;//是否可以有下一个 + private boolean mIdle;//是否空闲 + private ActionListener mActionListener; + private int mLineNum; + + public FansDanmuViewHolder(Context context, ViewGroup parentView) { + super(context, parentView); + } + + + @Override + protected int getLayoutId() { + return R.layout.view_gift_danmu_fans; + } + + @Override + public void init() { + mAvatar = (ImageView) findViewById(R.id.avatar); + mName = (TextView) findViewById(R.id.name); + mContent = (TextView) findViewById(R.id.content); + mScreenWidth = ScreenDimenUtil.getInstance().getScreenWdith(); + mUpdateListener = new ValueAnimator.AnimatorUpdateListener() { + @Override + public void onAnimationUpdate(ValueAnimator animation) { + float v = (float) animation.getAnimatedValue(); + mContentView.setX(v); + if (!mCanNext && v <= mScreenWidth - mWidth - DP_15) { + mCanNext = true; + if (mActionListener != null) { + mActionListener.onCanNext(mLineNum); + } + } + } + + }; + mAnimatorListener = new AnimatorListenerAdapter() { + @Override + public void onAnimationEnd(Animator animation) { + removeFromParent(); + mIdle = true; + if (mActionListener != null) { + mActionListener.onAnimEnd(FansDanmuViewHolder.this); + } + } + }; + } + + public void show(LiveDanMuBean bean, int lineNum) { + mLineNum = lineNum; + ImgLoader.display(mContext,bean.getAvatar(), mAvatar); + mName.setText(bean.getUserNiceName()+":"); + LevelBean levelBean = CommonAppConfig.getInstance().getLevel(bean.getLevel()); + if (levelBean != null) { + mName.setTextColor(Color.parseColor(levelBean.getColor())); + } + mContent.setText(bean.getContent()); + mCanNext = false; + mContentView.measure(0, 0); + mWidth = mContentView.getMeasuredWidth(); + mContentView.setX(mScreenWidth); + mContentView.setY(MARGIN_TOP + lineNum * SPACE); + addToParent(); + mAnimator = ValueAnimator.ofFloat(mScreenWidth, -mWidth); + mAnimator.addUpdateListener(mUpdateListener); + mAnimator.setInterpolator(new LinearInterpolator()); + mAnimator.setDuration((int) ((mScreenWidth + mWidth) / SPEED)); + mAnimator.addListener(mAnimatorListener); + mAnimator.start(); + } + + public boolean isIdle() { + return mIdle; + } + + public void setIdle(boolean idle) { + mIdle = idle; + } + + public void setActionListener(ActionListener actionListener) { + mActionListener = actionListener; + } + + public void release() { + if (mAnimator != null) { + mAnimator.cancel(); + } + removeFromParent(); + 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 50e2f228b..15b0e9a59 100644 --- a/live/src/main/java/com/yunbao/live/views/LiveRoomViewHolder.java +++ b/live/src/main/java/com/yunbao/live/views/LiveRoomViewHolder.java @@ -893,6 +893,12 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis } } }); + mAnchorSay.setOnLongClickListener(v -> { + + return false; + }); + + btnEvent = findViewById(R.id.btn_event); fullScreen = (FullServiceNotificationView) findViewById(R.id.full_screen); noble = (NobleNoticeView) findViewById(R.id.noble); @@ -5272,4 +5278,11 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis mLiveGiftAnimPresenter.showSendGiftAnimAllServer2(receiveGiftBean); mLiveGiftAnimPresenter.setLiveUidStream(mLiveUid, mStream); } + public void sendWelcomeFans(){ + LiveChatBean chatBean = new LiveChatBean(); + chatBean.setContent("123123test1243"); + chatBean.setType(LiveChatBean.SYSTEM3_COLOR); + chatBean.setBubble("https://downs.yaoulive.com/20230322/g2_.9.png"); + insertChat(chatBean,1); + } } diff --git a/live/src/main/res/drawable/bg_fans_group_buy_dialog_item.xml b/live/src/main/res/drawable/bg_fans_group_buy_dialog_item.xml new file mode 100644 index 000000000..837b1f741 --- /dev/null +++ b/live/src/main/res/drawable/bg_fans_group_buy_dialog_item.xml @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/live/src/main/res/layout/dialog_fens_group_buy.xml b/live/src/main/res/layout/dialog_fens_group_buy.xml new file mode 100644 index 000000000..0b77223d5 --- /dev/null +++ b/live/src/main/res/layout/dialog_fens_group_buy.xml @@ -0,0 +1,94 @@ + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/live/src/main/res/layout/dialog_fens_group_info.xml b/live/src/main/res/layout/dialog_fens_group_info.xml new file mode 100644 index 000000000..572b142f6 --- /dev/null +++ b/live/src/main/res/layout/dialog_fens_group_info.xml @@ -0,0 +1,76 @@ + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/live/src/main/res/layout/dialog_fens_group_send.xml b/live/src/main/res/layout/dialog_fens_group_send.xml new file mode 100644 index 000000000..16fc9e094 --- /dev/null +++ b/live/src/main/res/layout/dialog_fens_group_send.xml @@ -0,0 +1,52 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/live/src/main/res/layout/item_fens_group_buy_list.xml b/live/src/main/res/layout/item_fens_group_buy_list.xml new file mode 100644 index 000000000..a3a2d4724 --- /dev/null +++ b/live/src/main/res/layout/item_fens_group_buy_list.xml @@ -0,0 +1,82 @@ + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/live/src/main/res/layout/item_fens_group_package_list.xml b/live/src/main/res/layout/item_fens_group_package_list.xml new file mode 100644 index 000000000..520e40819 --- /dev/null +++ b/live/src/main/res/layout/item_fens_group_package_list.xml @@ -0,0 +1,76 @@ + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/live/src/main/res/layout/view_funs_live_anchor_start_notify.xml b/live/src/main/res/layout/view_funs_live_anchor_start_notify.xml new file mode 100644 index 000000000..c2fab6eb5 --- /dev/null +++ b/live/src/main/res/layout/view_funs_live_anchor_start_notify.xml @@ -0,0 +1,61 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/live/src/main/res/layout/view_gift_danmu_fans.xml b/live/src/main/res/layout/view_gift_danmu_fans.xml new file mode 100644 index 000000000..8b276529b --- /dev/null +++ b/live/src/main/res/layout/view_gift_danmu_fans.xml @@ -0,0 +1,69 @@ + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/live/src/main/res/mipmap-xhdpi/icon_fans_danmu_avatar.png b/live/src/main/res/mipmap-xhdpi/icon_fans_danmu_avatar.png new file mode 100644 index 000000000..e38f73eda Binary files /dev/null and b/live/src/main/res/mipmap-xhdpi/icon_fans_danmu_avatar.png differ diff --git a/live/src/main/res/mipmap-xxxhdpi/bg_fans_danmu.9.png b/live/src/main/res/mipmap-xxxhdpi/bg_fans_danmu.9.png new file mode 100644 index 000000000..ff56108d0 Binary files /dev/null and b/live/src/main/res/mipmap-xxxhdpi/bg_fans_danmu.9.png differ diff --git a/live/src/main/res/mipmap-xxxhdpi/bg_fans_group_buy_dialog.png b/live/src/main/res/mipmap-xxxhdpi/bg_fans_group_buy_dialog.png new file mode 100644 index 000000000..90ffa79b9 Binary files /dev/null and b/live/src/main/res/mipmap-xxxhdpi/bg_fans_group_buy_dialog.png differ diff --git a/live/src/main/res/mipmap-xxxhdpi/bg_funs_group_send_dialog_item.png b/live/src/main/res/mipmap-xxxhdpi/bg_funs_group_send_dialog_item.png new file mode 100644 index 000000000..a1d93b672 Binary files /dev/null and b/live/src/main/res/mipmap-xxxhdpi/bg_funs_group_send_dialog_item.png differ diff --git a/live/src/main/res/mipmap-xxxhdpi/bg_funs_live_anchor_start.png b/live/src/main/res/mipmap-xxxhdpi/bg_funs_live_anchor_start.png new file mode 100644 index 000000000..03a7d50ad Binary files /dev/null and b/live/src/main/res/mipmap-xxxhdpi/bg_funs_live_anchor_start.png differ diff --git a/live/src/main/res/mipmap-xxxhdpi/bg_funs_live_go_start.png b/live/src/main/res/mipmap-xxxhdpi/bg_funs_live_go_start.png new file mode 100644 index 000000000..156f5322a Binary files /dev/null and b/live/src/main/res/mipmap-xxxhdpi/bg_funs_live_go_start.png differ diff --git a/live/src/main/res/mipmap-xxxhdpi/icon_fans_group_buy_dialog_buy.png b/live/src/main/res/mipmap-xxxhdpi/icon_fans_group_buy_dialog_buy.png new file mode 100644 index 000000000..51fa6d321 Binary files /dev/null and b/live/src/main/res/mipmap-xxxhdpi/icon_fans_group_buy_dialog_buy.png differ diff --git a/live/src/main/res/mipmap-xxxhdpi/icon_fans_group_buy_dialog_day.png b/live/src/main/res/mipmap-xxxhdpi/icon_fans_group_buy_dialog_day.png new file mode 100644 index 000000000..48dd61714 Binary files /dev/null and b/live/src/main/res/mipmap-xxxhdpi/icon_fans_group_buy_dialog_day.png differ diff --git a/live/src/main/res/mipmap-xxxhdpi/icon_fans_group_buy_dialog_item.png b/live/src/main/res/mipmap-xxxhdpi/icon_fans_group_buy_dialog_item.png new file mode 100644 index 000000000..14900eda1 Binary files /dev/null and b/live/src/main/res/mipmap-xxxhdpi/icon_fans_group_buy_dialog_item.png differ diff --git a/live/src/main/res/values-en/strings.xml b/live/src/main/res/values-en/strings.xml index de647863b..3ba52f7f8 100644 --- a/live/src/main/res/values-en/strings.xml +++ b/live/src/main/res/values-en/strings.xml @@ -99,4 +99,12 @@ \'s letter and contact information Select Avatar Confirm + 1 The fan exclusive gift pack is an exclusive benefit for fan group users, which can quickly increase their companionship with the host after purchase + 2 Limited edition anchor gift (to protect you and love you dearly) is included in the Cherish Gift Bag and Zhenai Gift Bag. After purchase, it is placed in the fan gift backpack + 3 The exclusive gift package is bound to the anchor in a one-on-one relationship, and purchasing gift resources in the exclusive gift package can only be given to the anchor + 4 The gift resources in the gift package are valid for 30 days and can be given normally during the validity period; Gift resources become invalid and cannot be given after expiration + 1 Purchase can only be made once a month, and the gift package will be distributed in real-time after purchase + 2. The final interpretation rights of this gift package belong to PD Live + Introduction + Rules \ 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 8fa740d03..867471569 100644 --- a/live/src/main/res/values/strings.xml +++ b/live/src/main/res/values/strings.xml @@ -97,4 +97,12 @@ 的信件與聯繫方式 選擇頭像 確認使用 + 1. 粉絲專屬禮包為粉絲團用戶專屬權益,購買後可 快速提昇與該主播的陪伴值 + 2. 珍愛禮包、臻愛禮包中包入限量主播禮物(守護 你,摯愛你),開啟后立即發放到包裹中 + 3. 專屬禮包與主播為 1 對 1 綁定關係,購買專屬 禮包中禮物資源只可送給該主播 + 4. 禮包中禮物資源有效期 30 天,有效期內均可正 常贈送;過期後禮物資源失效不可贈送 + 1. 當月只可購買一次,購買后禮包实时發放 + 2. 该禮包最終解釋權歸 PD Live 所有 + 禮包介紹 + 購買規則 diff --git a/main/src/main/res/layout/activity_red_packet.xml b/main/src/main/res/layout/activity_red_packet.xml index b2430f744..572e95850 100644 --- a/main/src/main/res/layout/activity_red_packet.xml +++ b/main/src/main/res/layout/activity_red_packet.xml @@ -13,7 +13,7 @@ app:layout_constraintTop_toTopOf="parent" /> + app:layout_constraintTop_toBottomOf="@+id/anchorName" /> \ No newline at end of file diff --git a/main/src/main/res/layout/view_float_red_packet.xml b/main/src/main/res/layout/view_float_red_packet.xml index a9dc3e883..3d1bd0efc 100644 --- a/main/src/main/res/layout/view_float_red_packet.xml +++ b/main/src/main/res/layout/view_float_red_packet.xml @@ -42,7 +42,7 @@