提交主播投票功能

This commit is contained in:
zlzw 2023-05-17 15:12:51 +08:00
parent 46e37b14e4
commit df0f5f31e0
35 changed files with 1799 additions and 166 deletions

View File

@ -179,6 +179,9 @@ public class Constants {
public static final String CUSTOM_FULL_SERVICE_NOTIFY = "customFullServiceNotify";//全服通知 public static final String CUSTOM_FULL_SERVICE_NOTIFY = "customFullServiceNotify";//全服通知
public static final String XYD_COMPLETE = "XydComplete";//心愿单完成通知 public static final String XYD_COMPLETE = "XydComplete";//心愿单完成通知
public static final String WISH_LIST_PROGRESS = "wishListProgress";//心愿单进度通知 public static final String WISH_LIST_PROGRESS = "wishListProgress";//心愿单进度通知
public static final String LIVE_VOTE_CREATE="createVote";
public static final String LIVE_VOTE_UPDATE="updateVote";
public static final String LIVE_VOTE_END="endVote";
//游戏socket //游戏socket
public static final String SOCKET_GAME_ZJH = "startGame";//炸金花 public static final String SOCKET_GAME_ZJH = "startGame";//炸金花

View File

@ -104,12 +104,22 @@ public class EnterRoomInfoModel extends BaseModel {
private String anchorGoodnum; private String anchorGoodnum;
@SerializedName("jackpot_level") @SerializedName("jackpot_level")
private String jackpotLevel="-1"; private String jackpotLevel="-1";
@SerializedName("live_vote")
private LiveRoomVoteModel voteModel;
public String getJackpotLevel() { public String getJackpotLevel() {
return jackpotLevel; return jackpotLevel;
} }
public LiveRoomVoteModel getVoteModel() {
return voteModel;
}
public void setVoteModel(LiveRoomVoteModel voteModel) {
this.voteModel = voteModel;
}
public EnterRoomInfoModel setJackpotLevel(String jackpotLevel) { public EnterRoomInfoModel setJackpotLevel(String jackpotLevel) {
this.jackpotLevel = jackpotLevel; this.jackpotLevel = jackpotLevel;
return this; return this;

View File

@ -0,0 +1,173 @@
package com.yunbao.common.bean;
import com.google.gson.annotations.SerializedName;
import com.yunbao.common.utils.StringUtil;
import java.util.List;
/**
* 主播创建投票
* {
* "live_vote_id": "20",
* "question_content": "123",
* "vote_end_time": 180,
* "option_content_first_num": 0,
* "option_content_second_num": 0,
* "users_id": []
* }
*/
public class LiveRoomVoteModel extends BaseModel {
@SerializedName("vote_status")
private int status;
@SerializedName("live_vote_id")
private String voteId;
@SerializedName("question_content")
private String content;
@SerializedName("vote_end_time")
private int time;
@SerializedName("option_content_first_num")
private int answer1Num;
@SerializedName("option_content_second_num")
private int answer2Num;
@SerializedName("users_id")
private List<String> userIds;
@SerializedName("option_content_first")
private String answer1;
@SerializedName("option_content_second")
private String answer2;
@SerializedName("result")
private String result;
@SerializedName("option_text")
private String optionText;
@SerializedName("option_content_key")
private String vote;
private String liveUid;
public String getLiveUid() {
return liveUid;
}
public void setLiveUid(String liveUid) {
this.liveUid = liveUid;
}
public String getAnswer1() {
return answer1;
}
public void setAnswer1(String answer1) {
this.answer1 = answer1;
}
public String getAnswer2() {
return answer2;
}
public void setAnswer2(String answer2) {
this.answer2 = answer2;
}
public String getVoteId() {
return voteId;
}
public void setVoteId(String voteId) {
this.voteId = voteId;
}
public String getContent() {
return content;
}
public void setContent(String content) {
this.content = content;
}
public int getTime() {
return time;
}
public void setTime(int time) {
this.time = time;
}
public int getAnswer1Num() {
return answer1Num;
}
public void setAnswer1Num(int answer1Num) {
this.answer1Num = answer1Num;
}
public int getAnswer2Num() {
return answer2Num;
}
public void setAnswer2Num(int answer2Num) {
this.answer2Num = answer2Num;
}
public List<String> getUserIds() {
return userIds;
}
public void setUserIds(List<String> userIds) {
this.userIds = userIds;
}
public int getStatus() {
return status;
}
public void setStatus(int status) {
this.status = status;
}
public String getResult() {
return result;
}
public void setResult(String result) {
this.result = result;
}
public String getOptionText() {
return optionText;
}
public void setOptionText(String optionText) {
this.optionText = optionText;
}
@Override
public String toString() {
return "LiveRoomVoteModel{" +
"status=" + status +
", voteId='" + voteId + '\'' +
", content='" + content + '\'' +
", time=" + time +
", answer1Num=" + answer1Num +
", answer2Num=" + answer2Num +
", userIds=" + userIds +
", answer1='" + answer1 + '\'' +
", answer2='" + answer2 + '\'' +
", result='" + result + '\'' +
", optionText='" + optionText + '\'' +
", vote='" + vote + '\'' +
", liveUid='" + liveUid + '\'' +
'}';
}
public String getVote() {
return vote;
}
public void setVote(String vote) {
this.vote = vote;
}
public boolean isVoteLeft(){
return vote.equals("option_content_first_num");
}
}

View File

@ -16,6 +16,9 @@ public abstract class AbsDialogPopupWindow extends BottomPopupView {
this.mContext = context; this.mContext = context;
} }
/**
* <a href="https://github.com/li-xiaojun/XPopup/wiki/5.-%E5%B8%B8%E7%94%A8%E8%AE%BE%E7%BD%AE">参考配置</a>
*/
public abstract void buildDialog(XPopup.Builder builder); public abstract void buildDialog(XPopup.Builder builder);
public abstract int bindLayoutId(); public abstract int bindLayoutId();

View File

@ -17,6 +17,7 @@ import com.yunbao.common.bean.LinkMicUserBeanV2;
import com.yunbao.common.bean.ListInfoMessageModel; import com.yunbao.common.bean.ListInfoMessageModel;
import com.yunbao.common.bean.LiveAiRobotBean; import com.yunbao.common.bean.LiveAiRobotBean;
import com.yunbao.common.bean.LiveAnchorCallMeModel; import com.yunbao.common.bean.LiveAnchorCallMeModel;
import com.yunbao.common.bean.LiveRoomVoteModel;
import com.yunbao.common.bean.LiveAnchorSayModel; import com.yunbao.common.bean.LiveAnchorSayModel;
import com.yunbao.common.bean.LiveDataInfoModel; import com.yunbao.common.bean.LiveDataInfoModel;
import com.yunbao.common.bean.LiveInfoModel; import com.yunbao.common.bean.LiveInfoModel;
@ -694,4 +695,25 @@ public interface PDLiveApi {
*/ */
@GET("/api/public/?service=User.setLogOff") @GET("/api/public/?service=User.setLogOff")
Observable<ResponseModel<List<Object>>> setLogOff(); Observable<ResponseModel<List<Object>>> setLogOff();
/**
* 创建投票
*/
@GET("/api/public/?service=Live.createLiveVote")
Observable<ResponseModel<LiveRoomVoteModel>> createLiveVote(@Query("liveuid") String liveUid,
@Query("question_content") String content,
@Query("option_content_first") String first,
@Query("option_content_second") String second);
/**
* 更新投票
*/
@GET("/api/public/?service=Live.setLiveVote")
Observable<ResponseModel<List<String>>> updateLiveVote(@Query("liveuid") String liveUid,
@Query("option_content_key") String key);
/**
* 主动结束投票
*/
@GET("/api/public/?service=Live.endLiveVote")
Observable<ResponseModel<List<String>>> endLiveVote(@Query("liveuid") String liveUid);
} }

View File

@ -18,6 +18,7 @@ import com.yunbao.common.bean.LinkMicUserBeanV2;
import com.yunbao.common.bean.ListInfoMessageModel; import com.yunbao.common.bean.ListInfoMessageModel;
import com.yunbao.common.bean.LiveAiRobotBean; import com.yunbao.common.bean.LiveAiRobotBean;
import com.yunbao.common.bean.LiveAnchorCallMeModel; import com.yunbao.common.bean.LiveAnchorCallMeModel;
import com.yunbao.common.bean.LiveRoomVoteModel;
import com.yunbao.common.bean.LiveAnchorSayModel; import com.yunbao.common.bean.LiveAnchorSayModel;
import com.yunbao.common.bean.LiveDataInfoModel; import com.yunbao.common.bean.LiveDataInfoModel;
import com.yunbao.common.bean.LiveInfoModel; import com.yunbao.common.bean.LiveInfoModel;
@ -1427,6 +1428,78 @@ public class LiveNetManager {
}).isDisposed(); }).isDisposed();
} }
public void createLiveVote(String liveUid, String content, String first, String second, HttpCallback<LiveRoomVoteModel> callback) {
API.get().pdLiveApi(mContext)
.createLiveVote(liveUid, content, first, second)
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(new Consumer<ResponseModel<LiveRoomVoteModel>>() {
@Override
public void accept(ResponseModel<LiveRoomVoteModel> listResponseModel) throws Exception {
if (callback != null) {
callback.onSuccess(listResponseModel.getData().getInfo());
}
}
}, new Consumer<Throwable>() {
@Override
public void accept(Throwable throwable) throws Exception {
if (callback != null) {
callback.onError(throwable.getMessage());
}
}
}).isDisposed();
}
public void updateLiveVote(String liveUid, boolean isLeftVote, HttpCallback<String> callback) {
String key;
if (isLeftVote) {//是左边的投票
key = "option_content_first_num";
} else {
key = "option_content_second_num";
}
API.get().pdLiveApi(mContext)
.updateLiveVote(liveUid, key)
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(new Consumer<ResponseModel<List<String>>>() {
@Override
public void accept(ResponseModel<List<String>> listResponseModel) throws Exception {
if (callback != null) {
callback.onSuccess("");
}
}
}, new Consumer<Throwable>() {
@Override
public void accept(Throwable throwable) throws Exception {
if (callback != null) {
callback.onError(throwable.getMessage());
}
}
}).isDisposed();
}
public void endLiveVote(String liveUid, HttpCallback<String> callback) {
API.get().pdLiveApi(mContext)
.endLiveVote(liveUid)
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(new Consumer<ResponseModel<List<String>>>() {
@Override
public void accept(ResponseModel<List<String>> listResponseModel) throws Exception {
if (callback != null) {
callback.onSuccess(listResponseModel.getData().getMsg());
}
}
}, new Consumer<Throwable>() {
@Override
public void accept(Throwable throwable) throws Exception {
if (callback != null) {
callback.onError(throwable.getMessage());
}
}
}).isDisposed();
}
/** /**
* 直播间取消网络请求 * 直播间取消网络请求
*/ */

View File

@ -246,140 +246,6 @@
</HorizontalScrollView> </HorizontalScrollView>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginTop="30dp"
android:text="@string/live_config"
android:textColor="@color/white"
android:textSize="14sp" />
<HorizontalScrollView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:scrollbars="none">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginTop="10dp"
android:layout_marginBottom="20dp"
android:paddingEnd="16dp">
<LinearLayout
android:id="@+id/live_tool_beauty"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:orientation="vertical">
<ImageView
android:layout_width="40dp"
android:layout_height="40dp"
android:src="@mipmap/icon_beauty" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="6dp"
android:text="@string/live_beauty"
android:textColor="#FF9A9A9A"
android:textSize="12sp" />
</LinearLayout>
<LinearLayout
android:id="@+id/live_tool_camera"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="23dp"
android:gravity="center"
android:orientation="vertical">
<ImageView
android:layout_width="40dp"
android:layout_height="40dp"
android:src="@mipmap/icon_live_ready_camera" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="6dp"
android:text="@string/live_camera"
android:textColor="#FF9A9A9A"
android:textSize="12sp" />
</LinearLayout>
<LinearLayout
android:id="@+id/live_tool_leave"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="23dp"
android:gravity="center"
android:orientation="vertical">
<ImageView
android:id="@+id/live_tool_leave_img"
android:layout_width="40dp"
android:layout_height="40dp"
android:src="@mipmap/icon_leave" />
<TextView
android:id="@+id/live_tool_leave_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="6dp"
android:text="@string/live_zslk"
android:textColor="#FF9A9A9A"
android:textSize="12sp" />
</LinearLayout>
<LinearLayout
android:id="@+id/live_tool_anchor_say"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="23dp"
android:gravity="center"
android:orientation="vertical">
<ImageView
android:layout_width="40dp"
android:layout_height="40dp"
android:src="@mipmap/ic_live_fun_anchor_say" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="6dp"
android:text="@string/live_fun_anchor_say"
android:textColor="#FF9A9A9A"
android:textSize="12sp" />
</LinearLayout>
<LinearLayout
android:id="@+id/live_tool_call_me"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="23dp"
android:gravity="center"
android:orientation="vertical">
<ImageView
android:layout_width="40dp"
android:layout_height="40dp"
android:src="@mipmap/ic_live_fun_anchor_letter" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="6dp"
android:text="@string/live_fun_call_me"
android:textColor="#FF9A9A9A"
android:textSize="12sp" />
</LinearLayout>
</LinearLayout>
</HorizontalScrollView>
<TextView <TextView
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
@ -493,6 +359,177 @@
</LinearLayout> </LinearLayout>
</HorizontalScrollView> </HorizontalScrollView>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginTop="30dp"
android:text="@string/live_config"
android:textColor="@color/white"
android:textSize="14sp" />
<HorizontalScrollView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:scrollbars="none">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginTop="10dp"
android:layout_marginBottom="20dp"
android:paddingEnd="16dp">
<LinearLayout
android:id="@+id/live_tool_beauty"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:orientation="vertical">
<ImageView
android:layout_width="40dp"
android:layout_height="40dp"
android:src="@mipmap/icon_beauty" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="6dp"
android:text="@string/live_beauty"
android:textColor="#FF9A9A9A"
android:textSize="12sp" />
</LinearLayout>
<LinearLayout
android:id="@+id/live_tool_camera"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="23dp"
android:gravity="center"
android:orientation="vertical">
<ImageView
android:layout_width="40dp"
android:layout_height="40dp"
android:src="@mipmap/icon_live_ready_camera" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="6dp"
android:text="@string/live_camera"
android:textColor="#FF9A9A9A"
android:textSize="12sp" />
</LinearLayout>
<LinearLayout
android:id="@+id/live_tool_leave"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="23dp"
android:gravity="center"
android:orientation="vertical">
<ImageView
android:id="@+id/live_tool_leave_img"
android:layout_width="40dp"
android:layout_height="40dp"
android:src="@mipmap/icon_leave" />
<TextView
android:id="@+id/live_tool_leave_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="6dp"
android:text="@string/live_zslk"
android:textColor="#FF9A9A9A"
android:textSize="12sp" />
</LinearLayout>
<LinearLayout
android:id="@+id/live_tool_anchor_say"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="23dp"
android:gravity="center"
android:orientation="vertical">
<ImageView
android:layout_width="40dp"
android:layout_height="40dp"
android:src="@mipmap/ic_live_fun_anchor_say" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="6dp"
android:text="@string/live_fun_anchor_say"
android:textColor="#FF9A9A9A"
android:textSize="12sp" />
</LinearLayout>
<LinearLayout
android:id="@+id/live_tool_call_me"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="23dp"
android:gravity="center"
android:orientation="vertical">
<ImageView
android:layout_width="40dp"
android:layout_height="40dp"
android:src="@mipmap/ic_live_fun_anchor_letter" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="6dp"
android:text="@string/live_fun_call_me"
android:textColor="#FF9A9A9A"
android:textSize="12sp" />
</LinearLayout>
</LinearLayout>
</HorizontalScrollView>
<HorizontalScrollView
android:layout_width="match_parent"
android:layout_height="wrap_content">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginBottom="20dp">
<LinearLayout
android:id="@+id/live_tool_qa"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:orientation="vertical">
<ImageView
android:layout_width="40dp"
android:layout_height="40dp"
android:src="@mipmap/icon_live_qa" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="6dp"
android:text="@string/dialog_live_function_qa"
android:textColor="#FF9A9A9A"
android:textSize="12sp" />
</LinearLayout>
</LinearLayout>
</HorizontalScrollView>
</LinearLayout> </LinearLayout>

View File

@ -1155,4 +1155,15 @@ Limited ride And limited avatar frame</string>
<string name="dialog_live_gift_open_noble">VIP</string> <string name="dialog_live_gift_open_noble">VIP</string>
<string name="dialog_live_gift_open_guard">Open Guard</string> <string name="dialog_live_gift_open_guard">Open Guard</string>
<string name="dialog_live_gift_open_fans">Open Fan group</string> <string name="dialog_live_gift_open_fans">Open Fan group</string>
<string name="dialog_live_function_qa">QA</string>
<string name="dialog_anchor_create_qa_submit">submit</string>
<string name="dialog_anchor_create_qa_cancel">cancel</string>
<string name="dialog_anchor_create_qa_question">question:</string>
<string name="dialog_anchor_create_qa_answer">answer:</string>
<string name="live_vote_close_title">Do you want to end this voting early?</string>
<string name="live_vote_close_yes">Yes</string>
<string name="live_vote_close_no">No</string>
<string name="live_vote_hide_text">VOTE</string>
<string name="live_room_vote_over_tip">%s \n box disappears after %s seconds</string>
<string name="live_anchor_vote_tip">Please complete the form.</string>
</resources> </resources>

View File

@ -1150,4 +1150,15 @@
<string name="dialog_live_gift_open_noble">開通貴族</string> <string name="dialog_live_gift_open_noble">開通貴族</string>
<string name="dialog_live_gift_open_guard">開通守護</string> <string name="dialog_live_gift_open_guard">開通守護</string>
<string name="dialog_live_gift_open_fans">開通粉絲團</string> <string name="dialog_live_gift_open_fans">開通粉絲團</string>
<string name="dialog_live_function_qa">發啟問答</string>
<string name="dialog_anchor_create_qa_submit">發啟問答</string>
<string name="dialog_anchor_create_qa_cancel">取消</string>
<string name="dialog_anchor_create_qa_question">問題設置:</string>
<string name="dialog_anchor_create_qa_answer">答案設置:</string>
<string name="live_vote_close_title">是否提前結束本次投票?</string>
<string name="live_vote_close_yes"></string>
<string name="live_vote_close_no"></string>
<string name="live_vote_hide_text">投票中</string>
<string name="live_room_vote_over_tip">%s \n 問答框%s秒后消失</string>
<string name="live_anchor_vote_tip">請完整填寫</string>
</resources> </resources>

View File

@ -1149,4 +1149,15 @@
<string name="dialog_live_gift_open_noble">開通貴族</string> <string name="dialog_live_gift_open_noble">開通貴族</string>
<string name="dialog_live_gift_open_guard">開通守護</string> <string name="dialog_live_gift_open_guard">開通守護</string>
<string name="dialog_live_gift_open_fans">開通粉絲團</string> <string name="dialog_live_gift_open_fans">開通粉絲團</string>
<string name="dialog_live_function_qa">發啟問答</string>
<string name="dialog_anchor_create_qa_submit">發啟問答</string>
<string name="dialog_anchor_create_qa_cancel">取消</string>
<string name="dialog_anchor_create_qa_question">問題設置:</string>
<string name="dialog_anchor_create_qa_answer">答案設置:</string>
<string name="live_vote_close_title">是否提前結束本次投票?</string>
<string name="live_vote_close_yes"></string>
<string name="live_vote_close_no"></string>
<string name="live_vote_hide_text">投票中</string>
<string name="live_room_vote_over_tip">%s \n 問答框%s秒后消失</string>
<string name="live_anchor_vote_tip">請完整填寫</string>
</resources> </resources>

View File

@ -1150,4 +1150,15 @@
<string name="dialog_live_gift_open_noble">開通貴族</string> <string name="dialog_live_gift_open_noble">開通貴族</string>
<string name="dialog_live_gift_open_guard">開通守護</string> <string name="dialog_live_gift_open_guard">開通守護</string>
<string name="dialog_live_gift_open_fans">開通粉絲團</string> <string name="dialog_live_gift_open_fans">開通粉絲團</string>
<string name="dialog_live_function_qa">發啟問答</string>
<string name="dialog_anchor_create_qa_submit">發啟問答</string>
<string name="dialog_anchor_create_qa_cancel">取消</string>
<string name="dialog_anchor_create_qa_question">問題設置:</string>
<string name="dialog_anchor_create_qa_answer">答案設置:</string>
<string name="live_vote_close_title">是否提前結束本次投票?</string>
<string name="live_vote_close_yes"></string>
<string name="live_vote_close_no"></string>
<string name="live_vote_hide_text">投票中</string>
<string name="live_room_vote_over_tip">%s \n 問答框%s秒后消失</string>
<string name="live_anchor_vote_tip">請完整填寫</string>
</resources> </resources>

View File

@ -1156,4 +1156,15 @@ Limited ride And limited avatar frame</string>
<string name="dialog_live_gift_open_noble">VIP</string> <string name="dialog_live_gift_open_noble">VIP</string>
<string name="dialog_live_gift_open_guard">Open Guard</string> <string name="dialog_live_gift_open_guard">Open Guard</string>
<string name="dialog_live_gift_open_fans">Open Fan group</string> <string name="dialog_live_gift_open_fans">Open Fan group</string>
<string name="dialog_live_function_qa">QA</string>
<string name="dialog_anchor_create_qa_submit">submit</string>
<string name="dialog_anchor_create_qa_cancel">cancel</string>
<string name="dialog_anchor_create_qa_question">question:</string>
<string name="dialog_anchor_create_qa_answer">answer:</string>
<string name="live_vote_close_title">Do you want to end this voting early?</string>
<string name="live_vote_close_yes">Yes</string>
<string name="live_vote_close_no">No</string>
<string name="live_vote_hide_text">VOTE</string>
<string name="live_room_vote_over_tip">%s \n box disappears after %s seconds</string>
<string name="live_anchor_vote_tip">Please complete the form.</string>
</resources> </resources>

View File

@ -1,5 +1,6 @@
package com.yunbao.live.activity; package com.yunbao.live.activity;
import android.annotation.SuppressLint; import android.annotation.SuppressLint;
import android.app.Dialog; import android.app.Dialog;
import android.content.Intent; import android.content.Intent;
@ -47,6 +48,7 @@ import com.yunbao.common.bean.IMLoginModel;
import com.yunbao.common.bean.LinkMicUserBean; import com.yunbao.common.bean.LinkMicUserBean;
import com.yunbao.common.bean.LiveBean; import com.yunbao.common.bean.LiveBean;
import com.yunbao.common.bean.LiveGiftBean; import com.yunbao.common.bean.LiveGiftBean;
import com.yunbao.common.bean.LiveRoomVoteModel;
import com.yunbao.common.bean.LiveUserGiftBean; import com.yunbao.common.bean.LiveUserGiftBean;
import com.yunbao.common.bean.LiveUserMailBoxModel; import com.yunbao.common.bean.LiveUserMailBoxModel;
import com.yunbao.common.bean.SlideInfoModel; import com.yunbao.common.bean.SlideInfoModel;
@ -1044,9 +1046,9 @@ public class LiveAudienceActivity extends LiveActivity {
liveFansFragment.show(getSupportFragmentManager(), "LiveGuardDialogFragment"); liveFansFragment.show(getSupportFragmentManager(), "LiveGuardDialogFragment");
break; break;
case GUARD: case GUARD:
if(event.getObject()==null) { if (event.getObject() == null) {
openNewGuardListWindow(mContext instanceof LiveRyAnchorActivity); openNewGuardListWindow(mContext instanceof LiveRyAnchorActivity);
}else{ } else {
openNewBuyGuardWindow(true); openNewBuyGuardWindow(true);
} }
break; break;
@ -1333,6 +1335,31 @@ public class LiveAudienceActivity extends LiveActivity {
manager.showXydComplete(event.getXydCompleteModel(), event.getLiveReceiveGiftBean()); manager.showXydComplete(event.getXydCompleteModel(), event.getLiveReceiveGiftBean());
} }
break; break;
case VOTE_CREATE:
case VOTE_UPDATE:
JSONObject map = (JSONObject) event.getObject();
manager.mLiveRoomViewHolder.setVoteData(
map.getString("question"),
map.getString("answer1"),
map.getString("answer2"),
map.getString("num1"),
map.getString("num2")
);
break;
case VOTE_END:
try {
LiveRoomVoteModel voteModel = JSONObject.parseObject(event.getObject().toString(), LiveRoomVoteModel.class);
System.out.println(">>>" + voteModel);
String content = voteModel.getResult();
if (!StringUtil.isEmpty(voteModel.getOptionText())) {
content =voteModel.getResult().replace(voteModel.getOptionText(), "<font color='#FF8E43'>" + voteModel.getOptionText() + "</font>");
}
manager.mLiveRoomViewHolder.dismissVote(voteModel.getResult(), content);
} catch (Exception e) {
e.printStackTrace();
}
break;
} }

View File

@ -5,6 +5,7 @@ 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.LUCKY_ANGEL;
import static com.yunbao.live.bean.LiveChatBean.RECOMMEND_CARD_NOTIFY; 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.STAR_CHALLENGE_UPGRADE_NOTIFY;
import static com.yunbao.live.bean.LiveChatBean.SYSTEM3_COLOR;
import static com.yunbao.live.bean.LiveChatBean.WISH_LIST_PROGRESS; import static com.yunbao.live.bean.LiveChatBean.WISH_LIST_PROGRESS;
import static com.yunbao.live.bean.LiveChatBean.XYD_COMPLETE; import static com.yunbao.live.bean.LiveChatBean.XYD_COMPLETE;
@ -13,6 +14,7 @@ import android.content.Context;
import android.graphics.Color; import android.graphics.Color;
import android.graphics.drawable.Drawable; import android.graphics.drawable.Drawable;
import android.os.Bundle; import android.os.Bundle;
import android.text.Html;
import android.text.Spannable; import android.text.Spannable;
import android.text.SpannableStringBuilder; import android.text.SpannableStringBuilder;
import android.text.Spanned; import android.text.Spanned;
@ -47,6 +49,7 @@ import com.yunbao.common.manager.IMLoginManager;
import com.yunbao.common.utils.Bus; import com.yunbao.common.utils.Bus;
import com.yunbao.common.utils.DpUtil; import com.yunbao.common.utils.DpUtil;
import com.yunbao.common.utils.SpUtil; import com.yunbao.common.utils.SpUtil;
import com.yunbao.common.utils.ToastUtil;
import com.yunbao.common.views.weight.ClipPathCircleImage; import com.yunbao.common.views.weight.ClipPathCircleImage;
import com.yunbao.live.R; import com.yunbao.live.R;
import com.yunbao.live.activity.LiveAudienceActivity; import com.yunbao.live.activity.LiveAudienceActivity;
@ -82,7 +85,7 @@ public class LiveChatAdapter extends RecyclerView.Adapter {
private int mPosition; private int mPosition;
private boolean isBottom = false; private boolean isBottom = false;
private int fountSize=13; private int fountSize = 13;
public LiveChatAdapter(Context context) { public LiveChatAdapter(Context context) {
mContext = context; mContext = context;
@ -100,10 +103,10 @@ public class LiveChatAdapter extends RecyclerView.Adapter {
} }
} }
}; };
if(SpUtil.getInstance().isExists("pd_live_room_fount_size")){ if (SpUtil.getInstance().isExists("pd_live_room_fount_size")) {
try { try {
fountSize=Integer.parseInt(SpUtil.getStringValue("pd_live_room_fount_size")); fountSize = Integer.parseInt(SpUtil.getStringValue("pd_live_room_fount_size"));
}catch (Exception ignored){ } catch (Exception ignored) {
} }
} }
@ -173,8 +176,8 @@ public class LiveChatAdapter extends RecyclerView.Adapter {
} }
public void switchFount(int fount) { public void switchFount(int fount) {
fountSize=fount; fountSize = fount;
SpUtil.setStringValue("pd_live_room_fount_size",fountSize+""); SpUtil.setStringValue("pd_live_room_fount_size", fountSize + "");
notifyDataSetChanged(); notifyDataSetChanged();
} }
@ -198,7 +201,7 @@ public class LiveChatAdapter extends RecyclerView.Adapter {
class Vh extends RecyclerView.ViewHolder { class Vh extends RecyclerView.ViewHolder {
LinearLayout mBg, view_follow, view_action_game, view_zg, xydComplete; LinearLayout mBg, view_follow, view_action_game, view_zg, xydComplete;
TextView mTextView, tv_chat_active_into, tv_chat_avtive_name, tv_zg_anchorname, textTxt2,automatic_chat; TextView mTextView, tv_chat_active_into, tv_chat_avtive_name, tv_zg_anchorname, textTxt2, automatic_chat;
RoundedImageView avatar; RoundedImageView avatar;
View v_chat_active_close; View v_chat_active_close;
RecyclerView rv_chat_active; RecyclerView rv_chat_active;
@ -477,6 +480,8 @@ public class LiveChatAdapter extends RecyclerView.Adapter {
new LoadDian9TuUtil().loadDian9Tu(mContext, mBg, bean.getMsgModel().getSystem_bubble(), 1); new LoadDian9TuUtil().loadDian9Tu(mContext, mBg, bean.getMsgModel().getSystem_bubble(), 1);
new LiveTextRender().lucky100(mContext, mTextView, bean.getMsgModel()); new LiveTextRender().lucky100(mContext, mTextView, bean.getMsgModel());
} }
} else if (bean.getType() == SYSTEM3_COLOR) {
mTextView.setText(Html.fromHtml(bean.getContent()));
} else { } else {
if (bean.getBubble() != null && !bean.getBubble().equals("")) { if (bean.getBubble() != null && !bean.getBubble().equals("")) {
//加载.9图聊天气泡 //加载.9图聊天气泡

View File

@ -23,6 +23,7 @@ public class LiveChatBean {
public static final int STAR_CHALLENGE_UPGRADE_NOTIFY = 105; public static final int STAR_CHALLENGE_UPGRADE_NOTIFY = 105;
public static final int LUCKY_ANGEL = 106;//幸运天使 public static final int LUCKY_ANGEL = 106;//幸运天使
public static final int LUCKY_100_CHECK = 107;//幸运天使 public static final int LUCKY_100_CHECK = 107;//幸运天使
public static final int SYSTEM3_COLOR = 108;//带颜色的系统消息,格式 XXXX<font color='#FF8E43'>YYY</font>
public static final int XYD_COMPLETE = 207;//心愿单完成通知 public static final int XYD_COMPLETE = 207;//心愿单完成通知
public static final int WISH_LIST_PROGRESS = 307;//心愿单进度通知 public static final int WISH_LIST_PROGRESS = 307;//心愿单进度通知

View File

@ -0,0 +1,75 @@
package com.yunbao.live.dialog;
import android.content.Context;
import android.widget.Button;
import android.widget.EditText;
import androidx.annotation.NonNull;
import com.lxj.xpopup.XPopup;
import com.yunbao.common.dialog.AbsDialogPopupWindow;
import com.yunbao.common.utils.ToastUtil;
import com.yunbao.live.R;
import com.yunbao.live.utils.LiveAnchorVoteManager;
/**
* 主播创建问答弹框
*/
public class LiveAnchorCreateQADialog extends AbsDialogPopupWindow {
private EditText question, answer1, answer2;
private Button submit, cancel;
private String liveUid;
public LiveAnchorCreateQADialog setLiveUid(String liveUid) {
this.liveUid = liveUid;
return this;
}
public LiveAnchorCreateQADialog(@NonNull Context context) {
super(context);
}
@Override
public void buildDialog(XPopup.Builder builder) {
builder.dismissOnTouchOutside(false);
builder.autoFocusEditText(false);
}
@Override
public int bindLayoutId() {
return R.layout.dialog_live_anchor_create_qa;
}
@Override
protected void onCreate() {
super.onCreate();
question = findViewById(R.id.edit_question);
answer1 = findViewById(R.id.edit_answer1);
answer2 = findViewById(R.id.edit_answer2);
submit = findViewById(R.id.submit);
cancel = findViewById(R.id.cancel);
cancel.setOnClickListener(v -> dismiss());
submit.setOnClickListener(v -> {
if (question.getText().toString().trim().length() == 0 ||
answer1.getText().toString().trim().length() == 0 ||
answer2.getText().toString().trim().length() == 0
) {
ToastUtil.show(getContext().getString(R.string.live_anchor_vote_tip));
return;
}
createVote(question.getText().toString(), answer1.getText().toString(), answer2.getText().toString());
});
}
private void createVote(String question, String answer1, String answer2) {
LiveAnchorVoteManager.getInstance().createVote(liveUid, question, answer1, answer2, (bean, position) -> {
if(position!=0){
ToastUtil.show(bean.getContent());
return;
}
dismiss();
});
}
}

View File

@ -120,6 +120,7 @@ public class LiveNewFunctionDialogFragment extends AbsDialogFragment implements
findViewById(R.id.live_tool_robot).setOnClickListener(this); findViewById(R.id.live_tool_robot).setOnClickListener(this);
findViewById(R.id.live_tool_call_me).setOnClickListener(this); findViewById(R.id.live_tool_call_me).setOnClickListener(this);
findViewById(R.id.live_tool_anchor_say).setOnClickListener(this); findViewById(R.id.live_tool_anchor_say).setOnClickListener(this);
findViewById(R.id.live_tool_qa).setOnClickListener(this);
if (leave == 0) { if (leave == 0) {
((ImageView) mLeaveView.findViewById(R.id.live_tool_leave_img)).setImageResource(R.mipmap.icon_leave); ((ImageView) mLeaveView.findViewById(R.id.live_tool_leave_img)).setImageResource(R.mipmap.icon_leave);
@ -198,7 +199,9 @@ public class LiveNewFunctionDialogFragment extends AbsDialogFragment implements
new LiveAnchorEditCallMeDialog(mContext).setLiveUid(liveUid).showDialog(); new LiveAnchorEditCallMeDialog(mContext).setLiveUid(liveUid).showDialog();
} else if (id == R.id.live_tool_anchor_say) { } else if (id == R.id.live_tool_anchor_say) {
new LiveAnchorSayPopDialog(mContext).setLiveUid(liveUid).setOnItemClickListener((bean, position) new LiveAnchorSayPopDialog(mContext).setLiveUid(liveUid).setOnItemClickListener((bean, position)
-> mLiveRoomHandler.postDelayed(()-> ((LiveRyAnchorActivity)(mContext)).mLiveRoomViewHolder.initAnchorSayData(),1000)).showDialog(); -> mLiveRoomHandler.postDelayed(() -> ((LiveRyAnchorActivity) (mContext)).mLiveRoomViewHolder.initAnchorSayData(), 1000)).showDialog();
} else if (id == R.id.live_tool_qa) {
new LiveAnchorCreateQADialog(mContext).setLiveUid(liveUid).showDialog();
} }
} }

View File

@ -0,0 +1,295 @@
package com.yunbao.live.event;
import com.alibaba.fastjson.JSONArray;
import com.yunbao.common.bean.ActiveModel;
import com.yunbao.common.bean.AiAutomaticSpeechModel;
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.LiveReceiveGiftBean;
import com.yunbao.live.bean.OpenParametersModel;
public class LiveAnchorEvent extends BaseModel {
private LiveAnchorType type;
private ActiveModel model = new ActiveModel();
private String avatar = "";
private OpenParametersModel parametersModel = new OpenParametersModel();
private AnchorRecommendItemModel anchorRecommendItemModel = new AnchorRecommendItemModel();
private int micIng = 0;//连麦状态
private LiveBean bean;
private Object object;
private int liveType;
private int liveTypeVal;
private MsgModel msgModel;//全服消息
private AiAutomaticSpeechModel aiAutomaticSpeechModel;//机器人消息
private boolean voicePress = false;
private boolean isActivity = false;//是否展示趣味活动和增值权益
private JSONArray pkScores;
private String uid;
private int time;
private CustomFullServiceNotifyEvent customFullServiceNotifyEvent;
private LivePKUserListBean livePKUserListBean;
private String votes;
private String length;
private int nums;
private String uname;
private WishModel wishListProgress;
private XydCompleteModel xydCompleteModel;
private LiveReceiveGiftBean liveReceiveGiftBean;
public LiveReceiveGiftBean getLiveReceiveGiftBean() {
return liveReceiveGiftBean;
}
public LiveAnchorEvent setLiveReceiveGiftBean(LiveReceiveGiftBean liveReceiveGiftBean) {
this.liveReceiveGiftBean = liveReceiveGiftBean;
return this;
}
public XydCompleteModel getXydCompleteModel() {
return xydCompleteModel;
}
public LiveAnchorEvent setXydCompleteModel(XydCompleteModel xydCompleteModel) {
this.xydCompleteModel = xydCompleteModel;
return this;
}
public WishModel getWishListProgress() {
return wishListProgress;
}
public LiveAnchorEvent setWishListProgress(WishModel wishListProgress) {
this.wishListProgress = wishListProgress;
return this;
}
public String getVotes() {
return votes;
}
public LiveAnchorEvent setVotes(String votes) {
this.votes = votes;
return this;
}
public String getLength() {
return length;
}
public LiveAnchorEvent setLength(String length) {
this.length = length;
return this;
}
public int getNums() {
return nums;
}
public LiveAnchorEvent setNums(int nums) {
this.nums = nums;
return this;
}
public String getUname() {
return uname;
}
public LiveAnchorEvent setUname(String uname) {
this.uname = uname;
return this;
}
public LivePKUserListBean getLivePKUserListBean() {
return livePKUserListBean;
}
public LiveAnchorEvent setLivePKUserListBean(LivePKUserListBean livePKUserListBean) {
this.livePKUserListBean = livePKUserListBean;
return this;
}
public CustomFullServiceNotifyEvent getCustomFullServiceNotifyEvent() {
return customFullServiceNotifyEvent;
}
public LiveAnchorEvent setCustomFullServiceNotifyEvent(CustomFullServiceNotifyEvent customFullServiceNotifyEvent) {
this.customFullServiceNotifyEvent = customFullServiceNotifyEvent;
return this;
}
public JSONArray getPkScores() {
return pkScores;
}
public LiveAnchorEvent setPkScores(JSONArray pkScores) {
this.pkScores = pkScores;
return this;
}
public String getUid() {
return uid;
}
public LiveAnchorEvent setUid(String uid) {
this.uid = uid;
return this;
}
public int getTime() {
return time;
}
public LiveAnchorEvent setTime(int time) {
this.time = time;
return this;
}
public boolean isActivity() {
return isActivity;
}
public LiveAnchorEvent setActivity(boolean activity) {
isActivity = activity;
return this;
}
public boolean isVoicePress() {
return voicePress;
}
public LiveAnchorEvent setVoicePress(boolean voicePress) {
this.voicePress = voicePress;
return this;
}
public AiAutomaticSpeechModel getAiAutomaticSpeechModel() {
return aiAutomaticSpeechModel;
}
public LiveAnchorEvent setAiAutomaticSpeechModel(AiAutomaticSpeechModel aiAutomaticSpeechModel) {
this.aiAutomaticSpeechModel = aiAutomaticSpeechModel;
return this;
}
public MsgModel getMsgModel() {
return msgModel;
}
public LiveAnchorEvent setMsgModel(MsgModel msgModel) {
this.msgModel = msgModel;
return this;
}
public int getLiveType() {
return liveType;
}
public LiveAnchorEvent setLiveType(int liveType) {
this.liveType = liveType;
return this;
}
public int getLiveTypeVal() {
return liveTypeVal;
}
public LiveAnchorEvent setLiveTypeVal(int liveTypeVal) {
this.liveTypeVal = liveTypeVal;
return this;
}
public LiveBean getBean() {
return bean;
}
public LiveAnchorEvent setBean(LiveBean bean) {
this.bean = bean;
return this;
}
public int getMicIng() {
return micIng;
}
public LiveAnchorEvent setMicIng(int micIng) {
this.micIng = micIng;
return this;
}
public AnchorRecommendItemModel getAnchorRecommendItemModel() {
return anchorRecommendItemModel;
}
public LiveAnchorEvent setAnchorRecommendItemModel(AnchorRecommendItemModel anchorRecommendItemModel) {
this.anchorRecommendItemModel = anchorRecommendItemModel;
return this;
}
public OpenParametersModel getParametersModel() {
return parametersModel;
}
public LiveAnchorEvent setParametersModel(OpenParametersModel parametersModel) {
this.parametersModel = parametersModel;
return this;
}
public String getAvatar() {
return avatar;
}
public LiveAnchorEvent setAvatar(String avatar) {
this.avatar = avatar;
return this;
}
public ActiveModel getModel() {
return model;
}
public LiveAnchorEvent setModel(ActiveModel model) {
this.model = model;
return this;
}
public LiveAnchorType getType() {
return type;
}
public LiveAnchorEvent setType(LiveAnchorType type) {
this.type = type;
return this;
}
public Object getObject() {
return object;
}
public LiveAnchorEvent setObject(Object object) {
this.object = object;
return this;
}
public enum LiveAnchorType {
VOTE_CREATE(1, "创建投票"),
VOTE_ANCHOR_END(2, "投票结束"),
VOTE_ANCHOR_UPDATE(3, "投票结束");
private int type;
private String name;
LiveAnchorType(int type, String name) {
this.type = type;
this.name = name;
}
}
}

View File

@ -341,7 +341,10 @@ public class LiveAudienceEvent extends BaseModel {
WISH_LIST_PROGRESS(61, "心愿单进度"), WISH_LIST_PROGRESS(61, "心愿单进度"),
CLOSE_LIVE_ROOM(62, "关闭直播间"), CLOSE_LIVE_ROOM(62, "关闭直播间"),
FONT_SIZE(63, "侧边字号设置"), FONT_SIZE(63, "侧边字号设置"),
LIVE_FONT_SIZE(64, "字号设置"); LIVE_FONT_SIZE(64, "字号设置"),
VOTE_CREATE(65, "创建投票"),
VOTE_UPDATE(66, "更新投票"),
VOTE_END(67, "投票结束");
private int type; private int type;
private String name; private String name;

View File

@ -52,6 +52,7 @@ import com.yunbao.live.bean.LiveGiftPrizePoolWinBean;
import com.yunbao.live.bean.LiveLuckGiftWinBean; import com.yunbao.live.bean.LiveLuckGiftWinBean;
import com.yunbao.live.bean.LivePKUserListBean; import com.yunbao.live.bean.LivePKUserListBean;
import com.yunbao.live.bean.LiveReceiveGiftBean; import com.yunbao.live.bean.LiveReceiveGiftBean;
import com.yunbao.live.event.LiveAnchorEvent;
import com.yunbao.live.event.LiveAudienceEvent; import com.yunbao.live.event.LiveAudienceEvent;
import com.yunbao.live.views.LiveEndViewHolder; import com.yunbao.live.views.LiveEndViewHolder;
import com.yunbao.live.views.LivePlayKsyViewHolder; import com.yunbao.live.views.LivePlayKsyViewHolder;
@ -621,6 +622,34 @@ public class SocketRyClient {
.setGiftType(map.getInteger("giftId")) .setGiftType(map.getInteger("giftId"))
.setLuid(conString.toString())).setUname(map.getString("userName")).setLiveType(Integer.parseInt(map.getString("level")))); .setLuid(conString.toString())).setUname(map.getString("userName")).setLiveType(Integer.parseInt(map.getString("level"))));
break; break;
case Constants.LIVE_VOTE_CREATE:
Bus.get().post(new LiveAudienceEvent()
.setType(LiveAudienceEvent.LiveAudienceType.VOTE_CREATE)
.setObject(map)
);
break;
case Constants.LIVE_VOTE_END:
Bus.get().post(new LiveAudienceEvent()
.setType(LiveAudienceEvent.LiveAudienceType.VOTE_END)
.setObject(map)
);
EventBus.getDefault().post(new LiveAnchorEvent()
.setType(LiveAnchorEvent.LiveAnchorType.VOTE_ANCHOR_END)
.setObject(map)
);
break;
case Constants.LIVE_VOTE_UPDATE:
//通知给观众
Bus.get().post(new LiveAudienceEvent()
.setType(LiveAudienceEvent.LiveAudienceType.VOTE_UPDATE)
.setObject(map)
);
//通知给主播
EventBus.getDefault().post(new LiveAnchorEvent()
.setType(LiveAnchorEvent.LiveAnchorType.VOTE_ANCHOR_UPDATE)
.setObject(map)
);
break;
} }
} }

View File

@ -0,0 +1,121 @@
package com.yunbao.live.utils;
import android.os.Handler;
import android.os.Looper;
import com.yunbao.common.CommonAppContext;
import com.yunbao.common.bean.LiveRoomVoteModel;
import com.yunbao.common.http.base.HttpCallback;
import com.yunbao.common.http.live.LiveNetManager;
import com.yunbao.common.interfaces.OnItemClickListener;
import com.yunbao.common.utils.ToastUtil;
import com.yunbao.live.event.LiveAnchorEvent;
import org.greenrobot.eventbus.EventBus;
import java.util.Timer;
import java.util.TimerTask;
/**
* 主播投票管理器可以创建投票和手动结束投票
*/
public class LiveAnchorVoteManager {
private static LiveAnchorVoteManager manager;
private String liveUid;
private boolean isVoting = false;
private LiveRoomVoteModel vote;
private TimerTask task;
private LiveAnchorVoteManager() {
}
public static LiveAnchorVoteManager getInstance() {
if (manager == null) {
manager = new LiveAnchorVoteManager();
}
return manager;
}
public void createVote(String liveUid, String question, String answer1, String answer2, OnItemClickListener<LiveRoomVoteModel> listener) {
if (isVoting) {
return;
}
this.liveUid = liveUid;
LiveNetManager.get(CommonAppContext.getTopActivity())
.createLiveVote(liveUid, question, answer1, answer2, new HttpCallback<LiveRoomVoteModel>() {
@Override
public void onSuccess(LiveRoomVoteModel data) {
data.setAnswer1(answer1);
data.setAnswer2(answer2);
data.setLiveUid(liveUid);
vote = data;
createTimerTask();
EventBus.getDefault().post(new LiveAnchorEvent()
.setType(LiveAnchorEvent.LiveAnchorType.VOTE_CREATE)
.setObject(data)
);
listener.onItemClick(vote, 0);
}
@Override
public void onError(String error) {
ToastUtil.show(error);
LiveRoomVoteModel voteModel = new LiveRoomVoteModel();
voteModel.setContent(error);
listener.onItemClick(voteModel, -1);
}
});
}
private void createTimerTask() {
if (isVoting) {
task.cancel();
}
task = new TimerTask() {
@Override
public void run() {
isVoting = true;
new Handler(Looper.getMainLooper()).post(() -> {
entVote((bean, position) -> {
EventBus.getDefault().post(new LiveAnchorEvent()
.setType(LiveAnchorEvent.LiveAnchorType.VOTE_ANCHOR_END)
.setObject(bean)
);
});
});
}
};
new Timer().schedule(task, vote.getTime() * 1000L);
}
public void entVote(OnItemClickListener<String> msg) {
if (isVoting) {
task.cancel();
}
LiveNetManager.get(CommonAppContext.getTopActivity())
.endLiveVote(liveUid, new HttpCallback<String>() {
@Override
public void onSuccess(String data) {
isVoting = false;
msg.onItemClick(data, 0);
}
@Override
public void onError(String error) {
msg.onItemClick(error, -1);
}
});
}
public void clear() {
if (task != null) {
task.cancel();
task = null;
}
}
}

View File

@ -0,0 +1,259 @@
package com.yunbao.live.utils;
import android.content.Context;
import android.graphics.Color;
import android.os.Handler;
import android.os.Looper;
import android.view.View;
import android.view.animation.Animation;
import android.view.animation.AnimationUtils;
import android.widget.ImageView;
import android.widget.ProgressBar;
import android.widget.RelativeLayout;
import android.widget.TextView;
import com.yunbao.common.bean.LiveRoomVoteModel;
import com.yunbao.common.http.base.HttpCallback;
import com.yunbao.common.http.live.LiveNetManager;
import com.yunbao.common.utils.StringUtil;
import com.yunbao.common.utils.ToastUtil;
import com.yunbao.live.R;
import com.yunbao.live.activity.LiveRyAnchorActivity;
import java.util.Timer;
import java.util.TimerTask;
/**
* 直播间投票控件管理器
*/
public class LiveRoomVoteManager {
private final Context mContext;
private final View voteLayout;
private final View voteRoot;
private final View mVoteShow;
private final View mClose;
private final ImageView mAnchorVoteHide;
private final boolean isAnchor;
private final TextView mTitle;
private final TextView mSubmit;
private final TextView mCancel;
private final ProgressBar mProgress;
LiveRoomVoteModel createVoteModel;
public LiveRoomVoteManager(Context mContext, View root) {
this.mContext = mContext;
mAnchorVoteHide = root.findViewById(R.id.vote_hide);
mVoteShow = root.findViewById(R.id.vote_show);
mClose = root.findViewById(R.id.vote_close);
voteLayout = root.findViewById(R.id.vote_layout);
voteRoot = root.findViewById(R.id.live_room_vote);
mTitle = root.findViewById(R.id.title);
mSubmit = root.findViewById(R.id.vote_sub1);
mCancel = root.findViewById(R.id.vote_sub2);
mProgress = root.findViewById(R.id.vote_progress);
mAnchorVoteHide.setOnClickListener(v -> hideAnchorVote());
mVoteShow.setOnClickListener(v -> hideAnchorVote());
mClose.setOnClickListener(v -> close());
if (mContext instanceof LiveRyAnchorActivity) {
isAnchor = true;
} else {
isAnchor = false;
mClose.setVisibility(View.INVISIBLE);
}
hide();
initClick();
}
private void close() {
mTitle.setText(R.string.live_vote_close_title);
mSubmit.setText(R.string.live_vote_close_yes);
mCancel.setText(R.string.live_vote_close_no);
mCancel.setOnClickListener(v -> {
mTitle.setText(createVoteModel.getContent());
mSubmit.setText(createVoteModel.getAnswer1());
mCancel.setText(createVoteModel.getAnswer2());
initClick();
});
mSubmit.setOnClickListener(v -> endAnchorVote());
}
private void initClick() {
if (isAnchor) {
return;
}
mSubmit.setOnClickListener(v -> updateVote(true));
mCancel.setOnClickListener(v -> updateVote(false));
}
private void updateVote(boolean isSubmit) {
LiveNetManager.get(mContext)
.updateLiveVote(createVoteModel.getLiveUid(), isSubmit, new HttpCallback<String>() {
@Override
public void onSuccess(String data) {
mCancel.setOnClickListener(null);
mSubmit.setOnClickListener(null);
if (isSubmit) {
mSubmit.setTextColor(Color.parseColor("#FFB800"));
mCancel.setTextColor(Color.parseColor("#999999"));
} else {
mCancel.setTextColor(Color.parseColor("#FFB800"));
mSubmit.setTextColor(Color.parseColor("#999999"));
}
mSubmit.setTag(createVoteModel.getLiveUid());
}
@Override
public void onError(String error) {
ToastUtil.show(error);
}
});
}
private void endAnchorVote() {
LiveAnchorVoteManager.getInstance().entVote((bean, position) -> {
if (position == -1) {
ToastUtil.show(bean);
return;
}
mClose.setVisibility(View.INVISIBLE);
});
}
public void endTimerTask(String msg) {
if (isAnchor) {
LiveAnchorVoteManager.getInstance().clear();
}
mCancel.setOnClickListener(null);
mSubmit.setOnClickListener(null);
mSubmit.setText(createVoteModel.getAnswer1());
mCancel.setText(createVoteModel.getAnswer2());
new Timer().schedule(new TimerTask() {
int time = 6;
@Override
public void run() {
new Handler(Looper.getMainLooper()).post(() -> {
if (--time == 0) {
hide();
cancel();
return;
}
mTitle.setText(String.format(mContext.getString(R.string.live_room_vote_over_tip), msg, time + ""));
});
}
}, 0, 1000);
}
public void setCreateVoteModel(LiveRoomVoteModel createVoteModel) {
try {
if (createVoteModel.getStatus() == 0) {
hide();
return;
}
this.createVoteModel = createVoteModel;
mTitle.setText(createVoteModel.getContent());
mSubmit.setText(createVoteModel.getAnswer1());
mCancel.setText(createVoteModel.getAnswer2());
mCancel.setOnClickListener(null);
mSubmit.setOnClickListener(null);
if (mSubmit.getTag() == null || !mSubmit.getTag().equals(createVoteModel.getLiveUid())) {
mSubmit.setTextColor(Color.WHITE);
mCancel.setTextColor(Color.WHITE);
initClick();
}
if (!StringUtil.isEmpty(createVoteModel.getVote())) {
mCancel.setOnClickListener(null);
mSubmit.setOnClickListener(null);
if (createVoteModel.isVoteLeft()) {
mSubmit.setTextColor(Color.parseColor("#FFB800"));
mCancel.setTextColor(Color.parseColor("#999999"));
} else {
mCancel.setTextColor(Color.parseColor("#FFB800"));
mSubmit.setTextColor(Color.parseColor("#999999"));
}
mSubmit.setTag(createVoteModel.getLiveUid());
}
if (createVoteModel.getAnswer1Num() == 0 && createVoteModel.getAnswer2Num() == 0) {
mProgress.setMax(20);
setLength(10);
} else {
mProgress.setMax(createVoteModel.getAnswer1Num() + createVoteModel.getAnswer2Num());
setLength(createVoteModel.getAnswer1Num());
}
show();
} catch (Exception e) {
e.printStackTrace();
}
}
public void setLength(int length) {
length = mProgress.getMax() - length;
mProgress.setProgress(length);
}
private void hideAnchorVote() {
boolean hide = mAnchorVoteHide.getTag() == null || (boolean) mAnchorVoteHide.getTag();
Animation animation;
if (hide) {
animation = AnimationUtils.loadAnimation(mContext, R.anim.view_live_anchor_vote_out);
} else {
animation = AnimationUtils.loadAnimation(mContext, R.anim.view_live_anchor_vote_in);
}
animation.setAnimationListener(new Animation.AnimationListener() {
@Override
public void onAnimationStart(Animation animation) {
if (!hide) {
voteRoot.setVisibility(View.VISIBLE);
mAnchorVoteHide.setVisibility(View.VISIBLE);
mVoteShow.setVisibility(View.GONE);
if (isAnchor) {
mClose.setVisibility(View.VISIBLE);
}
}
}
@Override
public void onAnimationEnd(Animation animation) {
if (hide) {
voteRoot.setVisibility(View.INVISIBLE);
mAnchorVoteHide.setVisibility(View.GONE);
mVoteShow.setVisibility(View.VISIBLE);
if (isAnchor) {
mClose.setVisibility(View.INVISIBLE);
}
}
mAnchorVoteHide.setTag(!hide);
}
@Override
public void onAnimationRepeat(Animation animation) {
}
});
voteRoot.startAnimation(animation);
}
public void setMarginPosition(int position) {
RelativeLayout.LayoutParams voteLayoutParams = (RelativeLayout.LayoutParams) voteLayout.getLayoutParams();
voteLayoutParams.topMargin = position;
voteLayout.setLayoutParams(voteLayoutParams);
}
public void show() {
voteLayout.setVisibility(View.VISIBLE);
}
public void hide() {
voteLayout.setVisibility(View.GONE);
mSubmit.setTag(null);
}
}

View File

@ -71,6 +71,7 @@ import com.yunbao.common.bean.IMLoginModel;
import com.yunbao.common.bean.LevelBean; import com.yunbao.common.bean.LevelBean;
import com.yunbao.common.bean.LinkMicUserBean; import com.yunbao.common.bean.LinkMicUserBean;
import com.yunbao.common.bean.LiveAnchorCallMeModel; import com.yunbao.common.bean.LiveAnchorCallMeModel;
import com.yunbao.common.bean.LiveRoomVoteModel;
import com.yunbao.common.bean.LiveAnchorSayModel; import com.yunbao.common.bean.LiveAnchorSayModel;
import com.yunbao.common.bean.LiveBean; import com.yunbao.common.bean.LiveBean;
import com.yunbao.common.bean.LiveGiftBean; import com.yunbao.common.bean.LiveGiftBean;
@ -99,6 +100,7 @@ import com.yunbao.common.interfaces.CommonCallback;
import com.yunbao.common.interfaces.OnItemClickListener; import com.yunbao.common.interfaces.OnItemClickListener;
import com.yunbao.common.manager.IMLoginManager; import com.yunbao.common.manager.IMLoginManager;
import com.yunbao.common.manager.RandomPkManager; import com.yunbao.common.manager.RandomPkManager;
import com.yunbao.common.utils.AppManager;
import com.yunbao.common.utils.Bus; import com.yunbao.common.utils.Bus;
import com.yunbao.common.utils.DeviceUtils; import com.yunbao.common.utils.DeviceUtils;
import com.yunbao.common.utils.DialogUitl; import com.yunbao.common.utils.DialogUitl;
@ -148,6 +150,7 @@ import com.yunbao.live.dialog.LiveHDDialogFragment;
import com.yunbao.live.dialog.LiveUserAnchorMailBoxWebInfoPopDialog; import com.yunbao.live.dialog.LiveUserAnchorMailBoxWebInfoPopDialog;
import com.yunbao.live.dialog.LiveUserDialogFragment; import com.yunbao.live.dialog.LiveUserDialogFragment;
import com.yunbao.live.dialog.LiveWishListDialogFragment4Audience; import com.yunbao.live.dialog.LiveWishListDialogFragment4Audience;
import com.yunbao.live.event.LiveAnchorEvent;
import com.yunbao.live.event.LiveAudienceEvent; import com.yunbao.live.event.LiveAudienceEvent;
import com.yunbao.live.event.LiveRoomChangeEvent; import com.yunbao.live.event.LiveRoomChangeEvent;
import com.yunbao.live.http.LiveHttpConsts; import com.yunbao.live.http.LiveHttpConsts;
@ -157,6 +160,7 @@ import com.yunbao.live.presenter.LiveEnterRoomAnimPresenter;
import com.yunbao.live.presenter.LiveGiftAnimPresenter; import com.yunbao.live.presenter.LiveGiftAnimPresenter;
import com.yunbao.live.presenter.LiveLightAnimPresenter; import com.yunbao.live.presenter.LiveLightAnimPresenter;
import com.yunbao.live.presenter.LiveRoomCheckLivePresenter; import com.yunbao.live.presenter.LiveRoomCheckLivePresenter;
import com.yunbao.live.utils.LiveRoomVoteManager;
import com.yunbao.live.utils.LiveTextRender; import com.yunbao.live.utils.LiveTextRender;
import com.yunbao.live.utils.LoadDian9TuUtil; import com.yunbao.live.utils.LoadDian9TuUtil;
@ -352,6 +356,9 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
private TextView mAnchorSayText; private TextView mAnchorSayText;
private ImageView mAnchorSayHide; private ImageView mAnchorSayHide;
//----!主播说组件---// //----!主播说组件---//
//----投票组件---//
private LiveRoomVoteManager voteManager;
//----!投票组件---//
private Banner topBanner1, topBanner2;//心愿单&联系方式 private Banner topBanner1, topBanner2;//心愿单&联系方式
public SVGAImageView svga_new_user_gif, svga_new_user_double, svga_new_user_follow; public SVGAImageView svga_new_user_gif, svga_new_user_double, svga_new_user_follow;
private String mAnchorName;//主播名字 private String mAnchorName;//主播名字
@ -996,6 +1003,7 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
}; };
mRoot = (ViewGroup) findViewById(R.id.root); mRoot = (ViewGroup) findViewById(R.id.root);
voteManager = new LiveRoomVoteManager(mContext, mRoot);
mAvatar = (ImageView) findViewById(R.id.avatar); mAvatar = (ImageView) findViewById(R.id.avatar);
mLevelAnchor = (ImageView) findViewById(R.id.level_anchor); mLevelAnchor = (ImageView) findViewById(R.id.level_anchor);
@ -1085,6 +1093,7 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
RelativeLayout.LayoutParams msgLayoutLayoutParams = (RelativeLayout.LayoutParams) msgLayout.getLayoutParams(); RelativeLayout.LayoutParams msgLayoutLayoutParams = (RelativeLayout.LayoutParams) msgLayout.getLayoutParams();
msgLayoutLayoutParams.topMargin = topMargin + DpUtil.dp2px(50); msgLayoutLayoutParams.topMargin = topMargin + DpUtil.dp2px(50);
msgLayout.setLayoutParams(msgLayoutLayoutParams); msgLayout.setLayoutParams(msgLayoutLayoutParams);
voteManager.setMarginPosition(topMargin + DpUtil.dp2px(50));
RelativeLayout.LayoutParams params1 = (RelativeLayout.LayoutParams) RelativeLayout.LayoutParams params1 = (RelativeLayout.LayoutParams)
mChatRecyclerView.getLayoutParams(); mChatRecyclerView.getLayoutParams();
@ -1475,6 +1484,8 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
if (!IMLoginManager.get(mContext).hintChat()) { if (!IMLoginManager.get(mContext).hintChat()) {
msgLayout.setVisibility(View.VISIBLE); msgLayout.setVisibility(View.VISIBLE);
} }
AppManager.runDebugCode(() -> msgLayout.setVisibility(View.GONE));
voteManager.hide();
if (d_pk_view != null) { if (d_pk_view != null) {
d_pk_view.setVisibility(View.GONE); d_pk_view.setVisibility(View.GONE);
} }
@ -3104,7 +3115,7 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
if (mContext instanceof LiveAudienceActivity) { if (mContext instanceof LiveAudienceActivity) {
int type = 0; int type = 0;
GuardUserModel model = new GuardUserModel(); GuardUserModel model = new GuardUserModel();
if (TextUtils.isEmpty(guardUserModel.getGuardType())) { if (guardUserModel != null && TextUtils.isEmpty(guardUserModel.getGuardType())) {
type = Integer.parseInt(guardUserModel.getGuardType()); type = Integer.parseInt(guardUserModel.getGuardType());
} }
if (chatBean.getGuardType() != 0 && chatBean.getGuardType() > type) { if (chatBean.getGuardType() != 0 && chatBean.getGuardType() > type) {
@ -3669,6 +3680,39 @@ 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();
bean.setType(LiveChatBean.SYSTEM3_COLOR);
bean.setContent(data);
mLiveChatAdapter.insertItem(bean);
}
public void setVoteData(LiveRoomVoteModel voteModel) {
Log.i("voteModel", voteModel.toString());
voteModel.setLiveUid(mLiveUid);
voteManager.setCreateVoteModel(voteModel);
}
private static class LiveRoomHandler extends Handler { private static class LiveRoomHandler extends Handler {
private LiveRoomViewHolder mLiveRoomViewHolder; private LiveRoomViewHolder mLiveRoomViewHolder;
@ -4232,6 +4276,33 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
} }
} }
@Subscribe(threadMode = ThreadMode.MAIN)
public void updateSubForAnchor(LiveAnchorEvent event) {
if (mContext instanceof LiveAudienceActivity) {
return;
}
if (event.getType() == LiveAnchorEvent.LiveAnchorType.VOTE_CREATE) {
voteManager.setCreateVoteModel((LiveRoomVoteModel) event.getObject());
} else if (event.getType() == LiveAnchorEvent.LiveAnchorType.VOTE_ANCHOR_END) {
LiveRoomVoteModel voteModel = JSONObject.parseObject(event.getObject().toString(), LiveRoomVoteModel.class);
Log.i(">>>", voteModel.toString());
String content = voteModel.getResult();
if (!StringUtil.isEmpty(voteModel.getOptionText())) {
content = voteModel.getResult().replace(voteModel.getOptionText(), "<font color='#FF8E43'>" + voteModel.getOptionText() + "</font>");
}
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")
);
}
}
@Subscribe(threadMode = ThreadMode.MAIN) @Subscribe(threadMode = ThreadMode.MAIN)
public void updateSub(LiveAudienceEvent event) { public void updateSub(LiveAudienceEvent event) {
switch (event.getType()) { switch (event.getType()) {
@ -4914,6 +4985,9 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
@Override @Override
public void onBannerClick(List datas, int position) { public void onBannerClick(List datas, int position) {
if (datas.size() > 0) { if (datas.size() > 0) {
if (position >= mTopBannerList.size()) {
position = 0;
}
if (mTopBannerList.get(position).getType() == TopBannerCustomViewHolder.TYPE_CALL_ANCHOR) { if (mTopBannerList.get(position).getType() == TopBannerCustomViewHolder.TYPE_CALL_ANCHOR) {
Dialog loading = DialogUitl.loadingDialog(mContext); Dialog loading = DialogUitl.loadingDialog(mContext);
loading.show(); loading.show();
@ -4999,8 +5073,10 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
call.setType(TopBannerCustomViewHolder.TYPE_CALL_ANCHOR); call.setType(TopBannerCustomViewHolder.TYPE_CALL_ANCHOR);
mTopBannerList.add(0, call); mTopBannerList.add(0, call);
topBanner1.update(mTopBannerList); topBanner1.update(mTopBannerList);
if (topBanner2.getVisibility() == View.VISIBLE) {
topBanner2.update(mTopBannerList); topBanner2.update(mTopBannerList);
} }
}
} }

View File

@ -269,6 +269,8 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe
@Override @Override
public void run() { public void run() {
try{
Log.e("ImgLoader1", data.getAvatar()); Log.e("ImgLoader1", data.getAvatar());
if (mLiveRyLinkMicPkPresenter != null) { if (mLiveRyLinkMicPkPresenter != null) {
mLiveRyLinkMicPkPresenter.clearData(); mLiveRyLinkMicPkPresenter.clearData();
@ -364,6 +366,10 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe
mLiveLinkMicPresenter.setSocketClient(mSocketClient); mLiveLinkMicPresenter.setSocketClient(mSocketClient);
} }
enterRoomNew(); enterRoomNew();
}catch (Exception e){
e.printStackTrace();
}
} }
}); });
@ -497,6 +503,7 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe
//初始化顶部banner //初始化顶部banner
mLiveRoomViewHolder.initTopBanner(); mLiveRoomViewHolder.initTopBanner();
mLiveRoomViewHolder.updateTopBanner(); mLiveRoomViewHolder.updateTopBanner();
mLiveRoomViewHolder.setVoteData(data.getEnterRoomInfo().getVoteModel());
isattention = Integer.parseInt(data.getEnterRoomInfo().getIsattention()); isattention = Integer.parseInt(data.getEnterRoomInfo().getIsattention());
if (isattention == 0) { if (isattention == 0) {

View File

@ -0,0 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android">
<translate
android:duration="300"
android:fromXDelta="100%"
android:toXDelta="0" />
<alpha
android:duration="300"
android:fromAlpha="0"
android:toAlpha="1" />
</set>

View File

@ -0,0 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android">
<translate
android:duration="300"
android:fromXDelta="0"
android:toXDelta="100%" />
<alpha
android:duration="300"
android:fromAlpha="1"
android:toAlpha="0.2" />
</set>

View File

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<shape android:shape="rectangle">
<corners android:radius="10dp" />
<solid android:color="#292929" />
</shape>
</item>
</selector>

View File

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<shape android:shape="rectangle">
<corners android:radius="15dp" />
<solid android:color="#cc000000" />
</shape>
</item>
</selector>

View File

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<shape android:shape="rectangle">
<corners android:radius="5dp" />
<solid android:color="#cc000000" />
</shape>
</item>
</selector>

View File

@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:width="9dp" android:height="22dp">
<shape android:shape="rectangle">
<solid android:color="#ffff2b75" />
<gradient android:type="linear" android:useLevel="true" android:startColor="#ff6170ff" android:endColor="#ff7cd6ff" android:angle="45" />
<corners android:topLeftRadius="5dp" android:topRightRadius="5dp" android:bottomLeftRadius="5dp" android:bottomRightRadius="5dp" />
</shape>
</item>
</selector>

View File

@ -0,0 +1,36 @@
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<!--背景色从左到右色值,渐变-->
<item android:id="@android:id/background">
<shape>
<corners android:radius="5dp" />
<gradient
android:angle="0"
android:centerColor="#7CD6FF"
android:endColor="#6170FF"
android:startColor="#6170FF" />
</shape>
</item>
<!--进度条从左到右色值,渐变-->
<item android:id="@android:id/progress">
<clip
>
<scale android:scaleWidth="100%">
<shape>
<corners
android:bottomLeftRadius="5dp"
android:radius="5dp"
android:topLeftRadius="5dp" />
<gradient
android:angle="0"
android:endColor="#FF35BF"
android:startColor="#FD2F5A" />
</shape>
</scale>
</clip>
</item>
</layer-list>

View File

@ -69,7 +69,7 @@
android:layout_marginTop="16dp" android:layout_marginTop="16dp"
android:layout_marginEnd="16dp" android:layout_marginEnd="16dp"
android:background="@drawable/bg_live_ready_btn2" android:background="@drawable/bg_live_ready_btn2"
android:text="保存" android:text="@string/save"
android:textColor="@color/white" android:textColor="@color/white"
android:textSize="16sp" android:textSize="16sp"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"

View File

@ -0,0 +1,115 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/border_translucent"
android:orientation="vertical">
<EditText
android:id="@+id/edit_question"
android:layout_width="match_parent"
android:layout_height="80dp"
android:layout_marginStart="15dp"
android:layout_marginTop="20dp"
android:layout_marginEnd="15dp"
android:background="@drawable/background_292929"
android:ems="10"
android:gravity="top"
android:hint="@string/dialog_anchor_create_qa_question"
android:inputType="text|textMultiLine"
android:maxLength="33"
android:paddingStart="10dp"
android:paddingTop="11dp"
android:paddingEnd="10dp"
android:textColor="#FFFFFF"
android:textColorHint="#FFFFFF"
android:textSize="14sp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginStart="15dp"
android:layout_marginTop="20dp"
android:layout_marginEnd="15dp"
android:orientation="horizontal"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/editTextText">
<EditText
android:id="@+id/edit_answer1"
android:layout_width="wrap_content"
android:layout_height="45dp"
android:layout_marginEnd="4dp"
android:layout_weight="1"
android:background="@drawable/background_292929"
android:maxLength="8"
android:ems="33"
android:gravity="center|start"
android:hint="@string/dialog_anchor_create_qa_answer"
android:inputType="text"
android:paddingStart="10dp"
android:paddingEnd="10dp"
android:textColor="#FFFFFF"
android:textColorHint="#FFFFFF"
android:textSize="14sp" />
<EditText
android:id="@+id/edit_answer2"
android:layout_width="wrap_content"
android:layout_height="45dp"
android:layout_marginStart="4dp"
android:layout_weight="1"
android:maxLength="8"
android:background="@drawable/background_292929"
android:ems="33"
android:gravity="center|start"
android:hint="@string/dialog_anchor_create_qa_answer"
android:inputType="text"
android:paddingStart="10dp"
android:paddingEnd="10dp"
android:textColor="#FFFFFF"
android:textColorHint="#FFFFFF"
android:textSize="14sp" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginStart="16dp"
android:layout_marginTop="16dp"
android:layout_marginEnd="16dp"
android:layout_marginBottom="20dp"
android:gravity="center"
android:orientation="horizontal">
<Button
android:id="@+id/submit"
android:layout_width="110dp"
android:layout_height="36dp"
android:background="@drawable/bg_live_ready_btn2"
android:text="@string/dialog_anchor_create_qa_submit"
android:textColor="@color/white"
android:textSize="14sp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" />
<Button
android:id="@+id/cancel"
android:layout_width="110dp"
android:layout_height="36dp"
android:layout_marginStart="16dp"
android:background="@drawable/bg_dialog_unfollow_cancel"
android:text="@string/dialog_anchor_create_qa_cancel"
android:textColor="#FFC300"
android:textSize="14sp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" />
</LinearLayout>
</LinearLayout>

View File

@ -0,0 +1,138 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<LinearLayout
android:id="@+id/live_room_vote"
android:layout_width="130dp"
android:layout_height="wrap_content"
android:layout_marginTop="-8dp"
android:layout_marginEnd="12dp"
android:background="@drawable/background_cc000"
android:orientation="vertical"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/vote_hide">
<TextView
android:id="@+id/title"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="10dp"
android:layout_marginTop="5dp"
android:layout_marginEnd="10dp"
tools:text="主播的這個舞蹈你 喜歡嗎"
android:textColor="#FFFFFF"
android:textSize="14sp" />
<ProgressBar
android:id="@+id/vote_progress"
style="?android:attr/progressBarStyleHorizontal"
android:layout_width="match_parent"
android:layout_height="8dp"
android:layout_marginTop="9dp"
android:max="20"
android:progress="10"
android:progressDrawable="@drawable/live_room_qa_progress"
android:rotationY="180" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<TextView
android:id="@+id/vote_sub1"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_weight="1"
android:gravity="center"
android:paddingTop="5dp"
android:paddingBottom="5dp"
tools:text="喜欢"
android:textColor="#FFFFFF"
android:textSize="14sp" />
<View
android:layout_width="1dp"
android:layout_height="match_parent"
android:background="#FFF" />
<TextView
android:id="@+id/vote_sub2"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_weight="1"
android:gravity="center"
android:paddingTop="5dp"
android:paddingBottom="5dp"
tools:text="不喜欢"
android:textColor="#FFFFFF"
android:textSize="14sp" />
</LinearLayout>
</LinearLayout>
<ImageView
android:id="@+id/vote_close"
android:layout_width="15dp"
android:layout_height="15dp"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:srcCompat="@mipmap/live_close"
tools:layout_editor_absoluteY="93dp" />
<ImageView
android:id="@+id/vote_hide"
android:layout_width="10dp"
android:layout_height="15dp"
android:layout_marginEnd="5dp"
android:rotationY="180"
android:scaleType="fitXY"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:srcCompat="@mipmap/icon_back" />
<LinearLayout
android:id="@+id/vote_show"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/background_live_vote_cc000"
android:gravity="center"
android:orientation="horizontal"
android:visibility="gone"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent"
tools:visibility="visible">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
app:srcCompat="@mipmap/icon_back" />
<TextView
android:layout_width="10dp"
android:layout_height="wrap_content"
android:layout_marginTop="2dp"
android:layout_marginEnd="2dp"
android:layout_marginBottom="2dp"
android:layout_weight="1"
android:background="@drawable/bg_live_room_vote_hide"
android:ems="1"
android:lineSpacingMultiplier='0.8'
android:paddingStart="1.5dp"
android:paddingTop="2dp"
android:paddingEnd="1.5dp"
android:paddingBottom="2dp"
android:text="@string/live_vote_hide_text"
android:textColor="@color/white"
android:textSize="6sp" />
</LinearLayout>
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@ -1303,7 +1303,13 @@
android:layout_marginBottom="-30dp" android:layout_marginBottom="-30dp"
android:background="@color/white" android:background="@color/white"
android:visibility="invisible" /> android:visibility="invisible" />
<include
android:id="@+id/vote_layout"
layout="@layout/sim_live_room_vote"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
/>
<ImageView <ImageView
android:id="@+id/icon_pk_top" android:id="@+id/icon_pk_top"