机器人自动发消息设置页面修改,机器人求关注新增发送消息类型,直播间开播清晰度设置

This commit is contained in:
18401019693 2022-12-28 18:21:00 +08:00
parent a7cef3c6f8
commit 90f58054fa
22 changed files with 504 additions and 16 deletions

View File

@ -172,6 +172,7 @@ public class Constants {
public static final String RECOMMEND_CARD_NOTIFY = "recommendCardNotify";//推荐卡通知消息 public static final String RECOMMEND_CARD_NOTIFY = "recommendCardNotify";//推荐卡通知消息
public static final String STAR_CHALLENGE_UPDATE = "starChallengeUpdate";//星级助力 public static final String STAR_CHALLENGE_UPDATE = "starChallengeUpdate";//星级助力
public static final String AI_AUTOMATIC_SPEECH = "aiAutomaticSpeech";//机器人助手 public static final String AI_AUTOMATIC_SPEECH = "aiAutomaticSpeech";//机器人助手
public static final String AI_AUTOMATIC_SPEECH_LIVE = "aiAutomaticSpeechNew";//机器人助手
public static final String STAR_CHALLENGE_UPGRADE_NOTIFY = "starChallengeUpgradeNotify";//星级挑战成功 public static final String STAR_CHALLENGE_UPGRADE_NOTIFY = "starChallengeUpgradeNotify";//星级挑战成功
public static final String SUPER_VISION = "supervision";//超级发言警告 public static final String SUPER_VISION = "supervision";//超级发言警告
public static final String PK_RANK_UPDATE = "RankingRankUpdate";//PK排位赛更新数据 public static final String PK_RANK_UPDATE = "RankingRankUpdate";//PK排位赛更新数据

View File

@ -0,0 +1,49 @@
package com.yunbao.common.bean;
import android.text.TextUtils;
import com.google.gson.annotations.SerializedName;
public class LiveStetUpStatusModel extends BaseModel {
@SerializedName("wishList")
private String wishList;
@SerializedName("ai_state")
private String aiState;
/**
* wishList 1设置 0 未设置
*
* @return
*/
public boolean getWishListState() {
return TextUtils.equals(wishList, "1");
}
/**
* aiState 1打开机器人 0 未设置
*
* @return
*/
public boolean getAiStateState() {
return TextUtils.equals(aiState, "1");
}
public String getWishList() {
return wishList;
}
public LiveStetUpStatusModel setWishList(String wishList) {
this.wishList = wishList;
return this;
}
public String getAiState() {
return aiState;
}
public LiveStetUpStatusModel setAiState(String aiState) {
this.aiState = aiState;
return this;
}
}

View File

@ -15,6 +15,7 @@ import com.yunbao.common.bean.LinkMicUserBeanV2;
import com.yunbao.common.bean.LiveAiRobotBean; import com.yunbao.common.bean.LiveAiRobotBean;
import com.yunbao.common.bean.LiveInfoModel; import com.yunbao.common.bean.LiveInfoModel;
import com.yunbao.common.bean.LiveRoomActivityBanner; import com.yunbao.common.bean.LiveRoomActivityBanner;
import com.yunbao.common.bean.LiveStetUpStatusModel;
import com.yunbao.common.bean.MsgSwitchDetailModel; import com.yunbao.common.bean.MsgSwitchDetailModel;
import com.yunbao.common.bean.NewPeopleInfo; import com.yunbao.common.bean.NewPeopleInfo;
import com.yunbao.common.bean.NobleRankHideUserListModel; import com.yunbao.common.bean.NobleRankHideUserListModel;
@ -522,11 +523,18 @@ public interface PDLiveApi {
/** /**
* 机器人修改话术 * 机器人修改话术
*/ */
@GET("/api/public/?service=Live.updateAiAutomaticSpeech ") @GET("/api/public/?service=Live.updateAiAutomaticSpeech")
Observable<ResponseModel<List<String>>> updateAiAutomaticSpeech( Observable<ResponseModel<List<String>>> updateAiAutomaticSpeech(
@Query("type") String type, @Query("type") String type,
@Query("id") String id, @Query("id") String id,
@Query("content") String content @Query("content") String content
); );
/**
* 开播获取机器人状态和心愿单状态
*/
@GET("/api/public/?service=Live.getLiveStetUpStatus")
Observable<ResponseModel<LiveStetUpStatusModel>> getLiveStetUpStatus(
@Query("liveuid") String liveUid
);
} }

View File

@ -7,7 +7,6 @@ import android.text.TextUtils;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import com.cosmos.baseutil.app.AppContext;
import com.google.gson.Gson; import com.google.gson.Gson;
import com.lzf.easyfloat.EasyFloat; import com.lzf.easyfloat.EasyFloat;
import com.yunbao.common.CommonAppContext; import com.yunbao.common.CommonAppContext;
@ -39,7 +38,25 @@ public class IMLoginManager extends BaseCacheManager {
private final String IS_FLOAT = "is_float"; private final String IS_FLOAT = "is_float";
private final String IS_HINT = "is_hint"; private final String IS_HINT = "is_hint";
private final String IS_HINT2 = "is_hint2"; private final String IS_HINT2 = "is_hint2";
private final String SELECT_CLARITY = "selectClarity";
/**
* 设置清晰度
*
* @param selectClarity
*/
public void setSelectClarity(int selectClarity) {
put(SELECT_CLARITY, selectClarity);
}
/**
* 获取清晰度
*
* @return
*/
public int getSelectClarity() {
return getInt(SELECT_CLARITY, 1);
}
public boolean isHint() { public boolean isHint() {
return 1 == getInt(IS_HINT, 0); return 1 == getInt(IS_HINT, 0);

View File

@ -4,6 +4,7 @@ import android.content.Context;
import android.text.TextUtils; import android.text.TextUtils;
import android.view.View; import android.view.View;
import android.widget.EditText; import android.widget.EditText;
import android.widget.TextView;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
@ -17,14 +18,17 @@ import com.yunbao.common.utils.ToastUtil;
*/ */
public class InputCustomPopup extends CenterPopupView { public class InputCustomPopup extends CenterPopupView {
private String message = ""; private String message = "";
private int title = R.string.dialog_tip;
public InputCustomPopup(@NonNull Context context, String message) { public InputCustomPopup(@NonNull Context context, String message, int title) {
super(context); super(context);
this.message = message; this.message = message;
this.title = title;
} }
public InputCustomPopup(@NonNull Context context) { public InputCustomPopup(@NonNull Context context,int title) {
super(context); super(context);
this.title = title;
} }
// 返回自定义弹窗的布局 // 返回自定义弹窗的布局
@ -38,7 +42,9 @@ public class InputCustomPopup extends CenterPopupView {
protected void onCreate() { protected void onCreate() {
super.onCreate(); super.onCreate();
EditText content = findViewById(R.id.content); EditText content = findViewById(R.id.content);
TextView titleText = findViewById(R.id.title);
content.setText(message); content.setText(message);
titleText.setText(title);
findViewById(R.id.btn_cancel).setOnClickListener(new OnClickListener() { findViewById(R.id.btn_cancel).setOnClickListener(new OnClickListener() {
@Override @Override
public void onClick(View v) { public void onClick(View v) {

View File

@ -0,0 +1,116 @@
package com.yunbao.common.views;
import android.content.Context;
import android.view.View;
import android.widget.ImageView;
import android.widget.RelativeLayout;
import androidx.annotation.NonNull;
import com.lxj.xpopup.core.BottomPopupView;
import com.yunbao.common.R;
import com.yunbao.common.views.weight.ViewClicksAntiShake;
public class LiveClarityCustomPopup extends BottomPopupView implements View.OnClickListener {
private int selectClarity = 1;
private RelativeLayout lineSd, lineHd, lineFhd;
private ImageView iconSd, iconHd, iconFhd;
public int getSelectClarity() {
return selectClarity;
}
public LiveClarityCustomPopup(@NonNull Context context, int selectClarity) {
super(context);
this.selectClarity = selectClarity;
}
public LiveClarityCustomPopup(@NonNull Context context) {
super(context);
}
@Override
public void onClick(View v) {
}
// 返回自定义弹窗的布局
@Override
protected int getImplLayoutId() {
return R.layout.dialog_live_clarity;
}
// 执行初始化操作比如findView设置点击或者任何你弹窗内的业务逻辑
@Override
protected void onCreate() {
super.onCreate();
initView();
initDate();
}
private void initView() {
lineSd = findViewById(R.id.line_sd);
lineHd = findViewById(R.id.line_hd);
lineFhd = findViewById(R.id.line_fhd);
iconSd = findViewById(R.id.icon_sd);
iconHd = findViewById(R.id.icon_hd);
iconFhd = findViewById(R.id.icon_fhd);
selectClarity(selectClarity);
//流畅
ViewClicksAntiShake.clicksAntiShake(lineSd, () -> {
selectClarity = 0;
selectClarity(selectClarity);
dismiss();
});
//高清
ViewClicksAntiShake.clicksAntiShake(lineHd, () -> {
selectClarity = 1;
selectClarity(selectClarity);
dismiss();
});
//超高清
ViewClicksAntiShake.clicksAntiShake(lineFhd, () -> {
selectClarity = 2;
selectClarity(selectClarity);
dismiss();
});
}
/**
* 状态选择
*
* @param selectClarity
*/
private void selectClarity(int selectClarity) {
switch (selectClarity) {
case 0:
lineSd.setSelected(true);
lineHd.setSelected(false);
lineFhd.setSelected(false);
iconSd.setVisibility(VISIBLE);
iconHd.setVisibility(GONE);
iconFhd.setVisibility(GONE);
break;
case 1:
lineSd.setSelected(false);
lineHd.setSelected(true);
lineFhd.setSelected(false);
iconSd.setVisibility(GONE);
iconHd.setVisibility(VISIBLE);
iconFhd.setVisibility(GONE);
break;
case 2:
lineSd.setSelected(false);
lineHd.setSelected(false);
lineFhd.setSelected(true);
iconSd.setVisibility(GONE);
iconHd.setVisibility(GONE);
iconFhd.setVisibility(VISIBLE);
break;
}
}
private void initDate() {
}
}

View File

@ -136,7 +136,7 @@ public class LiveRobotMessageCustomPopup extends BottomPopupView {
@Override @Override
public void onClick(View v) { public void onClick(View v) {
new XPopup.Builder(getContext()) new XPopup.Builder(getContext())
.asCustom(new InputCustomPopup(getContext()).setListener(new InputCustomPopup.InputCustomListener() { .asCustom(new InputCustomPopup(getContext(),R.string.automatic_message_sending).setListener(new InputCustomPopup.InputCustomListener() {
@Override @Override
public void onConfirm(String text) { public void onConfirm(String text) {
//添加消息语 //添加消息语

View File

@ -82,7 +82,7 @@ public class LiveRobotSayHelloCustomPopup extends BottomPopupView {
@Override @Override
public void onClick(View v) { public void onClick(View v) {
new XPopup.Builder(getContext()) new XPopup.Builder(getContext())
.asCustom(new InputCustomPopup(getContext()).setListener(new InputCustomPopup.InputCustomListener() { .asCustom(new InputCustomPopup(getContext(), R.string.automatic_greeting_setting).setListener(new InputCustomPopup.InputCustomListener() {
@Override @Override
public void onConfirm(String text) { public void onConfirm(String text) {
//添加消息语 //添加消息语

View File

@ -53,7 +53,7 @@ public class RobotMessageViewHolder extends RecyclerView.ViewHolder {
@Override @Override
public void onClick(View v) { public void onClick(View v) {
new XPopup.Builder(itemView.getContext()) new XPopup.Builder(itemView.getContext())
.asCustom(new InputCustomPopup(itemView.getContext(), message.getContent()).setListener(new InputCustomPopup.InputCustomListener() { .asCustom(new InputCustomPopup(itemView.getContext(), message.getContent(), R.string.automatic_message_sending).setListener(new InputCustomPopup.InputCustomListener() {
@Override @Override
public void onConfirm(String text) { public void onConfirm(String text) {
LiveNetManager.get(itemView.getContext()) LiveNetManager.get(itemView.getContext())

View File

@ -53,7 +53,7 @@ public class RobotSayHelloViewHoler extends RecyclerView.ViewHolder {
@Override @Override
public void onClick(View v) { public void onClick(View v) {
new XPopup.Builder(itemView.getContext()) new XPopup.Builder(itemView.getContext())
.asCustom(new InputCustomPopup(itemView.getContext(), message.getContent()).setListener(new InputCustomPopup.InputCustomListener() { .asCustom(new InputCustomPopup(itemView.getContext(), message.getContent(), R.string.automatic_greeting_setting).setListener(new InputCustomPopup.InputCustomListener() {
@Override @Override
public void onConfirm(String text) { public void onConfirm(String text) {
LiveNetManager.get(itemView.getContext()) LiveNetManager.get(itemView.getContext())

View File

@ -0,0 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_selected="true">
<shape>
<corners android:radius="8dp" />
<solid android:color="#20FFB2B2" />
</shape>
</item>
<item android:state_selected="false">
<shape>
<corners android:radius="8dp" />
<solid android:color="#407792D0" />
</shape>
</item>
</selector>

View File

@ -0,0 +1,139 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="249dp"
android:background="@drawable/bg_live_tota"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:gravity="center_vertical">
<RelativeLayout
android:id="@+id/line_sd"
android:layout_width="0dp"
android:layout_height="137dp"
android:layout_marginStart="10dp"
android:layout_weight="1"
android:background="@drawable/bg_btn_definition"
android:orientation="vertical">
<ImageView
android:id="@+id/icon_sd"
android:layout_width="14dp"
android:layout_height="14dp"
android:layout_alignParentEnd="true"
android:layout_marginStart="10dp"
android:layout_marginTop="10dp"
android:layout_marginEnd="10dp"
android:layout_marginBottom="10dp"
android:src="@mipmap/icon_selected" />
<ImageView
android:id="@+id/sd"
android:layout_width="32dp"
android:layout_height="32dp"
android:layout_centerHorizontal="true"
android:layout_marginTop="39dp"
android:src="@mipmap/icon_sd" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/sd"
android:layout_centerInParent="true"
android:layout_marginTop="4dp"
android:text="@string/standard_clear"
android:textColor="#F6F7FB"
android:textSize="16sp" />
</RelativeLayout>
<RelativeLayout
android:id="@+id/line_hd"
android:layout_width="0dp"
android:layout_height="137dp"
android:layout_marginStart="10dp"
android:layout_weight="1"
android:background="@drawable/bg_btn_definition"
android:orientation="vertical">
<ImageView
android:id="@+id/icon_hd"
android:layout_width="14dp"
android:layout_height="14dp"
android:layout_alignParentEnd="true"
android:layout_margin="10dp"
android:src="@mipmap/icon_selected" />
<ImageView
android:id="@+id/hd"
android:layout_width="32dp"
android:layout_height="32dp"
android:layout_centerHorizontal="true"
android:layout_marginTop="39dp"
android:src="@mipmap/icon_hd" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/hd"
android:layout_centerHorizontal="true"
android:layout_marginTop="4dp"
android:text="@string/high_definition"
android:textColor="#F6F7FB"
android:textSize="16sp" />
</RelativeLayout>
<RelativeLayout
android:id="@+id/line_fhd"
android:layout_width="0dp"
android:layout_height="137dp"
android:layout_marginStart="10dp"
android:layout_marginEnd="10dp"
android:layout_weight="1"
android:background="@drawable/bg_btn_definition"
android:orientation="vertical">
<ImageView
android:id="@+id/icon_fhd"
android:layout_width="14dp"
android:layout_height="14dp"
android:layout_alignParentEnd="true"
android:layout_margin="10dp"
android:src="@mipmap/icon_selected" />
<ImageView
android:id="@+id/fhd"
android:layout_width="32dp"
android:layout_height="32dp"
android:layout_centerHorizontal="true"
android:layout_marginTop="39dp"
android:src="@mipmap/icon_fhd" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/fhd"
android:layout_centerHorizontal="true"
android:layout_marginTop="4dp"
android:text="@string/ultra_hd"
android:textColor="#F6F7FB"
android:textSize="16sp" />
</RelativeLayout>
</LinearLayout>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginBottom="30dp"
android:text="@string/clarity_hint"
android:textColor="#FFFFFF"
android:textSize="12sp" />
</LinearLayout>

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

View File

@ -996,4 +996,8 @@
<string name="robot_add_content_hint3" translatable="false">當有用戶進入直播間時,機器人會@該用戶並自動</string> <string name="robot_add_content_hint3" translatable="false">當有用戶進入直播間時,機器人會@該用戶並自動</string>
<string name="robot_add_content_hint4" translatable="false">隨機以下一句話。最少設置1條最多20條。</string> <string name="robot_add_content_hint4" translatable="false">隨機以下一句話。最少設置1條最多20條。</string>
<string name="robot_setup" translatable="false">機器人設置</string> <string name="robot_setup" translatable="false">機器人設置</string>
<string name="high_definition" translatable="false">高清</string>
<string name="standard_clear" translatable="false">流暢</string>
<string name="ultra_hd" translatable="false">超高清</string>
<string name="clarity_hint" translatable="false">確定清晰度開播後,需要重新開播才能更改</string>
</resources> </resources>

View File

@ -10,9 +10,9 @@ ext {
manifestPlaceholders = [ manifestPlaceholders = [
// //
serverHost : "https://napi.yaoulive.com", // serverHost : "https://napi.yaoulive.com",
// //
// serverHost : "https://ceshi.yaoulive.com", serverHost : "https://ceshi.yaoulive.com",
// //
txMapAppKey : "EOZBZ-ASLCU-4XPV3-BDCHZ-4E3Q7-H4BWB", txMapAppKey : "EOZBZ-ASLCU-4XPV3-BDCHZ-4E3Q7-H4BWB",

View File

@ -918,6 +918,10 @@ public class LiveRyAnchorActivity extends LiveActivity implements LiveFunctionCl
LiveHttpUtil.stopLive(mStream, new HttpCallback() { LiveHttpUtil.stopLive(mStream, new HttpCallback() {
@Override @Override
public void onSuccess(int code, String msg, String[] info) { public void onSuccess(int code, String msg, String[] info) {
if (robotRunnable != null) {
robotHandler.removeCallbacks(robotRunnable);
robotRunnable = null;
}
if (code == 0) { if (code == 0) {
JSONObject obj = JSON.parseObject(info[0]); JSONObject obj = JSON.parseObject(info[0]);
JSONObject datas = obj.getJSONObject("data"); JSONObject datas = obj.getJSONObject("data");
@ -1622,7 +1626,10 @@ public class LiveRyAnchorActivity extends LiveActivity implements LiveFunctionCl
@Override @Override
public void onSuccess(List<LiveAiRobotBean.Message> messageList) { public void onSuccess(List<LiveAiRobotBean.Message> messageList) {
Random random = new Random(); Random random = new Random();
int randNumber = random.nextInt(messageList.size() - 1) - 1; int randNumber = random.nextInt(messageList.size()) - 1;
if (randNumber < 0) {
randNumber = 0;
}
Log.e("随机打招呼", "(((((((((((((((((((((((((((((((((((((((((((((((data.randNumber())" + randNumber); Log.e("随机打招呼", "(((((((((((((((((((((((((((((((((((((((((((((((data.randNumber())" + randNumber);
Log.e("随机打招呼", "(((((((((((((((((((((((((((((((((((((((((((((((data)" + messageList.toString()); Log.e("随机打招呼", "(((((((((((((((((((((((((((((((((((((((((((((((data)" + messageList.toString());
sendRobotMessage(robotName, messageList.get(randNumber).getContent()); sendRobotMessage(robotName, messageList.get(randNumber).getContent());
@ -1673,7 +1680,7 @@ public class LiveRyAnchorActivity extends LiveActivity implements LiveFunctionCl
.setContent(content); .setContent(content);
SocketSendBean msg = SocketSendBean msg =
new SocketSendBean() new SocketSendBean()
.param("_method_", "aiAutomaticSpeech") .param("_method_", "aiAutomaticSpeechNew")
.param("msgtype", "10") .param("msgtype", "10")
.param("ct", GsonUtils.toJson(aiAutomaticSpeechModel, AiAutomaticSpeechModel.class)); .param("ct", GsonUtils.toJson(aiAutomaticSpeechModel, AiAutomaticSpeechModel.class));
msg.create(); msg.create();

View File

@ -529,6 +529,7 @@ public class SocketRyClient {
} }
break; break;
case Constants.AI_AUTOMATIC_SPEECH: case Constants.AI_AUTOMATIC_SPEECH:
case Constants.AI_AUTOMATIC_SPEECH_LIVE:
//{"name_color":"#f19ec2","ai_name":"助手小小P","content":"@1 ","user_name":"1","icon":"https://downs.yaoulive.com/xzs_tab.png","system_bubble":"https://downs.yaoulive.com/xzs_qipao.9.png"} //{"name_color":"#f19ec2","ai_name":"助手小小P","content":"@1 ","user_name":"1","icon":"https://downs.yaoulive.com/xzs_tab.png","system_bubble":"https://downs.yaoulive.com/xzs_qipao.9.png"}
AiAutomaticSpeechModel aiAutomaticSpeechModel = GsonUtils.fromJson(map.getString("ct"), AiAutomaticSpeechModel.class); AiAutomaticSpeechModel aiAutomaticSpeechModel = GsonUtils.fromJson(map.getString("ct"), AiAutomaticSpeechModel.class);
Bus.get().post(new LiveAudienceEvent() Bus.get().post(new LiveAudienceEvent()

View File

@ -11,12 +11,15 @@ import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
import android.view.inputmethod.InputMethodManager; import android.view.inputmethod.InputMethodManager;
import android.widget.EditText; import android.widget.EditText;
import android.widget.ImageView;
import android.widget.TextView; import android.widget.TextView;
import androidx.constraintlayout.widget.ConstraintLayout; import androidx.constraintlayout.widget.ConstraintLayout;
import androidx.core.content.ContextCompat; import androidx.core.content.ContextCompat;
import com.lxj.xpopup.XPopup; import com.lxj.xpopup.XPopup;
import com.lxj.xpopup.core.BasePopupView;
import com.lxj.xpopup.interfaces.XPopupCallback;
import com.yunbao.common.CommonAppConfig; import com.yunbao.common.CommonAppConfig;
import com.yunbao.common.Constants; import com.yunbao.common.Constants;
import com.yunbao.common.bean.LiveClassBean; import com.yunbao.common.bean.LiveClassBean;
@ -25,6 +28,7 @@ import com.yunbao.common.glide.ImgLoader;
import com.yunbao.common.http.HttpCallback; import com.yunbao.common.http.HttpCallback;
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.utils.DialogUitl; import com.yunbao.common.utils.DialogUitl;
import com.yunbao.common.utils.L; import com.yunbao.common.utils.L;
import com.yunbao.common.utils.ProcessImageUtil; import com.yunbao.common.utils.ProcessImageUtil;
@ -32,7 +36,9 @@ 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.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.LiveRobotSettingCustomPopup; import com.yunbao.common.views.LiveRobotSettingCustomPopup;
import com.yunbao.common.views.weight.ViewClicksAntiShake;
import com.yunbao.faceunity.FaceManager; import com.yunbao.faceunity.FaceManager;
import com.yunbao.live.R; import com.yunbao.live.R;
import com.yunbao.live.activity.LiveActivity; import com.yunbao.live.activity.LiveActivity;
@ -59,7 +65,7 @@ public class LiveNewReadyRyViewHolder extends AbsViewHolder implements View.OnCl
private ProcessImageUtil mImageUtil; private ProcessImageUtil mImageUtil;
private File mAvatarFile; private File mAvatarFile;
private TextView mLiveClass; private TextView mLiveClass;
private TextView mLiveTypeTextView;//房间类型TextView private TextView mLiveTypeTextView, liveClarity;//房间类型TextView
private TextView mLiveWishListTextView;//心愿单TextView private TextView mLiveWishListTextView;//心愿单TextView
private int mLiveClassID;//直播频道id private int mLiveClassID;//直播频道id
private int mLiveType;//房间类型 private int mLiveType;//房间类型
@ -70,6 +76,8 @@ public class LiveNewReadyRyViewHolder extends AbsViewHolder implements View.OnCl
private LiveClassBean classBean; private LiveClassBean classBean;
private FaceManager manager; private FaceManager manager;
private TextView faceTextView;//提示人脸未检测到的TextView private TextView faceTextView;//提示人脸未检测到的TextView
private ImageView imgClarity;
private int selectClarity = 1;
public LiveNewReadyRyViewHolder(Context context, ViewGroup parentView, int liveSdk) { public LiveNewReadyRyViewHolder(Context context, ViewGroup parentView, int liveSdk) {
super(context, parentView, liveSdk); super(context, parentView, liveSdk);
@ -90,6 +98,8 @@ public class LiveNewReadyRyViewHolder extends AbsViewHolder implements View.OnCl
@Override @Override
public void init() { public void init() {
mRootView = (ConstraintLayout) findViewById(R.id.traceroute_rootview); mRootView = (ConstraintLayout) findViewById(R.id.traceroute_rootview);
imgClarity = (ImageView) findViewById(R.id.img_clarity);
liveClarity = (TextView) findViewById(R.id.live_clarity);
mRootView.setOnClickListener(new View.OnClickListener() { mRootView.setOnClickListener(new View.OnClickListener() {
@Override @Override
public void onClick(View view) { public void onClick(View view) {
@ -163,6 +173,7 @@ public class LiveNewReadyRyViewHolder extends AbsViewHolder implements View.OnCl
findViewById(R.id.btn_start_live).setOnClickListener(this); findViewById(R.id.btn_start_live).setOnClickListener(this);
findViewById(R.id.btn_wishlist).setOnClickListener(this); findViewById(R.id.btn_wishlist).setOnClickListener(this);
findViewById(R.id.btn_horizontally).setOnClickListener(this); findViewById(R.id.btn_horizontally).setOnClickListener(this);
if (manager != null) { if (manager != null) {
manager.setFaceStatusChanged(new FaceManager.FaceStatusChanged() { manager.setFaceStatusChanged(new FaceManager.FaceStatusChanged() {
final Handler handler = new Handler(Looper.getMainLooper()); final Handler handler = new Handler(Looper.getMainLooper());
@ -180,6 +191,83 @@ public class LiveNewReadyRyViewHolder extends AbsViewHolder implements View.OnCl
}); });
//新美颜 //新美颜
setFaceUnity(true); setFaceUnity(true);
}
//设置清晰度
selectClarity = IMLoginManager.get(mContext).getSelectClarity();
setSelectClarity(selectClarity);
ViewClicksAntiShake
.clicksAntiShake(
findViewById(R.id.btn_live_clarity), () -> {
LiveClarityCustomPopup liveClarityCustomPopup = new LiveClarityCustomPopup(mContext, selectClarity);
new XPopup.Builder(mContext)
.setPopupCallback(new XPopupCallback() {
@Override
public void onCreated(BasePopupView popupView) {
}
@Override
public void beforeShow(BasePopupView popupView) {
}
@Override
public void onShow(BasePopupView popupView) {
}
@Override
public void onDismiss(BasePopupView popupView) {
setSelectClarity(liveClarityCustomPopup.getSelectClarity());
}
@Override
public void beforeDismiss(BasePopupView popupView) {
}
@Override
public boolean onBackPressed(BasePopupView popupView) {
return false;
}
@Override
public void onKeyBoardStateChanged(BasePopupView popupView, int height) {
}
@Override
public void onDrag(BasePopupView popupView, int value, float percent, boolean upOrLeft) {
}
@Override
public void onClickOutside(BasePopupView popupView) {
}
})
.asCustom(liveClarityCustomPopup)
.show();
});
}
private void setSelectClarity(int selectClarity) {
this.selectClarity = selectClarity;
IMLoginManager.get(mContext).setSelectClarity(selectClarity);
switch (selectClarity) {
case 0:
imgClarity.setImageResource(R.mipmap.icon_sd);
liveClarity.setText(R.string.standard_clear);
break;
case 1:
imgClarity.setImageResource(R.mipmap.icon_hd);
liveClarity.setText(R.string.high_definition);
break;
case 2:
imgClarity.setImageResource(R.mipmap.icon_fhd);
liveClarity.setText(R.string.ultra_hd);
break;
} }
} }

View File

@ -54,6 +54,43 @@
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"> app:layout_constraintTop_toTopOf="parent">
<LinearLayout
android:id="@+id/btn_live_clarity"
android:layout_width="wrap_content"
android:layout_height="25dp"
android:layout_marginStart="16dp"
android:layout_marginTop="10dp"
android:gravity="center"
android:orientation="horizontal"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">
<ImageView
android:id="@+id/img_clarity"
android:layout_width="18dp"
android:layout_height="18dp"
android:layout_weight="1"
app:srcCompat="@mipmap/icon_fhd" />
<TextView
android:id="@+id/live_clarity"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="5dp"
android:layout_marginEnd="4dp"
android:layout_weight="1"
android:text="@string/high_definition"
android:textColor="@color/white"
android:textSize="12sp" />
<ImageView
android:layout_width="5dp"
android:layout_height="10dp"
android:layout_weight="1"
android:scaleType="centerCrop"
android:src="@mipmap/icon_live_more" />
</LinearLayout>
<LinearLayout <LinearLayout
android:id="@+id/btn_room_type" android:id="@+id/btn_room_type"
android:layout_width="wrap_content" android:layout_width="wrap_content"
@ -62,7 +99,7 @@
android:layout_marginTop="10dp" android:layout_marginTop="10dp"
android:gravity="center" android:gravity="center"
android:orientation="horizontal" android:orientation="horizontal"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toEndOf="@id/btn_live_clarity"
app:layout_constraintTop_toTopOf="parent"> app:layout_constraintTop_toTopOf="parent">
<ImageView <ImageView
@ -94,11 +131,11 @@
android:id="@+id/btn_live_class" android:id="@+id/btn_live_class"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="25dp" android:layout_height="25dp"
android:layout_marginStart="75dp"
android:layout_marginTop="10dp" android:layout_marginTop="10dp"
android:layout_marginEnd="16dp"
android:gravity="center" android:gravity="center"
android:orientation="horizontal" android:orientation="horizontal"
app:layout_constraintStart_toEndOf="@+id/btn_room_type" app:layout_constraintEnd_toStartOf="@+id/btn_wishlist"
app:layout_constraintTop_toTopOf="parent"> app:layout_constraintTop_toTopOf="parent">
<TextView <TextView