diff --git a/common/src/main/java/com/yunbao/common/event/SendBlindGiftEvent.java b/common/src/main/java/com/yunbao/common/event/SendBlindGiftEvent.java
new file mode 100644
index 000000000..84eeb6593
--- /dev/null
+++ b/common/src/main/java/com/yunbao/common/event/SendBlindGiftEvent.java
@@ -0,0 +1,558 @@
+package com.yunbao.common.event;
+
+import com.google.gson.annotations.SerializedName;
+import com.yunbao.common.bean.BaseModel;
+
+public class SendBlindGiftEvent extends BaseModel {
+
+ @SerializedName("uid")
+ private String uid;
+ @SerializedName("giftid")
+ private String giftid;
+ @SerializedName("type")
+ private String type;
+ @SerializedName("mark")
+ private String mark;
+ @SerializedName("wrap_gift_num")
+ private String wrapGiftNum;
+ @SerializedName("giftcount")
+ private String giftcount;
+ @SerializedName("totalcoin")
+ private String totalcoin;
+ @SerializedName("giftname")
+ private String giftname;
+ @SerializedName("giftnameen")
+ private String giftnameen;
+ @SerializedName("gifticon")
+ private String gifticon;
+ @SerializedName("swftime")
+ private String swftime;
+ @SerializedName("swftype")
+ private String swftype;
+ @SerializedName("swf")
+ private String swf;
+ @SerializedName("level")
+ private String level;
+ @SerializedName("medal_name")
+ private String medalName;
+ @SerializedName("medal_level")
+ private String medalLevel;
+ @SerializedName("coin")
+ private String coin;
+ @SerializedName("gold")
+ private String gold;
+ @SerializedName("votestotal")
+ private String votestotal;
+ @SerializedName("medalRankNum")
+ private String medalRankNum;
+ @SerializedName("ispk")
+ private String ispk;
+ @SerializedName("pkuid")
+ private boolean pkuid;
+ @SerializedName("pkuid1")
+ private String pkuid1;
+ @SerializedName("pkuid2")
+ private String pkuid2;
+ @SerializedName("pktotal1")
+ private String pktotal1;
+ @SerializedName("pktotal2")
+ private String pktotal2;
+ @SerializedName("active_total")
+ private String activeTotal;
+ @SerializedName("blind_box_status")
+ private boolean blindBoxStatus;
+ @SerializedName("gift_id")
+ private String giftId;
+ @SerializedName("gift_type")
+ private String giftType;
+ @SerializedName("needcoin")
+ private String needcoin;
+ @SerializedName("gift_msg")
+ private String giftMsg;
+ @SerializedName("gift_notification")
+ private boolean giftNotification;
+ @SerializedName("gift_colour")
+ private String giftColour;
+ @SerializedName("box_type")
+ private String boxType;
+ @SerializedName("box_type_name")
+ private String boxTypeName;
+ @SerializedName("action")
+ private String action;
+ @SerializedName("dress_notification")
+ private boolean dressNotification;
+ @SerializedName("dress_type")
+ private Object dressType;
+ @SerializedName("dress_id")
+ private Object dressId;
+ @SerializedName("dress_name")
+ private String dressName;
+ @SerializedName("display_src")
+ private Object displaySrc;
+ @SerializedName("effect_src")
+ private Object effectSrc;
+ @SerializedName("dress_description")
+ private Object dressDescription;
+ @SerializedName("noble_dress")
+ private Object nobleDress;
+ @SerializedName("dress_msg")
+ private String dressMsg;
+ @SerializedName("dress_colour")
+ private String dressColour;
+ @SerializedName("dress_threshold_value")
+ private String dressThresholdValue;
+ @SerializedName("live_gift_notify")
+ private String liveGiftNotify;
+ @SerializedName("userNiceName")
+ private String userNiceName;
+
+ public String getUserNiceName() {
+ return userNiceName;
+ }
+
+ public SendBlindGiftEvent setUserNiceName(String userNiceName) {
+ this.userNiceName = userNiceName;
+ return this;
+ }
+
+ public String getUid() {
+ return uid;
+ }
+
+ public SendBlindGiftEvent setUid(String uid) {
+ this.uid = uid;
+ return this;
+ }
+
+ public String getGiftid() {
+ return giftid;
+ }
+
+ public SendBlindGiftEvent setGiftid(String giftid) {
+ this.giftid = giftid;
+ return this;
+ }
+
+ public String getType() {
+ return type;
+ }
+
+ public SendBlindGiftEvent setType(String type) {
+ this.type = type;
+ return this;
+ }
+
+ public String getMark() {
+ return mark;
+ }
+
+ public SendBlindGiftEvent setMark(String mark) {
+ this.mark = mark;
+ return this;
+ }
+
+ public String getWrapGiftNum() {
+ return wrapGiftNum;
+ }
+
+ public SendBlindGiftEvent setWrapGiftNum(String wrapGiftNum) {
+ this.wrapGiftNum = wrapGiftNum;
+ return this;
+ }
+
+ public String getGiftcount() {
+ return giftcount;
+ }
+
+ public SendBlindGiftEvent setGiftcount(String giftcount) {
+ this.giftcount = giftcount;
+ return this;
+ }
+
+ public String getTotalcoin() {
+ return totalcoin;
+ }
+
+ public SendBlindGiftEvent setTotalcoin(String totalcoin) {
+ this.totalcoin = totalcoin;
+ return this;
+ }
+
+ public String getGiftname() {
+ return giftname;
+ }
+
+ public SendBlindGiftEvent setGiftname(String giftname) {
+ this.giftname = giftname;
+ return this;
+ }
+
+ public String getGiftnameen() {
+ return giftnameen;
+ }
+
+ public SendBlindGiftEvent setGiftnameen(String giftnameen) {
+ this.giftnameen = giftnameen;
+ return this;
+ }
+
+ public String getGifticon() {
+ return gifticon;
+ }
+
+ public SendBlindGiftEvent setGifticon(String gifticon) {
+ this.gifticon = gifticon;
+ return this;
+ }
+
+ public String getSwftime() {
+ return swftime;
+ }
+
+ public SendBlindGiftEvent setSwftime(String swftime) {
+ this.swftime = swftime;
+ return this;
+ }
+
+ public String getSwftype() {
+ return swftype;
+ }
+
+ public SendBlindGiftEvent setSwftype(String swftype) {
+ this.swftype = swftype;
+ return this;
+ }
+
+ public String getSwf() {
+ return swf;
+ }
+
+ public SendBlindGiftEvent setSwf(String swf) {
+ this.swf = swf;
+ return this;
+ }
+
+ public String getLevel() {
+ return level;
+ }
+
+ public SendBlindGiftEvent setLevel(String level) {
+ this.level = level;
+ return this;
+ }
+
+ public String getMedalName() {
+ return medalName;
+ }
+
+ public SendBlindGiftEvent setMedalName(String medalName) {
+ this.medalName = medalName;
+ return this;
+ }
+
+ public String getMedalLevel() {
+ return medalLevel;
+ }
+
+ public SendBlindGiftEvent setMedalLevel(String medalLevel) {
+ this.medalLevel = medalLevel;
+ return this;
+ }
+
+ public String getCoin() {
+ return coin;
+ }
+
+ public SendBlindGiftEvent setCoin(String coin) {
+ this.coin = coin;
+ return this;
+ }
+
+ public String getGold() {
+ return gold;
+ }
+
+ public SendBlindGiftEvent setGold(String gold) {
+ this.gold = gold;
+ return this;
+ }
+
+ public String getVotestotal() {
+ return votestotal;
+ }
+
+ public SendBlindGiftEvent setVotestotal(String votestotal) {
+ this.votestotal = votestotal;
+ return this;
+ }
+
+ public String getMedalRankNum() {
+ return medalRankNum;
+ }
+
+ public SendBlindGiftEvent setMedalRankNum(String medalRankNum) {
+ this.medalRankNum = medalRankNum;
+ return this;
+ }
+
+ public String getIspk() {
+ return ispk;
+ }
+
+ public SendBlindGiftEvent setIspk(String ispk) {
+ this.ispk = ispk;
+ return this;
+ }
+
+ public boolean isPkuid() {
+ return pkuid;
+ }
+
+ public SendBlindGiftEvent setPkuid(boolean pkuid) {
+ this.pkuid = pkuid;
+ return this;
+ }
+
+ public String getPkuid1() {
+ return pkuid1;
+ }
+
+ public SendBlindGiftEvent setPkuid1(String pkuid1) {
+ this.pkuid1 = pkuid1;
+ return this;
+ }
+
+ public String getPkuid2() {
+ return pkuid2;
+ }
+
+ public SendBlindGiftEvent setPkuid2(String pkuid2) {
+ this.pkuid2 = pkuid2;
+ return this;
+ }
+
+ public String getPktotal1() {
+ return pktotal1;
+ }
+
+ public SendBlindGiftEvent setPktotal1(String pktotal1) {
+ this.pktotal1 = pktotal1;
+ return this;
+ }
+
+ public String getPktotal2() {
+ return pktotal2;
+ }
+
+ public SendBlindGiftEvent setPktotal2(String pktotal2) {
+ this.pktotal2 = pktotal2;
+ return this;
+ }
+
+ public String getActiveTotal() {
+ return activeTotal;
+ }
+
+ public SendBlindGiftEvent setActiveTotal(String activeTotal) {
+ this.activeTotal = activeTotal;
+ return this;
+ }
+
+ public boolean isBlindBoxStatus() {
+ return blindBoxStatus;
+ }
+
+ public SendBlindGiftEvent setBlindBoxStatus(boolean blindBoxStatus) {
+ this.blindBoxStatus = blindBoxStatus;
+ return this;
+ }
+
+ public String getGiftId() {
+ return giftId;
+ }
+
+ public SendBlindGiftEvent setGiftId(String giftId) {
+ this.giftId = giftId;
+ return this;
+ }
+
+ public String getGiftType() {
+ return giftType;
+ }
+
+ public SendBlindGiftEvent setGiftType(String giftType) {
+ this.giftType = giftType;
+ return this;
+ }
+
+ public String getNeedcoin() {
+ return needcoin;
+ }
+
+ public SendBlindGiftEvent setNeedcoin(String needcoin) {
+ this.needcoin = needcoin;
+ return this;
+ }
+
+ public String getGiftMsg() {
+ return giftMsg;
+ }
+
+ public SendBlindGiftEvent setGiftMsg(String giftMsg) {
+ this.giftMsg = giftMsg;
+ return this;
+ }
+
+ public boolean isGiftNotification() {
+ return giftNotification;
+ }
+
+ public SendBlindGiftEvent setGiftNotification(boolean giftNotification) {
+ this.giftNotification = giftNotification;
+ return this;
+ }
+
+ public String getGiftColour() {
+ return giftColour;
+ }
+
+ public SendBlindGiftEvent setGiftColour(String giftColour) {
+ this.giftColour = giftColour;
+ return this;
+ }
+
+ public String getBoxType() {
+ return boxType;
+ }
+
+ public SendBlindGiftEvent setBoxType(String boxType) {
+ this.boxType = boxType;
+ return this;
+ }
+
+ public String getBoxTypeName() {
+ return boxTypeName;
+ }
+
+ public SendBlindGiftEvent setBoxTypeName(String boxTypeName) {
+ this.boxTypeName = boxTypeName;
+ return this;
+ }
+
+ public String getAction() {
+ return action;
+ }
+
+ public SendBlindGiftEvent setAction(String action) {
+ this.action = action;
+ return this;
+ }
+
+ public boolean isDressNotification() {
+ return dressNotification;
+ }
+
+ public SendBlindGiftEvent setDressNotification(boolean dressNotification) {
+ this.dressNotification = dressNotification;
+ return this;
+ }
+
+ public Object getDressType() {
+ return dressType;
+ }
+
+ public SendBlindGiftEvent setDressType(Object dressType) {
+ this.dressType = dressType;
+ return this;
+ }
+
+ public Object getDressId() {
+ return dressId;
+ }
+
+ public SendBlindGiftEvent setDressId(Object dressId) {
+ this.dressId = dressId;
+ return this;
+ }
+
+ public String getDressName() {
+ return dressName;
+ }
+
+ public SendBlindGiftEvent setDressName(String dressName) {
+ this.dressName = dressName;
+ return this;
+ }
+
+ public Object getDisplaySrc() {
+ return displaySrc;
+ }
+
+ public SendBlindGiftEvent setDisplaySrc(Object displaySrc) {
+ this.displaySrc = displaySrc;
+ return this;
+ }
+
+ public Object getEffectSrc() {
+ return effectSrc;
+ }
+
+ public SendBlindGiftEvent setEffectSrc(Object effectSrc) {
+ this.effectSrc = effectSrc;
+ return this;
+ }
+
+ public Object getDressDescription() {
+ return dressDescription;
+ }
+
+ public SendBlindGiftEvent setDressDescription(Object dressDescription) {
+ this.dressDescription = dressDescription;
+ return this;
+ }
+
+ public Object getNobleDress() {
+ return nobleDress;
+ }
+
+ public SendBlindGiftEvent setNobleDress(Object nobleDress) {
+ this.nobleDress = nobleDress;
+ return this;
+ }
+
+ public String getDressMsg() {
+ return dressMsg;
+ }
+
+ public SendBlindGiftEvent setDressMsg(String dressMsg) {
+ this.dressMsg = dressMsg;
+ return this;
+ }
+
+ public String getDressColour() {
+ return dressColour;
+ }
+
+ public SendBlindGiftEvent setDressColour(String dressColour) {
+ this.dressColour = dressColour;
+ return this;
+ }
+
+ public String getDressThresholdValue() {
+ return dressThresholdValue;
+ }
+
+ public SendBlindGiftEvent setDressThresholdValue(String dressThresholdValue) {
+ this.dressThresholdValue = dressThresholdValue;
+ return this;
+ }
+
+ public String getLiveGiftNotify() {
+ return liveGiftNotify;
+ }
+
+ public SendBlindGiftEvent setLiveGiftNotify(String liveGiftNotify) {
+ this.liveGiftNotify = liveGiftNotify;
+ return this;
+ }
+}
diff --git a/live/src/main/assets/hdsn.svga b/live/src/main/assets/hdsn.svga
new file mode 100644
index 000000000..1f0733a03
Binary files /dev/null and b/live/src/main/assets/hdsn.svga differ
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 f324bb145..c4aef1ba1 100644
--- a/live/src/main/java/com/yunbao/live/activity/LiveActivity.java
+++ b/live/src/main/java/com/yunbao/live/activity/LiveActivity.java
@@ -31,6 +31,7 @@ import com.yunbao.common.bean.NobleRankHideUserListModel;
import com.yunbao.common.bean.UserBean;
import com.yunbao.common.event.CoinChangeEvent;
import com.yunbao.common.event.FollowEvent;
+import com.yunbao.common.event.SendBlindGiftEvent;
import com.yunbao.common.http.HttpCallback;
import com.yunbao.common.http.live.LiveNetManager;
import com.yunbao.common.interfaces.KeyBoardHeightChangeListener;
@@ -40,7 +41,6 @@ import com.yunbao.common.utils.L;
import com.yunbao.common.utils.ProcessImageUtil;
import com.yunbao.common.utils.SVGAViewUtils;
import com.yunbao.common.utils.ToastUtil;
-import com.yunbao.common.utils.WordUtil;
import com.yunbao.common.utils.formatBigNum;
import com.yunbao.live.R;
import com.yunbao.live.bean.GuardUserBean;
@@ -317,25 +317,27 @@ public abstract class LiveActivity extends AbsActivity implements SocketMessageL
* 收到礼物消息
*/
@Override
- public void onSendGift(LiveReceiveGiftBean bean) {
-
- //购买守护
- if (bean.ismTypeBuyGuard()) {
- if (mLiveRoomViewHolder != null) {
- if (!mIsAnchor) {
- mLiveRoomViewHolder.showGuardGifMessage(bean);
+ public void onSendGift(LiveReceiveGiftBean bean, SendBlindGiftEvent event) {
+ if (event == null) {
+ //购买守护
+ if (bean.ismTypeBuyGuard()) {
+ if (mLiveRoomViewHolder != null) {
+ if (!mIsAnchor) {
+ mLiveRoomViewHolder.showGuardGifMessage(bean);
+ }
}
- }
- } else {
- if (mLiveRoomViewHolder != null) {
- if (bean.getmLiveUId().equals(bean.getRoomnum())) {
- mLiveRoomViewHolder.insertChat(bean.getLiveChatBean(), 1);
- }
- mLiveRoomViewHolder.showGiftMessage(bean, mIsAnchor);
+ } else {
+ if (mLiveRoomViewHolder != null) {
+ if (bean.getmLiveUId().equals(bean.getRoomnum())) {
+ mLiveRoomViewHolder.insertChat(bean.getLiveChatBean(), 1);
+ }
+ mLiveRoomViewHolder.showGiftMessage(bean, mIsAnchor);
+ }
}
}
+
}
@@ -1362,6 +1364,7 @@ public abstract class LiveActivity extends AbsActivity implements SocketMessageL
fragment.setArguments(bundle);
fragment.show(getSupportFragmentManager(), "LiveGuardBuyDialogFragment");
}
+
/**
* 打开购买守护的弹窗
*/
diff --git a/live/src/main/java/com/yunbao/live/activity/LiveRyAnchorActivity.java b/live/src/main/java/com/yunbao/live/activity/LiveRyAnchorActivity.java
index 968f4bc64..94e131085 100644
--- a/live/src/main/java/com/yunbao/live/activity/LiveRyAnchorActivity.java
+++ b/live/src/main/java/com/yunbao/live/activity/LiveRyAnchorActivity.java
@@ -51,6 +51,7 @@ import com.yunbao.common.bean.MicUserBean;
import com.yunbao.common.bean.UserBean;
import com.yunbao.common.dialog.NotCancelableDialog;
import com.yunbao.common.event.LoginInvalidEvent;
+import com.yunbao.common.event.SendBlindGiftEvent;
import com.yunbao.common.http.CommonHttpConsts;
import com.yunbao.common.http.CommonHttpUtil;
import com.yunbao.common.http.HttpCallback;
@@ -73,6 +74,7 @@ import com.yunbao.common.views.LiveNewWishListPopup;
import com.yunbao.common.views.LiveRobotSettingCustomPopup;
import com.yunbao.faceunity.FaceManager;
import com.yunbao.live.R;
+import com.yunbao.live.bean.LiveChatBean;
import com.yunbao.live.bean.LiveGuardInfo;
import com.yunbao.live.bean.LiveKsyConfigBean;
import com.yunbao.live.bean.LiveReceiveGiftBean;
@@ -1464,14 +1466,13 @@ public class LiveRyAnchorActivity extends LiveActivity implements LiveFunctionCl
}
@Override
- public void onSendGift(LiveReceiveGiftBean bean) {
- //购买守护
- if (bean.ismTypeBuyGuard()) {
- if (mLiveRoomViewHolder != null) {
- mLiveRoomViewHolder.showGuardGifMessage(bean);
- }
- } else {
-
+ public void onSendGift(LiveReceiveGiftBean bean, SendBlindGiftEvent event) {
+ if (event!=null){
+ //插入盲盒礼物消息
+ bean.getLiveChatBean().setType(LiveChatBean.BLIND_BOX);
+ bean.getLiveChatBean().setContent(event.getGiftMsg());
+ bean.getLiveChatBean().setGiftName(event.getGiftname());
+ bean.getLiveChatBean().setUserNiceName(event.getUserNiceName());
if (mLiveRoomViewHolder != null) {
if (bean.getmLiveUId().equals(bean.getRoomnum())) {
mLiveRoomViewHolder.insertChat(bean.getLiveChatBean(), 1);
@@ -1479,8 +1480,25 @@ public class LiveRyAnchorActivity extends LiveActivity implements LiveFunctionCl
mLiveRoomViewHolder.showGiftMessage(bean, false);
mLiveRoomViewHolder.updataWishList(bean.getGiftId(), bean.getGiftCount());
}
+ }else {
+ //购买守护
+ if (bean.ismTypeBuyGuard()) {
+ if (mLiveRoomViewHolder != null) {
+ 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());
+ }
+
+ }
}
+
}
private void printLog(String content) {
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 06c2750fe..163f7a99e 100644
--- a/live/src/main/java/com/yunbao/live/adapter/LiveChatAdapter.java
+++ b/live/src/main/java/com/yunbao/live/adapter/LiveChatAdapter.java
@@ -27,11 +27,9 @@ import android.view.View;
import android.view.ViewGroup;
import android.view.animation.Animation;
import android.view.animation.AnimationUtils;
-import android.widget.FrameLayout;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
-import android.widget.Toast;
import androidx.annotation.NonNull;
import androidx.recyclerview.widget.GridLayoutManager;
@@ -49,7 +47,6 @@ 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.ToastUtil;
import com.yunbao.common.views.weight.ClipPathCircleImage;
import com.yunbao.live.R;
import com.yunbao.live.activity.LiveAudienceActivity;
@@ -360,6 +357,10 @@ public class LiveChatAdapter extends RecyclerView.Adapter {
mTextView.setText(builder);
} else if (bean.getType() == -10) {
mBg.setBackground(null);
+ } else if (bean.getType() == LiveChatBean.BLIND_BOX) {
+ Log.e("BLIND_BOX", bean.toString());
+ new LoadDian9TuUtil().loadDian9TuAssets(mContext, mBg, 1);
+ new LiveTextRender().blindBox(mContext, mTextView, bean);
} else if (bean.getType() == LiveChatBean.SYSTEM) {
boolean isContains = false;
for (LiveChatBean model : mList) {
diff --git a/live/src/main/java/com/yunbao/live/bean/LiveChatBean.java b/live/src/main/java/com/yunbao/live/bean/LiveChatBean.java
index c57e9fb9f..12e035400 100644
--- a/live/src/main/java/com/yunbao/live/bean/LiveChatBean.java
+++ b/live/src/main/java/com/yunbao/live/bean/LiveChatBean.java
@@ -26,7 +26,7 @@ public class LiveChatBean {
public static final int SYSTEM3_COLOR = 108;//带颜色的系统消息,格式 XXXXYYY
public static final int XYD_COMPLETE = 207;//心愿单完成通知
public static final int WISH_LIST_PROGRESS = 307;//心愿单进度通知
-
+ public static final int BLIND_BOX = 409;//盲盒礼物消息
private String id;
@@ -52,6 +52,17 @@ public class LiveChatBean {
private String prankIcon;
private String hot_card;
private MsgModel msgModel = new MsgModel();//自定义消息体
+ private String giftName;
+
+ public String getGiftName() {
+ return giftName;
+ }
+
+ public LiveChatBean setGiftName(String giftName) {
+ this.giftName = giftName;
+ return this;
+ }
+
private AiAutomaticSpeechModel aiAutomaticSpeechModel = new AiAutomaticSpeechModel();//机器人消息体
public AiAutomaticSpeechModel getAiAutomaticSpeechModel() {
@@ -369,4 +380,45 @@ public class LiveChatBean {
public void setMedalLevelImageUrl(String medalLevelImageUrl) {
this.medalLevelImageUrl = medalLevelImageUrl;
}
+
+ @Override
+ public String toString() {
+ return "LiveChatBean{" +
+ "NORMAL=" + NORMAL +
+ ", id='" + id + '\'' +
+ ", userNiceName='" + userNiceName + '\'' +
+ ", level=" + level +
+ ", content='" + content + '\'' +
+ ", heart=" + heart +
+ ", type=" + type +
+ ", liangName='" + liangName + '\'' +
+ ", vipType=" + vipType +
+ ", guardType=" + guardType +
+ ", anchor=" + anchor +
+ ", manager=" + manager +
+ ", medalNmae='" + medalNmae + '\'' +
+ ", medalLevelImageUrl='" + medalLevelImageUrl + '\'' +
+ ", bubble='" + bubble + '\'' +
+ ", medal='" + medal + '\'' +
+ ", medal_new='" + medal_new + '\'' +
+ ", medal_honor='" + medal_honor + '\'' +
+ ", hot_num='" + hot_num + '\'' +
+ ", good_nub='" + good_nub + '\'' +
+ ", anchorName='" + anchorName + '\'' +
+ ", prankIcon='" + prankIcon + '\'' +
+ ", hot_card='" + hot_card + '\'' +
+ ", msgModel=" + msgModel +
+ ", giftName='" + giftName + '\'' +
+ ", aiAutomaticSpeechModel=" + aiAutomaticSpeechModel +
+ ", nobleId='" + nobleId + '\'' +
+ ", nobleIcon='" + nobleIcon + '\'' +
+ ", bubbleSrc='" + bubbleSrc + '\'' +
+ ", startColor='" + startColor + '\'' +
+ ", endColor='" + endColor + '\'' +
+ ", contentColor='" + contentColor + '\'' +
+ ", atUserName='" + atUserName + '\'' +
+ ", atUserID='" + atUserID + '\'' +
+ ", isAttention=" + isAttention +
+ '}';
+ }
}
diff --git a/live/src/main/java/com/yunbao/live/dialog/LiveGiftDialogFragment.java b/live/src/main/java/com/yunbao/live/dialog/LiveGiftDialogFragment.java
index 9ae8f95c0..5fd26b9ce 100644
--- a/live/src/main/java/com/yunbao/live/dialog/LiveGiftDialogFragment.java
+++ b/live/src/main/java/com/yunbao/live/dialog/LiveGiftDialogFragment.java
@@ -40,6 +40,10 @@ import com.alibaba.android.arouter.launcher.ARouter;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
+import com.opensource.svgaplayer.SVGADrawable;
+import com.opensource.svgaplayer.SVGAImageView;
+import com.opensource.svgaplayer.SVGAParser;
+import com.opensource.svgaplayer.SVGAVideoEntity;
import com.yunbao.common.CommonAppConfig;
import com.yunbao.common.Constants;
import com.yunbao.common.bean.BlindBoxInfoModel;
@@ -47,6 +51,7 @@ import com.yunbao.common.bean.LiveGiftBean;
import com.yunbao.common.bean.LiveGiftBean2;
import com.yunbao.common.bean.UserBean;
import com.yunbao.common.dialog.AbsDialogFragment;
+import com.yunbao.common.event.SendBlindGiftEvent;
import com.yunbao.common.http.HttpCallback;
import com.yunbao.common.http.HttpClient;
import com.yunbao.common.http.live.LiveNetManager;
@@ -58,6 +63,7 @@ import com.yunbao.common.utils.DialogUitl;
import com.yunbao.common.utils.DpUtil;
import com.yunbao.common.utils.GiftCacheUtil;
import com.yunbao.common.utils.NobleUtil;
+import com.yunbao.common.utils.SVGAViewUtils;
import com.yunbao.common.utils.StringUtil;
import com.yunbao.common.utils.ToastUtil;
import com.yunbao.live.R;
@@ -141,7 +147,7 @@ public class LiveGiftDialogFragment extends AbsDialogFragment implements View.On
private int isContactGift = 0;
DialogInterface.OnDismissListener onDismissListener;
DialogInterface.OnShowListener onShowListener;
-
+ private SVGAImageView blindSvga;
@Override
protected int getLayoutId() {
@@ -176,6 +182,7 @@ public class LiveGiftDialogFragment extends AbsDialogFragment implements View.On
@Override
public void onDismiss(DialogInterface dialog) {
super.onDismiss(dialog);
+ Bus.getOff(this);
if (onDismissListener != null) {
onDismissListener.onDismiss(dialog);
}
@@ -196,6 +203,7 @@ public class LiveGiftDialogFragment extends AbsDialogFragment implements View.On
@Override
public void onActivityCreated(Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
+ Bus.getOn(this);
mCoin = (TextView) mRootView.findViewById(R.id.coin);
mTvGoldCoin = (TextView) mRootView.findViewById(R.id.goldCoin);
mTvGoCharge = (TextView) mRootView.findViewById(R.id.go_charge);
@@ -207,6 +215,7 @@ public class LiveGiftDialogFragment extends AbsDialogFragment implements View.On
progressBlind1 = mRootView.findViewById(R.id.progress_blind2);
progressBlind2 = mRootView.findViewById(R.id.progress_blind3);
mArrow = mRootView.findViewById(R.id.arrow);
+ blindSvga = mRootView.findViewById(R.id.blind_svga);
mBtnSend = mRootView.findViewById(R.id.btn_send);
mBtnSendGroup = mRootView.findViewById(R.id.btn_send_group);
mBtnSendLian = mRootView.findViewById(R.id.btn_send_lian);
@@ -409,7 +418,6 @@ public class LiveGiftDialogFragment extends AbsDialogFragment implements View.On
upData();
mCoin.setText(obj.getString("coin"));
mTvGoldCoin.setText(obj.getString("gold"));
- Bus.getOn(LiveGiftDialogFragment.this);
}
}
@@ -701,6 +709,7 @@ public class LiveGiftDialogFragment extends AbsDialogFragment implements View.On
mBtnChooseCount.setVisibility(View.VISIBLE);
mArrow.setVisibility(View.VISIBLE);
mBtnSend.setBackground(mDrawable1);
+ mBtnChooseCount.setEnabled(true);
}
if (bean.getType() == 5) {
@@ -722,8 +731,10 @@ public class LiveGiftDialogFragment extends AbsDialogFragment implements View.On
* @param blindBoxType
*/
private StringBuffer blindGiftNamesBuffer = null;
+ private int blindBoxType;
private void showBlindProgress(int blindBoxType) {
+ this.blindBoxType = blindBoxType;
blindGiftNamesBuffer = new StringBuffer();
BlindBoxInfoModel model = null;
for (BlindBoxInfoModel boxInfoModel : blindBoxInfoModels) {
@@ -732,6 +743,22 @@ public class LiveGiftDialogFragment extends AbsDialogFragment implements View.On
}
}
if (model == null) return;
+ new SVGAParser(mContext).decodeFromAssets("hdsn.svga", new SVGAParser.ParseCompletion() {
+ @Override
+ public void onComplete(SVGAVideoEntity videoItem) {
+ SVGADrawable drawable = new SVGADrawable(videoItem);
+ blindSvga.setImageDrawable(drawable);
+ SVGAViewUtils.playEndClear(blindSvga, false);
+
+ }
+
+ @Override
+ public void onError() {
+ Log.e("errqs", "errl");
+ }
+ }, null);
+ mArrow.setVisibility(View.GONE);
+ mBtnChooseCount.setEnabled(false);
mVipGold.setVisibility(View.GONE);
blindBox.setVisibility(View.VISIBLE);
WindowManager.LayoutParams params = getDialog().getWindow().getAttributes();
@@ -1016,4 +1043,73 @@ public class LiveGiftDialogFragment extends AbsDialogFragment implements View.On
}
}
}
+
+ @Subscribe(threadMode = ThreadMode.MAIN)
+ public void onSendBlindGiftEvent(SendBlindGiftEvent event) {
+ BlindBoxInfoModel model = null;
+ for (int i = 0; i < blindBoxInfoModels.size(); i++) {
+ if (TextUtils.equals(blindBoxInfoModels.get(i).getBlindBoxType(), event.getBoxType())) {
+ blindBoxInfoModels.get(i).setDressThresholdValue(event.getDressThresholdValue());
+ model = blindBoxInfoModels.get(i);
+ }
+ }
+ long userID = IMLoginManager.get(mContext).getUserInfo().getId();
+ String boxBlindName;
+ //判断送礼用户更新送礼用户进度
+ if (TextUtils.equals(String.valueOf(userID), event.getUid()) && blindBoxType == Integer.parseInt(event.getBoxType())) {
+ switch (blindBoxType) {
+ case 1:
+ boxBlindName = mContext.getString(R.string.mini_blind_box);
+
+ progressBlind.setMax(Integer.parseInt(model.getThresholdValue()));
+ progressBlind.setProgress(Integer.parseInt(model.getDressThresholdValue()));
+ break;
+ case 2:
+ boxBlindName = mContext.getString(R.string.collection_blind_box);
+
+ progressBlind1.setMax(Integer.parseInt(model.getThresholdValue()));
+ progressBlind1.setProgress(Integer.parseInt(model.getDressThresholdValue()));
+
+ break;
+ default:
+ boxBlindName = mContext.getString(R.string.pd_blind_box);
+ progressBlind2.setMax(Integer.parseInt(model.getThresholdValue()));
+ progressBlind2.setProgress(Integer.parseInt(model.getDressThresholdValue()));
+ break;
+ }
+ //进度下方提示语
+ if (TextUtils.equals(model.getThresholdValue(), model.getDressThresholdValue())) {
+ String individualDressing = mContext.getString(R.string.individual_dressing);
+ String msg = mContext.getString(R.string.have_already_win);
+ msg = String.format(msg, model.getThresholdDressName());
+ int dressNameIndexOf = msg.indexOf(model.getThresholdDressName());
+ int individualDressingIndexOf = msg.indexOf(String.valueOf(individualDressing));
+ int dressNameSize = model.getThresholdDressName().length();
+ int individualDressingSize = String.valueOf(individualDressing).length();
+ SpannableStringBuilder builder = new SpannableStringBuilder();
+ builder.append(msg);
+ builder.setSpan(new ForegroundColorSpan(Color.parseColor("#FFF682")), dressNameIndexOf, dressNameIndexOf + dressNameSize, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
+ builder.setSpan(new ForegroundColorSpan(Color.parseColor("#FFF682")), individualDressingIndexOf, individualDressingIndexOf + individualDressingSize, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
+ blindNumber.setText(builder);
+ } else {
+ int progress = Integer.parseInt(model.getThresholdValue()) - Integer.parseInt(model.getDressThresholdValue());
+ String msg = mContext.getString(R.string.resend_win);
+ msg = String.format(msg, String.valueOf(progress), boxBlindName, model.getThresholdDressName());
+ int dressNameIndexOf = msg.indexOf(model.getThresholdDressName());
+ int progressIndexOf = msg.indexOf(String.valueOf(progress));
+ int dressNameSize = model.getThresholdDressName().length();
+ int progressSize = String.valueOf(progress).length();
+ SpannableStringBuilder builder = new SpannableStringBuilder();
+ builder.append(msg);
+ builder.setSpan(new ForegroundColorSpan(Color.parseColor("#FFF682")), dressNameIndexOf, dressNameIndexOf + dressNameSize, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
+ builder.setSpan(new ForegroundColorSpan(Color.parseColor("#FFF682")), progressIndexOf, progressIndexOf + progressSize, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
+ blindNumber.setText(builder);
+ StringBuffer stringBuffer = new StringBuffer();
+ stringBuffer.append(model.getDressThresholdValue())
+ .append("/")
+ .append(model.getThresholdValue());
+ textBlindProgress.setText(stringBuffer.toString());
+ }
+ }
+ }
}
diff --git a/live/src/main/java/com/yunbao/live/socket/SocketClient.java b/live/src/main/java/com/yunbao/live/socket/SocketClient.java
index 4d164de00..56a275d58 100644
--- a/live/src/main/java/com/yunbao/live/socket/SocketClient.java
+++ b/live/src/main/java/com/yunbao/live/socket/SocketClient.java
@@ -334,7 +334,7 @@ public class SocketClient {
receiveGiftBean.setUid(uid);
receiveGiftBean.setGuardType(map.getString("guard_type"));
receiveGiftBean.setSendtype(map.getIntValue("action"));
- mListener.onSendGift(receiveGiftBean);
+ mListener.onSendGift(receiveGiftBean,null);
}
} else {
LiveReceiveGiftBean receiveGiftBean = new LiveReceiveGiftBean();
@@ -346,7 +346,7 @@ public class SocketClient {
receiveGiftBean.setUid(map.getString("uid"));
receiveGiftBean.setGuardType(map.getString("guard_type"));
receiveGiftBean.setSendtype(map.getIntValue("action"));
- mListener.onSendGift(receiveGiftBean);
+ mListener.onSendGift(receiveGiftBean,null);
}
}
@@ -557,13 +557,13 @@ public class SocketClient {
LivePKUserListBean livePKUserListBean = JSON.parseObject(receiveGiftBean.getPkTopUsers(), LivePKUserListBean.class);
if (mLiveUid.equals(map.getString("roomnum"))) {
if (!mLiveUid.equals(map.getString("roomnum"))) {
- mListener.onSendGift(receiveGiftBean);
+ mListener.onSendGift(receiveGiftBean,null);
}
//同一个直播间时才刷新pk
mListener.onSendGiftPk(map.getLongValue("pktotal1"), map.getLongValue("pktotal2"), livePKUserListBean);
} else {
if (!mLiveUid.equals(map.getString("roomnum"))) {
- mListener.onSendGift(receiveGiftBean);
+ mListener.onSendGift(receiveGiftBean,null);
}
//同一个直播间时才刷新pk
if (mLiveUid.equals(map.getString("pkuid1")) ||
@@ -574,7 +574,7 @@ public class SocketClient {
}
} else {
if (!mLiveUid.equals(map.getString("roomnum"))) {
- mListener.onSendGift(receiveGiftBean);
+ mListener.onSendGift(receiveGiftBean,null);
}
}
}
@@ -628,7 +628,7 @@ public class SocketClient {
try {
if (!TextUtils.isEmpty(mLiveUid)) {
if (mLiveUid.equals(map.getString("roomnum"))) {
- mListener.onSendGift(receiveGiftBean);
+ mListener.onSendGift(receiveGiftBean,null);
mListener.onSendGiftPk(map.getLongValue("pktotal1"), map.getLongValue("pktotal2"), livePKUserListBean);
} else {
mListener.onSendGiftPk(map.getLongValue("pktotal2"), map.getLongValue("pktotal1"), livePKUserListBean);
@@ -640,7 +640,7 @@ public class SocketClient {
} else {
Log.i("tvvs", receiveGiftBean.getLiveChatBean().getContent());
- mListener.onSendGift(receiveGiftBean);
+ mListener.onSendGift(receiveGiftBean,null);
}
if (map.getIntValue("drpk_status") == 1) {
LiveRoomViewHolder.UpPkBar(map.getJSONArray("userlist"), mLiveUid, 0);
diff --git a/live/src/main/java/com/yunbao/live/socket/SocketMessageListener.java b/live/src/main/java/com/yunbao/live/socket/SocketMessageListener.java
index 3d5040038..ff09eb10e 100644
--- a/live/src/main/java/com/yunbao/live/socket/SocketMessageListener.java
+++ b/live/src/main/java/com/yunbao/live/socket/SocketMessageListener.java
@@ -2,6 +2,7 @@ package com.yunbao.live.socket;
import com.alibaba.fastjson.JSONObject;
import com.yunbao.common.bean.UserBean;
+import com.yunbao.common.event.SendBlindGiftEvent;
import com.yunbao.live.bean.LiveBuyGuardMsgBean;
import com.yunbao.live.bean.LiveChatBean;
import com.yunbao.live.bean.LiveDanMuBean;
@@ -57,7 +58,7 @@ public interface SocketMessageListener {
*
* @param bean 礼物信息
*/
- void onSendGift(LiveReceiveGiftBean bean);
+ void onSendGift(LiveReceiveGiftBean bean, SendBlindGiftEvent event);
void onBuyZuoji(LiveReceiveGiftBean bean);
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 332c18aa8..082fe779d 100644
--- a/live/src/main/java/com/yunbao/live/socket/SocketRyClient.java
+++ b/live/src/main/java/com/yunbao/live/socket/SocketRyClient.java
@@ -33,6 +33,7 @@ import com.yunbao.common.bean.UserBean;
import com.yunbao.common.bean.WishModel;
import com.yunbao.common.bean.XydCompleteModel;
import com.yunbao.common.event.CustomFullServiceNotifyEvent;
+import com.yunbao.common.event.SendBlindGiftEvent;
import com.yunbao.common.http.HttpCallback;
import com.yunbao.common.http.HttpClient;
import com.yunbao.common.manager.IMRTCManager;
@@ -680,7 +681,7 @@ public class SocketRyClient {
receiveGiftBean.setUid(uid);
receiveGiftBean.setGuardType(map.getString("guard_type"));
receiveGiftBean.setSendtype(map.getIntValue("action"));
- mListener.onSendGift(receiveGiftBean);
+ mListener.onSendGift(receiveGiftBean, null);
}
} else {
LiveReceiveGiftBean receiveGiftBean = new LiveReceiveGiftBean();
@@ -692,7 +693,7 @@ public class SocketRyClient {
receiveGiftBean.setUid(map.getString("uid"));
receiveGiftBean.setGuardType(map.getString("guard_type"));
receiveGiftBean.setSendtype(map.getIntValue("action"));
- mListener.onSendGift(receiveGiftBean);
+ mListener.onSendGift(receiveGiftBean, null);
}
}
@@ -907,13 +908,13 @@ public class SocketRyClient {
LivePKUserListBean livePKUserListBean = JSON.parseObject(receiveGiftBean.getPkTopUsers(), LivePKUserListBean.class);
if (mLiveUid.equals(map.getString("roomnum"))) {
if (!mLiveUid.equals(map.getString("roomnum"))) {
- mListener.onSendGift(receiveGiftBean);
+ mListener.onSendGift(receiveGiftBean, null);
}
//同一个直播间时才刷新pk
mListener.onSendGiftPk(map.getLongValue("pktotal1"), map.getLongValue("pktotal2"), livePKUserListBean);
} else {
if (!mLiveUid.equals(map.getString("roomnum"))) {
- mListener.onSendGift(receiveGiftBean);
+ mListener.onSendGift(receiveGiftBean, null);
}
//同一个直播间时才刷新pk
if (mLiveUid.equals(map.getString("pkuid1")) ||
@@ -924,7 +925,7 @@ public class SocketRyClient {
}
} else {
if (!mLiveUid.equals(map.getString("roomnum"))) {
- mListener.onSendGift(receiveGiftBean);
+ mListener.onSendGift(receiveGiftBean, null);
}
}
}
@@ -963,12 +964,15 @@ public class SocketRyClient {
chatBean.setContent(mContext.getString(R.string.live_send_gift_1) + " " + +receiveGiftBean.getGiftCount() + " " + mContext.getString(R.string.live_send_gift_2) + receiveGiftBean.getGiftnameen());
}
- mListener.onSendGift(receiveGiftBean);
+ mListener.onSendGift(receiveGiftBean, null);
}
// 玩家自己送礼物
private void sendGiftInSameRoom(JSONObject map) {
+ String ctJson = map.getString("ct");
+ SendBlindGiftEvent sendBlindGiftEvent = GsonUtils.fromJson(ctJson, SendBlindGiftEvent.class);
LiveReceiveGiftBean receiveGiftBean = JSON.parseObject(map.getString("ct"), LiveReceiveGiftBean.class);
+ sendBlindGiftEvent.setUserNiceName(map.getString("uname"));
receiveGiftBean.setAvatar(map.getString("uhead") + "");
receiveGiftBean.setUserNiceName(map.getString("uname"));
receiveGiftBean.setRoomnum(map.getString("roomnum"));
@@ -997,11 +1001,11 @@ public class SocketRyClient {
if (map.get("guard_type") != null && !"".equals(map.get("guard_type")) && !"null".equals(map.get("guard_type"))) {
chatBean.setGuardType(map.getInteger("guard_type"));
}
+
if (CommonAppContext.lang.equals("chinese")) {
chatBean.setContent(mContext.getString(R.string.live_send_gift_1) + receiveGiftBean.getGiftCount() + mContext.getString(R.string.live_send_gift_2) + receiveGiftBean.getGiftName());
} else {
chatBean.setContent(mContext.getString(R.string.live_send_gift_1) + " " + +receiveGiftBean.getGiftCount() + " " + mContext.getString(R.string.live_send_gift_2) + receiveGiftBean.getGiftnameen());
-
}
//增加粉丝徽章信息
chatBean.setMedalNmae(map.getString("medal_name"));
@@ -1010,12 +1014,12 @@ public class SocketRyClient {
chatBean.setMedalLevelImageUrl(fansMedalBean.getThumb());
receiveGiftBean.setLiveChatBean(chatBean);
- Log.e("tag", "ifpk" + map.getIntValue("ifpk") + "");
+
if (map.getIntValue("ifpk") == 1) {
try {
if (!TextUtils.isEmpty(mLiveUid)) {
if (mLiveUid.equals(map.getString("roomnum"))) {
- mListener.onSendGift(receiveGiftBean);
+ mListener.onSendGift(receiveGiftBean, null);
mListener.onSendGiftPk(map.getLongValue("pktotal1"), map.getLongValue("pktotal2"), livePKUserListBean);
} else {
mListener.onSendGiftPk(map.getLongValue("pktotal2"), map.getLongValue("pktotal1"), livePKUserListBean);
@@ -1027,7 +1031,12 @@ public class SocketRyClient {
} else {
Log.i("tvvs", receiveGiftBean.getLiveChatBean().getContent());
- mListener.onSendGift(receiveGiftBean);
+ if (!TextUtils.isEmpty(sendBlindGiftEvent.getAction()) && TextUtils.equals("blind_box", sendBlindGiftEvent.getAction())) {
+ mListener.onSendGift(receiveGiftBean, sendBlindGiftEvent);
+ } else {
+ mListener.onSendGift(receiveGiftBean, null);
+ }
+
}
if (map.getIntValue("drpk_status") == 1) {
Bus.get().post(new LiveAudienceEvent()
diff --git a/live/src/main/java/com/yunbao/live/utils/LiveTextRender.java b/live/src/main/java/com/yunbao/live/utils/LiveTextRender.java
index 843b8a089..abb06e360 100644
--- a/live/src/main/java/com/yunbao/live/utils/LiveTextRender.java
+++ b/live/src/main/java/com/yunbao/live/utils/LiveTextRender.java
@@ -86,6 +86,19 @@ public class LiveTextRender {
sFontSizeSpan3 = new AbsoluteSizeSpan(14, true);
}
+ public void blindBox(Context context, TextView textView, LiveChatBean bean) {
+ String chatMsg = bean.getContent();
+ int userNiceNameIndex = chatMsg.indexOf(bean.getUserNiceName());
+ int userNiceNameSize = bean.getUserNiceName().length();
+ int giftNameIndex = chatMsg.indexOf(bean.getGiftName());
+ int giftNameSize = bean.getGiftName().length();
+ SpannableStringBuilder builder = new SpannableStringBuilder();
+ builder.append(chatMsg);
+ builder.setSpan(new ForegroundColorSpan(Color.parseColor("#78FEFF")), userNiceNameIndex, userNiceNameIndex + userNiceNameSize, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
+ builder.setSpan(new ForegroundColorSpan(Color.parseColor("#FFF86C")), giftNameIndex, giftNameIndex + giftNameSize, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
+ textView.setText(builder);
+ }
+
/**
* 直播间推荐卡
*
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 40aff0c3d..10c8e51df 100644
--- a/live/src/main/java/com/yunbao/live/views/PortraitLiveManager.java
+++ b/live/src/main/java/com/yunbao/live/views/PortraitLiveManager.java
@@ -45,6 +45,7 @@ import com.yunbao.common.bean.XydCompleteModel;
import com.yunbao.common.custom.MyViewPager;
import com.yunbao.common.event.FollowEvent;
import com.yunbao.common.event.LiveFloatEvent;
+import com.yunbao.common.event.SendBlindGiftEvent;
import com.yunbao.common.glide.ImgLoader;
import com.yunbao.common.http.CommonHttpConsts;
import com.yunbao.common.http.CommonHttpUtil;
@@ -269,105 +270,105 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe
@Override
public void run() {
- try{
+ try {
- Log.e("ImgLoader1", data.getAvatar());
- if (mLiveRyLinkMicPkPresenter != null) {
- mLiveRyLinkMicPkPresenter.clearData();
- mLiveRyLinkMicPkPresenter.release();
- mLiveRyLinkMicPkPresenter = null;
- }
+ Log.e("ImgLoader1", data.getAvatar());
+ if (mLiveRyLinkMicPkPresenter != null) {
+ mLiveRyLinkMicPkPresenter.clearData();
+ mLiveRyLinkMicPkPresenter.release();
+ mLiveRyLinkMicPkPresenter = null;
+ }
- mLiveBean = data;
- mLiveSDK = liveSdk;
- mLiveType = liveType;
- mLiveTypeVal = liveTypeVal;
- liveID = data.getUid();
- Bus.get().post(new LiveAudienceEvent()
- .setType(LiveAudienceEvent.LiveAudienceType.OPEN_PARAMETERS)
- .setParametersModel(openParametersModel
- .setmLiveType(mLiveType)
- .setmLiveTypeVal(mLiveTypeVal)));
- loading.setVisibility(View.VISIBLE);
- ImgLoader.displayBlurLive(mContext, mLiveBean.getAvatar(), ivBg);
- AnimationDrawable frameAnimation = (AnimationDrawable) ivLoading.getBackground();
- frameAnimation.start();
- liveHandler.removeCallbacks(loadRunnableGone);
- if (mLivePlayViewHolder == null) {
- mLivePlayViewHolder = new LivePlayRyViewHolder(mContext, playContainer, 1);
- mLiveRoomViewHolder = new LiveRoomViewHolder(false, 1, mContext, mContainer, mSecondPage.findViewById(R.id.gift_gif), mSecondPage.findViewById(R.id.gift_svga), mContainerWrap, mContext.getWindowManager());
- mLiveAudienceViewHolder = new LiveAudienceViewHolder(mContext, mContainer);
- mLiveLinkMicPresenter = new LiveLinkMicPresenter(mContext, mLivePlayViewHolder, false, mLiveSDK, mLiveAudienceViewHolder.getContentView());
- mLiveLinkMicAnchorPresenter = new LiveLinkMicAnchorPresenter(mContext, mLivePlayViewHolder, false, mLiveSDK, null);
- mLiveRyLinkMicPkPresenter = new LiveRyLinkMicPkPresenter(mContext, mLivePlayViewHolder, false, null);
- mLivePlayViewHolder.addToParent();
- mLivePlayViewHolder.subscribeActivityLifeCycle();
- mLivePlayViewHolder.setLoadViewListener(new LiveRoomPlayViewHolder.LoadingListener() {
+ mLiveBean = data;
+ mLiveSDK = liveSdk;
+ mLiveType = liveType;
+ mLiveTypeVal = liveTypeVal;
+ liveID = data.getUid();
+ Bus.get().post(new LiveAudienceEvent()
+ .setType(LiveAudienceEvent.LiveAudienceType.OPEN_PARAMETERS)
+ .setParametersModel(openParametersModel
+ .setmLiveType(mLiveType)
+ .setmLiveTypeVal(mLiveTypeVal)));
+ loading.setVisibility(View.VISIBLE);
+ ImgLoader.displayBlurLive(mContext, mLiveBean.getAvatar(), ivBg);
+ AnimationDrawable frameAnimation = (AnimationDrawable) ivLoading.getBackground();
+ frameAnimation.start();
+ liveHandler.removeCallbacks(loadRunnableGone);
+ if (mLivePlayViewHolder == null) {
+ mLivePlayViewHolder = new LivePlayRyViewHolder(mContext, playContainer, 1);
+ mLiveRoomViewHolder = new LiveRoomViewHolder(false, 1, mContext, mContainer, mSecondPage.findViewById(R.id.gift_gif), mSecondPage.findViewById(R.id.gift_svga), mContainerWrap, mContext.getWindowManager());
+ mLiveAudienceViewHolder = new LiveAudienceViewHolder(mContext, mContainer);
+ mLiveLinkMicPresenter = new LiveLinkMicPresenter(mContext, mLivePlayViewHolder, false, mLiveSDK, mLiveAudienceViewHolder.getContentView());
+ mLiveLinkMicAnchorPresenter = new LiveLinkMicAnchorPresenter(mContext, mLivePlayViewHolder, false, mLiveSDK, null);
+ mLiveRyLinkMicPkPresenter = new LiveRyLinkMicPkPresenter(mContext, mLivePlayViewHolder, false, null);
+ mLivePlayViewHolder.addToParent();
+ mLivePlayViewHolder.subscribeActivityLifeCycle();
+ mLivePlayViewHolder.setLoadViewListener(new LiveRoomPlayViewHolder.LoadingListener() {
+ @Override
+ public void onPlayer() {
+ liveHandler.postDelayed(loadRunnableGone, 350);
+ }
+ });
+ mLiveRoomViewHolder.subscribeActivityLifeCycle();
+ mLiveAudienceViewHolder.addToParent();
+ mLiveRoomViewHolder.addToParent();
+ mLiveAudienceViewHolder.subscribeActivityLifeCycle();
+ } else {
+ mLivePlayViewHolder.setLiveBeanLandscape(1);
+ mLiveLinkMicPresenter.setLiveSdk(mLiveSDK);
+ mLiveLinkMicAnchorPresenter.setLiveSdk(mLiveSDK);
+ }
+
+ if (mLiveRyLinkMicPkPresenter == null) {
+ mLiveRyLinkMicPkPresenter = new LiveRyLinkMicPkPresenter(mContext, mLivePlayViewHolder, false, null);
+ }
+ //去除主播离开画面
+ if (LivePlayKsyViewHolder.leave != null) {
+ LivePlayKsyViewHolder.leave.setVisibility(View.GONE);
+ }
+ if (LivePlayRyViewHolder.leave != null) {
+ LivePlayRyViewHolder.leave.setVisibility(View.GONE);
+ }
+ //直播间背景
+
+ ImgLoader.displayBlurLive(mContext, mLiveBean.getAvatar(), liveBack, 400, 600);
+
+ mask.setVisibility(View.VISIBLE);
+ mLivePlayViewHolder.clearFrame();
+ mLivePlayViewHolder.setLiveBean(mLiveBean);
+ mLivePlayViewHolder.removeDetailView();
+ mLivePlayViewHolder.setCover(mLiveBean.getAvatar());
+ mLivePlayViewHolder.setLiveBeanLandscape(mLiveBean.getLandscape());
+ mLiveRoomViewHolder.changeMessageLandscape(mLiveBean.getLandscape());
+ //mLivePlayViewHolder.play(mLiveBean.getPull(), LiveRoomPlayViewHolder.PLAY_MODEL_DEF);
+ mLivePlayViewHolder.setOnMicCallback(new LiveRoomPlayViewHolder.OnMicCallback() {
@Override
- public void onPlayer() {
- liveHandler.postDelayed(loadRunnableGone, 350);
+ public void onMikUpdate() {
+ if (mContext instanceof LiveActivity) {
+ ((LiveActivity) mContext).showMicList(mLiveBean.getUid(), mLiveRoomViewHolder);
+ }
}
});
- mLiveRoomViewHolder.subscribeActivityLifeCycle();
- mLiveAudienceViewHolder.addToParent();
- mLiveRoomViewHolder.addToParent();
- mLiveAudienceViewHolder.subscribeActivityLifeCycle();
- } else {
- mLivePlayViewHolder.setLiveBeanLandscape(1);
- mLiveLinkMicPresenter.setLiveSdk(mLiveSDK);
- mLiveLinkMicAnchorPresenter.setLiveSdk(mLiveSDK);
- }
-
- if (mLiveRyLinkMicPkPresenter == null) {
- mLiveRyLinkMicPkPresenter = new LiveRyLinkMicPkPresenter(mContext, mLivePlayViewHolder, false, null);
- }
- //去除主播离开画面
- if (LivePlayKsyViewHolder.leave != null) {
- LivePlayKsyViewHolder.leave.setVisibility(View.GONE);
- }
- if (LivePlayRyViewHolder.leave != null) {
- LivePlayRyViewHolder.leave.setVisibility(View.GONE);
- }
- //直播间背景
-
- ImgLoader.displayBlurLive(mContext, mLiveBean.getAvatar(), liveBack, 400, 600);
-
- mask.setVisibility(View.VISIBLE);
- mLivePlayViewHolder.clearFrame();
- mLivePlayViewHolder.setLiveBean(mLiveBean);
- mLivePlayViewHolder.removeDetailView();
- mLivePlayViewHolder.setCover(mLiveBean.getAvatar());
- mLivePlayViewHolder.setLiveBeanLandscape(mLiveBean.getLandscape());
- mLiveRoomViewHolder.changeMessageLandscape(mLiveBean.getLandscape());
- //mLivePlayViewHolder.play(mLiveBean.getPull(), LiveRoomPlayViewHolder.PLAY_MODEL_DEF);
- mLivePlayViewHolder.setOnMicCallback(new LiveRoomPlayViewHolder.OnMicCallback() {
- @Override
- public void onMikUpdate() {
- if (mContext instanceof LiveActivity) {
- ((LiveActivity) mContext).showMicList(mLiveBean.getUid(), mLiveRoomViewHolder);
- }
+ mLiveRoomViewHolder.resetView();
+ enterRoomModel.clear();
+ enterRoomLeaveHandler.removeCallbacks(enterRoomLeaveRunnable);
+ mLiveRoomViewHolder.setAvatar(data.getAvatar());
+ mLiveRoomViewHolder.setAnchorLevel(data.getLevelAnchor());
+ mLiveRoomViewHolder.setName(data.getUserNiceName());
+ mLiveRoomViewHolder.setRoomNum(data.getLiangNameTip());
+ mLiveRoomViewHolder.setTitle(data.getTitle());
+ mLiveRoomViewHolder.setAnchorGoodNumber(data.getGoodNum());
+ mLiveRoomViewHolder.clearGuardIcon();
+ mLiveRoomViewHolder.clearChat();
+ mLiveRoomViewHolder.releaseGift();
+ mLiveRyLinkMicPkPresenter.setLiveUid(data.getUid(), "");
+ mSocketRyClient = new SocketRyClient(mLiveBean.getUid(), PortraitLiveManager.this, mContext);
+ if (mLiveLinkMicPresenter != null) {
+ mLiveLinkMicPresenter.setSocketClient(mSocketClient);
}
- });
- mLiveRoomViewHolder.resetView();
- enterRoomModel.clear();
- enterRoomLeaveHandler.removeCallbacks(enterRoomLeaveRunnable);
- mLiveRoomViewHolder.setAvatar(data.getAvatar());
- mLiveRoomViewHolder.setAnchorLevel(data.getLevelAnchor());
- mLiveRoomViewHolder.setName(data.getUserNiceName());
- mLiveRoomViewHolder.setRoomNum(data.getLiangNameTip());
- mLiveRoomViewHolder.setTitle(data.getTitle());
- mLiveRoomViewHolder.setAnchorGoodNumber(data.getGoodNum());
- mLiveRoomViewHolder.clearGuardIcon();
- mLiveRoomViewHolder.clearChat();
- mLiveRoomViewHolder.releaseGift();
- mLiveRyLinkMicPkPresenter.setLiveUid(data.getUid(), "");
- mSocketRyClient = new SocketRyClient(mLiveBean.getUid(), PortraitLiveManager.this, mContext);
- if (mLiveLinkMicPresenter != null) {
- mLiveLinkMicPresenter.setSocketClient(mSocketClient);
- }
- enterRoomNew();
+ enterRoomNew();
- }catch (Exception e){
+ } catch (Exception e) {
e.printStackTrace();
}
}
@@ -1119,21 +1120,50 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe
}
@Override
- public void onSendGift(LiveReceiveGiftBean bean) {
- //购买守护
- if (bean.ismTypeBuyGuard()) {
- if (mLiveRoomViewHolder != null) {
- mLiveRoomViewHolder.showGuardGifMessage(bean);
+ public void onSendGift(LiveReceiveGiftBean bean, SendBlindGiftEvent event) {
+ if (event != null) {
+ LiveChatBean liveChatBean = null;
+ if (!TextUtils.isEmpty(event.getDressName()) && !TextUtils.isEmpty(event.getDressMsg())) {
+ liveChatBean = new LiveChatBean();
+ liveChatBean.setUserNiceName(event.getUserNiceName());
+ liveChatBean.setType(LiveChatBean.BLIND_BOX);
+ liveChatBean.setGiftName(event.getDressName());
+ liveChatBean.setContent(event.getDressMsg());
}
- } else {
+ //插入盲盒礼物消息
+ bean.getLiveChatBean().setType(LiveChatBean.BLIND_BOX);
+ bean.getLiveChatBean().setContent(event.getGiftMsg());
+ bean.getLiveChatBean().setGiftName(event.getGiftname());
+ bean.getLiveChatBean().setUserNiceName(event.getUserNiceName());
if (mLiveRoomViewHolder != null) {
if (bean.getmLiveUId().equals(bean.getRoomnum())) {
+ if (liveChatBean != null) {
+ mLiveRoomViewHolder.insertChat(liveChatBean, 1);
+ }
mLiveRoomViewHolder.insertChat(bean.getLiveChatBean(), 1);
}
mLiveRoomViewHolder.showGiftMessage(bean, false);
mLiveRoomViewHolder.updataWishList(bean.getGiftId(), bean.getGiftCount());
}
+ Bus.get().post(event);
+ } else {
+ //购买守护
+ if (bean.ismTypeBuyGuard()) {
+ if (mLiveRoomViewHolder != null) {
+ 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/drawable/bg_live_vip_blue.png b/live/src/main/res/drawable/bg_live_vip_blue.png
index 1b08dcfcf..25caf2067 100644
Binary files a/live/src/main/res/drawable/bg_live_vip_blue.png and b/live/src/main/res/drawable/bg_live_vip_blue.png differ
diff --git a/live/src/main/res/layout/dialog_live_gift_wrap.xml b/live/src/main/res/layout/dialog_live_gift_wrap.xml
index 2bee65f7a..770e7b92a 100644
--- a/live/src/main/res/layout/dialog_live_gift_wrap.xml
+++ b/live/src/main/res/layout/dialog_live_gift_wrap.xml
@@ -41,21 +41,20 @@
+ android:src="@mipmap/icon_vip_gold_new" />
+ android:textStyle="bold"
+ android:textColor="#F5C600"
+ android:textSize="10sp" />
+ android:textColor="#FFFFFF"
+ android:textSize="8sp" />
diff --git a/live/src/main/res/layout/view_blind_box.xml b/live/src/main/res/layout/view_blind_box.xml
index 69cfe7046..9c833679c 100644
--- a/live/src/main/res/layout/view_blind_box.xml
+++ b/live/src/main/res/layout/view_blind_box.xml
@@ -11,12 +11,13 @@
android:layout_height="86.5dp"
android:background="@mipmap/bg_phoenix">
-
+ />