diff --git a/common/src/main/java/com/yunbao/common/bean/LiveRoomVoteModel.java b/common/src/main/java/com/yunbao/common/bean/LiveRoomVoteModel.java
index e08329ec4..c9de60a77 100644
--- a/common/src/main/java/com/yunbao/common/bean/LiveRoomVoteModel.java
+++ b/common/src/main/java/com/yunbao/common/bean/LiveRoomVoteModel.java
@@ -1,5 +1,6 @@
package com.yunbao.common.bean;
+import com.alibaba.fastjson.annotation.JSONField;
import com.google.gson.annotations.SerializedName;
import com.yunbao.common.utils.StringUtil;
@@ -166,8 +167,12 @@ public class LiveRoomVoteModel extends BaseModel {
public void setVote(String vote) {
this.vote = vote;
}
- public boolean isVoteLeft(){
+
+ public boolean isVoteLeft() {
return vote.equals("option_content_first_num");
}
+ public boolean isVote() {
+ return !StringUtil.isEmpty(vote);
+ }
}
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 2f2a4e1ab..b9fc80899 100644
--- a/live/src/main/java/com/yunbao/live/activity/LiveAudienceActivity.java
+++ b/live/src/main/java/com/yunbao/live/activity/LiveAudienceActivity.java
@@ -1337,22 +1337,36 @@ public class LiveAudienceActivity extends LiveActivity {
break;
case VOTE_CREATE:
case VOTE_UPDATE:
+ LiveRoomVoteModel voteModel = new LiveRoomVoteModel();
JSONObject map = (JSONObject) event.getObject();
- manager.mLiveRoomViewHolder.setVoteData(
- map.getString("question"),
- map.getString("answer1"),
- map.getString("answer2"),
- map.getString("num1"),
- map.getString("num2")
- );
+ try {
+ voteModel.setStatus(1);
+ voteModel.setLiveUid(mLiveUid);
+ voteModel.setContent(map.getString("question"));
+ voteModel.setAnswer1(map.getString("answer1"));
+ voteModel.setAnswer2(map.getString("answer2"));
+ voteModel.setAnswer1Num(map.getInteger("num1"));
+ voteModel.setAnswer2Num(map.getInteger("num2"));
+ manager.mLiveRoomViewHolder.setVoteData(voteModel);
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+
break;
case VOTE_END:
try {
- LiveRoomVoteModel voteModel = JSONObject.parseObject(event.getObject().toString(), LiveRoomVoteModel.class);
+ voteModel = new LiveRoomVoteModel();
+ map = (JSONObject) event.getObject();
+ voteModel.setStatus(map.getInteger("status"));
+ voteModel.setContent(map.getString("question"));
+ voteModel.setAnswer1(map.getString("answer1"));
+ voteModel.setAnswer2(map.getString("answer2"));
+ voteModel.setAnswer1Num(map.getInteger("num1"));
+ voteModel.setAnswer2Num(map.getInteger("num2"));
System.out.println(">>>" + voteModel);
String content = voteModel.getResult();
if (!StringUtil.isEmpty(voteModel.getOptionText())) {
- content =voteModel.getResult().replace(voteModel.getOptionText(), "" + voteModel.getOptionText() + "");
+ content = voteModel.getResult().replace(voteModel.getOptionText(), "" + voteModel.getOptionText() + "");
}
manager.mLiveRoomViewHolder.dismissVote(voteModel.getResult(), content);
} catch (Exception e) {
diff --git a/live/src/main/java/com/yunbao/live/utils/LiveRoomVoteManager.java b/live/src/main/java/com/yunbao/live/utils/LiveRoomVoteManager.java
index 4bdd5ec68..1ed2c70b9 100644
--- a/live/src/main/java/com/yunbao/live/utils/LiveRoomVoteManager.java
+++ b/live/src/main/java/com/yunbao/live/utils/LiveRoomVoteManager.java
@@ -82,6 +82,8 @@ public class LiveRoomVoteManager {
private void initClick() {
if (isAnchor) {
+ mCancel.setOnClickListener(null);
+ mSubmit.setOnClickListener(null);
return;
}
mSubmit.setOnClickListener(v -> updateVote(true));
@@ -188,6 +190,9 @@ public class LiveRoomVoteManager {
mProgress.setMax(createVoteModel.getAnswer1Num() + createVoteModel.getAnswer2Num());
setLength(createVoteModel.getAnswer1Num());
}
+ if(isAnchor){
+ mClose.setVisibility(View.VISIBLE);
+ }
show();
} catch (Exception e) {
e.printStackTrace();
@@ -256,4 +261,14 @@ public class LiveRoomVoteManager {
voteLayout.setVisibility(View.GONE);
mSubmit.setTag(null);
}
+ public void fold(){
+ if(mVoteShow.getVisibility()!=View.VISIBLE){
+ hideAnchorVote();
+ }
+ }
+ public void expansion(){
+ if(mVoteShow.getVisibility()==View.VISIBLE){
+ hideAnchorVote();
+ }
+ }
}
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 18ca369c4..b2e79b4fd 100644
--- a/live/src/main/java/com/yunbao/live/views/LiveRoomViewHolder.java
+++ b/live/src/main/java/com/yunbao/live/views/LiveRoomViewHolder.java
@@ -1519,7 +1519,8 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
enterRoomLeave.setVisibility(View.GONE);
topBanner1.setVisibility(View.GONE);
topBanner2.setVisibility(View.GONE);
-
+ topBanner1.update(mTopBannerList);
+ topBanner2.update(mTopBannerList);
removeDetailView();
}
@@ -3680,24 +3681,6 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
}
}
- public void setVoteData(String question, String answer1, String answer2, String num1, String num2) {
- try {
- LiveRoomVoteModel voteModel = new LiveRoomVoteModel();
- voteModel.setStatus(1);
- voteModel.setContent(question);
- voteModel.setAnswer1(answer1);
- voteModel.setAnswer2(answer2);
- voteModel.setAnswer1Num(Integer.parseInt(num1));
- voteModel.setAnswer2Num(Integer.parseInt(num2));
- voteModel.setLiveUid(mLiveUid);
- Log.i("voteManager", voteManager.toString());
- voteManager.setCreateVoteModel(voteModel);
- } catch (Exception e) {
- e.printStackTrace();
- }
-
- }
-
public void dismissVote(String msg, String data) {
voteManager.endTimerTask(msg);
LiveChatBean bean = new LiveChatBean();
@@ -3709,6 +3692,11 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
public void setVoteData(LiveRoomVoteModel voteModel) {
Log.i("voteModel", voteModel.toString());
voteModel.setLiveUid(mLiveUid);
+ if(voteModel.isVote()){
+ voteManager.fold();
+ }else{
+ voteManager.expansion();
+ }
voteManager.setCreateVoteModel(voteModel);
}
@@ -4292,14 +4280,8 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
}
dismissVote(voteModel.getResult(), content);
} else if (event.getType() == LiveAnchorEvent.LiveAnchorType.VOTE_ANCHOR_UPDATE) {
- JSONObject map = (JSONObject) event.getObject();
- setVoteData(
- map.getString("question"),
- map.getString("answer1"),
- map.getString("answer2"),
- map.getString("num1"),
- map.getString("num2")
- );
+ LiveRoomVoteModel voteModel = JSONObject.parseObject(event.getObject().toString(), LiveRoomVoteModel.class);
+ setVoteData(voteModel);
}
}