diff --git a/common/src/main/java/com/yunbao/common/Constants.java b/common/src/main/java/com/yunbao/common/Constants.java index 2e8a5c808..164614260 100644 --- a/common/src/main/java/com/yunbao/common/Constants.java +++ b/common/src/main/java/com/yunbao/common/Constants.java @@ -76,7 +76,7 @@ public class Constants { public static final String PAY_BUY_COIN_ALI = "Charge.getAliOrder"; public static final String PAY_BUY_COIN_WX = "Charge.getWxOrder"; -// public static final String PACKAGE_NAME_ALI = "com.eg.android.AlipayGphone";//支付宝的包名 + // public static final String PACKAGE_NAME_ALI = "com.eg.android.AlipayGphone";//支付宝的包名 public static final String PACKAGE_NAME_WX = "com.tencent.mm";//微信的包名 public static final String PACKAGE_NAME_QQ = "com.tencent.mobileqq";//QQ的包名 public static final String LAT = "lat"; @@ -133,7 +133,7 @@ public class Constants { public static final int LIVE_FUNC_WKS = 2014;//語音 public static final int LIVE_FUNC_ZSLK = 2015;//語音 public static final int LIVE_FUNC_RANDOM_PK = 2016;//随机PK - public static final int LIVE_ROBOT= 2017;//机器人 + public static final int LIVE_ROBOT = 2017;//机器人 //socket public static final String SOCKET_CONN = "conn"; @@ -177,6 +177,8 @@ public class Constants { public static final String SUPER_VISION = "supervision";//超级发言警告 public static final String PK_RANK_UPDATE = "RankingRankUpdate";//PK排位赛更新数据 public static final String CUSTOM_FULL_SERVICE_NOTIFY = "customFullServiceNotify";//全服通知 + public static final String XYD_COMPLETE = "XydComplete";//心愿单完成通知 + public static final String WISH_LIST_PROGRESS = "wishListProgress";//心愿单进度通知 //游戏socket public static final String SOCKET_GAME_ZJH = "startGame";//炸金花 diff --git a/common/src/main/java/com/yunbao/common/bean/XydCompleteModel.java b/common/src/main/java/com/yunbao/common/bean/XydCompleteModel.java new file mode 100644 index 000000000..b21383f87 --- /dev/null +++ b/common/src/main/java/com/yunbao/common/bean/XydCompleteModel.java @@ -0,0 +1,328 @@ +package com.yunbao.common.bean; + +import com.google.gson.Gson; +import com.google.gson.annotations.SerializedName; + +public class XydCompleteModel extends BaseModel { + + + @SerializedName("_method_") + private String method; + @SerializedName("action") + private String action; + @SerializedName("msgtype") + private String msgtype; + @SerializedName("level") + private int level; + @SerializedName("uname") + private String uname; + @SerializedName("uid") + private String uid; + @SerializedName("uhead") + private String uhead; + @SerializedName("evensend") + private String evensend; + @SerializedName("liangname") + private String liangname; + @SerializedName("vip_type") + private String vipType; + @SerializedName("svg") + private String svg; + @SerializedName("ancherName") + private String ancherName; + @SerializedName("userName") + private String userName; + @SerializedName("medal_name") + private String medalName; + @SerializedName("medal_level") + private String medalLevel; + @SerializedName("guard_type") + private String guardType; + @SerializedName("medal") + private String medal; + @SerializedName("medal_honor") + private String medalHonor; + @SerializedName("good_num") + private int goodNum; + @SerializedName("roomnum") + private String roomnum; + @SerializedName("msg") + private String msg; + @SerializedName("liveId") + private String liveId; + @SerializedName("swf") + private String swf; + @SerializedName("swftime") + private String swftime; + @SerializedName("swftype") + private int swftype; + @SerializedName("type") + private int type; + @SerializedName("giftname") + private String giftname; + @SerializedName("equipment") + private String equipment; + @SerializedName("bubble") + private String bubble; + + public String getMethod() { + return method; + } + + public XydCompleteModel setMethod(String method) { + this.method = method; + return this; + } + + public String getAction() { + return action; + } + + public XydCompleteModel setAction(String action) { + this.action = action; + return this; + } + + public String getMsgtype() { + return msgtype; + } + + public XydCompleteModel setMsgtype(String msgtype) { + this.msgtype = msgtype; + return this; + } + + public int getLevel() { + return level; + } + + public XydCompleteModel setLevel(int level) { + this.level = level; + return this; + } + + public String getUname() { + return uname; + } + + public XydCompleteModel setUname(String uname) { + this.uname = uname; + return this; + } + + public String getUid() { + return uid; + } + + public XydCompleteModel setUid(String uid) { + this.uid = uid; + return this; + } + + public String getUhead() { + return uhead; + } + + public XydCompleteModel setUhead(String uhead) { + this.uhead = uhead; + return this; + } + + public String getEvensend() { + return evensend; + } + + public XydCompleteModel setEvensend(String evensend) { + this.evensend = evensend; + return this; + } + + public String getLiangname() { + return liangname; + } + + public XydCompleteModel setLiangname(String liangname) { + this.liangname = liangname; + return this; + } + + public String getVipType() { + return vipType; + } + + public XydCompleteModel setVipType(String vipType) { + this.vipType = vipType; + return this; + } + + public String getSvg() { + return svg; + } + + public XydCompleteModel setSvg(String svg) { + this.svg = svg; + return this; + } + + public String getAncherName() { + return ancherName; + } + + public XydCompleteModel setAncherName(String ancherName) { + this.ancherName = ancherName; + return this; + } + + public String getUserName() { + return userName; + } + + public XydCompleteModel setUserName(String userName) { + this.userName = userName; + return this; + } + + public String getMedalName() { + return medalName; + } + + public XydCompleteModel setMedalName(String medalName) { + this.medalName = medalName; + return this; + } + + public String getMedalLevel() { + return medalLevel; + } + + public XydCompleteModel setMedalLevel(String medalLevel) { + this.medalLevel = medalLevel; + return this; + } + + public String getGuardType() { + return guardType; + } + + public XydCompleteModel setGuardType(String guardType) { + this.guardType = guardType; + return this; + } + + public String getMedal() { + return medal; + } + + public XydCompleteModel setMedal(String medal) { + this.medal = medal; + return this; + } + + public String getMedalHonor() { + return medalHonor; + } + + public XydCompleteModel setMedalHonor(String medalHonor) { + this.medalHonor = medalHonor; + return this; + } + + public int getGoodNum() { + return goodNum; + } + + public XydCompleteModel setGoodNum(int goodNum) { + this.goodNum = goodNum; + return this; + } + + public String getRoomnum() { + return roomnum; + } + + public XydCompleteModel setRoomnum(String roomnum) { + this.roomnum = roomnum; + return this; + } + + public String getMsg() { + return msg; + } + + public XydCompleteModel setMsg(String msg) { + this.msg = msg; + return this; + } + + public String getLiveId() { + return liveId; + } + + public XydCompleteModel setLiveId(String liveId) { + this.liveId = liveId; + return this; + } + + public String getSwf() { + return swf; + } + + public XydCompleteModel setSwf(String swf) { + this.swf = swf; + return this; + } + + public String getSwftime() { + return swftime; + } + + public XydCompleteModel setSwftime(String swftime) { + this.swftime = swftime; + return this; + } + + public int getSwftype() { + return swftype; + } + + public XydCompleteModel setSwftype(int swftype) { + this.swftype = swftype; + return this; + } + + public int getType() { + return type; + } + + public XydCompleteModel setType(int type) { + this.type = type; + return this; + } + + public String getGiftname() { + return giftname; + } + + public XydCompleteModel setGiftname(String giftname) { + this.giftname = giftname; + return this; + } + + public String getEquipment() { + return equipment; + } + + public XydCompleteModel setEquipment(String equipment) { + this.equipment = equipment; + return this; + } + + public String getBubble() { + return bubble; + } + + public XydCompleteModel setBubble(String bubble) { + this.bubble = bubble; + return this; + } +} diff --git a/config.gradle b/config.gradle index cb4fb0dff..ab55f4f22 100644 --- a/config.gradle +++ b/config.gradle @@ -5,7 +5,7 @@ ext { minSdkVersion : 21, targetSdkVersion : 31, versionCode : 414, - versionName : "6.4.9" + versionName : "6.5.0" ] manifestPlaceholders = [ //正式、 diff --git a/live/src/main/java/com/yunbao/live/activity/LiveAudienceActivity.java b/live/src/main/java/com/yunbao/live/activity/LiveAudienceActivity.java index 07f4f76fc..26445c8b1 100644 --- a/live/src/main/java/com/yunbao/live/activity/LiveAudienceActivity.java +++ b/live/src/main/java/com/yunbao/live/activity/LiveAudienceActivity.java @@ -144,7 +144,7 @@ public class LiveAudienceActivity extends LiveActivity { private LiveBean mLiveBean; //当前直播间下标 private int mCurrentItem, mCurrentPage; - private static PortraitLiveManager manager; + private static PortraitLiveManager manager; private int mLastPosition = -1; private ViewGroup mViewGroup; @@ -1296,7 +1296,16 @@ public class LiveAudienceActivity extends LiveActivity { .setAnchorAvatar(event.getBean().getAvatar()) .showDialog(); break; - + case WISH_LIST_PROGRESS: + if (manager != null) { + manager.wishListProgress(event.getWishListProgress(), event.getUname()); + } + break; + case XYD_COMPLETE: + if (manager != null) { + manager.showXydComplete(event.getXydCompleteModel()); + } + break; } 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 2182a1364..498a01a39 100644 --- a/live/src/main/java/com/yunbao/live/adapter/LiveChatAdapter.java +++ b/live/src/main/java/com/yunbao/live/adapter/LiveChatAdapter.java @@ -5,12 +5,18 @@ import static com.yunbao.live.bean.LiveChatBean.LUCKY_100_CHECK; import static com.yunbao.live.bean.LiveChatBean.LUCKY_ANGEL; import static com.yunbao.live.bean.LiveChatBean.RECOMMEND_CARD_NOTIFY; import static com.yunbao.live.bean.LiveChatBean.STAR_CHALLENGE_UPGRADE_NOTIFY; +import static com.yunbao.live.bean.LiveChatBean.WISH_LIST_PROGRESS; +import static com.yunbao.live.bean.LiveChatBean.XYD_COMPLETE; import android.annotation.SuppressLint; import android.content.Context; +import android.graphics.Color; +import android.graphics.drawable.Drawable; import android.os.Bundle; +import android.text.Html; import android.text.Spannable; import android.text.SpannableStringBuilder; +import android.text.Spanned; import android.text.TextUtils; import android.text.style.ForegroundColorSpan; import android.util.Log; @@ -174,12 +180,12 @@ public class LiveChatAdapter extends RecyclerView.Adapter { class Vh extends RecyclerView.ViewHolder { - LinearLayout mBg, view_follow, view_action_game, view_zg; - TextView mTextView, tv_chat_active_into, tv_chat_avtive_name, tv_zg_anchorname; + LinearLayout mBg, view_follow, view_action_game, view_zg, xydComplete; + TextView mTextView, tv_chat_active_into, tv_chat_avtive_name, tv_zg_anchorname, textTxt2; RoundedImageView avatar; View v_chat_active_close; RecyclerView rv_chat_active; - ImageView img_zg_img, btnAttention; + ImageView img_zg_img, btnAttention, textLeave; FrameLayout attentionLayout; ClipPathCircleImage clipImage2; @@ -187,6 +193,7 @@ public class LiveChatAdapter extends RecyclerView.Adapter { super(itemView); mBg = (LinearLayout) itemView.findViewById(R.id.bg); mTextView = (TextView) itemView.findViewById(R.id.text_txt); + textTxt2 = (TextView) itemView.findViewById(R.id.text_txt2); attentionLayout = (FrameLayout) itemView.findViewById(R.id.attention_layout); clipImage2 = (ClipPathCircleImage) itemView.findViewById(R.id.clip_image2); itemView.setOnClickListener(mOnClickListener); @@ -201,9 +208,11 @@ public class LiveChatAdapter extends RecyclerView.Adapter { rv_chat_active = (RecyclerView) itemView.findViewById(R.id.rv_chat_active); view_zg = (LinearLayout) itemView.findViewById(R.id.view_zg); + xydComplete = (LinearLayout) itemView.findViewById(R.id.xyd_complete); tv_zg_anchorname = (TextView) itemView.findViewById(R.id.tv_zg_anchorname); img_zg_img = (ImageView) itemView.findViewById(R.id.img_zg_img); btnAttention = (ImageView) itemView.findViewById(R.id.btn_attention); + textLeave = (ImageView) itemView.findViewById(R.id.text_leave); } @@ -342,8 +351,8 @@ public class LiveChatAdapter extends RecyclerView.Adapter { mTextView.setText(bean.getContent()); } } else if (bean.getType() == LiveChatBean.SYSTEM2) { - mTextView.setTextColor(0xffffffff); - mBg.setBackground(null); + mTextView.setTextColor(Color.parseColor("#ffffff")); + new LoadDian9TuUtil().loadDian9TuAssets(mContext, mBg, 1); mTextView.setText(bean.getContent()); } // else if (bean.getType() == -1) {//自动消息,关注 @@ -388,6 +397,30 @@ public class LiveChatAdapter extends RecyclerView.Adapter { //加载.9图聊天气泡 new LoadDian9TuUtil().loadDian9Tu(mContext, mBg, bean.getBubble(), 1); new LiveTextRender().recommendCardNotify(mContext, mTextView, bean); + } else if (bean.getType() == WISH_LIST_PROGRESS) { + //加载.9图聊天气泡 + new LoadDian9TuUtil().loadDian9TuAssets(mContext, mBg, 1); + xydComplete.setVisibility(View.VISIBLE); + textTxt2.setText(userNicenamehighlight(bean.getContent(), bean.getAtUserName(), bean.getUserNiceName())); + mTextView.setVisibility(View.GONE); + textLeave.setVisibility(View.GONE); + } else if (bean.getType() == XYD_COMPLETE) { + //加载.9图聊天气泡 + new LoadDian9TuUtil().loadDian9TuAssets(mContext, mBg, 1); + xydComplete.setVisibility(View.VISIBLE); + textTxt2.setText(userNicenamehighlight(bean.getContent(), bean.getAtUserName(), bean.getUserNiceName())); + new LiveTextRender().getLiveLevelImage(mContext, bean.getLevel(), new ImgLoader.DrawableCallback() { + @Override + public void onLoadSuccess(Drawable drawable) { + ImgLoader.display2(mContext, drawable, textLeave); + } + + @Override + public void onLoadFailed() { + + } + }); + mTextView.setVisibility(View.GONE); } else if (bean.getType() == AI_AUTOMATIC_SPEECH) { //加载.9图聊天气泡 new LoadDian9TuUtil().loadDian9Tu(mContext, mBg, bean.getAiAutomaticSpeechModel().getSystemBubble(), 1); @@ -599,4 +632,23 @@ public class LiveChatAdapter extends RecyclerView.Adapter { } } + + private Spanned userNicenamehighlight(String context, String keyword, String keyword2) { + String contextHtml = ""; + String keywordHtml2; + String keywordHtml; + if (TextUtils.isEmpty(keyword) || TextUtils.isEmpty(keyword2)) { + keywordHtml2 = TextUtils.isEmpty(keyword) ? "1" : keyword; + keywordHtml = TextUtils.isEmpty(keyword) ? "1" : keyword; + } else { + keywordHtml2 = "" + keyword + ""; + keywordHtml = "" + keyword2 + ""; + } + + contextHtml = "" + context + ""; + contextHtml = contextHtml.replace(keyword, keywordHtml2).replace(keyword2, keywordHtml); + + + return Html.fromHtml(contextHtml); + } } 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 599d74661..85a6697cd 100644 --- a/live/src/main/java/com/yunbao/live/bean/LiveChatBean.java +++ b/live/src/main/java/com/yunbao/live/bean/LiveChatBean.java @@ -23,6 +23,8 @@ public class LiveChatBean { public static final int STAR_CHALLENGE_UPGRADE_NOTIFY = 105; public static final int LUCKY_ANGEL = 106;//幸运天使 public static final int LUCKY_100_CHECK = 107;//幸运天使 + public static final int XYD_COMPLETE = 207;//心愿单完成通知 + public static final int WISH_LIST_PROGRESS = 307;//心愿单进度通知 diff --git a/live/src/main/java/com/yunbao/live/event/LiveAudienceEvent.java b/live/src/main/java/com/yunbao/live/event/LiveAudienceEvent.java index 3bcb03d2e..8b065d7ec 100644 --- a/live/src/main/java/com/yunbao/live/event/LiveAudienceEvent.java +++ b/live/src/main/java/com/yunbao/live/event/LiveAudienceEvent.java @@ -7,6 +7,8 @@ import com.yunbao.common.bean.AnchorRecommendItemModel; import com.yunbao.common.bean.BaseModel; import com.yunbao.common.bean.LiveBean; import com.yunbao.common.bean.MsgModel; +import com.yunbao.common.bean.WishModel; +import com.yunbao.common.bean.XydCompleteModel; import com.yunbao.common.event.CustomFullServiceNotifyEvent; import com.yunbao.live.bean.LivePKUserListBean; import com.yunbao.live.bean.OpenParametersModel; @@ -35,6 +37,26 @@ public class LiveAudienceEvent extends BaseModel { private String length; private int nums; private String uname; + private WishModel wishListProgress; + private XydCompleteModel xydCompleteModel; + + public XydCompleteModel getXydCompleteModel() { + return xydCompleteModel; + } + + public LiveAudienceEvent setXydCompleteModel(XydCompleteModel xydCompleteModel) { + this.xydCompleteModel = xydCompleteModel; + return this; + } + + public WishModel getWishListProgress() { + return wishListProgress; + } + + public LiveAudienceEvent setWishListProgress(WishModel wishListProgress) { + this.wishListProgress = wishListProgress; + return this; + } public String getVotes() { return votes; @@ -300,10 +322,12 @@ public class LiveAudienceEvent extends BaseModel { LIVE_VIDEO(54, "画质选择"), LUCKY_100_CHECK(55, "幸运百分百"), LIVE_END(56, "主播下播"), - LIVE_HIDE_MSG_RED(57,"隐藏红点"), - LIVE_SHARE(58,"直播間分享"), - LIVE_PK_ING(59,"PK中"), - LIVE_PK_END(60,"PK结束"); + LIVE_HIDE_MSG_RED(57, "隐藏红点"), + LIVE_SHARE(58, "直播間分享"), + LIVE_PK_ING(59, "PK中"), + LIVE_PK_END(60, "PK结束"), + XYD_COMPLETE(62, "心愿单完成"), + WISH_LIST_PROGRESS(61, "心愿单进度"); private int type; private String name; diff --git a/live/src/main/java/com/yunbao/live/http/LiveHttpUtil.java b/live/src/main/java/com/yunbao/live/http/LiveHttpUtil.java index 72ec2881f..73e968a5a 100644 --- a/live/src/main/java/com/yunbao/live/http/LiveHttpUtil.java +++ b/live/src/main/java/com/yunbao/live/http/LiveHttpUtil.java @@ -639,6 +639,7 @@ public class LiveHttpUtil { .params("GroupId", "g" + liveUid) .params("jsonstr", jsonstr) .params("isprank", by) + .params("appVersion", CommonAppConfig.getInstance().getVersion()) .execute(callback); } 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 e22306814..2bd1727ac 100644 --- a/live/src/main/java/com/yunbao/live/socket/SocketRyClient.java +++ b/live/src/main/java/com/yunbao/live/socket/SocketRyClient.java @@ -28,6 +28,8 @@ import com.yunbao.common.bean.MsgModel; import com.yunbao.common.bean.PkRankBean; import com.yunbao.common.bean.SocketModel; 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.http.HttpCallback; import com.yunbao.common.http.HttpClient; @@ -294,7 +296,7 @@ public class SocketRyClient { .setUid(mLiveUid) .setTime(map.getIntValue("drpk_time"))); if (livePushRyViewHolder == null) { - // LiveAudienceActivity.getmLivePlayViewHolder().setPkview(); + // LiveAudienceActivity.getmLivePlayViewHolder().setPkview(); Bus.get().post(new LiveAudienceEvent() .setType(LiveAudienceEvent.LiveAudienceType.SOCKET_LIVE_DRPK_SET_PK_VIEW) ); @@ -540,14 +542,14 @@ public class SocketRyClient { } break; case Constants.STAR_CHALLENGE_UPDATE://星级助力 - SocketModel starChallengeModel = GsonUtils.fromJson(socketMsg, SocketModel.class); - List starChallengeMsg = starChallengeModel.getMsg(); - if (starChallengeMsg.size() > 0) { - - Bus.get().post(new LiveAudienceEvent() - .setType(LiveAudienceEvent.LiveAudienceType.START_MESSAGE) - .setMsgModel(starChallengeMsg.get(0))); - } +// SocketModel starChallengeModel = GsonUtils.fromJson(socketMsg, SocketModel.class); +// List starChallengeMsg = starChallengeModel.getMsg(); +// if (starChallengeMsg.size() > 0) { +// +// Bus.get().post(new LiveAudienceEvent() +// .setType(LiveAudienceEvent.LiveAudienceType.START_MESSAGE) +// .setMsgModel(starChallengeMsg.get(0))); +// } break; case Constants.AI_AUTOMATIC_SPEECH: case Constants.AI_AUTOMATIC_SPEECH_LIVE: @@ -595,6 +597,26 @@ public class SocketRyClient { .setType(LiveAudienceEvent.LiveAudienceType.CUSTOM_FULL_SERVICE_NOTIFY) .setCustomFullServiceNotifyEvent(customFullServiceNotifyEvent)); break; + case Constants.XYD_COMPLETE: +// xydComplete(map); + XydCompleteModel xydCompleteModel = GsonUtils.fromJson(map.toString(), XydCompleteModel.class); + EventBus.getDefault().post(new LiveAudienceEvent() + .setType(LiveAudienceEvent.LiveAudienceType.XYD_COMPLETE) + .setXydCompleteModel(xydCompleteModel)); + break; + case Constants.WISH_LIST_PROGRESS: + StringBuffer conString = new StringBuffer(); + conString.append(map.getString("msg")); + EventBus.getDefault().post(new LiveAudienceEvent() + .setType(LiveAudienceEvent.LiveAudienceType.WISH_LIST_PROGRESS) + .setWishListProgress(new WishModel() + .setWishlistProgress(map.getString("wishlist_progress")) + .setWishlistIcon(map.getString("wishlist_icon")) + .setWishlistName(map.getString("wishlist_name")) + .setWishlistNum(map.getString("wishlist_num")) + .setGiftType(map.getInteger("giftId")) + .setLuid(conString.toString())).setUname(map.getString("userName"))); + break; } } @@ -874,6 +896,43 @@ public class SocketRyClient { } } + private static void xydComplete(JSONObject map) { + LiveReceiveGiftBean receiveGiftBean = new LiveReceiveGiftBean(); + receiveGiftBean.setAvatar(map.getString("uhead") + ""); + receiveGiftBean.setUserNiceName(map.getString("uname")); + receiveGiftBean.setRoomnum(map.getString("roomnum")); + receiveGiftBean.setAncherName(map.getString("ancherName")); + receiveGiftBean.setHot_num(map.getString("hot_num")); + receiveGiftBean.setDrpk_status(map.getString("drpk_status")); + receiveGiftBean.setGitType(map.getInteger("swftype ")); + receiveGiftBean.setmLiveUId(mLiveUid); + receiveGiftBean.setmTypeBuyGuard(false); + receiveGiftBean.setAllServerNotify(false); + receiveGiftBean.setGifUrl(map.getString("svg")); + LiveChatBean chatBean = new LiveChatBean(); + chatBean.setUserNiceName(receiveGiftBean.getUserNiceName()); + chatBean.setLevel(receiveGiftBean.getLevel()); + chatBean.setMedal_honor(map.getString("medal_honor")); + chatBean.setId(map.getString("uid")); + chatBean.setLiangName(map.getString("liangname")); + chatBean.setVipType(map.getIntValue("vip_type")); + chatBean.setBubble(map.getString("bubble")); + chatBean.setMedal(map.getString("medal")); + chatBean.setMedal_new(map.getString("medal_new")); + chatBean.setGood_nub(map.getString("good_num")); + chatBean.setType(LiveChatBean.GIFT); + 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(WordUtil.getString(R.string.live_send_gift_1) + receiveGiftBean.getGiftCount() + WordUtil.getString(R.string.live_send_gift_2) + receiveGiftBean.getGiftName()); + } else { + chatBean.setContent(WordUtil.getString(R.string.live_send_gift_1) + " " + +receiveGiftBean.getGiftCount() + " " + WordUtil.getString(R.string.live_send_gift_2) + receiveGiftBean.getGiftnameen()); + + } + mListener.onSendGift(receiveGiftBean); + } + // 玩家自己送礼物 private static void sendGiftInSameRoom(JSONObject map) { LiveReceiveGiftBean receiveGiftBean = JSON.parseObject(map.getString("ct"), LiveReceiveGiftBean.class); 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 ca6d2a537..7d5f02066 100644 --- a/live/src/main/java/com/yunbao/live/views/LiveRoomViewHolder.java +++ b/live/src/main/java/com/yunbao/live/views/LiveRoomViewHolder.java @@ -87,6 +87,7 @@ import com.yunbao.common.bean.StarChallengeStatusModel; import com.yunbao.common.bean.TaskModel; import com.yunbao.common.bean.UserBean; import com.yunbao.common.bean.WishModel; +import com.yunbao.common.bean.XydCompleteModel; import com.yunbao.common.event.AnchorInfoEvent; import com.yunbao.common.event.CustomFullServiceNotifyEvent; import com.yunbao.common.glide.ImgLoader; @@ -353,6 +354,7 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis private ImageView mAnchorSayHide; //----!主播说组件---// private Banner topBanner1;//心愿单&联系方式 + private SVGAImageView xydSvg; public SVGAImageView svga_new_user_gif, svga_new_user_double, svga_new_user_follow; @Subscribe(threadMode = ThreadMode.MAIN) public void onUpdata(String str) { @@ -576,6 +578,60 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis } } + + private Runnable xydCompleteRunnable = new Runnable() { + @Override + public void run() { + if (xydCompleteModels.size() > 0) + showXydComplete(xydCompleteModels.get(0)); + } + }; + List xydCompleteModels = new ArrayList<>(); + + public void showXydComplete(XydCompleteModel model) { + + if (model.getLiveId().equals(mLiveUid)) { + LiveChatBean bean = new LiveChatBean(); + + bean.setContent(model.getMsg()); + bean.setUserNiceName(model.getUserName()); + bean.setAtUserName(model.getGiftname()) + .setLevel(model.getLevel()); + bean.setType(LiveChatBean.XYD_COMPLETE); + mLiveChatAdapter.insertItem(bean); + + xydCompleteModels.add(model); + if (mSVGAImageView.isAnimating()) { + new Handler().postDelayed(xydCompleteRunnable, 2000); + } else { + try { + xydSvg.setLoops(1); + new SVGAParser(Contexts).parse(new URL(model.getSvg()), new SVGAParser.ParseCompletion() { + @Override + public void onComplete(SVGAVideoEntity videoItem) { + SVGADrawable drawable = new SVGADrawable(videoItem); + xydSvg.setImageDrawable(drawable); + + SVGAViewUtils.playEndClear(xydSvg); + } + + @Override + public void onError() { + } + }); + } catch (MalformedURLException e) { + e.printStackTrace(); + } + + if (xydCompleteModels.size() > 0) { + xydCompleteModels.remove(0); + new Handler().postDelayed(xydCompleteRunnable, 2000); + } + } + + } + } + @Override protected int getLayoutId() { return R.layout.view_live_room; @@ -1357,7 +1413,7 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis new LoadDian9TuUtil().loadDian9TuAssets2(mContext, liveWksLayout, "rectangle_new.png", 1); new LoadDian9TuUtil().loadDian9TuAssets2(mContext, wishListLayout2, "rectangle_new.png", 1); - + xydSvg = (SVGAImageView) findViewById(R.id.xyd_svg); } /** @@ -4162,6 +4218,57 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis case LIVE_PK_END: showAnchorSayAndCallAnchor(); break; + + + } + + } + + public void wishListProgress(WishModel wishModel, String userNiceName) { + wishListProgress = null; + WishModel model = wishModel; + if (!TextUtils.isEmpty(model.getWishlistName()) || !TextUtils.isEmpty(model.getWishlistProgress())) { + for (BannerBean bannerBean : mTopBannerList) { + if (bannerBean.getType() == 1) { + mTopBannerList.remove(bannerBean); + } + } + topBanner1.update(mTopBannerList); + new Handler().postDelayed(new Runnable() { + @Override + public void run() { + BannerBean bannerBean = new BannerBean(); + bannerBean.setWishlistIcon(model.getWishlistIcon()) + .setWishlistName(model.getWishlistName()) + .setWishlistNum(model.getWishlistNum()) + .setWishlistProgress(model.getWishlistProgress()) + .setmLink(CommonAppConfig.HOST + "/index.php") + .setType(1); + bannerBean.setShow_type("2"); + mTopBannerList.add(bannerBean); + LiveChatBean bean = new LiveChatBean(); + bean.setContent(model.getLuid()); + bean.setUserNiceName(userNiceName); + bean.setAtUserName(model.getWishlistName()); + bean.setType(LiveChatBean.WISH_LIST_PROGRESS); + mLiveChatAdapter.insertItem(bean); + topBanner1.update(mTopBannerList); + } + }, 500); + + } else { + for (BannerBean bannerBean : mTopBannerList) { + if (bannerBean.getType() == 1) { + mTopBannerList.remove(bannerBean); + } + } +// LiveChatBean bean = new LiveChatBean(); +// bean.setContent(model.getLuid()); +// bean.setUserNiceName(userNiceName); +// bean.setAtUserName(model.getWishlistName()); +// bean.setType(LiveChatBean.WISH_LIST_PROGRESS); +// mLiveChatAdapter.insertItem(bean); + topBanner1.update(mTopBannerList); } } @@ -4596,6 +4703,7 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis } public void updateTopBanner() { + if (wishListProgress == null) return; if (!TextUtils.isEmpty(wishListProgress.getWishlistName()) || !TextUtils.isEmpty(wishListProgress.getWishlistProgress())) { if (mTopBannerList == null) { mTopBannerList = new ArrayList<>(); @@ -4607,9 +4715,7 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis .setWishlistNum(wishListProgress.getWishlistNum()) .setWishlistProgress(wishListProgress.getWishlistProgress()) .setmLink(CommonAppConfig.HOST + "/index.php") - .setType(1) - - ; + .setType(1); bannerBean.setShow_type("2"); mTopBannerList.add(bannerBean); topBanner1.update(mTopBannerList); @@ -4700,7 +4806,6 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis System.out.println("!>>>>> 获取联系方式:" + error); } }); - updateTopBanner(); } private void checkNewLetter() { 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 1b8021dcd..4468c48cc 100644 --- a/live/src/main/java/com/yunbao/live/views/PortraitLiveManager.java +++ b/live/src/main/java/com/yunbao/live/views/PortraitLiveManager.java @@ -41,6 +41,7 @@ import com.yunbao.common.bean.MsgModel; import com.yunbao.common.bean.StarChallengeStatusModel; import com.yunbao.common.bean.UserBean; import com.yunbao.common.bean.WishModel; +import com.yunbao.common.bean.XydCompleteModel; import com.yunbao.common.custom.MyViewPager; import com.yunbao.common.event.FollowEvent; import com.yunbao.common.event.LiveFloatEvent; @@ -252,7 +253,9 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe public void run() { loading.setVisibility(View.GONE); enterRoomLeaveHandler.post(enterRoomLeaveRunnable); - topBannerHandler.postDelayed(topBannerRunnable, 6000); + if (topBannerRunnable != null) { + topBannerHandler.postDelayed(topBannerRunnable, 6000); + } } }; private Runnable topBannerRunnable = new Runnable() { @@ -261,7 +264,10 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe if (mLiveRoomViewHolder != null) { //初始化顶部banner mLiveRoomViewHolder.initTopBanner(); - + mLiveRoomViewHolder.updateTopBanner(); + topBannerHandler.removeCallbacks(topBannerRunnable); + topBannerRunnable = null; + topBannerHandler = null; } } @@ -1939,4 +1945,14 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe } } + public void wishListProgress(WishModel wishListProgress, String userNiceName) { + if (mLiveRoomViewHolder != null) { + mLiveRoomViewHolder.wishListProgress(wishListProgress, userNiceName); + } + } + public void showXydComplete(XydCompleteModel model) { + if (mLiveRoomViewHolder != null) { + mLiveRoomViewHolder.showXydComplete(model); + } + } } diff --git a/live/src/main/res/layout/item_live_chat.xml b/live/src/main/res/layout/item_live_chat.xml index 4547f41f7..2a257ffd4 100644 --- a/live/src/main/res/layout/item_live_chat.xml +++ b/live/src/main/res/layout/item_live_chat.xml @@ -214,4 +214,29 @@ android:src="@mipmap/btn_attention" /> + + + + + + + \ No newline at end of file diff --git a/live/src/main/res/layout/view_live_room.xml b/live/src/main/res/layout/view_live_room.xml index 9baca8a1b..79894a164 100644 --- a/live/src/main/res/layout/view_live_room.xml +++ b/live/src/main/res/layout/view_live_room.xml @@ -552,9 +552,9 @@ @@ -708,6 +708,7 @@ app:delay_time="5000" app:indicator_height="8dp" app:indicator_width="8dp" /> + + android:background="@color/white" + android:visibility="invisible" /> + + + app:autoPlay="true" />