Merge branch 'master' into dev_tmp
# Conflicts: # main/src/main/java/com/yunbao/main/views/MainHomeViewHolder.java
This commit is contained in:
commit
0f9bd6aa3c
@ -299,7 +299,7 @@
|
||||
<string name="beautify_hip_slim">Hip</string>
|
||||
<string name="beautify_head_slim">Head shrink</string>
|
||||
<string name="beautify_leg_thin_slim">Thin leg</string>
|
||||
<string name="toast_not_detect_body">No body tracking</string>
|
||||
<string name="toast_not_detect_body">No message tracking</string>
|
||||
<string name="pta_human_full_body">Body driver</string>
|
||||
<string name="pta_human_half_body">Bust driver</string>
|
||||
|
||||
|
@ -89,20 +89,23 @@ public class CustomMessageReceiver extends PushMessageReceiver {
|
||||
public boolean onNotificationMessageArrived(Context context, PushType pushType, PushNotificationMessage notificationMessage) {
|
||||
Log.i("gmc", notificationMessage.getPushContent() + "VVV" + notificationMessage.getPushTitle() + "gmc11112222" + notificationMessage.getExtra());
|
||||
if (!SpUtil.getInstance().getBooleanValue("NOTIFICATION")) {
|
||||
Activity activity = AppContext.activityWeakReference.get();
|
||||
if (activity != null) {
|
||||
DialogUitl.showSimpleDialog(activity, "应用需要通知权限", new DialogUitl.SimpleCallback() {
|
||||
@Override
|
||||
public void onConfirmClick(Dialog dialog, String content) {
|
||||
Intent intent = new Intent();
|
||||
intent.setAction("android.settings.APP_NOTIFICATION_SETTINGS");
|
||||
intent.putExtra("app_package", context.getPackageName());
|
||||
intent.putExtra("app_uid", context.getApplicationInfo().uid);
|
||||
// for Android 8 and above
|
||||
intent.putExtra("android.provider.extra.APP_PACKAGE", context.getPackageName());
|
||||
activity.startActivity(intent);
|
||||
}
|
||||
});
|
||||
if (AppContext.activityWeakReference != null) {
|
||||
Activity activity = AppContext.activityWeakReference.get();
|
||||
if (activity != null) {
|
||||
DialogUitl.showSimpleDialog(activity, "应用需要通知权限", new DialogUitl.SimpleCallback() {
|
||||
@Override
|
||||
public void onConfirmClick(Dialog dialog, String content) {
|
||||
Intent intent = new Intent();
|
||||
intent.setAction("android.settings.APP_NOTIFICATION_SETTINGS");
|
||||
intent.putExtra("app_package", context.getPackageName());
|
||||
intent.putExtra("app_uid", context.getApplicationInfo().uid);
|
||||
// for Android 8 and above
|
||||
intent.putExtra("android.provider.extra.APP_PACKAGE", context.getPackageName());
|
||||
activity.startActivity(intent);
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
if (notificationMessage.getExtra() == null) {
|
||||
|
@ -133,6 +133,7 @@ public class Constants {
|
||||
public static final int LIVE_FUNC_WKS = 2014;//語音
|
||||
public static final int LIVE_FUNC_ZSLK = 2015;//語音
|
||||
public static final int LIVE_FUNC_RANDOM_PK = 2016;//随机PK
|
||||
public static final int LIVE_ROBOT= 2017;//机器人
|
||||
|
||||
//socket
|
||||
public static final String SOCKET_CONN = "conn";
|
||||
|
@ -0,0 +1,51 @@
|
||||
package com.yunbao.common.adapter;
|
||||
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.yunbao.common.R;
|
||||
import com.yunbao.common.bean.LiveAiRobotBean;
|
||||
import com.yunbao.common.views.RobotMessageViewHolder;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class RobotMessageAdapter extends RecyclerView.Adapter {
|
||||
private List<LiveAiRobotBean.Message> messageList = new ArrayList<>();
|
||||
|
||||
@Override
|
||||
public RecyclerView.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
||||
View robotMessageView = LayoutInflater.from(parent.getContext()).inflate(R.layout.view_robot_message, parent, false);
|
||||
return new RobotMessageViewHolder(robotMessageView);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBindViewHolder(@NonNull RecyclerView.ViewHolder holder, int position) {
|
||||
RobotMessageViewHolder messageViewHolder = (RobotMessageViewHolder) holder;
|
||||
messageViewHolder.setData(messageList.get(position), position + 1);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemCount() {
|
||||
return messageList.size();
|
||||
}
|
||||
|
||||
|
||||
public void setDataAll(List<LiveAiRobotBean.Message> messages) {
|
||||
messageList.clear();
|
||||
messageList.addAll(messages);
|
||||
notifyDataSetChanged();
|
||||
}
|
||||
|
||||
// 删除数据
|
||||
public void removeData(int position) {
|
||||
messageList.remove(position);
|
||||
//删除动画
|
||||
notifyItemRemoved(position);
|
||||
}
|
||||
}
|
@ -0,0 +1,51 @@
|
||||
package com.yunbao.common.adapter;
|
||||
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.yunbao.common.R;
|
||||
import com.yunbao.common.bean.LiveAiRobotBean;
|
||||
import com.yunbao.common.views.RobotSayHelloViewHoler;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class RobotSayHelloAdapter extends RecyclerView.Adapter {
|
||||
private List<LiveAiRobotBean.Message> messageList = new ArrayList<>();
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public RecyclerView.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
||||
View robotSayHelloView = LayoutInflater.from(parent.getContext()).inflate(R.layout.view_robot_message, parent, false);
|
||||
return new RobotSayHelloViewHoler(robotSayHelloView);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBindViewHolder(@NonNull RecyclerView.ViewHolder holder, int position) {
|
||||
RobotSayHelloViewHoler robotSayHelloViewHoler = (RobotSayHelloViewHoler) holder;
|
||||
robotSayHelloViewHoler.setData(messageList.get(position), position + 1);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemCount() {
|
||||
return messageList.size();
|
||||
}
|
||||
|
||||
|
||||
public void setDataAll(List<LiveAiRobotBean.Message> messages) {
|
||||
messageList.clear();
|
||||
messageList.addAll(messages);
|
||||
notifyDataSetChanged();
|
||||
}
|
||||
|
||||
// 删除数据
|
||||
public void removeData(int position) {
|
||||
messageList.remove(position);
|
||||
//删除动画
|
||||
notifyItemRemoved(position);
|
||||
}
|
||||
}
|
@ -1,10 +1,18 @@
|
||||
package com.yunbao.common.bean;
|
||||
|
||||
|
||||
public class HttpCallbackModel extends BaseModel{
|
||||
public class HttpCallbackModel extends BaseModel {
|
||||
private int code;
|
||||
private String msg;
|
||||
|
||||
public HttpCallbackModel() {
|
||||
}
|
||||
|
||||
public HttpCallbackModel(int code, String msg) {
|
||||
this.code = code;
|
||||
this.msg = msg;
|
||||
}
|
||||
|
||||
public int getCode() {
|
||||
return code;
|
||||
}
|
||||
|
138
common/src/main/java/com/yunbao/common/bean/LiveAiRobotBean.java
Normal file
138
common/src/main/java/com/yunbao/common/bean/LiveAiRobotBean.java
Normal file
@ -0,0 +1,138 @@
|
||||
package com.yunbao.common.bean;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
/**
|
||||
* 机器人bean
|
||||
*/
|
||||
public class LiveAiRobotBean extends BaseModel {
|
||||
@SerializedName("ai_name")
|
||||
private String name;
|
||||
@SerializedName("ai_state")
|
||||
private int status;//1=开 0=关
|
||||
@SerializedName("ai_time")
|
||||
private int time;
|
||||
@SerializedName("ai_sayhi")
|
||||
private int autoSeyHiNumber;// 自动打招呼已配置数量
|
||||
@SerializedName("ai_gz")
|
||||
private int autoRequestFollowNumber;//自动求关注已配置数量
|
||||
|
||||
public LiveAiRobotBean() {
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public int getStatus() {
|
||||
return status;
|
||||
}
|
||||
|
||||
public void setStatus(int status) {
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
public int getTime() {
|
||||
return time;
|
||||
}
|
||||
|
||||
public void setTime(int time) {
|
||||
this.time = time;
|
||||
}
|
||||
|
||||
public int getAutoSeyHiNumber() {
|
||||
return autoSeyHiNumber;
|
||||
}
|
||||
|
||||
public void setAutoSeyHiNumber(int autoSeyHiNumber) {
|
||||
this.autoSeyHiNumber = autoSeyHiNumber;
|
||||
}
|
||||
|
||||
public int getAutoRequestFollowNumber() {
|
||||
return autoRequestFollowNumber;
|
||||
}
|
||||
|
||||
public void setAutoRequestFollowNumber(int autoRequestFollowNumber) {
|
||||
this.autoRequestFollowNumber = autoRequestFollowNumber;
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public String toString() {
|
||||
return "LiveAiRobotBean{" +
|
||||
"name='" + name + '\'' +
|
||||
", status=" + status +
|
||||
", time=" + time +
|
||||
", autoSeyHiNumber=" + autoSeyHiNumber +
|
||||
", autoRequestFollowNumber=" + autoRequestFollowNumber +
|
||||
'}';
|
||||
}
|
||||
|
||||
/**
|
||||
* 机器人消息
|
||||
*/
|
||||
public static class Message {
|
||||
public static final int TYPE_SAY_HI=1;//自动打招呼
|
||||
public static final int TYPE_FOLLOW=3;//自动求关注
|
||||
@SerializedName("id")
|
||||
private int id;
|
||||
@SerializedName("uid")
|
||||
private int uid;
|
||||
@SerializedName("type")
|
||||
private int type;
|
||||
@SerializedName("content")
|
||||
private String content;
|
||||
|
||||
public Message() {
|
||||
}
|
||||
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(int id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public int getUid() {
|
||||
return uid;
|
||||
}
|
||||
|
||||
public void setUid(int uid) {
|
||||
this.uid = uid;
|
||||
}
|
||||
|
||||
public int getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public void setType(int type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public String getContent() {
|
||||
return content;
|
||||
}
|
||||
|
||||
public void setContent(String content) {
|
||||
this.content = content;
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public String toString() {
|
||||
return "Message{" +
|
||||
"id=" + id +
|
||||
", uid=" + uid +
|
||||
", type=" + type +
|
||||
", content='" + content + '\'' +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,16 @@
|
||||
package com.yunbao.common.event;
|
||||
|
||||
import com.yunbao.common.bean.BaseModel;
|
||||
|
||||
public class LiveRobotMessageEvent extends BaseModel {
|
||||
private int index = -1;
|
||||
|
||||
public int getIndex() {
|
||||
return index;
|
||||
}
|
||||
|
||||
public LiveRobotMessageEvent setIndex(int index) {
|
||||
this.index = index;
|
||||
return this;
|
||||
}
|
||||
}
|
@ -0,0 +1,16 @@
|
||||
package com.yunbao.common.event;
|
||||
|
||||
import com.yunbao.common.bean.BaseModel;
|
||||
|
||||
public class LiveRobotSayHelloEvent extends BaseModel {
|
||||
private int index = -1;
|
||||
|
||||
public int getIndex() {
|
||||
return index;
|
||||
}
|
||||
|
||||
public LiveRobotSayHelloEvent setIndex(int index) {
|
||||
this.index = index;
|
||||
return this;
|
||||
}
|
||||
}
|
@ -9,8 +9,10 @@ import com.yunbao.common.bean.CustomSidebarInfoModel;
|
||||
import com.yunbao.common.bean.EnterRoomNewModel;
|
||||
import com.yunbao.common.bean.FaceBookUpModel;
|
||||
import com.yunbao.common.bean.HourRank;
|
||||
import com.yunbao.common.bean.HttpCallbackModel;
|
||||
import com.yunbao.common.bean.IMLoginModel;
|
||||
import com.yunbao.common.bean.LinkMicUserBeanV2;
|
||||
import com.yunbao.common.bean.LiveAiRobotBean;
|
||||
import com.yunbao.common.bean.LiveInfoModel;
|
||||
import com.yunbao.common.bean.LiveRoomActivityBanner;
|
||||
import com.yunbao.common.bean.MsgSwitchDetailModel;
|
||||
@ -18,10 +20,10 @@ import com.yunbao.common.bean.NewPeopleInfo;
|
||||
import com.yunbao.common.bean.NobleRankHideUserListModel;
|
||||
import com.yunbao.common.bean.NobleTrumpetModel;
|
||||
import com.yunbao.common.bean.PkRankBean;
|
||||
import com.yunbao.common.bean.RandomPkUserBean;
|
||||
import com.yunbao.common.bean.RankPkInfoBean;
|
||||
import com.yunbao.common.bean.PrankGiftBean;
|
||||
import com.yunbao.common.bean.PrankHttpTurntableBean;
|
||||
import com.yunbao.common.bean.RandomPkUserBean;
|
||||
import com.yunbao.common.bean.RankPkInfoBean;
|
||||
import com.yunbao.common.bean.SearchModel;
|
||||
import com.yunbao.common.bean.SetAttentsModel;
|
||||
import com.yunbao.common.bean.SlideInBannerModel;
|
||||
@ -29,6 +31,7 @@ import com.yunbao.common.bean.StarChallengeStatusModel;
|
||||
import com.yunbao.common.bean.VipModel;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import io.reactivex.Observable;
|
||||
import retrofit2.http.Field;
|
||||
@ -36,6 +39,7 @@ import retrofit2.http.FormUrlEncoded;
|
||||
import retrofit2.http.GET;
|
||||
import retrofit2.http.POST;
|
||||
import retrofit2.http.Query;
|
||||
import retrofit2.http.QueryMap;
|
||||
|
||||
/**
|
||||
* PDLive网络接口访问
|
||||
@ -354,42 +358,51 @@ public interface PDLiveApi {
|
||||
|
||||
/**
|
||||
* 设置随机PK开关
|
||||
*
|
||||
* @param pk 1=开,0=关
|
||||
*/
|
||||
@GET("/api/public/?service=Livepk.setRandomPKType")
|
||||
Observable<ResponseModel<List<BaseModel>>> changeRandomPkSwitch(@Query("random_pk") int pk);
|
||||
|
||||
/**
|
||||
* 获取自由PK次数
|
||||
*/
|
||||
@GET("/api/public/?service=Livepk.getActivePkNum")
|
||||
Observable<ResponseModel<Integer>> getFreePkNumber();
|
||||
|
||||
/**
|
||||
* 发起随机PK
|
||||
*/
|
||||
@GET("/api/public/?service=Livepk.setRandomPK")
|
||||
Observable<ResponseModel<String>> randomPK();
|
||||
|
||||
/**
|
||||
* 随机PK后调用接口给后台记录
|
||||
*/
|
||||
@GET("/api/public/?service=Livepk.startRandomPK")
|
||||
Observable<ResponseModel<BaseModel>> startRandomPK(@Query("pkuid")String pkuid);
|
||||
Observable<ResponseModel<BaseModel>> startRandomPK(@Query("pkuid") String pkuid);
|
||||
|
||||
/**
|
||||
* 自由PK开始后调用接口扣掉次数
|
||||
*/
|
||||
@GET("/api/public/?service=Livepk.setActivePkNum")
|
||||
Observable<ResponseModel<BaseModel>> setFreePkNum();
|
||||
|
||||
/**
|
||||
* 随机PK搜索用户
|
||||
*
|
||||
* @param cs 简体关键字/uid
|
||||
* @param ct 繁体关键字/uid
|
||||
*/
|
||||
@GET("/api/public/?service=Livepk.searchUser")
|
||||
Observable<ResponseModel<List<RandomPkUserBean>>> randomPkSearchUser(@Query("jian_key")String cs,@Query("fan_key")String ct);
|
||||
Observable<ResponseModel<List<RandomPkUserBean>>> randomPkSearchUser(@Query("jian_key") String cs, @Query("fan_key") String ct);
|
||||
|
||||
/**
|
||||
* 拒绝随机PK
|
||||
*/
|
||||
@GET("/api/public/?service=Livepk.setBanRandomPK")
|
||||
Observable<ResponseModel<BaseModel>> setBanRandomPK();
|
||||
|
||||
/**
|
||||
* 拒绝随机PK
|
||||
*/
|
||||
@ -403,6 +416,7 @@ public interface PDLiveApi {
|
||||
Observable<ResponseModel<PrankHttpTurntableBean>> getAnchorPrankTurntable(
|
||||
@Query("anchor_id") String anchor_id
|
||||
);
|
||||
|
||||
/**
|
||||
* 提交整蛊
|
||||
*/
|
||||
@ -418,6 +432,7 @@ public interface PDLiveApi {
|
||||
@Query("turntable_six") String turntable_six,
|
||||
@Query("status") String status
|
||||
);
|
||||
|
||||
/**
|
||||
* 转盘整蛊结束后调用的接口
|
||||
*/
|
||||
@ -431,7 +446,7 @@ public interface PDLiveApi {
|
||||
* 获取整蛊列表
|
||||
*/
|
||||
@GET("/api/public/?service=Prank.prankList")
|
||||
Observable<ResponseModel<List<PrankGiftBean>>> prankList( @Query("anchor_id") String anchor_id);
|
||||
Observable<ResponseModel<List<PrankGiftBean>>> prankList(@Query("anchor_id") String anchor_id);
|
||||
|
||||
/**
|
||||
* 设置礼物整蛊
|
||||
@ -443,6 +458,7 @@ public interface PDLiveApi {
|
||||
@Query("gift_num") String gift_num,
|
||||
@Query("prank_content") String prank_content
|
||||
);
|
||||
|
||||
/**
|
||||
* 删除礼物整蛊
|
||||
*/
|
||||
@ -451,58 +467,66 @@ public interface PDLiveApi {
|
||||
@Query("anchor_id") String anchor_id,
|
||||
@Query("prank_index") String prank_index
|
||||
);
|
||||
|
||||
/**
|
||||
* 设置机器人开关
|
||||
*/
|
||||
@GET("/api/public/?service=Live.setAnchorAiState")
|
||||
Observable<ResponseModel<List<BaseModel>>> setAnchorAiState(
|
||||
Observable<ResponseModel<HttpCallbackModel>> setAnchorAiState(
|
||||
@Query("ai_state") String ai_state
|
||||
);
|
||||
|
||||
/**
|
||||
* 获取机器人信息
|
||||
*/
|
||||
@GET("/api/public/?service=Live.getAnchorAiState")
|
||||
Observable<ResponseModel<List<BaseModel>>> getAnchorAiState(
|
||||
Observable<ResponseModel<LiveAiRobotBean>> getAnchorAiState(
|
||||
);
|
||||
|
||||
/**
|
||||
* 修改机器人信息
|
||||
*/
|
||||
@GET("/api/public/?service=Live.setAnchorAiState")
|
||||
Observable<ResponseModel<List<BaseModel>>> getAnchorAiState(
|
||||
@Query("name") String name,
|
||||
@Query("value") String value
|
||||
Observable<ResponseModel<Integer>> setAnchorAiState(
|
||||
@QueryMap Map<String, Object> map
|
||||
);
|
||||
/**
|
||||
|
||||
/**
|
||||
* 获取机器人自定义话术
|
||||
* @param type 1(自定义打招呼) 3(自定义求关注)
|
||||
*
|
||||
* @param type 1(自定义打招呼) 3(自定义求关注)
|
||||
*/
|
||||
@GET("/api/public/?service=Live.getAiAutomaticSpeech")
|
||||
Observable<ResponseModel<List<BaseModel>>> getAiAutomaticSpeech(
|
||||
Observable<ResponseModel<List<LiveAiRobotBean.Message>>> getAiAutomaticSpeech(
|
||||
@Query("type") String type
|
||||
);
|
||||
|
||||
/**
|
||||
* 机器人添加话术
|
||||
*/
|
||||
@GET("/api/public/?service=Live.addAiAutomaticSpeech")
|
||||
Observable<ResponseModel<List<BaseModel>>> addAiAutomaticSpeech(
|
||||
Observable<ResponseModel<List<String>>> addAiAutomaticSpeech(
|
||||
@Query("type") String type,
|
||||
@Query("content") String content
|
||||
);
|
||||
|
||||
/**
|
||||
* 机器人删除话术
|
||||
*/
|
||||
@GET("/api/public/?service=Live.delAiAutomaticSpeech ")
|
||||
Observable<ResponseModel<List<BaseModel>>> delAiAutomaticSpeech (
|
||||
@Query("type") String type,
|
||||
@Query("id") String id
|
||||
);
|
||||
/**
|
||||
* 机器人修改话术
|
||||
*/
|
||||
@GET("/api/public/?service=Live.updateAiAutomaticSpeech ")
|
||||
Observable<ResponseModel<List<BaseModel>>> updateAiAutomaticSpeech (
|
||||
Observable<ResponseModel<List<String>>> delAiAutomaticSpeech(
|
||||
@Query("type") String type,
|
||||
@Query("id") String id
|
||||
);
|
||||
|
||||
/**
|
||||
* 机器人修改话术
|
||||
*/
|
||||
@GET("/api/public/?service=Live.updateAiAutomaticSpeech ")
|
||||
Observable<ResponseModel<List<String>>> updateAiAutomaticSpeech(
|
||||
@Query("type") String type,
|
||||
@Query("id") String id,
|
||||
@Query("content") String content
|
||||
);
|
||||
|
||||
}
|
||||
|
@ -14,6 +14,7 @@ import com.yunbao.common.bean.EnterRoomNewModel;
|
||||
import com.yunbao.common.bean.HttpCallbackModel;
|
||||
import com.yunbao.common.bean.LinkMicUserBean;
|
||||
import com.yunbao.common.bean.LinkMicUserBeanV2;
|
||||
import com.yunbao.common.bean.LiveAiRobotBean;
|
||||
import com.yunbao.common.bean.LiveInfoModel;
|
||||
import com.yunbao.common.bean.LiveRoomActivityBanner;
|
||||
import com.yunbao.common.bean.NobleRankHideUserListModel;
|
||||
@ -21,7 +22,6 @@ import com.yunbao.common.bean.NobleTrumpetModel;
|
||||
import com.yunbao.common.bean.PkRankBean;
|
||||
import com.yunbao.common.bean.PrankGiftBean;
|
||||
import com.yunbao.common.bean.PrankHttpTurntableBean;
|
||||
import com.yunbao.common.bean.PrankTurntableBean;
|
||||
import com.yunbao.common.bean.RandomPkUserBean;
|
||||
import com.yunbao.common.bean.RankPkInfoBean;
|
||||
import com.yunbao.common.bean.SetAttentsModel;
|
||||
@ -33,13 +33,14 @@ import com.yunbao.common.http.base.CheckLiveCallBack;
|
||||
import com.yunbao.common.http.base.HttpCallback;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import io.reactivex.android.schedulers.AndroidSchedulers;
|
||||
import io.reactivex.disposables.Disposable;
|
||||
import io.reactivex.functions.Consumer;
|
||||
import io.reactivex.schedulers.Schedulers;
|
||||
import retrofit2.http.Query;
|
||||
|
||||
|
||||
/**
|
||||
@ -879,7 +880,7 @@ public class LiveNetManager {
|
||||
/**
|
||||
* 整蛊结束
|
||||
*/
|
||||
public void endPrankTurntable(String mLiveUid,HttpCallback<BaseModel> callback){
|
||||
public void endPrankTurntable(String mLiveUid, HttpCallback<BaseModel> callback) {
|
||||
API.get().pdLiveApi(mContext)
|
||||
.endPrankTurntable(mLiveUid)
|
||||
.subscribeOn(Schedulers.io())
|
||||
@ -898,6 +899,141 @@ public class LiveNetManager {
|
||||
|
||||
}
|
||||
|
||||
public void getAiRobotStatus(HttpCallback<LiveAiRobotBean> callback) {
|
||||
API.get().pdLiveApi(mContext)
|
||||
.getAnchorAiState()
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(responseModel -> {
|
||||
if (callback != null) {
|
||||
callback.onSuccess(responseModel.getData().getInfo());
|
||||
}
|
||||
}, new Consumer<Throwable>() {
|
||||
@Override
|
||||
public void accept(Throwable throwable) throws Exception {
|
||||
if (callback != null) {
|
||||
callback.onError(throwable.getMessage());
|
||||
}
|
||||
}
|
||||
}).isDisposed();
|
||||
}
|
||||
|
||||
public void setAiRobotStatus(String status, HttpCallback<HttpCallbackModel> callback) {
|
||||
API.get().pdLiveApi(mContext)
|
||||
.setAnchorAiState(status)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(responseModel -> {
|
||||
if (callback != null) {
|
||||
callback.onSuccess(null);
|
||||
}
|
||||
}, new Consumer<Throwable>() {
|
||||
@Override
|
||||
public void accept(Throwable throwable) throws Exception {
|
||||
if (callback != null) {
|
||||
callback.onError(throwable.getMessage());
|
||||
}
|
||||
}
|
||||
}).isDisposed();
|
||||
}
|
||||
|
||||
public void setAiRobotDate(String name, String value, HttpCallback<HttpCallbackModel> callback) {
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
map.put(name, value);
|
||||
API.get().pdLiveApi(mContext)
|
||||
.setAnchorAiState(map)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(responseModel -> {
|
||||
if (callback != null) {
|
||||
callback.onSuccess(null);
|
||||
}
|
||||
}, new Consumer<Throwable>() {
|
||||
@Override
|
||||
public void accept(Throwable throwable) throws Exception {
|
||||
if (callback != null) {
|
||||
callback.onError(throwable.getMessage());
|
||||
}
|
||||
}
|
||||
}).isDisposed();
|
||||
}
|
||||
|
||||
public void getAiRobotBody(int type, HttpCallback<List<LiveAiRobotBean.Message>> callback) {
|
||||
API.get().pdLiveApi(mContext)
|
||||
.getAiAutomaticSpeech(type + "")
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(responseModel -> {
|
||||
if (callback != null) {
|
||||
callback.onSuccess(responseModel.getData().getInfo());
|
||||
}
|
||||
}, new Consumer<Throwable>() {
|
||||
@Override
|
||||
public void accept(Throwable throwable) throws Exception {
|
||||
if (callback != null) {
|
||||
callback.onError(throwable.getMessage());
|
||||
}
|
||||
}
|
||||
}).isDisposed();
|
||||
}
|
||||
|
||||
public void addAiRobotBody(int type, String content, HttpCallback<HttpCallbackModel> callback) {
|
||||
API.get().pdLiveApi(mContext)
|
||||
.addAiAutomaticSpeech(type + "", content)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(responseModel -> {
|
||||
if (callback != null) {
|
||||
callback.onSuccess(new HttpCallbackModel(responseModel.getData().getCode(), responseModel.getData().getMsg()));
|
||||
}
|
||||
}, new Consumer<Throwable>() {
|
||||
@Override
|
||||
public void accept(Throwable throwable) throws Exception {
|
||||
if (callback != null) {
|
||||
callback.onError(throwable.getMessage());
|
||||
}
|
||||
}
|
||||
}).isDisposed();
|
||||
}
|
||||
|
||||
public void updateAiRobotBody(int type, int id, String content, HttpCallback<HttpCallbackModel> callback) {
|
||||
API.get().pdLiveApi(mContext)
|
||||
.updateAiAutomaticSpeech(type + "", id + "", content)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(responseModel -> {
|
||||
if (callback != null) {
|
||||
callback.onSuccess(new HttpCallbackModel(responseModel.getData().getCode(), responseModel.getData().getMsg()));
|
||||
}
|
||||
}, new Consumer<Throwable>() {
|
||||
@Override
|
||||
public void accept(Throwable throwable) throws Exception {
|
||||
if (callback != null) {
|
||||
callback.onError(throwable.getMessage());
|
||||
}
|
||||
}
|
||||
}).isDisposed();
|
||||
}
|
||||
|
||||
public void delAiRobotBody(int type, int id, HttpCallback<HttpCallbackModel> callback) {
|
||||
API.get().pdLiveApi(mContext)
|
||||
.delAiAutomaticSpeech(type + "", id + "")
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(responseModel -> {
|
||||
if (callback != null) {
|
||||
callback.onSuccess(new HttpCallbackModel(responseModel.getData().getCode(), responseModel.getData().getMsg()));
|
||||
}
|
||||
}, new Consumer<Throwable>() {
|
||||
@Override
|
||||
public void accept(Throwable throwable) throws Exception {
|
||||
if (callback != null) {
|
||||
callback.onError(throwable.getMessage());
|
||||
}
|
||||
}
|
||||
}).isDisposed();
|
||||
}
|
||||
|
||||
/**
|
||||
* 直播间取消网络请求
|
||||
*/
|
||||
|
@ -127,7 +127,8 @@ public class CustomDrawerPopupView extends DrawerPopupView {
|
||||
ViewClicksAntiShake.clicksAntiShake(findViewById(R.id.system_notice), new ViewClicksAntiShake.ViewClicksCallBack() {
|
||||
@Override
|
||||
public void onViewClicks() {
|
||||
dismiss();
|
||||
// dismiss();
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
@ -0,0 +1,92 @@
|
||||
package com.yunbao.common.views;
|
||||
|
||||
import android.content.Context;
|
||||
import android.text.TextUtils;
|
||||
import android.view.View;
|
||||
import android.widget.EditText;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
import com.lxj.xpopup.animator.PopupAnimator;
|
||||
import com.lxj.xpopup.core.CenterPopupView;
|
||||
import com.yunbao.common.R;
|
||||
import com.yunbao.common.utils.ToastUtil;
|
||||
|
||||
/**
|
||||
* 输入弹窗
|
||||
*/
|
||||
public class InputCustomPopup extends CenterPopupView {
|
||||
private String message = "";
|
||||
|
||||
public InputCustomPopup(@NonNull Context context, String message) {
|
||||
super(context);
|
||||
this.message = message;
|
||||
}
|
||||
|
||||
public InputCustomPopup(@NonNull Context context) {
|
||||
super(context);
|
||||
}
|
||||
|
||||
// 返回自定义弹窗的布局
|
||||
@Override
|
||||
protected int getImplLayoutId() {
|
||||
return R.layout.input_custom_popup;
|
||||
}
|
||||
|
||||
// 执行初始化操作,比如:findView,设置点击,或者任何你弹窗内的业务逻辑
|
||||
@Override
|
||||
protected void onCreate() {
|
||||
super.onCreate();
|
||||
EditText content = findViewById(R.id.content);
|
||||
content.setText(message);
|
||||
findViewById(R.id.btn_cancel).setOnClickListener(new OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
dismiss(); // 关闭弹窗
|
||||
}
|
||||
});
|
||||
findViewById(R.id.btn_confirm).setOnClickListener(new OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
String textContent = content.getText().toString();
|
||||
if (TextUtils.isEmpty(textContent)) {
|
||||
ToastUtil.show("输入内容不可为空");
|
||||
return;
|
||||
}
|
||||
if (listener != null) {
|
||||
listener.onConfirm(textContent);
|
||||
}
|
||||
dismiss(); // 关闭弹窗
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// 设置最大宽度,看需要而定,
|
||||
@Override
|
||||
protected int getMaxWidth() {
|
||||
return super.getMaxWidth();
|
||||
}
|
||||
|
||||
// 设置最大高度,看需要而定
|
||||
@Override
|
||||
protected int getMaxHeight() {
|
||||
return super.getMaxHeight();
|
||||
}
|
||||
|
||||
// 设置自定义动画器,看需要而定
|
||||
@Override
|
||||
protected PopupAnimator getPopupAnimator() {
|
||||
return super.getPopupAnimator();
|
||||
}
|
||||
|
||||
public interface InputCustomListener {
|
||||
void onConfirm(String text);
|
||||
}
|
||||
|
||||
private InputCustomListener listener;
|
||||
|
||||
public InputCustomPopup setListener(InputCustomListener listener) {
|
||||
this.listener = listener;
|
||||
return this;
|
||||
}
|
||||
}
|
@ -0,0 +1,181 @@
|
||||
package com.yunbao.common.views;
|
||||
|
||||
import android.content.Context;
|
||||
import android.util.Log;
|
||||
import android.view.KeyEvent;
|
||||
import android.view.View;
|
||||
import android.view.inputmethod.EditorInfo;
|
||||
import android.view.inputmethod.InputMethodManager;
|
||||
import android.widget.EditText;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.lxj.xpopup.XPopup;
|
||||
import com.lxj.xpopup.core.BottomPopupView;
|
||||
import com.yunbao.common.R;
|
||||
import com.yunbao.common.adapter.RobotMessageAdapter;
|
||||
import com.yunbao.common.bean.HttpCallbackModel;
|
||||
import com.yunbao.common.bean.LiveAiRobotBean;
|
||||
import com.yunbao.common.event.LiveRobotMessageEvent;
|
||||
import com.yunbao.common.http.base.HttpCallback;
|
||||
import com.yunbao.common.http.live.LiveNetManager;
|
||||
import com.yunbao.common.utils.Bus;
|
||||
import com.yunbao.common.utils.ToastUtil;
|
||||
|
||||
import org.greenrobot.eventbus.Subscribe;
|
||||
import org.greenrobot.eventbus.ThreadMode;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class LiveRobotMessageCustomPopup extends BottomPopupView {
|
||||
private static String TAG = "AI机器人";
|
||||
private RecyclerView robotMessages;
|
||||
private RobotMessageAdapter robotMessageAdapter;
|
||||
|
||||
private EditText robotNameSetting;
|
||||
private TextView robotTime;
|
||||
private String robotTimeString = "";
|
||||
|
||||
public LiveRobotMessageCustomPopup(@NonNull Context context, String robotTime) {
|
||||
super(context);
|
||||
this.robotTimeString = robotTime;
|
||||
}
|
||||
|
||||
public LiveRobotMessageCustomPopup(@NonNull Context context) {
|
||||
super(context);
|
||||
}
|
||||
|
||||
// 返回自定义弹窗的布局
|
||||
@Override
|
||||
protected int getImplLayoutId() {
|
||||
return R.layout.dialog_live_robot_message;
|
||||
}
|
||||
|
||||
// 执行初始化操作,比如:findView,设置点击,或者任何你弹窗内的业务逻辑
|
||||
@Override
|
||||
protected void onCreate() {
|
||||
super.onCreate();
|
||||
Bus.getOn(this);
|
||||
initView();
|
||||
initDate();
|
||||
}
|
||||
|
||||
@Subscribe(threadMode = ThreadMode.MAIN)
|
||||
public void onLiveRobotMessageEvent(LiveRobotMessageEvent event) {
|
||||
if (event.getIndex() > 0) {
|
||||
robotMessageAdapter.removeData(event.getIndex());
|
||||
} else {
|
||||
initDate();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDestroy() {
|
||||
super.onDestroy();
|
||||
Bus.getOff(this);
|
||||
}
|
||||
|
||||
|
||||
private void initView() {
|
||||
robotMessages = (RecyclerView) findViewById(R.id.robot_messages);
|
||||
robotNameSetting = findViewById(R.id.robot_name_setting);
|
||||
robotTime = findViewById(R.id.robot_time);
|
||||
robotMessageAdapter = new RobotMessageAdapter();
|
||||
robotMessages.setLayoutManager(new LinearLayoutManager(getContext(), LinearLayoutManager.VERTICAL, false));
|
||||
robotMessages.setAdapter(robotMessageAdapter);
|
||||
robotTime.setText(robotTimeString);
|
||||
findViewById(R.id.bt_cancel).setOnClickListener(new OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
dismiss();
|
||||
}
|
||||
});
|
||||
robotTime.setOnClickListener(new OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
robotTime.setVisibility(GONE);
|
||||
robotNameSetting.setVisibility(VISIBLE);
|
||||
robotNameSetting.setText(robotTime.getText().toString());
|
||||
//输入框,获取焦点 不然无法弹出键盘
|
||||
robotNameSetting.requestFocus();
|
||||
//键盘输入法管理器
|
||||
InputMethodManager imm = (InputMethodManager) getContext().getSystemService(Context.INPUT_METHOD_SERVICE);
|
||||
imm.showSoftInput(robotNameSetting, 0);
|
||||
}
|
||||
});
|
||||
robotNameSetting.setOnEditorActionListener(new TextView.OnEditorActionListener() {
|
||||
@Override
|
||||
public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
|
||||
if (actionId == EditorInfo.IME_ACTION_DONE) {
|
||||
// 修改助手名字
|
||||
LiveNetManager.get(getContext())
|
||||
.setAiRobotDate("ai_time", robotNameSetting.getText().toString(), new HttpCallback<HttpCallbackModel>() {
|
||||
@Override
|
||||
public void onSuccess(HttpCallbackModel data) {
|
||||
robotNameSetting.setVisibility(GONE);
|
||||
robotTime.setVisibility(VISIBLE);
|
||||
robotTime.setText(robotNameSetting.getText().toString());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(String error) {
|
||||
ToastUtil.show(error);
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
return false;
|
||||
}
|
||||
});
|
||||
//添加消息语
|
||||
findViewById(R.id.robot_add_content).setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
new XPopup.Builder(getContext())
|
||||
.asCustom(new InputCustomPopup(getContext()).setListener(new InputCustomPopup.InputCustomListener() {
|
||||
@Override
|
||||
public void onConfirm(String text) {
|
||||
//添加消息语
|
||||
LiveNetManager.get(getContext())
|
||||
.addAiRobotBody(LiveAiRobotBean.Message.TYPE_FOLLOW, text, new HttpCallback<HttpCallbackModel>() {
|
||||
@Override
|
||||
public void onSuccess(HttpCallbackModel data) {
|
||||
initDate();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(String error) {
|
||||
ToastUtil.show(error);
|
||||
}
|
||||
});
|
||||
}
|
||||
}))
|
||||
.show();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void initDate() {
|
||||
|
||||
LiveNetManager.get(getContext())
|
||||
.getAiRobotBody(LiveAiRobotBean.Message.TYPE_FOLLOW, new HttpCallback<List<LiveAiRobotBean.Message>>() {
|
||||
@Override
|
||||
public void onSuccess(List<LiveAiRobotBean.Message> data) {
|
||||
Log.i(TAG, "onSuccess: " + data.size());
|
||||
for (LiveAiRobotBean.Message message : data) {
|
||||
Log.i(TAG, "onSuccess: message=" + message.toString());
|
||||
}
|
||||
robotMessageAdapter.setDataAll(data);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(String error) {
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
@ -0,0 +1,128 @@
|
||||
package com.yunbao.common.views;
|
||||
|
||||
import android.content.Context;
|
||||
import android.util.Log;
|
||||
import android.view.View;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.lxj.xpopup.XPopup;
|
||||
import com.lxj.xpopup.core.BottomPopupView;
|
||||
import com.yunbao.common.R;
|
||||
import com.yunbao.common.adapter.RobotSayHelloAdapter;
|
||||
import com.yunbao.common.bean.HttpCallbackModel;
|
||||
import com.yunbao.common.bean.LiveAiRobotBean;
|
||||
import com.yunbao.common.event.LiveRobotSayHelloEvent;
|
||||
import com.yunbao.common.http.base.HttpCallback;
|
||||
import com.yunbao.common.http.live.LiveNetManager;
|
||||
import com.yunbao.common.utils.Bus;
|
||||
import com.yunbao.common.utils.ToastUtil;
|
||||
|
||||
import org.greenrobot.eventbus.Subscribe;
|
||||
import org.greenrobot.eventbus.ThreadMode;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class LiveRobotSayHelloCustomPopup extends BottomPopupView {
|
||||
private RecyclerView robotMessages;
|
||||
private RobotSayHelloAdapter robotMessageAdapter;
|
||||
private static String TAG = "AI机器人";
|
||||
|
||||
public LiveRobotSayHelloCustomPopup(@NonNull Context context) {
|
||||
super(context);
|
||||
}
|
||||
|
||||
|
||||
// 返回自定义弹窗的布局
|
||||
@Override
|
||||
protected int getImplLayoutId() {
|
||||
return R.layout.dialog_live_robot_say_hello;
|
||||
}
|
||||
|
||||
// 执行初始化操作,比如:findView,设置点击,或者任何你弹窗内的业务逻辑
|
||||
@Override
|
||||
protected void onCreate() {
|
||||
super.onCreate();
|
||||
Bus.getOn(this);
|
||||
initView();
|
||||
initDate();
|
||||
}
|
||||
|
||||
@Subscribe(threadMode = ThreadMode.MAIN)
|
||||
public void onLiveRobotSayHelloEvent(LiveRobotSayHelloEvent event) {
|
||||
if (event.getIndex() > 0) {
|
||||
robotMessageAdapter.removeData(event.getIndex());
|
||||
} else {
|
||||
initDate();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDestroy() {
|
||||
super.onDestroy();
|
||||
Bus.getOff(this);
|
||||
}
|
||||
|
||||
private void initView() {
|
||||
robotMessages = (RecyclerView) findViewById(R.id.robot_messages);
|
||||
robotMessageAdapter = new RobotSayHelloAdapter();
|
||||
robotMessages.setLayoutManager(new LinearLayoutManager(getContext(), LinearLayoutManager.VERTICAL, false));
|
||||
robotMessages.setAdapter(robotMessageAdapter);
|
||||
findViewById(R.id.bt_cancel).setOnClickListener(new OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
dismiss();
|
||||
}
|
||||
});
|
||||
//添加消息语
|
||||
findViewById(R.id.robot_add_content).setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
new XPopup.Builder(getContext())
|
||||
.asCustom(new InputCustomPopup(getContext()).setListener(new InputCustomPopup.InputCustomListener() {
|
||||
@Override
|
||||
public void onConfirm(String text) {
|
||||
//添加消息语
|
||||
LiveNetManager.get(getContext())
|
||||
.addAiRobotBody(LiveAiRobotBean.Message.TYPE_SAY_HI, text, new HttpCallback<HttpCallbackModel>() {
|
||||
@Override
|
||||
public void onSuccess(HttpCallbackModel data) {
|
||||
initDate();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(String error) {
|
||||
ToastUtil.show(error);
|
||||
}
|
||||
});
|
||||
}
|
||||
}))
|
||||
.show();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
private void initDate() {
|
||||
LiveNetManager.get(getContext())
|
||||
.getAiRobotBody(LiveAiRobotBean.Message.TYPE_SAY_HI, new HttpCallback<List<LiveAiRobotBean.Message>>() {
|
||||
@Override
|
||||
public void onSuccess(List<LiveAiRobotBean.Message> data) {
|
||||
Log.i(TAG, "onSuccess 自动打招呼 : " + data.size());
|
||||
for (LiveAiRobotBean.Message message : data) {
|
||||
Log.i(TAG, "onSuccess: message=" + message.toString());
|
||||
}
|
||||
robotMessageAdapter.setDataAll(data);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(String error) {
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
@ -0,0 +1,269 @@
|
||||
package com.yunbao.common.views;
|
||||
|
||||
import android.content.Context;
|
||||
import android.util.Log;
|
||||
import android.view.KeyEvent;
|
||||
import android.view.View;
|
||||
import android.view.inputmethod.EditorInfo;
|
||||
import android.view.inputmethod.InputMethodManager;
|
||||
import android.widget.EditText;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.appcompat.widget.AppCompatTextView;
|
||||
|
||||
import com.lxj.xpopup.XPopup;
|
||||
import com.lxj.xpopup.core.BasePopupView;
|
||||
import com.lxj.xpopup.core.BottomPopupView;
|
||||
import com.lxj.xpopup.interfaces.XPopupCallback;
|
||||
import com.yunbao.common.R;
|
||||
import com.yunbao.common.bean.HttpCallbackModel;
|
||||
import com.yunbao.common.bean.LiveAiRobotBean;
|
||||
import com.yunbao.common.http.base.HttpCallback;
|
||||
import com.yunbao.common.http.live.LiveNetManager;
|
||||
import com.yunbao.common.utils.ToastUtil;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class LiveRobotSettingCustomPopup extends BottomPopupView implements View.OnClickListener {
|
||||
private static String TAG = "AI机器人";
|
||||
private EditText robotNameSetting;
|
||||
private AppCompatTextView automaticGreetingNumber, automaticMessageNumber;
|
||||
private TextView robotNameText;
|
||||
private String time = "";
|
||||
private ImageView robotState;
|
||||
|
||||
private int robotStateInt = 1;
|
||||
|
||||
public LiveRobotSettingCustomPopup(@NonNull Context context) {
|
||||
super(context);
|
||||
}
|
||||
|
||||
// 返回自定义弹窗的布局
|
||||
@Override
|
||||
protected int getImplLayoutId() {
|
||||
return R.layout.dialog_live_robot_setting;
|
||||
}
|
||||
|
||||
// 执行初始化操作,比如:findView,设置点击,或者任何你弹窗内的业务逻辑
|
||||
@Override
|
||||
protected void onCreate() {
|
||||
super.onCreate();
|
||||
intiView();
|
||||
initDate();
|
||||
}
|
||||
|
||||
private void intiView() {
|
||||
robotNameSetting = findViewById(R.id.robot_name_setting);
|
||||
robotNameText = findViewById(R.id.robot_name_text);
|
||||
robotState = findViewById(R.id.robot_state);
|
||||
automaticGreetingNumber = findViewById(R.id.automatic_greeting_number);
|
||||
automaticMessageNumber = findViewById(R.id.automatic_message_number);
|
||||
findViewById(R.id.automatic_message_sending).setOnClickListener(this);
|
||||
findViewById(R.id.automatic_greeting_setting).setOnClickListener(this);
|
||||
robotNameText.setOnClickListener(this);
|
||||
robotState.setOnClickListener(this);
|
||||
|
||||
robotNameSetting.setOnEditorActionListener(new TextView.OnEditorActionListener() {
|
||||
@Override
|
||||
public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
|
||||
if (actionId == EditorInfo.IME_ACTION_DONE) {
|
||||
// 修改助手名字
|
||||
LiveNetManager.get(getContext())
|
||||
.setAiRobotDate("ai_name", robotNameSetting.getText().toString(), new HttpCallback<HttpCallbackModel>() {
|
||||
@Override
|
||||
public void onSuccess(HttpCallbackModel data) {
|
||||
robotNameSetting.setVisibility(GONE);
|
||||
robotNameText.setVisibility(VISIBLE);
|
||||
robotNameText.setText(robotNameSetting.getText().toString());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(String error) {
|
||||
ToastUtil.show(error);
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
return false;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
int viewID = v.getId();
|
||||
if (viewID == R.id.automatic_message_sending) {
|
||||
new XPopup.Builder(getContext())
|
||||
.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) {
|
||||
initDate();
|
||||
}
|
||||
|
||||
@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(new LiveRobotMessageCustomPopup(getContext(), time))
|
||||
.show();
|
||||
} else if (viewID == R.id.robot_name_text) {
|
||||
robotNameText.setVisibility(GONE);
|
||||
robotNameSetting.setVisibility(VISIBLE);
|
||||
robotNameSetting.setText(robotNameText.getText().toString());
|
||||
//输入框,获取焦点 不然无法弹出键盘
|
||||
robotNameSetting.requestFocus();
|
||||
//键盘输入法管理器
|
||||
InputMethodManager imm = (InputMethodManager) getContext().getSystemService(Context.INPUT_METHOD_SERVICE);
|
||||
imm.showSoftInput(robotNameSetting, 0);
|
||||
} else if (viewID == R.id.robot_state) {
|
||||
int state = 0;
|
||||
if (robotStateInt == 1) {
|
||||
state = 0;
|
||||
} else {
|
||||
state = 1;
|
||||
}
|
||||
// 修改助手名字
|
||||
int finalState = state;
|
||||
LiveNetManager.get(getContext())
|
||||
.setAiRobotDate("ai_state", String.valueOf(state), new HttpCallback<HttpCallbackModel>() {
|
||||
@Override
|
||||
public void onSuccess(HttpCallbackModel data) {
|
||||
if (finalState == 1) {
|
||||
robotState.setImageResource(R.mipmap.special_icon_on);
|
||||
robotStateInt = 1;
|
||||
} else {
|
||||
robotState.setImageResource(R.mipmap.special_icon_off);
|
||||
robotStateInt = 0;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(String error) {
|
||||
ToastUtil.show(error);
|
||||
}
|
||||
});
|
||||
} else if (viewID == R.id.automatic_greeting_setting) {
|
||||
new XPopup.Builder(getContext())
|
||||
.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) {
|
||||
initDate();
|
||||
}
|
||||
|
||||
@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(new LiveRobotSayHelloCustomPopup(getContext()))
|
||||
.show();
|
||||
}
|
||||
}
|
||||
|
||||
private void initDate() {
|
||||
LiveNetManager.get(getContext())
|
||||
.getAiRobotStatus(new com.yunbao.common.http.base.HttpCallback<LiveAiRobotBean>() {
|
||||
@Override
|
||||
public void onSuccess(LiveAiRobotBean data) {
|
||||
robotNameText.setText(data.getName());
|
||||
automaticGreetingNumber.setText(String.valueOf(data.getAutoSeyHiNumber()));
|
||||
automaticMessageNumber.setText(String.valueOf(data.getAutoRequestFollowNumber()));
|
||||
time = String.valueOf(data.getTime());
|
||||
robotStateInt = data.getStatus();
|
||||
if (data.getStatus() == 1) {
|
||||
robotState.setImageResource(R.mipmap.special_icon_on);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(String error) {
|
||||
ToastUtil.show(error);
|
||||
}
|
||||
});
|
||||
|
||||
initListType1();
|
||||
initListType2();
|
||||
}
|
||||
|
||||
|
||||
private void initListType1() {
|
||||
|
||||
}
|
||||
|
||||
private void initListType2() {
|
||||
|
||||
}
|
||||
}
|
@ -0,0 +1,77 @@
|
||||
package com.yunbao.common.views;
|
||||
|
||||
import android.view.View;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.lxj.xpopup.XPopup;
|
||||
import com.yunbao.common.R;
|
||||
import com.yunbao.common.bean.HttpCallbackModel;
|
||||
import com.yunbao.common.bean.LiveAiRobotBean;
|
||||
import com.yunbao.common.event.LiveRobotMessageEvent;
|
||||
import com.yunbao.common.http.base.HttpCallback;
|
||||
import com.yunbao.common.http.live.LiveNetManager;
|
||||
import com.yunbao.common.utils.Bus;
|
||||
import com.yunbao.common.utils.ToastUtil;
|
||||
|
||||
|
||||
public class RobotMessageViewHolder extends RecyclerView.ViewHolder {
|
||||
private TextView serialNumber, messageText;
|
||||
private ImageView btnDelete;
|
||||
|
||||
public RobotMessageViewHolder(@NonNull View itemView) {
|
||||
super(itemView);
|
||||
serialNumber = itemView.findViewById(R.id.serial_number);
|
||||
messageText = itemView.findViewById(R.id.message_text);
|
||||
btnDelete = itemView.findViewById(R.id.btn_delete);
|
||||
}
|
||||
|
||||
public void setData(LiveAiRobotBean.Message message, int index) {
|
||||
serialNumber.setText(String.valueOf(index));
|
||||
messageText.setText(message.getContent());
|
||||
btnDelete.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
LiveNetManager.get(itemView.getContext())
|
||||
.delAiRobotBody(LiveAiRobotBean.Message.TYPE_FOLLOW, message.getId(), new HttpCallback<HttpCallbackModel>() {
|
||||
@Override
|
||||
public void onSuccess(HttpCallbackModel data) {
|
||||
Bus.get().post(new LiveRobotMessageEvent().setIndex(index - 1));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(String error) {
|
||||
ToastUtil.show(error);
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
messageText.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
new XPopup.Builder(itemView.getContext())
|
||||
.asCustom(new InputCustomPopup(itemView.getContext(), message.getContent()).setListener(new InputCustomPopup.InputCustomListener() {
|
||||
@Override
|
||||
public void onConfirm(String text) {
|
||||
LiveNetManager.get(itemView.getContext())
|
||||
.updateAiRobotBody(LiveAiRobotBean.Message.TYPE_FOLLOW, message.getId(), text, new HttpCallback<HttpCallbackModel>() {
|
||||
@Override
|
||||
public void onSuccess(HttpCallbackModel data) {
|
||||
Bus.get().post(new LiveRobotMessageEvent());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(String error) {
|
||||
ToastUtil.show(error);
|
||||
}
|
||||
});
|
||||
}
|
||||
}))
|
||||
.show();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
@ -0,0 +1,77 @@
|
||||
package com.yunbao.common.views;
|
||||
|
||||
import android.view.View;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.lxj.xpopup.XPopup;
|
||||
import com.yunbao.common.R;
|
||||
import com.yunbao.common.bean.HttpCallbackModel;
|
||||
import com.yunbao.common.bean.LiveAiRobotBean;
|
||||
import com.yunbao.common.event.LiveRobotSayHelloEvent;
|
||||
import com.yunbao.common.http.base.HttpCallback;
|
||||
import com.yunbao.common.http.live.LiveNetManager;
|
||||
import com.yunbao.common.utils.Bus;
|
||||
import com.yunbao.common.utils.ToastUtil;
|
||||
|
||||
public class RobotSayHelloViewHoler extends RecyclerView.ViewHolder {
|
||||
private TextView serialNumber, messageText;
|
||||
private ImageView btnDelete;
|
||||
|
||||
public RobotSayHelloViewHoler(@NonNull View itemView) {
|
||||
super(itemView);
|
||||
serialNumber = itemView.findViewById(R.id.serial_number);
|
||||
messageText = itemView.findViewById(R.id.message_text);
|
||||
btnDelete = itemView.findViewById(R.id.btn_delete);
|
||||
}
|
||||
|
||||
|
||||
public void setData(LiveAiRobotBean.Message message, int index) {
|
||||
serialNumber.setText(String.valueOf(index));
|
||||
messageText.setText(message.getContent());
|
||||
btnDelete.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
LiveNetManager.get(itemView.getContext())
|
||||
.delAiRobotBody(LiveAiRobotBean.Message.TYPE_SAY_HI, message.getId(), new HttpCallback<HttpCallbackModel>() {
|
||||
@Override
|
||||
public void onSuccess(HttpCallbackModel data) {
|
||||
Bus.get().post(new LiveRobotSayHelloEvent().setIndex(index - 1));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(String error) {
|
||||
ToastUtil.show(error);
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
messageText.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
new XPopup.Builder(itemView.getContext())
|
||||
.asCustom(new InputCustomPopup(itemView.getContext(), message.getContent()).setListener(new InputCustomPopup.InputCustomListener() {
|
||||
@Override
|
||||
public void onConfirm(String text) {
|
||||
LiveNetManager.get(itemView.getContext())
|
||||
.updateAiRobotBody(LiveAiRobotBean.Message.TYPE_SAY_HI, message.getId(), text, new HttpCallback<HttpCallbackModel>() {
|
||||
@Override
|
||||
public void onSuccess(HttpCallbackModel data) {
|
||||
Bus.get().post(new LiveRobotSayHelloEvent());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(String error) {
|
||||
ToastUtil.show(error);
|
||||
}
|
||||
});
|
||||
}
|
||||
}))
|
||||
.show();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
9
common/src/main/res/drawable/background_81c16d.xml
Normal file
9
common/src/main/res/drawable/background_81c16d.xml
Normal 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="11.67dp" />
|
||||
<solid android:color="#81C16D" />
|
||||
</shape>
|
||||
</item>
|
||||
</selector>
|
10
common/src/main/res/drawable/bg_robot_shape.xml
Normal file
10
common/src/main/res/drawable/bg_robot_shape.xml
Normal file
@ -0,0 +1,10 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
|
||||
<item >
|
||||
<shape>
|
||||
<corners android:radius="13.33dp"/>
|
||||
<solid android:color="#00B8EB"/>
|
||||
</shape>
|
||||
</item>
|
||||
</selector>
|
BIN
common/src/main/res/drawable/icon_robot.png
Normal file
BIN
common/src/main/res/drawable/icon_robot.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 3.8 KiB |
@ -108,7 +108,7 @@
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:visibility="gone"
|
||||
android:visibility="visible"
|
||||
android:id="@+id/system_notice"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
|
@ -95,6 +95,28 @@
|
||||
android:textSize="12sp" />
|
||||
|
||||
</LinearLayout>
|
||||
<LinearLayout
|
||||
android:id="@+id/live_tool_robot"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="28dp"
|
||||
android:gravity="center"
|
||||
android:orientation="vertical">
|
||||
|
||||
<ImageView
|
||||
android:layout_width="40dp"
|
||||
android:layout_height="40dp"
|
||||
android:src="@mipmap/live_more_icon_robot" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="6dp"
|
||||
android:text="@string/robot_setup"
|
||||
android:textColor="#FF9A9A9A"
|
||||
android:textSize="12sp" />
|
||||
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
</HorizontalScrollView>
|
||||
|
||||
|
174
common/src/main/res/layout/dialog_live_robot_message.xml
Normal file
174
common/src/main/res/layout/dialog_live_robot_message.xml
Normal file
@ -0,0 +1,174 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="400dp"
|
||||
android:background="#000002">
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/line1"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/bt_cancel"
|
||||
android:layout_width="24dp"
|
||||
android:layout_height="24dp"
|
||||
android:layout_marginStart="5.33dp"
|
||||
android:layout_marginTop="7.76dp"
|
||||
android:layout_marginBottom="6.33dp"
|
||||
android:src="@mipmap/icon_back" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_marginStart="6.67dp"
|
||||
android:text="@string/automatic_message_sending"
|
||||
android:textColor="#CCCCCC"
|
||||
android:textSize="15sp" />
|
||||
|
||||
<View
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="1dp"
|
||||
android:layout_weight="1" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/robot_add_content"
|
||||
android:layout_width="67.67dp"
|
||||
android:layout_height="23.33dp"
|
||||
android:layout_marginTop="8dp"
|
||||
android:layout_marginEnd="11dp"
|
||||
android:background="@drawable/background_81c16d"
|
||||
android:gravity="center"
|
||||
android:text="@string/robot_add_content"
|
||||
android:textColor="#FFFFFF"
|
||||
android:textSize="10sp" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/line2"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@id/line1"
|
||||
android:layout_marginStart="10.33dp"
|
||||
android:layout_marginEnd="10.67dp"
|
||||
android:background="@drawable/bg_prank_coin"
|
||||
android:orientation="horizontal"
|
||||
android:paddingTop="8.67dp"
|
||||
android:paddingBottom="7.67dp">
|
||||
|
||||
<ImageView
|
||||
android:layout_width="26dp"
|
||||
android:layout_height="26dp"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_marginStart="13.67dp"
|
||||
android:src="@mipmap/icon_tip" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_marginStart="8.33dp"
|
||||
android:text="@string/robot_add_content_hint1"
|
||||
android:textColor="#CCCCCC"
|
||||
android:textSize="12sp" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_marginStart="8.33dp"
|
||||
android:layout_marginTop="6dp"
|
||||
android:text="@string/robot_add_content_hint2"
|
||||
android:textColor="#CCCCCC"
|
||||
android:textSize="12sp" />
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/robot_name"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@+id/line2"
|
||||
android:layout_marginTop="11dp"
|
||||
|
||||
android:orientation="horizontal">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="10dp"
|
||||
android:text="@string/robot_automatic_speech_interval"
|
||||
android:textColor="#FFF"
|
||||
android:textSize="13sp" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="10dp"
|
||||
android:layout_marginTop="3.67dp"
|
||||
android:text="@string/robot_minimum_interval"
|
||||
android:textColor="#B3B3B3"
|
||||
android:textSize="10sp" />
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
|
||||
<TextView
|
||||
android:id="@+id/robot_time"
|
||||
android:layout_width="96dp"
|
||||
android:layout_height="27dp"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_marginEnd="10dp"
|
||||
android:background="@drawable/bg_prank_coin"
|
||||
android:gravity="center"
|
||||
android:maxLines="1"
|
||||
android:textColor="#FFF"
|
||||
android:textSize="12sp" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/robot_name_setting"
|
||||
android:layout_width="96dp"
|
||||
android:layout_height="27dp"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_marginEnd="10dp"
|
||||
android:background="@drawable/bg_prank_coin"
|
||||
android:gravity="center"
|
||||
android:imeOptions="actionDone"
|
||||
android:inputType="number"
|
||||
android:maxLines="1"
|
||||
android:textColor="#FFF"
|
||||
android:textSize="12sp"
|
||||
android:visibility="gone" />
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/robot_messages"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_below="@id/robot_name" />
|
||||
</RelativeLayout>
|
106
common/src/main/res/layout/dialog_live_robot_say_hello.xml
Normal file
106
common/src/main/res/layout/dialog_live_robot_say_hello.xml
Normal file
@ -0,0 +1,106 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="400dp"
|
||||
android:background="#000002">
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/line1"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/bt_cancel"
|
||||
android:layout_width="24dp"
|
||||
android:layout_height="24dp"
|
||||
android:layout_marginStart="5.33dp"
|
||||
android:layout_marginTop="7.76dp"
|
||||
android:layout_marginBottom="6.33dp"
|
||||
android:src="@mipmap/icon_back" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_marginStart="6.67dp"
|
||||
android:text="@string/automatic_greeting_setting"
|
||||
android:textColor="#CCCCCC"
|
||||
android:textSize="15sp" />
|
||||
|
||||
<View
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="1dp"
|
||||
android:layout_weight="1" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/robot_add_content"
|
||||
android:layout_width="67.67dp"
|
||||
android:layout_height="23.33dp"
|
||||
android:layout_marginTop="8dp"
|
||||
android:layout_marginEnd="11dp"
|
||||
android:background="@drawable/background_81c16d"
|
||||
android:gravity="center"
|
||||
android:text="@string/robot_add_content"
|
||||
android:textColor="#FFFFFF"
|
||||
android:textSize="10sp" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/line2"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@id/line1"
|
||||
android:layout_marginStart="10.33dp"
|
||||
android:layout_marginEnd="10.67dp"
|
||||
android:background="@drawable/bg_prank_coin"
|
||||
android:orientation="horizontal"
|
||||
android:paddingTop="8.67dp"
|
||||
android:paddingBottom="7.67dp">
|
||||
|
||||
<ImageView
|
||||
android:layout_width="26dp"
|
||||
android:layout_height="26dp"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_marginStart="13.67dp"
|
||||
android:src="@mipmap/icon_tip" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_marginStart="8.33dp"
|
||||
android:text="@string/robot_add_content_hint3"
|
||||
android:textColor="#CCCCCC"
|
||||
android:textSize="12sp" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_marginStart="8.33dp"
|
||||
android:layout_marginTop="6dp"
|
||||
android:text="@string/robot_add_content_hint4"
|
||||
android:textColor="#CCCCCC"
|
||||
android:textSize="12sp" />
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/robot_messages"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_below="@id/line2" />
|
||||
</RelativeLayout>
|
266
common/src/main/res/layout/dialog_live_robot_setting.xml
Normal file
266
common/src/main/res/layout/dialog_live_robot_setting.xml
Normal file
@ -0,0 +1,266 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="#000"
|
||||
android:paddingBottom="23dp">
|
||||
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView6"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="10dp"
|
||||
android:layout_marginTop="14dp"
|
||||
android:text="@string/speech_robot_setup"
|
||||
android:textColor="#CCCCCC"
|
||||
android:textSize="15sp"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/robot_status"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@id/textView6"
|
||||
android:layout_marginTop="18dp"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_marginStart="10dp"
|
||||
android:layout_weight="1"
|
||||
android:text="@string/robot_switch"
|
||||
android:textColor="#FFF"
|
||||
android:textSize="15sp" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/robot_state"
|
||||
android:layout_width="46dp"
|
||||
android:layout_height="23dp"
|
||||
android:layout_marginEnd="10dp"
|
||||
app:srcCompat="@mipmap/special_icon_off" />
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/robot_name"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@+id/robot_status"
|
||||
android:layout_marginTop="20dp"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="10dp"
|
||||
android:text="@string/robot_name_setting"
|
||||
android:textColor="#FFF"
|
||||
android:textSize="13sp" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="10dp"
|
||||
android:layout_marginTop="3.67dp"
|
||||
android:text="@string/word_limit"
|
||||
android:textColor="#B3B3B3"
|
||||
android:textSize="10sp" />
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
<EditText
|
||||
android:id="@+id/robot_name_setting"
|
||||
android:layout_width="96dp"
|
||||
android:layout_height="27dp"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_marginEnd="10dp"
|
||||
android:background="@drawable/bg_prank_coin"
|
||||
android:gravity="center"
|
||||
android:imeOptions="actionDone"
|
||||
android:inputType="text"
|
||||
android:maxLines="1"
|
||||
android:textColor="#FFF"
|
||||
android:textSize="12sp"
|
||||
android:visibility="gone" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/robot_name_text"
|
||||
android:layout_width="96dp"
|
||||
android:layout_height="27dp"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_marginEnd="10dp"
|
||||
android:background="@drawable/bg_prank_coin"
|
||||
android:gravity="center"
|
||||
android:imeOptions="actionDone"
|
||||
android:inputType="text"
|
||||
android:maxLines="1"
|
||||
android:textColor="#FFF"
|
||||
android:textSize="12sp" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/robot_say_hello"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@id/robot_name"
|
||||
android:layout_marginTop="20dp"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="10dp"
|
||||
android:text="@string/automatic_greeting_setting"
|
||||
android:textColor="#FFF"
|
||||
android:textSize="13sp" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="10dp"
|
||||
android:layout_marginTop="3.67dp"
|
||||
android:text="@string/configured_items"
|
||||
android:textColor="#B3B3B3"
|
||||
android:textSize="10sp" />
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:id="@+id/automatic_greeting_number"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="4.67dp"
|
||||
android:layout_marginTop="3.67dp"
|
||||
android:textColor="#00B8EB"
|
||||
android:textSize="10sp" />
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
<TextView
|
||||
android:id="@+id/automatic_greeting_setting"
|
||||
android:layout_width="96dp"
|
||||
android:layout_height="27dp"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_marginEnd="10dp"
|
||||
android:background="@drawable/bg_robot_shape"
|
||||
android:gravity="center"
|
||||
android:text="@string/robot_go_setting"
|
||||
android:textColor="#FFF"
|
||||
android:textSize="12sp" />
|
||||
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/robot_message"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@id/robot_say_hello"
|
||||
android:layout_marginTop="20dp"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="10dp"
|
||||
android:text="@string/automatic_message_sending"
|
||||
android:textColor="#FFF"
|
||||
android:textSize="13sp" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="10dp"
|
||||
android:layout_marginTop="3.67dp"
|
||||
android:text="@string/configured_items"
|
||||
android:textColor="#B3B3B3"
|
||||
android:textSize="10sp" />
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:id="@+id/automatic_message_number"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="4.67dp"
|
||||
android:layout_marginTop="3.67dp"
|
||||
android:textColor="#00B8EB"
|
||||
android:textSize="10sp" />
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
<TextView
|
||||
android:id="@+id/automatic_message_sending"
|
||||
android:layout_width="96dp"
|
||||
android:layout_height="27dp"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_marginEnd="10dp"
|
||||
android:background="@drawable/bg_robot_shape"
|
||||
android:gravity="center"
|
||||
android:text="@string/robot_go_setting"
|
||||
android:textColor="#FFF"
|
||||
android:textSize="12sp" />
|
||||
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@+id/robot_message"
|
||||
android:layout_marginStart="10.33dp"
|
||||
android:layout_marginTop="29dp"
|
||||
android:layout_marginEnd="10.67dp"
|
||||
android:background="@drawable/bg_prank_coin"
|
||||
android:orientation="horizontal"
|
||||
android:paddingTop="8.67dp"
|
||||
android:paddingBottom="7.67dp">
|
||||
|
||||
<ImageView
|
||||
android:layout_width="24dp"
|
||||
android:layout_height="24dp"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_marginStart="13.67dp"
|
||||
android:src="@mipmap/icon_tip" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_marginStart="8.33dp"
|
||||
android:text="@string/robot_hint"
|
||||
android:textColor="#CCCCCC"
|
||||
android:textSize="12sp" />
|
||||
</LinearLayout>
|
||||
|
||||
</RelativeLayout>
|
69
common/src/main/res/layout/input_custom_popup.xml
Normal file
69
common/src/main/res/layout/input_custom_popup.xml
Normal file
@ -0,0 +1,69 @@
|
||||
<?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="wrap_content"
|
||||
android:background="@drawable/bg_dialog"
|
||||
android:gravity="center_horizontal"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/title"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:layout_marginTop="15dp"
|
||||
android:layout_marginBottom="15dp"
|
||||
android:gravity="center_horizontal"
|
||||
android:text="@string/dialog_tip"
|
||||
android:textColor="#161616"
|
||||
android:textSize="15sp" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/content"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="15dp"
|
||||
android:layout_marginRight="15dp"
|
||||
android:layout_marginBottom="10dp"
|
||||
android:background="@drawable/bg_dialog_input"
|
||||
android:gravity="center"
|
||||
android:paddingLeft="10dp"
|
||||
android:paddingTop="10dp"
|
||||
android:paddingRight="10dp"
|
||||
android:paddingBottom="10dp"
|
||||
android:textColor="@color/textColor"
|
||||
android:textSize="14sp" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="40dp"
|
||||
android:layout_marginBottom="23dp"
|
||||
android:gravity="center">
|
||||
|
||||
|
||||
<TextView
|
||||
android:id="@+id/btn_cancel"
|
||||
android:layout_width="87dp"
|
||||
android:layout_height="33dp"
|
||||
android:layout_marginRight="7dp"
|
||||
android:background="@mipmap/tipbox_btn_gray"
|
||||
android:gravity="center"
|
||||
android:text="@string/cancel"
|
||||
android:textColor="#B1B1B1"
|
||||
android:textSize="14sp" />
|
||||
|
||||
|
||||
<TextView
|
||||
android:id="@+id/btn_confirm"
|
||||
|
||||
android:layout_width="87dp"
|
||||
android:layout_height="33dp"
|
||||
android:layout_marginLeft="7dp"
|
||||
android:background="@mipmap/tipbox_btn_orange"
|
||||
android:gravity="center"
|
||||
android:text="@string/confirm"
|
||||
android:textColor="#FFFFFF"
|
||||
android:textSize="14sp" />
|
||||
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
43
common/src/main/res/layout/view_robot_message.xml
Normal file
43
common/src/main/res/layout/view_robot_message.xml
Normal file
@ -0,0 +1,43 @@
|
||||
<?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="wrap_content"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="10dp"
|
||||
android:layout_marginTop="10dp"
|
||||
android:layout_weight="1"
|
||||
android:background="@drawable/bg_prank_coin">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/serial_number"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="13dp"
|
||||
android:text="1"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="20sp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/message_text"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_marginEnd="19dp"
|
||||
android:text="测试文字"
|
||||
android:textColor="#80CEF2"
|
||||
android:textSize="13sp" />
|
||||
</LinearLayout>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/btn_delete"
|
||||
android:layout_width="25dp"
|
||||
android:layout_height="25dp"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_marginStart="9dp"
|
||||
android:layout_marginEnd="10.67dp"
|
||||
android:src="@mipmap/icon_close" />
|
||||
</LinearLayout>
|
BIN
common/src/main/res/mipmap-xxhdpi/icon_close.png
Normal file
BIN
common/src/main/res/mipmap-xxhdpi/icon_close.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 2.5 KiB |
BIN
common/src/main/res/mipmap-xxhdpi/icon_robot.png
Normal file
BIN
common/src/main/res/mipmap-xxhdpi/icon_robot.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 3.8 KiB |
BIN
common/src/main/res/mipmap-xxhdpi/icon_tip.png
Normal file
BIN
common/src/main/res/mipmap-xxhdpi/icon_tip.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 2.8 KiB |
BIN
common/src/main/res/mipmap-xxhdpi/live_more_icon_robot.png
Normal file
BIN
common/src/main/res/mipmap-xxhdpi/live_more_icon_robot.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 24 KiB |
@ -978,4 +978,22 @@
|
||||
<string name="random_pk_dialog_refuse" translatable="false">拒绝</string>
|
||||
<string name="random_pk_dialog_refuse_again" translatable="false">坚持拒绝</string>
|
||||
<string name="random_pk_dialog_title" translatable="false">随机PK提示</string>
|
||||
|
||||
<string name="speech_robot_setup" translatable="false">自動發言機器人設置</string>
|
||||
<string name="robot_switch" translatable="false">機器人開關</string>
|
||||
<string name="robot_name_setting" translatable="false">機器人名字設置</string>
|
||||
<string name="word_limit" translatable="false">字數限制2-8個字</string>
|
||||
<string name="automatic_greeting_setting" translatable="false">自動打招呼設置</string>
|
||||
<string name="configured_items" translatable="false">已配置條數</string>
|
||||
<string name="automatic_message_sending" translatable="false">自動發消息設置</string>
|
||||
<string name="robot_go_setting" translatable="false">前往設置</string>
|
||||
<string name="robot_hint" translatable="false">感謝送禮、PK開始、PK結束的自動機器人消息,\n暫不支持自定義。</string>
|
||||
<string name="robot_add_content" translatable="false">添加內容</string>
|
||||
<string name="robot_add_content_hint1" translatable="false">每隔一段時間,機器人自動隨機以下一句話發出。</string>
|
||||
<string name="robot_add_content_hint2" translatable="false">填寫內容推薦,如:求送心願單、加粉絲團等</string>
|
||||
<string name="robot_automatic_speech_interval" translatable="false">自動發言間隔時間(分鐘)</string>
|
||||
<string name="robot_minimum_interval" translatable="false">最少間隔5分鐘1次</string>
|
||||
<string name="robot_add_content_hint3" translatable="false">當有用戶進入直播間時,機器人會@該用戶並自動</string>
|
||||
<string name="robot_add_content_hint4" translatable="false">隨機以下一句話。最少設置1條,最多20條。</string>
|
||||
<string name="robot_setup" translatable="false">機器人設置</string>
|
||||
</resources>
|
||||
|
@ -34,6 +34,7 @@ import com.alibaba.fastjson.JSONObject;
|
||||
import com.bumptech.glide.Glide;
|
||||
import com.bumptech.glide.request.target.CustomTarget;
|
||||
import com.bumptech.glide.request.transition.Transition;
|
||||
import com.lxj.xpopup.XPopup;
|
||||
import com.opensource.svgaplayer.SVGAImageView;
|
||||
import com.tencent.trtc.TRTCCloudDef;
|
||||
import com.yunbao.common.CommonAppConfig;
|
||||
@ -66,13 +67,13 @@ import com.yunbao.common.utils.ScreenDimenUtil;
|
||||
import com.yunbao.common.utils.StringUtil;
|
||||
import com.yunbao.common.utils.ToastUtil;
|
||||
import com.yunbao.common.utils.WordUtil;
|
||||
import com.yunbao.common.views.LiveRobotSettingCustomPopup;
|
||||
import com.yunbao.faceunity.FaceManager;
|
||||
import com.yunbao.live.R;
|
||||
import com.yunbao.live.bean.LiveGuardInfo;
|
||||
import com.yunbao.live.bean.LiveKsyConfigBean;
|
||||
import com.yunbao.live.bean.LiveReceiveGiftBean;
|
||||
import com.yunbao.live.dialog.FreePkDialogFragment;
|
||||
import com.yunbao.live.dialog.LiveLinkMicListDialogFragment;
|
||||
import com.yunbao.live.dialog.LiveNewFunctionDialogFragment;
|
||||
import com.yunbao.live.dialog.LiveNewWishListDialogFragment;
|
||||
import com.yunbao.live.dialog.LivePrankDialogFragment;
|
||||
@ -281,6 +282,11 @@ public class LiveRyAnchorActivity extends LiveActivity implements LiveFunctionCl
|
||||
@Override
|
||||
public void onClick(int functionID) {
|
||||
switch (functionID) {
|
||||
case Constants.LIVE_ROBOT:
|
||||
new XPopup.Builder(mContext)
|
||||
.asCustom(new LiveRobotSettingCustomPopup(mContext))
|
||||
.show();
|
||||
break;
|
||||
case Constants.LIVE_FUNC_ZG://zg
|
||||
// ToastUtil.show("開發中,敬請期待");
|
||||
LivePrankDialogFragment fragment = new LivePrankDialogFragment();
|
||||
|
@ -47,6 +47,7 @@ import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* Created by cxf on 2018/10/10.
|
||||
@ -127,7 +128,7 @@ public class LiveChatAdapter extends RecyclerView.Adapter {
|
||||
@Override
|
||||
public void onScrolled(@NonNull RecyclerView recyclerView, int dx, int dy) {
|
||||
super.onScrolled(recyclerView, dx, dy);
|
||||
if (isSlideToBottom(recyclerView)) return;
|
||||
if (isSlideToBottom(recyclerView) || dy == 0) return;
|
||||
mRecyclerViewScrolledDy = dy;
|
||||
}
|
||||
});
|
||||
@ -379,16 +380,23 @@ public class LiveChatAdapter extends RecyclerView.Adapter {
|
||||
|
||||
@SuppressLint("NotifyDataSetChanged")
|
||||
public void insertItem(LiveChatBean bean) {
|
||||
|
||||
if (bean == null) {
|
||||
return;
|
||||
}
|
||||
// Log.i(TAG, "insertItem: " + bean.getContent());
|
||||
int size = mList.size();
|
||||
//设置最大展示99条消息
|
||||
if (size == 100) {
|
||||
mList.remove(0);
|
||||
mList.subList(0, 50).clear();
|
||||
notifyItemRangeRemoved(0, 50);
|
||||
}
|
||||
mList.add(bean);
|
||||
if (getItemCount() == 1) {
|
||||
notifyDataSetChanged();
|
||||
} else {
|
||||
notifyItemInserted(getItemCount());
|
||||
}
|
||||
size = mList.size();
|
||||
if (isSlideToBottom(mRecyclerView) || mRecyclerViewScrolledDy == 0) {
|
||||
scrollToBottom();
|
||||
} else {
|
||||
@ -401,11 +409,7 @@ public class LiveChatAdapter extends RecyclerView.Adapter {
|
||||
mPosition = size;
|
||||
}
|
||||
}
|
||||
if (getItemCount() == 1) {
|
||||
notifyDataSetChanged();
|
||||
} else {
|
||||
notifyItemInserted(getItemCount());
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -447,6 +451,7 @@ public class LiveChatAdapter extends RecyclerView.Adapter {
|
||||
}
|
||||
|
||||
public void scrollToBottom() {
|
||||
mRecyclerViewScrolledDy = 0;
|
||||
if (mList.size() > 0) {
|
||||
mRecyclerView.smoothScrollToPosition(getItemCount() - 1);
|
||||
}
|
||||
|
@ -0,0 +1,40 @@
|
||||
package com.yunbao.live.adapter;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.PointF;
|
||||
import android.util.DisplayMetrics;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
import androidx.recyclerview.widget.LinearSmoothScroller;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
public class LiveChatRecyclerViewLayoutManager extends LinearLayoutManager {
|
||||
private static final float MILLISECONDS_PER_INCH = 200f;
|
||||
public LiveChatRecyclerViewLayoutManager(Context context) {
|
||||
super(context);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void smoothScrollToPosition(RecyclerView recyclerView, RecyclerView.State state, int position) {
|
||||
// super.smoothScrollToPosition(recyclerView, state, position);
|
||||
LinearSmoothScroller linearSmoothScroller = new LinearSmoothScroller(recyclerView.getContext())
|
||||
{
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public PointF computeScrollVectorForPosition(int targetPosition) {
|
||||
return LiveChatRecyclerViewLayoutManager.this.computeScrollVectorForPosition(targetPosition);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected float calculateSpeedPerPixel(DisplayMetrics displayMetrics) {
|
||||
// System.out.println("----->自定义滑动 = "+MILLISECONDS_PER_INCH+" > "+( MILLISECONDS_PER_INCH / displayMetrics.densityDpi));
|
||||
return MILLISECONDS_PER_INCH / displayMetrics.densityDpi;
|
||||
}
|
||||
|
||||
};
|
||||
linearSmoothScroller.setTargetPosition(position);
|
||||
startSmoothScroll(linearSmoothScroller);
|
||||
}
|
||||
}
|
@ -92,6 +92,7 @@ public class LiveNewFunctionDialogFragment extends AbsDialogFragment implements
|
||||
mMultiPkView.setOnClickListener(this);
|
||||
mMicView.setOnClickListener(this);
|
||||
mRandomPk.setOnClickListener(this);
|
||||
findViewById(R.id.live_tool_robot).setOnClickListener(this);
|
||||
|
||||
if (leave == 0) {
|
||||
((ImageView) mLeaveView.findViewById(R.id.live_tool_leave_img)).setImageResource(R.mipmap.icon_leave);
|
||||
@ -145,6 +146,9 @@ public class LiveNewFunctionDialogFragment extends AbsDialogFragment implements
|
||||
mFunctionClickListener.onClick(LIVE_FUNC_MIC);
|
||||
} else if (id == R.id.live_tool_random_pk) {
|
||||
mFunctionClickListener.onClick(LIVE_FUNC_RANDOM_PK);
|
||||
}else if (id==R.id.live_tool_robot){
|
||||
mFunctionClickListener.onClick(LIVE_ROBOT);
|
||||
dismiss();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -3,21 +3,18 @@ package com.yunbao.live.dialog;
|
||||
import android.app.ActionBar;
|
||||
import android.os.Bundle;
|
||||
import android.view.Gravity;
|
||||
import android.view.View;
|
||||
import android.view.Window;
|
||||
import android.view.WindowManager;
|
||||
|
||||
import com.yunbao.common.dialog.AbsDialogFragment;
|
||||
import com.yunbao.common.utils.DpUtil;
|
||||
import com.yunbao.live.R;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import com.yunbao.common.dialog.AbsDialogFragment;
|
||||
import com.yunbao.live.R;
|
||||
|
||||
/**
|
||||
* 机器人设置
|
||||
*/
|
||||
public class LiveRobotSettingDialogFragment extends AbsDialogFragment implements View.OnClickListener {
|
||||
|
||||
public class LiveRobotSettingDialogFragment extends AbsDialogFragment {
|
||||
|
||||
|
||||
@Override
|
||||
@ -39,24 +36,15 @@ public class LiveRobotSettingDialogFragment extends AbsDialogFragment implements
|
||||
protected void setWindowAttributes(Window window) {
|
||||
WindowManager.LayoutParams params = window.getAttributes();
|
||||
params.width = ActionBar.LayoutParams.MATCH_PARENT;
|
||||
params.height = DpUtil.dp2px(460);
|
||||
params.height = ActionBar.LayoutParams.WRAP_CONTENT;
|
||||
params.gravity = Gravity.BOTTOM;
|
||||
window.setAttributes(params);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onActivityCreated(@Nullable Bundle savedInstanceState) {
|
||||
super.onActivityCreated(savedInstanceState);
|
||||
Bundle bundle = getArguments();
|
||||
if (bundle == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
dismiss();
|
||||
}
|
||||
|
||||
|
||||
|
@ -2,7 +2,6 @@ package com.yunbao.live.views;
|
||||
|
||||
import android.app.Dialog;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
@ -17,13 +16,13 @@ import android.widget.TextView;
|
||||
import androidx.constraintlayout.widget.ConstraintLayout;
|
||||
import androidx.core.content.ContextCompat;
|
||||
|
||||
import com.lxj.xpopup.XPopup;
|
||||
import com.yunbao.common.CommonAppConfig;
|
||||
import com.yunbao.common.Constants;
|
||||
import com.yunbao.common.bean.LiveClassBean;
|
||||
import com.yunbao.common.bean.UserBean;
|
||||
import com.yunbao.common.glide.ImgLoader;
|
||||
import com.yunbao.common.http.HttpCallback;
|
||||
import com.yunbao.common.interfaces.ActivityResultCallback;
|
||||
import com.yunbao.common.interfaces.CommonCallback;
|
||||
import com.yunbao.common.interfaces.ImageResultCallback;
|
||||
import com.yunbao.common.utils.DialogUitl;
|
||||
@ -33,9 +32,9 @@ import com.yunbao.common.utils.StringUtil;
|
||||
import com.yunbao.common.utils.ToastUtil;
|
||||
import com.yunbao.common.utils.WordUtil;
|
||||
import com.yunbao.common.views.AbsViewHolder;
|
||||
import com.yunbao.common.views.LiveRobotSettingCustomPopup;
|
||||
import com.yunbao.faceunity.FaceManager;
|
||||
import com.yunbao.live.R;
|
||||
import com.yunbao.live.activity.Beauty360Activity3;
|
||||
import com.yunbao.live.activity.LiveActivity;
|
||||
import com.yunbao.live.activity.LiveRyAnchorActivity;
|
||||
import com.yunbao.live.bean.LiveRoomTypeBean;
|
||||
@ -160,6 +159,7 @@ public class LiveNewReadyRyViewHolder extends AbsViewHolder implements View.OnCl
|
||||
findViewById(R.id.btn_live_class).setOnClickListener(this);
|
||||
findViewById(R.id.btn_close).setOnClickListener(this);
|
||||
findViewById(R.id.btn_beauty).setOnClickListener(this);
|
||||
findViewById(R.id.btn_robot).setOnClickListener(this);
|
||||
findViewById(R.id.btn_start_live).setOnClickListener(this);
|
||||
findViewById(R.id.btn_wishlist).setOnClickListener(this);
|
||||
findViewById(R.id.btn_horizontally).setOnClickListener(this);
|
||||
@ -218,6 +218,10 @@ public class LiveNewReadyRyViewHolder extends AbsViewHolder implements View.OnCl
|
||||
} else if (i == R.id.btn_horizontally) {
|
||||
RCRTCCameraOutputStream cameraStream = RCRTCEngine.getInstance().getDefaultVideoStream();
|
||||
cameraStream.setPreviewMirror(!cameraStream.isPreviewMirror());
|
||||
} else if (i == R.id.btn_robot) {
|
||||
new XPopup.Builder(mContext)
|
||||
.asCustom(new LiveRobotSettingCustomPopup(mContext))
|
||||
.show();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -36,6 +36,7 @@ import androidx.annotation.Nullable;
|
||||
import androidx.constraintlayout.widget.ConstraintLayout;
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
import androidx.recyclerview.widget.SimpleItemAnimator;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
@ -115,6 +116,7 @@ import com.yunbao.live.activity.LiveAudienceActivity;
|
||||
import com.yunbao.live.activity.LiveRyAnchorActivity;
|
||||
import com.yunbao.live.activity.ZhuangBanActivity;
|
||||
import com.yunbao.live.adapter.LiveChatAdapter;
|
||||
import com.yunbao.live.adapter.LiveChatRecyclerViewLayoutManager;
|
||||
import com.yunbao.live.adapter.LiveRoomFastMessageRecyclerViewAdapter;
|
||||
import com.yunbao.live.adapter.LiveUserAdapter;
|
||||
import com.yunbao.live.bean.DrPkbean;
|
||||
@ -867,11 +869,54 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
|
||||
mChatRecyclerView.setLayoutParams(params1);
|
||||
|
||||
mChatRecyclerView.setHasFixedSize(true);
|
||||
LinearLayoutManager layoutManager = new LinearLayoutManager(mContext);
|
||||
LinearLayoutManager layoutManager = new LiveChatRecyclerViewLayoutManager(mContext);
|
||||
layoutManager.setStackFromEnd(true);
|
||||
mChatRecyclerView.setLayoutManager(layoutManager);
|
||||
mChatRecyclerView.addItemDecoration(new TopGradual());
|
||||
mChatRecyclerView.setItemViewCacheSize(10);
|
||||
mChatRecyclerView.setItemAnimator(new SimpleItemAnimator() {
|
||||
@Override
|
||||
public boolean animateRemove(RecyclerView.ViewHolder holder) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean animateAdd(RecyclerView.ViewHolder holder) {
|
||||
Animation animation = AnimationUtils.loadAnimation(mContext, R.anim.live_chat_msg_in);
|
||||
holder.itemView.startAnimation(animation);
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean animateMove(RecyclerView.ViewHolder holder, int fromX, int fromY, int toX, int toY) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean animateChange(RecyclerView.ViewHolder oldHolder, RecyclerView.ViewHolder newHolder, int fromLeft, int fromTop, int toLeft, int toTop) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void runPendingAnimations() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void endAnimation(@NonNull RecyclerView.ViewHolder item) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void endAnimations() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isRunning() {
|
||||
return false;
|
||||
}
|
||||
});
|
||||
mLiveChatAdapter = new LiveChatAdapter(mContext);
|
||||
mChatRecyclerView.setAdapter(mLiveChatAdapter);
|
||||
mLiveChatAdapter.setOnItemClickListener(new OnItemClickListener<LiveChatBean>() {
|
||||
@ -927,6 +972,39 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
|
||||
mViewMedal.setOnClickListener(this);
|
||||
findViewById(R.id.btn_close).setOnClickListener(this);
|
||||
mAvatar.setOnClickListener(this);
|
||||
/*//点击侧边消息按钮,自动发消息,测试用的
|
||||
msg.setOnClickListener(new View.OnClickListener() {
|
||||
long index = 0;
|
||||
|
||||
public TimerTask createTask() {
|
||||
return new TimerTask() {
|
||||
@Override
|
||||
public void run() {
|
||||
LiveChatBean bean = new LiveChatBean();
|
||||
bean.setContent("test msg = " + index++);
|
||||
bean.setUserNiceName("auto");
|
||||
handler.post(() -> mLiveChatAdapter.insertItem(bean));
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
Handler handler = new Handler(Looper.getMainLooper());
|
||||
private TimerTask task;
|
||||
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
if (task == null) {
|
||||
task = createTask();
|
||||
new Timer().schedule(task, 0, 1000);
|
||||
} else {
|
||||
task.cancel();
|
||||
task = null;
|
||||
}
|
||||
}
|
||||
});
|
||||
userMore.setOnClickListener(v -> {
|
||||
mLiveChatAdapter.scrollToBottom();
|
||||
});*/
|
||||
findViewById(R.id.btn_votes).setOnClickListener(this);
|
||||
findViewById(R.id.btn_medal_rank).setOnClickListener(this);
|
||||
findViewById(R.id.btn_noble).setOnClickListener(this);
|
||||
@ -3721,6 +3799,7 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
|
||||
* 展示新消息提示
|
||||
*/
|
||||
public void showNewMessage() {
|
||||
if (newMessage.getVisibility() == View.VISIBLE) return;
|
||||
Locale locale = mContext.getResources().getConfiguration().locale;
|
||||
String language = locale.getLanguage();
|
||||
ImgLoader.display(mContext, TextUtils.equals(language, "zh") ? R.mipmap.new_message_cn : R.mipmap.new_message_en, newMessage);
|
||||
|
16
live/src/main/res/anim/live_chat_msg_in.xml
Normal file
16
live/src/main/res/anim/live_chat_msg_in.xml
Normal file
@ -0,0 +1,16 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<set xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<translate
|
||||
android:interpolator="@android:anim/decelerate_interpolator"
|
||||
android:duration="500"
|
||||
android:fromAlpha="0.1"
|
||||
android:toAlpha="1"
|
||||
android:fromYDelta="2.5%p"
|
||||
android:toYDelta="0" />
|
||||
<alpha
|
||||
android:interpolator="@android:anim/decelerate_interpolator"
|
||||
android:duration="500"
|
||||
android:fromAlpha="0.1"
|
||||
android:toAlpha="1"
|
||||
/>
|
||||
</set>
|
@ -1,11 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.coordinatorlayout.widget.CoordinatorLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@drawable/border_translucent">
|
||||
|
||||
|
||||
|
||||
</androidx.coordinatorlayout.widget.CoordinatorLayout>
|
@ -1,8 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
<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:id="@+id/traceroute_rootview"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
@ -254,13 +252,23 @@
|
||||
android:id="@+id/faceTextView"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textColor="#FFFFFF"
|
||||
android:visibility="gone"
|
||||
android:textSize="16sp"
|
||||
android:text=""
|
||||
android:textColor="#FFFFFF"
|
||||
android:textSize="16sp"
|
||||
android:visibility="gone"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/btn_robot"
|
||||
android:layout_width="30dp"
|
||||
android:layout_height="30dp"
|
||||
android:layout_marginEnd="50dp"
|
||||
android:layout_marginBottom="53dp"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:srcCompat="@mipmap/icon_robot" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
BIN
live/src/main/res/mipmap-xxxhdpi/icon_back.png
Normal file
BIN
live/src/main/res/mipmap-xxxhdpi/icon_back.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.1 KiB |
Loading…
Reference in New Issue
Block a user