Merge branch 'dev_6.5.2'

# Conflicts:
#	common/src/main/java/com/yunbao/common/http/PDLiveApi.java
#	common/src/main/java/com/yunbao/common/http/live/LiveNetManager.java
#	common/src/main/res/values-en-rUS/string.xml
#	common/src/main/res/values-zh/strings.xml
#	common/src/main/res/values/strings.xml
#	live/src/main/java/com/yunbao/live/views/LiveRoomViewHolder.java
This commit is contained in:
zlzw 2023-05-17 16:20:10 +08:00
commit c1c8921f59
50 changed files with 1926 additions and 229 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

@ -18,7 +18,7 @@ public class LiveGiftBean {
// public static final int MARK_LUCK = 3; // public static final int MARK_LUCK = 3;
private int id; private int id;
private int type;//0 普通礼物 1是豪华礼物 private int type;//0 普通礼物 1是贵族 2守护 3粉丝团
private int mark;// 0 普通 1热门 2守护 3幸运 private int mark;// 0 普通 1热门 2守护 3幸运
private String name; private String name;
private String price; private String price;

View File

@ -0,0 +1,178 @@
package com.yunbao.common.bean;
import com.alibaba.fastjson.annotation.JSONField;
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");
}
public boolean isVote() {
return !StringUtil.isEmpty(vote);
}
}

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;
@ -700,4 +701,25 @@ public interface PDLiveApi {
*/ */
@GET("/api/public/?service=Task.userInfoTask") @GET("/api/public/?service=Task.userInfoTask")
Observable<ResponseModel<List<Object>>> userInfoTask(); Observable<ResponseModel<List<Object>>> userInfoTask();
/**
* 创建投票
*/
@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();
}
public void userInfoTask(HttpCallback<String> callback) { public void userInfoTask(HttpCallback<String> callback) {
API.get().pdLiveApi(mContext) API.get().pdLiveApi(mContext)
.userInfoTask() .userInfoTask()

View File

@ -121,7 +121,7 @@ public class AppManager {
*/ */
public static void runDebugCode(Runnable runnable) { public static void runDebugCode(Runnable runnable) {
if (BuildConfig.DEBUG) { if (BuildConfig.DEBUG) {
// runnable.run(); runnable.run();
} }
} }

View File

@ -8,7 +8,6 @@ import android.os.Handler;
import android.os.Looper; import android.os.Looper;
import android.text.InputFilter; import android.text.InputFilter;
import android.text.InputType; import android.text.InputType;
import android.text.Spanned;
import android.text.TextUtils; import android.text.TextUtils;
import android.text.format.DateFormat; import android.text.format.DateFormat;
import android.util.SparseArray; import android.util.SparseArray;
@ -331,7 +330,7 @@ public class DialogUitl {
private Context mContext; private Context mContext;
private String mTitle; private String mTitle;
private String mContent; private String mContent;
private String mConfrimString; private String mConfirmString;
private String mCancelString; private String mCancelString;
private boolean mCancelable; private boolean mCancelable;
private boolean mBackgroundDimEnabled;//显示区域以外是否使用黑色半透明背景 private boolean mBackgroundDimEnabled;//显示区域以外是否使用黑色半透明背景
@ -371,8 +370,8 @@ public class DialogUitl {
return this; return this;
} }
public Builder setConfrimString(String confrimString) { public Builder setConfirmString(String confirmString) {
mConfrimString = confrimString; mConfirmString = confirmString;
return this; return this;
} }
@ -460,8 +459,8 @@ public class DialogUitl {
content.setFilters(new InputFilter[]{new InputFilter.LengthFilter(mLength)}); content.setFilters(new InputFilter[]{new InputFilter.LengthFilter(mLength)});
} }
TextView btnConfirm = (TextView) dialog.findViewById(R.id.btn_confirm); TextView btnConfirm = (TextView) dialog.findViewById(R.id.btn_confirm);
if (!TextUtils.isEmpty(mConfrimString)) { if (!TextUtils.isEmpty(mConfirmString)) {
btnConfirm.setText(mConfrimString); btnConfirm.setText(mConfirmString);
} }
TextView btnCancel = (TextView) dialog.findViewById(R.id.btn_cancel); TextView btnCancel = (TextView) dialog.findViewById(R.id.btn_cancel);
if (!TextUtils.isEmpty(mCancelString)) { if (!TextUtils.isEmpty(mCancelString)) {

View File

@ -50,7 +50,7 @@ public class VersionUtil {
DialogUitl.Builder builder = new DialogUitl.Builder(context); DialogUitl.Builder builder = new DialogUitl.Builder(context);
builder.setTitle(context.getString(R.string.version_update)) builder.setTitle(context.getString(R.string.version_update))
.setContent(configBean.getUpdateDes()) .setContent(configBean.getUpdateDes())
.setConfrimString(context.getString(R.string.version_immediate_use)) .setConfirmString(context.getString(R.string.version_immediate_use))
.setCancelString(context.getString(R.string.version_not_update)) .setCancelString(context.getString(R.string.version_not_update))
.setCancelable(false) .setCancelable(false)
.setClickCallback(new DialogUitl.SimpleCallback2() { .setClickCallback(new DialogUitl.SimpleCallback2() {
@ -81,7 +81,7 @@ public class VersionUtil {
DialogUitl.Builder builder = new DialogUitl.Builder(context); DialogUitl.Builder builder = new DialogUitl.Builder(context);
builder.setTitle(context.getString(R.string.version_update)) builder.setTitle(context.getString(R.string.version_update))
.setContent(configBean.getUpdateDes()) .setContent(configBean.getUpdateDes())
.setConfrimString(context.getString(R.string.version_immediate_use)) .setConfirmString(context.getString(R.string.version_immediate_use))
.setCancelString(context.getString(R.string.version_not_update)) .setCancelString(context.getString(R.string.version_not_update))
.setCancelable(false) .setCancelable(false)
.setClickCallback(new DialogUitl.SimpleCallback2() { .setClickCallback(new DialogUitl.SimpleCallback2() {
@ -111,7 +111,7 @@ public class VersionUtil {
DialogUitl.Builder builder = new DialogUitl.Builder(context); DialogUitl.Builder builder = new DialogUitl.Builder(context);
builder.setTitle(context.getString(R.string.version_update)) builder.setTitle(context.getString(R.string.version_update))
.setContent(configBean.getUpdateDes()) .setContent(configBean.getUpdateDes())
.setConfrimString(context.getString(R.string.version_immediate_use)) .setConfirmString(context.getString(R.string.version_immediate_use))
.setCancelString(context.getString(R.string.version_not_update)) .setCancelString(context.getString(R.string.version_not_update))
.setCancelable(false) .setCancelable(false)
.setClickCallback(new DialogUitl.SimpleCallback2() { .setClickCallback(new DialogUitl.SimpleCallback2() {
@ -134,7 +134,7 @@ public class VersionUtil {
DialogUitl.Builder builder = new DialogUitl.Builder(context); DialogUitl.Builder builder = new DialogUitl.Builder(context);
builder.setTitle(context.getString(R.string.version_update)) builder.setTitle(context.getString(R.string.version_update))
.setContent(configBean.getUpdateDes()) .setContent(configBean.getUpdateDes())
.setConfrimString(context.getString(R.string.version_immediate_use)) .setConfirmString(context.getString(R.string.version_immediate_use))
.setCancelString(context.getString(R.string.version_not_update)) .setCancelString(context.getString(R.string.version_not_update))
.setCancelable(false) .setCancelable(false)
.setClickCallback(new DialogUitl.SimpleCallback2() { .setClickCallback(new DialogUitl.SimpleCallback2() {

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

@ -872,6 +872,7 @@ Limited ride And limited avatar frame</string>
<string name="activity_center">Activity</string> <string name="activity_center">Activity</string>
<string name="basic_tools">Basic tools</string> <string name="basic_tools">Basic tools</string>
<string name="effects_settings">Effect settings</string> <string name="effects_settings">Effect settings</string>
<string name="live_chat_font_settings">Font settings</string>
<string name="shield_gift_effect">Shield gift effect</string> <string name="shield_gift_effect">Shield gift effect</string>
<string name="shield_mount_effect">Shield car effect</string> <string name="shield_mount_effect">Shield car effect</string>
<string name="current_live_room">You are in the current live room</string> <string name="current_live_room">You are in the current live room</string>
@ -1125,6 +1126,11 @@ Limited ride And limited avatar frame</string>
<string name="unfollow"> Where is the host doing badly~\nBrother, are you sure you want to unfollow?</string> <string name="unfollow"> Where is the host doing badly~\nBrother, are you sure you want to unfollow?</string>
<string name="unfollow_confrim">follow</string> <string name="unfollow_confrim">follow</string>
<string name="heat_add">Heat Add</string> <string name="heat_add">Heat Add</string>
<string name="live_room_chat_fount_size_low">LOW</string>
<string name="live_room_chat_fount_size_def">DEFAULT</string>
<string name="live_room_chat_fount_size_high">HIGH</string>
<string name="dialog_live_fount_title">Select font size</string>
<string name="dialog_fount_submit">confirm</string>
<string name="chat_prompt">Private chat prompt</string> <string name="chat_prompt">Private chat prompt</string>
<string name="broadcast_oom">A private buoy on the side of the broadcast room</string> <string name="broadcast_oom">A private buoy on the side of the broadcast room</string>
<string name="chat_prompt2">Dynamic message</string> <string name="chat_prompt2">Dynamic message</string>
@ -1143,5 +1149,22 @@ Limited ride And limited avatar frame</string>
<string name="delete_account1">Do you want to delete the account</string> <string name="delete_account1">Do you want to delete the account</string>
<string name="delete_account2">After clicking delete, it will take effect immediately and cannot be restored. Are you sure you want to continue?</string> <string name="delete_account2">After clicking delete, it will take effect immediately and cannot be restored. Are you sure you want to continue?</string>
<string name="delete_account3">Confirm deletion</string> <string name="delete_account3">Confirm deletion</string>
<string name="dialog_live_gift_noble">This gift is exclusive to the nobility~</string>
<string name="dialog_live_gift_guard">"This gift is exclusive to guardianship~ "</string>
<string name="dialog_live_gift_fans">This gift is exclusive to the fan group~</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_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>
<string name="complete_information">完整填寫領大禮</string> <string name="complete_information">完整填寫領大禮</string>
</resources> </resources>

View File

@ -1144,4 +1144,21 @@
<string name="delete_account1">是否刪除賬號</string> <string name="delete_account1">是否刪除賬號</string>
<string name="delete_account2">點擊刪除後即刻生效,且不可恢復,您確認要繼續嗎?</string> <string name="delete_account2">點擊刪除後即刻生效,且不可恢復,您確認要繼續嗎?</string>
<string name="delete_account3">確認刪除</string> <string name="delete_account3">確認刪除</string>
<string name="dialog_live_gift_noble">該禮物是貴族專屬禮物噢~</string>
<string name="dialog_live_gift_guard">該禮物是守護專屬禮物噢~</string>
<string name="dialog_live_gift_fans">"該禮物是粉絲團專屬禮物噢~ "</string>
<string name="dialog_live_gift_open_noble">開通貴族</string>
<string name="dialog_live_gift_open_guard">開通守護</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

@ -1143,4 +1143,21 @@
<string name="delete_account1">是否刪除賬號</string> <string name="delete_account1">是否刪除賬號</string>
<string name="delete_account2">點擊刪除後即刻生效,且不可恢復,您確認要繼續嗎?</string> <string name="delete_account2">點擊刪除後即刻生效,且不可恢復,您確認要繼續嗎?</string>
<string name="delete_account3">確認刪除</string> <string name="delete_account3">確認刪除</string>
<string name="dialog_live_gift_noble">該禮物是貴族專屬禮物噢~</string>
<string name="dialog_live_gift_guard">該禮物是守護專屬禮物噢~</string>
<string name="dialog_live_gift_fans">"該禮物是粉絲團專屬禮物噢~ "</string>
<string name="dialog_live_gift_open_noble">開通貴族</string>
<string name="dialog_live_gift_open_guard">開通守護</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

@ -1145,4 +1145,21 @@
<string name="delete_account2">點擊刪除後即刻生效,且不可恢復,您確認要繼續嗎?</string> <string name="delete_account2">點擊刪除後即刻生效,且不可恢復,您確認要繼續嗎?</string>
<string name="delete_account3">確認刪除</string> <string name="delete_account3">確認刪除</string>
<string name="complete_information">完整填寫領大禮</string> <string name="complete_information">完整填寫領大禮</string>
<string name="dialog_live_gift_noble">該禮物是貴族專屬禮物噢~</string>
<string name="dialog_live_gift_guard">該禮物是守護專屬禮物噢~</string>
<string name="dialog_live_gift_fans">"該禮物是粉絲團專屬禮物噢~ "</string>
<string name="dialog_live_gift_open_noble">開通貴族</string>
<string name="dialog_live_gift_open_guard">開通守護</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,15 +1150,21 @@ Limited ride And limited avatar frame</string>
<string name="delete_account1">Do you want to delete the account</string> <string name="delete_account1">Do you want to delete the account</string>
<string name="delete_account2">After clicking delete, it will take effect immediately and cannot be restored. Are you sure you want to continue?</string> <string name="delete_account2">After clicking delete, it will take effect immediately and cannot be restored. Are you sure you want to continue?</string>
<string name="delete_account3">Confirm deletion</string> <string name="delete_account3">Confirm deletion</string>
<string name="complete_information">完整填寫領大禮</string> <string name="dialog_live_gift_noble">This gift is exclusive to the nobility~</string>
<string name="complete_information_consumable">填寫“*”的選項可完成</string> <string name="dialog_live_gift_guard">This gift is exclusive to guardianship~</string>
<string name="love_powder">真愛粉\n頭像框(7天)</string> <string name="dialog_live_gift_fans">This gift is exclusive to the fan group~</string>
<string name="golden_beans_128">128金豆</string> <string name="dialog_live_gift_open_noble">VIP</string>
<string name="love_powder_medal">真愛粉\n勛章(7天)</string> <string name="dialog_live_gift_open_guard">Open Guard</string>
<string name="man_student">男生</string> <string name="dialog_live_gift_open_fans">Open Fan group</string>
<string name="girl_student">女生</string> <string name="dialog_live_function_qa">QA</string>
<string name="complete_information_hint">已將獎勵發送至您的背包,請注意查看。</string> <string name="dialog_anchor_create_qa_submit">submit</string>
<string name="complete_information_hint3">離開會讓您失去獎勵,您確認離開嗎?</string> <string name="dialog_anchor_create_qa_cancel">cancel</string>
<string name="complete_information_hint2">愛你,愛你</string> <string name="dialog_anchor_create_qa_question">question:</string>
<string name="you_guide_me">指導下我好嗎</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;
@ -1047,7 +1049,11 @@ public class LiveAudienceActivity extends LiveActivity {
liveFansFragment.show(getSupportFragmentManager(), "LiveGuardDialogFragment"); liveFansFragment.show(getSupportFragmentManager(), "LiveGuardDialogFragment");
break; break;
case GUARD: case GUARD:
if (event.getObject() == null) {
openNewGuardListWindow(mContext instanceof LiveRyAnchorActivity); openNewGuardListWindow(mContext instanceof LiveRyAnchorActivity);
} else {
openNewBuyGuardWindow(true);
}
break; break;
case LIVE_WKS://周星榜 case LIVE_WKS://周星榜
String weeklyStarUrl = CommonAppConfig.HOST + "/h5/activity/weekStar/index.html?&uid=" String weeklyStarUrl = CommonAppConfig.HOST + "/h5/activity/weekStar/index.html?&uid="
@ -1332,6 +1338,45 @@ 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:
LiveRoomVoteModel voteModel = new LiveRoomVoteModel();
JSONObject map = (JSONObject) event.getObject();
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 {
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(), "<font color='#FF8E43'>" + voteModel.getOptionText() + "</font>");
}
manager.mLiveRoomViewHolder.dismissVote(voteModel.getResult(), content);
} catch (Exception e) {
e.printStackTrace();
}
break;
} }

View File

@ -46,6 +46,7 @@ import com.yunbao.common.utils.SVGAViewUtils;
import com.yunbao.common.utils.ToastUtil; import com.yunbao.common.utils.ToastUtil;
import com.yunbao.common.utils.WordUtil; import com.yunbao.common.utils.WordUtil;
import com.yunbao.live.R; import com.yunbao.live.R;
import com.yunbao.share.ui.InvitePopDialog;
import org.greenrobot.eventbus.Subscribe; import org.greenrobot.eventbus.Subscribe;
import org.greenrobot.eventbus.ThreadMode; import org.greenrobot.eventbus.ThreadMode;
@ -369,6 +370,10 @@ public class ZhuangBanActivity extends AbsActivity {
} catch (MalformedURLException e) { } catch (MalformedURLException e) {
e.printStackTrace(); e.printStackTrace();
} }
}else if (event.getMethod().equals("androidInviteShare")) {
new InvitePopDialog(mContext)
.setUrl(event.getData())
.showDialog();
} }
} }

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;
@ -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

@ -1,6 +1,5 @@
package com.yunbao.live.adapter; package com.yunbao.live.adapter;
import android.app.Dialog;
import android.content.Context; import android.content.Context;
import android.content.DialogInterface; import android.content.DialogInterface;
import android.os.Build; import android.os.Build;
@ -13,14 +12,11 @@ import android.widget.TextView;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView; import androidx.recyclerview.widget.RecyclerView;
import com.yunbao.common.bean.BaseModel;
import com.yunbao.common.bean.LiveUserMailBoxModel; import com.yunbao.common.bean.LiveUserMailBoxModel;
import com.yunbao.common.http.base.HttpCallback; import com.yunbao.common.http.base.HttpCallback;
import com.yunbao.common.http.live.LiveNetManager; import com.yunbao.common.http.live.LiveNetManager;
import com.yunbao.common.interfaces.OnItemClickListener; import com.yunbao.common.interfaces.OnItemClickListener;
import com.yunbao.common.utils.DialogUitl; import com.yunbao.common.utils.DialogUitl;
import com.yunbao.common.utils.ToastUtil;
import com.yunbao.common.utils.WordUtil;
import com.yunbao.live.R; import com.yunbao.live.R;
import com.yunbao.live.dialog.LiveUserAnchorMailBoxWebInfoPopDialog; import com.yunbao.live.dialog.LiveUserAnchorMailBoxWebInfoPopDialog;
@ -94,7 +90,7 @@ public class LiveUserAnchorMailBoxAdapter extends RecyclerView.Adapter<LiveUserA
new DialogUitl.Builder(mContext) new DialogUitl.Builder(mContext)
.setTitle(mContext.getString(R.string.live_user_letter_dialog_title)) .setTitle(mContext.getString(R.string.live_user_letter_dialog_title))
.setContent(mContext.getString(R.string.live_user_letter_dialog_content)) .setContent(mContext.getString(R.string.live_user_letter_dialog_content))
.setConfrimString(mContext.getString(R.string.live_user_letter_dialog_yes)) .setConfirmString(mContext.getString(R.string.live_user_letter_dialog_yes))
.setCancelString(mContext.getString(R.string.live_user_letter_dialog_no)) .setCancelString(mContext.getString(R.string.live_user_letter_dialog_no))
.setView(R.layout.dialog_live_random_pk) .setView(R.layout.dialog_live_random_pk)
.setCancelable(true) .setCancelable(true)

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

@ -45,7 +45,9 @@ import com.yunbao.common.http.HttpCallback;
import com.yunbao.common.http.HttpClient; import com.yunbao.common.http.HttpClient;
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.utils.AppManager;
import com.yunbao.common.utils.Bus; import com.yunbao.common.utils.Bus;
import com.yunbao.common.utils.DialogUitl;
import com.yunbao.common.utils.DpUtil; import com.yunbao.common.utils.DpUtil;
import com.yunbao.common.utils.GiftCacheUtil; import com.yunbao.common.utils.GiftCacheUtil;
import com.yunbao.common.utils.NobleUtil; import com.yunbao.common.utils.NobleUtil;
@ -59,6 +61,7 @@ import com.yunbao.live.adapter.LiveGiftPagerAdapter;
import com.yunbao.live.bean.GiftTopBean; import com.yunbao.live.bean.GiftTopBean;
import com.yunbao.live.bean.LiveGuardInfo; import com.yunbao.live.bean.LiveGuardInfo;
import com.yunbao.live.custom.GiftViewPager; import com.yunbao.live.custom.GiftViewPager;
import com.yunbao.live.event.LiveAudienceEvent;
import com.yunbao.live.http.LiveHttpConsts; import com.yunbao.live.http.LiveHttpConsts;
import com.yunbao.live.http.LiveHttpUtil; import com.yunbao.live.http.LiveHttpUtil;
import com.yunbao.live.utils.ToolsButton; import com.yunbao.live.utils.ToolsButton;
@ -816,6 +819,45 @@ public class LiveGiftDialogFragment extends AbsDialogFragment implements View.On
isGetNewWrap = true; isGetNewWrap = true;
refreshWrapListAfterSend(); refreshWrapListAfterSend();
} }
} else if (code == 1007 && mLiveGiftBean.getType() != 0) {
hideLianBtn();
dismiss();
LiveAudienceEvent.LiveAudienceType type = null;
String confirmString = mContext.getString(R.string.dialog_fount_submit);
String tips = msg;
switch (mLiveGiftBean.getType()) {
case 1:
type = LiveAudienceEvent.LiveAudienceType.NOBLE;
tips = mContext.getString(R.string.dialog_live_gift_noble);
confirmString = mContext.getString(R.string.dialog_live_gift_open_noble);
break;
case 2:
type = LiveAudienceEvent.LiveAudienceType.GUARD;
tips = mContext.getString(R.string.dialog_live_gift_guard);
confirmString = mContext.getString(R.string.dialog_live_gift_open_guard);
break;
case 3:
type = LiveAudienceEvent.LiveAudienceType.FAN_CLUB;
tips = mContext.getString(R.string.dialog_live_gift_fans);
confirmString = mContext.getString(R.string.dialog_live_gift_open_fans);
}
LiveAudienceEvent.LiveAudienceType finalType = type;
new DialogUitl.Builder(mContext)
.setView(R.layout.dialog_live_unfollow)
.setConfirmString(confirmString)
.setContent(tips)
.setClickCallback((dialog, content) -> {
LiveAudienceEvent event = new LiveAudienceEvent()
.setType(finalType);
if (finalType == LiveAudienceEvent.LiveAudienceType.GUARD) {
event = event.setObject("");
}
Bus.get().post(event);
}).build().show();
AppManager.runDebugCode(() -> {
Log.i("gifBean", mLiveGiftBean.toString());
});
} else { } else {
hideLianBtn(); hideLianBtn();
ToastUtil.show(msg); ToastUtil.show(msg);

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);
@ -199,6 +200,8 @@ public class LiveNewFunctionDialogFragment extends AbsDialogFragment implements
} 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

@ -1,6 +1,5 @@
package com.yunbao.live.dialog; package com.yunbao.live.dialog;
import android.annotation.SuppressLint;
import android.app.Dialog; import android.app.Dialog;
import android.os.Bundle; import android.os.Bundle;
import android.text.Html; import android.text.Html;
@ -35,7 +34,6 @@ import com.yunbao.common.http.live.LiveNetManager;
import com.yunbao.common.utils.DialogUitl; import com.yunbao.common.utils.DialogUitl;
import com.yunbao.common.utils.RouteUtil; import com.yunbao.common.utils.RouteUtil;
import com.yunbao.common.utils.ToastUtil; import com.yunbao.common.utils.ToastUtil;
import com.yunbao.common.utils.WordUtil;
import com.yunbao.live.R; import com.yunbao.live.R;
import com.yunbao.live.activity.LiveActivity; import com.yunbao.live.activity.LiveActivity;
import com.yunbao.live.activity.LiveRyAnchorActivity; import com.yunbao.live.activity.LiveRyAnchorActivity;
@ -438,7 +436,7 @@ public class LiveNewGuardBuyDialogFragment extends AbsDialogFragment implements
.setView(R.layout.dialog_live_random_pk) .setView(R.layout.dialog_live_random_pk)
.setTitle(mContext.getString(R.string.dialog_tip)) .setTitle(mContext.getString(R.string.dialog_tip))
.setCancelString(mContext.getString(R.string.live_use_discount_no)) .setCancelString(mContext.getString(R.string.live_use_discount_no))
.setConfrimString(mContext.getString(R.string.live_use_discount_yes)) .setConfirmString(mContext.getString(R.string.live_use_discount_yes))
.setClickCallback(new DialogUitl.SimpleCallback2() { .setClickCallback(new DialogUitl.SimpleCallback2() {
@Override @Override
public void onCancelClick() { public void onCancelClick() {

View File

@ -5,8 +5,6 @@ import android.graphics.Color;
import android.graphics.drawable.Drawable; import android.graphics.drawable.Drawable;
import android.os.Bundle; import android.os.Bundle;
import androidx.core.content.ContextCompat;
import android.text.TextUtils; import android.text.TextUtils;
import android.util.Log; import android.util.Log;
import android.view.Gravity; import android.view.Gravity;
@ -46,29 +44,22 @@ import com.yunbao.common.utils.RouteUtil;
import com.yunbao.common.utils.SVGAViewUtils; import com.yunbao.common.utils.SVGAViewUtils;
import com.yunbao.common.utils.StringUtil; import com.yunbao.common.utils.StringUtil;
import com.yunbao.common.utils.ToastUtil; import com.yunbao.common.utils.ToastUtil;
import com.yunbao.common.utils.WordUtil;
import com.yunbao.live.R; import com.yunbao.live.R;
import com.yunbao.live.activity.LiveActivity; import com.yunbao.live.activity.LiveActivity;
import com.yunbao.live.activity.LiveReportActivity; import com.yunbao.live.activity.LiveReportActivity;
import com.yunbao.live.activity.LiveRyAnchorActivity; import com.yunbao.live.activity.LiveRyAnchorActivity;
import com.yunbao.live.bean.GuardUserBean;
import com.yunbao.live.bean.ImpressBean;
import com.yunbao.common.bean.LiveBean; import com.yunbao.common.bean.LiveBean;
import com.yunbao.live.custom.MyTextView;
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.LiveHttpUtil; import com.yunbao.live.http.LiveHttpUtil;
import com.yunbao.live.presenter.LiveRoomCheckLivePresenter; import com.yunbao.live.presenter.LiveRoomCheckLivePresenter;
import com.yunbao.live.utils.LiveTextRender; import com.yunbao.live.utils.LiveTextRender;
import com.yunbao.live.views.LiveRoomViewHolder;
import org.greenrobot.eventbus.EventBus; import org.greenrobot.eventbus.EventBus;
import java.net.MalformedURLException; import java.net.MalformedURLException;
import java.net.URL; import java.net.URL;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays;
import java.util.List; import java.util.List;
import io.rong.imlib.IRongCoreCallback; import io.rong.imlib.IRongCoreCallback;
@ -534,7 +525,7 @@ public class LiveUserDialogFragment extends AbsDialogFragment implements View.On
if (mFollowing) { if (mFollowing) {
DialogUitl.Builder builder = new DialogUitl.Builder(mContext) DialogUitl.Builder builder = new DialogUitl.Builder(mContext)
.setContent(mContext.getString(R.string.unfollow)) .setContent(mContext.getString(R.string.unfollow))
.setConfrimString(mContext.getString(R.string.unfollow_confrim)) .setConfirmString(mContext.getString(R.string.unfollow_confrim))
.setCancelString(mContext.getString(R.string.unfollow_cancel)) .setCancelString(mContext.getString(R.string.unfollow_cancel))
.setView(R.layout.dialog_live_unfollow) .setView(R.layout.dialog_live_unfollow)
.setClickCallback3(new DialogUitl.SimpleCallback3() { .setClickCallback3(new DialogUitl.SimpleCallback3() {

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

@ -54,7 +54,6 @@ import com.yunbao.common.utils.DpUtil;
import com.yunbao.common.utils.ScreenDimenUtil; import com.yunbao.common.utils.ScreenDimenUtil;
import com.yunbao.common.utils.StringUtil; import com.yunbao.common.utils.StringUtil;
import com.yunbao.common.utils.ToastUtil; import com.yunbao.common.utils.ToastUtil;
import com.yunbao.common.utils.WordUtil;
import com.yunbao.live.R; import com.yunbao.live.R;
import com.yunbao.live.activity.LiveAudienceActivity; import com.yunbao.live.activity.LiveAudienceActivity;
import com.yunbao.live.activity.LiveRyAnchorActivity; import com.yunbao.live.activity.LiveRyAnchorActivity;
@ -1242,7 +1241,7 @@ public class LiveRyLinkMicPkPresenter implements View.OnClickListener {
"<font color='#999999' size='12'>有人向您发起PK请求。</font><br/>" + "<font color='#999999' size='12'>有人向您发起PK请求。</font><br/>" +
"<font color='#FB4F4F' size='12'>若拒绝PK将会10分钟内不会再收到任何随机PK请求。</font>" "<font color='#FB4F4F' size='12'>若拒绝PK将会10分钟内不会再收到任何随机PK请求。</font>"
)) ))
.setConfrimString("接受") .setConfirmString("接受")
.setCancelString("拒絕") .setCancelString("拒絕")
.setView(R.layout.dialog_live_random_pk) .setView(R.layout.dialog_live_random_pk)
.setSimpleCallbackView(new DialogUitl.SimpleCallbackView() { .setSimpleCallbackView(new DialogUitl.SimpleCallbackView() {

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,274 @@
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) {
mCancel.setOnClickListener(null);
mSubmit.setOnClickListener(null);
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());
}
if(isAnchor){
mClose.setVisibility(View.VISIBLE);
}
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);
}
public void fold(){
if(mVoteShow.getVisibility()!=View.VISIBLE){
hideAnchorVote();
}
}
public void expansion(){
if(mVoteShow.getVisibility()==View.VISIBLE){
hideAnchorVote();
}
}
}

View File

@ -46,7 +46,6 @@ import com.yunbao.common.utils.ProcessImageUtil;
import com.yunbao.common.utils.RouteUtil; import com.yunbao.common.utils.RouteUtil;
import com.yunbao.common.utils.StringUtil; import com.yunbao.common.utils.StringUtil;
import com.yunbao.common.utils.ToastUtil; import com.yunbao.common.utils.ToastUtil;
import com.yunbao.common.utils.WordUtil;
import com.yunbao.common.views.AbsViewHolder; import com.yunbao.common.views.AbsViewHolder;
import com.yunbao.common.views.LiveClarityCustomPopup; import com.yunbao.common.views.LiveClarityCustomPopup;
import com.yunbao.common.views.LiveNewWishListPopup; import com.yunbao.common.views.LiveNewWishListPopup;
@ -62,7 +61,6 @@ import com.yunbao.live.dialog.LiveAnchorSayPopDialog;
import com.yunbao.live.dialog.LiveFaceUnityDialogFragment; import com.yunbao.live.dialog.LiveFaceUnityDialogFragment;
import com.yunbao.live.dialog.LiveNewRoomClassDialogFragment; import com.yunbao.live.dialog.LiveNewRoomClassDialogFragment;
import com.yunbao.live.dialog.LiveNewRoomTypeDialogFragment; import com.yunbao.live.dialog.LiveNewRoomTypeDialogFragment;
import com.yunbao.live.dialog.LiveNewWishListDialogFragment;
import com.yunbao.live.dialog.LiveTimeDialogFragment; import com.yunbao.live.dialog.LiveTimeDialogFragment;
import com.yunbao.live.event.LiveAudienceEvent; import com.yunbao.live.event.LiveAudienceEvent;
import com.yunbao.live.http.LiveHttpConsts; import com.yunbao.live.http.LiveHttpConsts;
@ -664,7 +662,7 @@ public class LiveNewReadyRyViewHolder extends AbsViewHolder implements View.OnCl
new DialogUitl.Builder(mContext) new DialogUitl.Builder(mContext)
.setContent(mContext.getString(R.string.live_location_close_3)) .setContent(mContext.getString(R.string.live_location_close_3))
.setCancelable(true) .setCancelable(true)
.setConfrimString(mContext.getString(R.string.live_location_close_2)) .setConfirmString(mContext.getString(R.string.live_location_close_2))
.setClickCallback(new DialogUitl.SimpleCallback() { .setClickCallback(new DialogUitl.SimpleCallback() {
@Override @Override

View File

@ -7,25 +7,19 @@ import android.app.Dialog;
import android.content.Context; import android.content.Context;
import android.graphics.Color; import android.graphics.Color;
import android.media.AudioManager; import android.media.AudioManager;
import android.os.Bundle;
import android.os.Handler; import android.os.Handler;
import android.os.Looper; import android.os.Looper;
import android.os.SystemClock;
import android.text.TextUtils; import android.text.TextUtils;
import android.util.Log; import android.util.Log;
import android.view.Gravity; import android.view.Gravity;
import android.view.LayoutInflater;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
import android.view.ViewParent; import android.view.ViewParent;
import android.widget.FrameLayout; import android.widget.FrameLayout;
import android.widget.ImageView; import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.RelativeLayout; import android.widget.RelativeLayout;
import android.widget.TextView; import android.widget.TextView;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.google.android.exoplayer2.PlaybackException; import com.google.android.exoplayer2.PlaybackException;
import com.google.android.exoplayer2.Player; import com.google.android.exoplayer2.Player;
import com.google.android.exoplayer2.ui.StyledPlayerView; import com.google.android.exoplayer2.ui.StyledPlayerView;
@ -35,10 +29,8 @@ import com.lxj.xpopup.core.BasePopupView;
import com.lxj.xpopup.interfaces.XPopupCallback; import com.lxj.xpopup.interfaces.XPopupCallback;
import com.lzf.easyfloat.EasyFloat; import com.lzf.easyfloat.EasyFloat;
import com.lzy.okserver.OkDownload; import com.lzy.okserver.OkDownload;
import com.yunbao.common.Constants;
import com.yunbao.common.bean.EnterRoomNewModel; import com.yunbao.common.bean.EnterRoomNewModel;
import com.yunbao.common.dialog.LiveFontSizeSettingDialog; import com.yunbao.common.dialog.LiveFontSizeSettingDialog;
import com.yunbao.common.glide.ImgLoader;
import com.yunbao.common.http.HttpCallback; import com.yunbao.common.http.HttpCallback;
import com.yunbao.common.http.HttpClient; import com.yunbao.common.http.HttpClient;
import com.yunbao.common.interfaces.OnItemClickListener; import com.yunbao.common.interfaces.OnItemClickListener;
@ -50,14 +42,11 @@ import com.yunbao.common.utils.L;
import com.yunbao.common.utils.MicStatusManager; import com.yunbao.common.utils.MicStatusManager;
import com.yunbao.common.utils.ScreenDimenUtil; import com.yunbao.common.utils.ScreenDimenUtil;
import com.yunbao.common.utils.SpUtil; import com.yunbao.common.utils.SpUtil;
import com.yunbao.common.utils.StringUtil;
import com.yunbao.common.utils.ToastUtil; import com.yunbao.common.utils.ToastUtil;
import com.yunbao.common.utils.WordUtil;
import com.yunbao.common.views.LiveClarityCustomPopup; import com.yunbao.common.views.LiveClarityCustomPopup;
import com.yunbao.live.R; import com.yunbao.live.R;
import com.yunbao.live.activity.LiveActivity; import com.yunbao.live.activity.LiveActivity;
import com.yunbao.live.activity.LiveAudienceActivity; import com.yunbao.live.activity.LiveAudienceActivity;
import com.yunbao.live.dialog.LiveUserDialogFragment;
import com.yunbao.live.event.LiveAudienceEvent; import com.yunbao.live.event.LiveAudienceEvent;
import com.yunbao.live.utils.LiveExoPlayerManager; import com.yunbao.live.utils.LiveExoPlayerManager;
@ -700,7 +689,7 @@ public class LivePlayRyViewHolder extends LiveRoomPlayViewHolder {
DialogUitl.Builder builder = new DialogUitl.Builder(mContext) DialogUitl.Builder builder = new DialogUitl.Builder(mContext)
.setContent("邀請您進行語音連麥") .setContent("邀請您進行語音連麥")
.setTitle(mLiveBean.getUserNiceName()) .setTitle(mLiveBean.getUserNiceName())
.setConfrimString("接受") .setConfirmString("接受")
.setCancelString("拒絕") .setCancelString("拒絕")
.setView(R.layout.dialog_live_mic_invite) .setView(R.layout.dialog_live_mic_invite)
.setClickCallback(new DialogUitl.SimpleCallback() { .setClickCallback(new DialogUitl.SimpleCallback() {

View File

@ -29,7 +29,6 @@ import com.yunbao.common.utils.L;
import com.yunbao.common.utils.ProcessImageUtil; import com.yunbao.common.utils.ProcessImageUtil;
import com.yunbao.common.utils.StringUtil; import com.yunbao.common.utils.StringUtil;
import com.yunbao.common.utils.ToastUtil; import com.yunbao.common.utils.ToastUtil;
import com.yunbao.common.utils.WordUtil;
import com.yunbao.common.views.AbsViewHolder; import com.yunbao.common.views.AbsViewHolder;
import com.yunbao.live.R; import com.yunbao.live.R;
import com.yunbao.live.activity.LiveActivity; import com.yunbao.live.activity.LiveActivity;
@ -231,7 +230,7 @@ public class LiveReadyRyViewHolder extends AbsViewHolder implements View.OnClick
new DialogUitl.Builder(mContext) new DialogUitl.Builder(mContext)
.setContent(mContext.getString(R.string.live_location_close_3)) .setContent(mContext.getString(R.string.live_location_close_3))
.setCancelable(true) .setCancelable(true)
.setConfrimString(mContext.getString(R.string.live_location_close_2)) .setConfirmString(mContext.getString(R.string.live_location_close_2))
.setClickCallback(new DialogUitl.SimpleCallback() { .setClickCallback(new DialogUitl.SimpleCallback() {
@Override @Override

View File

@ -41,7 +41,6 @@ import com.yunbao.common.utils.L;
import com.yunbao.common.utils.ProcessImageUtil; import com.yunbao.common.utils.ProcessImageUtil;
import com.yunbao.common.utils.StringUtil; import com.yunbao.common.utils.StringUtil;
import com.yunbao.common.utils.ToastUtil; import com.yunbao.common.utils.ToastUtil;
import com.yunbao.common.utils.WordUtil;
import com.yunbao.common.views.AbsViewHolder; import com.yunbao.common.views.AbsViewHolder;
import com.yunbao.live.R; import com.yunbao.live.R;
import com.yunbao.live.activity.LiveActivity; import com.yunbao.live.activity.LiveActivity;
@ -255,7 +254,7 @@ public class LiveReadyViewHolder extends AbsViewHolder implements View.OnClickLi
new DialogUitl.Builder(mContext) new DialogUitl.Builder(mContext)
.setContent(mContext.getString(R.string.live_location_close_3)) .setContent(mContext.getString(R.string.live_location_close_3))
.setCancelable(true) .setCancelable(true)
.setConfrimString(mContext.getString(R.string.live_location_close_2)) .setConfirmString(mContext.getString(R.string.live_location_close_2))
.setClickCallback(new DialogUitl.SimpleCallback() { .setClickCallback(new DialogUitl.SimpleCallback() {
@Override @Override

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);
} }
@ -3106,7 +3117,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) {
@ -3671,6 +3682,26 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
} }
} }
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);
if(voteModel.isVote()){
voteManager.fold();
}else{
voteManager.expansion();
}
voteManager.setCreateVoteModel(voteModel);
}
private static class LiveRoomHandler extends Handler { private static class LiveRoomHandler extends Handler {
private LiveRoomViewHolder mLiveRoomViewHolder; private LiveRoomViewHolder mLiveRoomViewHolder;
@ -4234,6 +4265,27 @@ 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) {
LiveRoomVoteModel voteModel = JSONObject.parseObject(event.getObject().toString(), LiveRoomVoteModel.class);
setVoteData(voteModel);
}
}
@Subscribe(threadMode = ThreadMode.MAIN) @Subscribe(threadMode = ThreadMode.MAIN)
public void updateSub(LiveAudienceEvent event) { public void updateSub(LiveAudienceEvent event) {
switch (event.getType()) { switch (event.getType()) {
@ -4916,6 +4968,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();
@ -5002,7 +5057,6 @@ 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"

View File

@ -43,6 +43,7 @@ import com.yunbao.common.interfaces.ActivityResultCallback;
import com.yunbao.common.interfaces.CommonCallback; import com.yunbao.common.interfaces.CommonCallback;
import com.yunbao.common.interfaces.ImageResultCallback; import com.yunbao.common.interfaces.ImageResultCallback;
import com.yunbao.common.manager.IMLoginManager; import com.yunbao.common.manager.IMLoginManager;
import com.yunbao.common.utils.Bus;
import com.yunbao.common.utils.DpUtil; import com.yunbao.common.utils.DpUtil;
import com.yunbao.common.utils.JavascriptInterfaceUtils; import com.yunbao.common.utils.JavascriptInterfaceUtils;
import com.yunbao.common.utils.L; import com.yunbao.common.utils.L;
@ -53,6 +54,7 @@ import com.yunbao.common.utils.ToastUtil;
import com.yunbao.common.utils.WordUtil; import com.yunbao.common.utils.WordUtil;
import com.yunbao.main.R; import com.yunbao.main.R;
import com.yunbao.main.http.MainHttpUtil; import com.yunbao.main.http.MainHttpUtil;
import com.yunbao.share.ui.InvitePopDialog;
import org.greenrobot.eventbus.Subscribe; import org.greenrobot.eventbus.Subscribe;
import org.greenrobot.eventbus.ThreadMode; import org.greenrobot.eventbus.ThreadMode;
@ -83,6 +85,7 @@ public class RewardActivity extends AbsActivity {
@Override @Override
protected void main() { protected void main() {
Bus.getOn(this);
String url = getIntent().getStringExtra(Constants.URL); String url = getIntent().getStringExtra(Constants.URL);
L.e("H5---10>" + url); L.e("H5---10>" + url);
LinearLayout rootView = (LinearLayout) findViewById(R.id.rootView); LinearLayout rootView = (LinearLayout) findViewById(R.id.rootView);
@ -330,6 +333,7 @@ public class RewardActivity extends AbsActivity {
@Override @Override
protected void onDestroy() { protected void onDestroy() {
Bus.getOff(this);
if (mWebView != null) { if (mWebView != null) {
ViewGroup parent = (ViewGroup) mWebView.getParent(); ViewGroup parent = (ViewGroup) mWebView.getParent();
if (parent != null) { if (parent != null) {
@ -420,6 +424,10 @@ public class RewardActivity extends AbsActivity {
} else if (TextUtils.equals(event.getMethod(), "openUpdataAutograph")) { } else if (TextUtils.equals(event.getMethod(), "openUpdataAutograph")) {
isUpdataUser = true; isUpdataUser = true;
forwardSign(); forwardSign();
}else if (event.getMethod().equals("androidInviteShare")) {
new InvitePopDialog(mContext)
.setUrl(event.getData())
.showDialog();
} }
} }
} }