diff --git a/common/src/main/java/com/yunbao/common/Constants.java b/common/src/main/java/com/yunbao/common/Constants.java index c2835c75e..c4faa9609 100644 --- a/common/src/main/java/com/yunbao/common/Constants.java +++ b/common/src/main/java/com/yunbao/common/Constants.java @@ -165,6 +165,7 @@ public class Constants { public static final String SOCKET_PRIZE_POOL_UP = "jackpotUp";//奖池升级 public static final String SOCKET_HOUR = "SendHourChart";//小时榜更新 public static final String RECOMMEND_CARD_NOTIFY = "recommendCardNotify";//推荐卡通知消息 + public static final String STAR_CHALLENGE_UPDATE = "starChallengeUpdate";//星级助力 //游戏socket public static final String SOCKET_GAME_ZJH = "startGame";//炸金花 diff --git a/common/src/main/java/com/yunbao/common/bean/MsgModel.java b/common/src/main/java/com/yunbao/common/bean/MsgModel.java index 1b62310f6..43f921d5e 100644 --- a/common/src/main/java/com/yunbao/common/bean/MsgModel.java +++ b/common/src/main/java/com/yunbao/common/bean/MsgModel.java @@ -2,6 +2,7 @@ package com.yunbao.common.bean; import android.text.TextUtils; +import com.google.gson.Gson; import com.google.gson.annotations.SerializedName; import com.yunbao.common.views.weight.FullServiceNotificationView; @@ -49,6 +50,110 @@ public class MsgModel extends BaseModel { private String anchorName = ""; @SerializedName("systemBubble") private String systemBubble = ""; + @SerializedName("taskNum") + private String taskNum; + @SerializedName("currentStarVal") + private String currentStarVal; + @SerializedName("targetStarVal") + private String targetStarVal; + @SerializedName("currentAssistNum") + private String currentAssistNum; + @SerializedName("targetAssistNum") + private String targetAssistNum; + @SerializedName("starSrc") + private String starSrc; + @SerializedName("assistSrc") + private String assistSrc; + @SerializedName("taskName1") + private String taskName1; + @SerializedName("taskName2") + private String taskName2; + + public String getTaskNum() { + return taskNum; + } + + public MsgModel setTaskNum(String taskNum) { + this.taskNum = taskNum; + return this; + } + + public String getCurrentStarVal() { + return currentStarVal; + } + + public MsgModel setCurrentStarVal(String currentStarVal) { + this.currentStarVal = currentStarVal; + return this; + } + + public String getTargetStarVal() { + return targetStarVal; + } + + public MsgModel setTargetStarVal(String targetStarVal) { + this.targetStarVal = targetStarVal; + return this; + } + + public String getCurrentAssistNum() { + return currentAssistNum; + } + + public MsgModel setCurrentAssistNum(String currentAssistNum) { + this.currentAssistNum = currentAssistNum; + return this; + } + + public String getTargetAssistNum() { + return targetAssistNum; + } + + public MsgModel setTargetAssistNum(String targetAssistNum) { + this.targetAssistNum = targetAssistNum; + return this; + } + + public String getStarSrc() { + return starSrc; + } + + public MsgModel setStarSrc(String starSrc) { + this.starSrc = starSrc; + return this; + } + + public String getAssistSrc() { + return assistSrc; + } + + public MsgModel setAssistSrc(String assistSrc) { + this.assistSrc = assistSrc; + return this; + } + + public String getTaskName1() { + return taskName1; + } + + public MsgModel setTaskName1(String taskName1) { + this.taskName1 = taskName1; + return this; + } + + public String getTaskName2() { + return taskName2; + } + + public MsgModel setTaskName2(String taskName2) { + this.taskName2 = taskName2; + return this; + } + + public static MsgModel objectFromData(String str) { + + return new Gson().fromJson(str, MsgModel.class); + } public String getAction() { return action; diff --git a/common/src/main/java/com/yunbao/common/bean/StarChallengeStatusModel.java b/common/src/main/java/com/yunbao/common/bean/StarChallengeStatusModel.java index e94be4e5f..f86e33d81 100644 --- a/common/src/main/java/com/yunbao/common/bean/StarChallengeStatusModel.java +++ b/common/src/main/java/com/yunbao/common/bean/StarChallengeStatusModel.java @@ -80,7 +80,7 @@ public class StarChallengeStatusModel extends BaseModel { return taskNum; } - public BaseModel setTaskNum(String taskNum) { + public StarChallengeStatusModel setTaskNum(String taskNum) { this.taskNum = taskNum; return this; } @@ -89,7 +89,7 @@ public class StarChallengeStatusModel extends BaseModel { return currentStarVal; } - public BaseModel setCurrentStarVal(String currentStarVal) { + public StarChallengeStatusModel setCurrentStarVal(String currentStarVal) { this.currentStarVal = currentStarVal; return this; } @@ -98,7 +98,7 @@ public class StarChallengeStatusModel extends BaseModel { return targetStarVal; } - public BaseModel setTargetStarVal(String targetStarVal) { + public StarChallengeStatusModel setTargetStarVal(String targetStarVal) { this.targetStarVal = targetStarVal; return this; } @@ -107,7 +107,7 @@ public class StarChallengeStatusModel extends BaseModel { return currentAssistNum; } - public BaseModel setCurrentAssistNum(String currentAssistNum) { + public StarChallengeStatusModel setCurrentAssistNum(String currentAssistNum) { this.currentAssistNum = currentAssistNum; return this; } @@ -116,7 +116,7 @@ public class StarChallengeStatusModel extends BaseModel { return targetAssistNum; } - public BaseModel setTargetAssistNum(String targetAssistNum) { + public StarChallengeStatusModel setTargetAssistNum(String targetAssistNum) { this.targetAssistNum = targetAssistNum; return this; } @@ -125,7 +125,7 @@ public class StarChallengeStatusModel extends BaseModel { return starSrc; } - public BaseModel setStarSrc(String starSrc) { + public StarChallengeStatusModel setStarSrc(String starSrc) { this.starSrc = starSrc; return this; } @@ -134,7 +134,7 @@ public class StarChallengeStatusModel extends BaseModel { return assistSrc; } - public BaseModel setAssistSrc(String assistSrc) { + public StarChallengeStatusModel setAssistSrc(String assistSrc) { this.assistSrc = assistSrc; return this; } 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 9ad6fa1d9..f678ae668 100644 --- a/live/src/main/java/com/yunbao/live/activity/LiveAudienceActivity.java +++ b/live/src/main/java/com/yunbao/live/activity/LiveAudienceActivity.java @@ -338,8 +338,9 @@ public class LiveAudienceActivity extends LiveActivity { } } }; - private void over(){ - if("NEWUSER".equals(getIntent().getStringExtra("OPEN"))){ + + private void over() { + if ("NEWUSER".equals(getIntent().getStringExtra("OPEN"))) { manager.mLiveAudienceViewHolder.openNewPeopleDialog(); } } @@ -842,6 +843,9 @@ public class LiveAudienceActivity extends LiveActivity { case AT_MESSAGE: manager.showAtMessage(); break; + case START_MESSAGE: + manager.starMessage(event.getMsgModel()); + break; } 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 4aa8a9edd..b010559ef 100644 --- a/live/src/main/java/com/yunbao/live/event/LiveAudienceEvent.java +++ b/live/src/main/java/com/yunbao/live/event/LiveAudienceEvent.java @@ -133,8 +133,8 @@ public class LiveAudienceEvent extends BaseModel { RECOMMEND_CARD_NOTIFY(21, "贵族推荐通知"), SLIDE_SETTINGS(22, "滑動設置"), NEW_MESSAGE_REMINDER(23, "新消息提醒"), - AT_MESSAGE(24, "@消息") - ; + AT_MESSAGE(24, "@消息"), + START_MESSAGE(25, "星级消息"); private int type; private String name; 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 a4c851cc4..ae4e1894e 100644 --- a/live/src/main/java/com/yunbao/live/socket/SocketRyClient.java +++ b/live/src/main/java/com/yunbao/live/socket/SocketRyClient.java @@ -470,6 +470,16 @@ public class SocketRyClient { .setMsgModel(recommendCardNotifyMsg.get(0))); } 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))); + } + break; } } 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 34f97ddf5..e0a85ef77 100644 --- a/live/src/main/java/com/yunbao/live/views/LiveRoomViewHolder.java +++ b/live/src/main/java/com/yunbao/live/views/LiveRoomViewHolder.java @@ -1027,14 +1027,25 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis } public void showStart(StarChallengeStatusModel data) { + boolean star = false; if (mBannerList2 == null) { mBannerList2 = new ArrayList<>(); + } else { + for (BannerBean bean : mBannerList2) { + if (bean.isStart()){ + star = true; + bean.setModel(data); + } + } + if (!star){ + BannerBean bannerBean = new BannerBean(); + bannerBean.setStart(true); + bannerBean.setModel(data); + mBannerList2.add(bannerBean); + } } - BannerBean bannerBean = new BannerBean(); - bannerBean.setStart(true); - bannerBean.setModel(data); - mBannerList2.add(bannerBean); - showBanner2(); + + mBanner2.update(mBannerList2); } public void hideFloatMsg() { 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 bdd685bf5..ecfdb0ca4 100644 --- a/live/src/main/java/com/yunbao/live/views/PortraitLiveManager.java +++ b/live/src/main/java/com/yunbao/live/views/PortraitLiveManager.java @@ -172,6 +172,8 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe private Handler liveHandler = new Handler(); //公共參數 private OpenParametersModel openParametersModel = null; + //星级活动地址 + private String activityUrl = ""; public PortraitLiveManager(Activity context, Intent intent) { this.mContext = context; @@ -294,6 +296,7 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe @Override public void onSuccess(StarChallengeStatusModel data) { if (mLiveRoomViewHolder != null) { + activityUrl = data.getActivityUrl(); mLiveRoomViewHolder.showStart(data); } } @@ -1558,4 +1561,22 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe mLiveRoomViewHolder.showAtMessage(); } } + + public void starMessage(MsgModel msgModel) { + if (mLiveRoomViewHolder != null) { + + mLiveRoomViewHolder + .showStart( + new StarChallengeStatusModel(activityUrl) + .setTaskNum(msgModel.getTaskNum()) + .setTaskName1(msgModel.getTaskName1()) + .setTaskName2(msgModel.getTaskName2()) + .setStarSrc(msgModel.getStarSrc()) + .setCurrentStarVal(msgModel.getCurrentStarVal()) + .setTargetStarVal(msgModel.getTargetStarVal()) + .setAssistSrc(msgModel.getAssistSrc()) + .setTargetAssistNum(msgModel.getTargetAssistNum()) + .setCurrentAssistNum(msgModel.getCurrentAssistNum())); + } + } }