開播設置,修改開播接口新增分辨率設置參數
This commit is contained in:
@@ -0,0 +1,105 @@
|
||||
package com.yunbao.common.bean;
|
||||
|
||||
import com.yunbao.common.Constants;
|
||||
import com.yunbao.common.R;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Created by cxf on 2018/10/8.
|
||||
* 直播房间类型
|
||||
*/
|
||||
|
||||
public class LiveRoomTypeBean {
|
||||
|
||||
private int mId;
|
||||
private String mName;
|
||||
private int mCheckedIcon;
|
||||
private int mUnCheckedIcon;
|
||||
private boolean mChecked;
|
||||
|
||||
public LiveRoomTypeBean() {
|
||||
}
|
||||
|
||||
public LiveRoomTypeBean(int id, String name) {
|
||||
mId = id;
|
||||
mName = name;
|
||||
}
|
||||
|
||||
public LiveRoomTypeBean(int id, String name, int checkedIcon, int unCheckedIcon) {
|
||||
mId = id;
|
||||
mName = name;
|
||||
mCheckedIcon = checkedIcon;
|
||||
mUnCheckedIcon = unCheckedIcon;
|
||||
}
|
||||
|
||||
public int getId() {
|
||||
return mId;
|
||||
}
|
||||
|
||||
public void setId(int id) {
|
||||
mId = id;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return mName;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
mName = name;
|
||||
}
|
||||
|
||||
public int getCheckedIcon() {
|
||||
return mCheckedIcon;
|
||||
}
|
||||
|
||||
public void setCheckedIcon(int checkedIcon) {
|
||||
mCheckedIcon = checkedIcon;
|
||||
}
|
||||
|
||||
public int getUnCheckedIcon() {
|
||||
return mUnCheckedIcon;
|
||||
}
|
||||
|
||||
public void setUnCheckedIcon(int unCheckedIcon) {
|
||||
mUnCheckedIcon = unCheckedIcon;
|
||||
}
|
||||
|
||||
public boolean isChecked() {
|
||||
return mChecked;
|
||||
}
|
||||
|
||||
public void setChecked(boolean checked) {
|
||||
mChecked = checked;
|
||||
}
|
||||
|
||||
public static List<LiveRoomTypeBean> getLiveTypeList(String[][] liveTypes) {
|
||||
List<LiveRoomTypeBean> list = new ArrayList<>();
|
||||
if (liveTypes != null) {
|
||||
for (String[] arr : liveTypes) {
|
||||
LiveRoomTypeBean bean = new LiveRoomTypeBean(Integer.parseInt(arr[0]), arr[1]);
|
||||
switch (bean.getId()) {
|
||||
case Constants.LIVE_TYPE_NORMAL:
|
||||
bean.setCheckedIcon(R.mipmap.icon_live_type_normal_1);
|
||||
bean.setUnCheckedIcon(R.mipmap.icon_live_type_normal_2);
|
||||
break;
|
||||
case Constants.LIVE_TYPE_PWD:
|
||||
bean.setCheckedIcon(R.mipmap.icon_live_type_pwd_1);
|
||||
bean.setUnCheckedIcon(R.mipmap.icon_live_type_pwd_2);
|
||||
break;
|
||||
case Constants.LIVE_TYPE_PAY:
|
||||
bean.setCheckedIcon(R.mipmap.icon_live_type_pay_1);
|
||||
bean.setUnCheckedIcon(R.mipmap.icon_live_type_pay_2);
|
||||
break;
|
||||
case Constants.LIVE_TYPE_TIME:
|
||||
bean.setCheckedIcon(R.mipmap.icon_live_type_time_1);
|
||||
bean.setUnCheckedIcon(R.mipmap.icon_live_type_time_2);
|
||||
break;
|
||||
}
|
||||
list.add(bean);
|
||||
}
|
||||
}
|
||||
return list;
|
||||
}
|
||||
}
|
||||
@@ -17,6 +17,7 @@ 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.LiveStetUpStatusModel;
|
||||
import com.yunbao.common.bean.NobleRankHideUserListModel;
|
||||
import com.yunbao.common.bean.NobleTrumpetModel;
|
||||
import com.yunbao.common.bean.PkRankBean;
|
||||
@@ -1034,6 +1035,34 @@ public class LiveNetManager {
|
||||
}).isDisposed();
|
||||
}
|
||||
|
||||
/**
|
||||
* 开播设置数据获取
|
||||
*
|
||||
* @param liveUid
|
||||
* @param callback
|
||||
*/
|
||||
public void getLiveStetUpStatus(String liveUid, HttpCallback<LiveStetUpStatusModel> callback) {
|
||||
API.get().pdLiveApi(mContext)
|
||||
.getLiveStetUpStatus(liveUid)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(new Consumer<ResponseModel<LiveStetUpStatusModel>>() {
|
||||
@Override
|
||||
public void accept(ResponseModel<LiveStetUpStatusModel> liveStetUpStatusModelResponseModel) throws Exception {
|
||||
if (callback != null) {
|
||||
callback.onSuccess(liveStetUpStatusModelResponseModel.getData().getInfo());
|
||||
}
|
||||
}
|
||||
}, new Consumer<Throwable>() {
|
||||
@Override
|
||||
public void accept(Throwable throwable) throws Exception {
|
||||
if (callback != null) {
|
||||
callback.onError(throwable.getMessage());
|
||||
}
|
||||
}
|
||||
}).isDisposed();
|
||||
}
|
||||
|
||||
/**
|
||||
* 直播间取消网络请求
|
||||
*/
|
||||
|
||||
@@ -0,0 +1,178 @@
|
||||
package com.yunbao.common.views;
|
||||
|
||||
import android.content.Context;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
import com.lxj.xpopup.core.CenterPopupView;
|
||||
import com.yunbao.common.R;
|
||||
import com.yunbao.common.bean.LiveClassBean;
|
||||
import com.yunbao.common.bean.LiveRoomTypeBean;
|
||||
import com.yunbao.common.bean.LiveStetUpStatusModel;
|
||||
import com.yunbao.common.http.base.HttpCallback;
|
||||
import com.yunbao.common.http.live.LiveNetManager;
|
||||
import com.yunbao.common.manager.IMLoginManager;
|
||||
import com.yunbao.common.utils.ToastUtil;
|
||||
import com.yunbao.common.views.weight.ViewClicksAntiShake;
|
||||
|
||||
public class LiveOpenCustomPopup extends CenterPopupView {
|
||||
//清晰度
|
||||
private int selectClarity;
|
||||
//直播类型
|
||||
private LiveClassBean classBean;
|
||||
//房间类型
|
||||
private LiveRoomTypeBean liveRoomTypeBean;
|
||||
|
||||
private TextView textClarity, textLiveRoomType, textLiveClass, textLiveWishlist, textRobot;
|
||||
|
||||
public LiveOpenCustomPopup setClassBean(LiveClassBean classBean) {
|
||||
this.classBean = classBean;
|
||||
textLiveClass.setText(classBean.getName());
|
||||
return this;
|
||||
}
|
||||
|
||||
public LiveOpenCustomPopup setLiveRoomTypeBean(LiveRoomTypeBean liveRoomTypeBean) {
|
||||
this.liveRoomTypeBean = liveRoomTypeBean;
|
||||
textLiveRoomType.setText(liveRoomTypeBean.getName());
|
||||
return this;
|
||||
}
|
||||
|
||||
public LiveOpenCustomPopup(@NonNull Context context, int selectClarity, LiveClassBean classBean, LiveRoomTypeBean liveRoomTypeBean) {
|
||||
super(context);
|
||||
this.selectClarity = selectClarity;
|
||||
this.classBean = classBean;
|
||||
this.liveRoomTypeBean = liveRoomTypeBean;
|
||||
}
|
||||
|
||||
// 返回自定义弹窗的布局
|
||||
@Override
|
||||
protected int getImplLayoutId() {
|
||||
return R.layout.view_live_open;
|
||||
}
|
||||
|
||||
// 执行初始化操作,比如:findView,设置点击,或者任何你弹窗内的业务逻辑
|
||||
@Override
|
||||
protected void onCreate() {
|
||||
super.onCreate();
|
||||
initView();
|
||||
initDate();
|
||||
}
|
||||
|
||||
private void initView() {
|
||||
textClarity = findViewById(R.id.text_clarity);
|
||||
textLiveRoomType = findViewById(R.id.text_live_room_type);
|
||||
textLiveClass = findViewById(R.id.text_live_class);
|
||||
textLiveWishlist = findViewById(R.id.text_live_wishlist);
|
||||
textRobot = findViewById(R.id.text_robot);
|
||||
if (classBean != null) {
|
||||
textLiveClass.setText(classBean.getName());
|
||||
}
|
||||
if (liveRoomTypeBean != null) {
|
||||
textLiveRoomType.setText(liveRoomTypeBean.getName());
|
||||
}
|
||||
setSelectClarity(selectClarity);
|
||||
//關閉彈窗
|
||||
ViewClicksAntiShake.clicksAntiShake(findViewById(R.id.live_open_cancel), () -> dismiss());
|
||||
//開播
|
||||
ViewClicksAntiShake.clicksAntiShake(findViewById(R.id.live_open_ok), () -> {
|
||||
if (callBack != null) {
|
||||
callBack.startLive(liveRoomTypeBean, classBean);
|
||||
}
|
||||
dismiss();
|
||||
});
|
||||
//設置直播類型
|
||||
ViewClicksAntiShake.clicksAntiShake(findViewById(R.id.line_live_class), () -> {
|
||||
if (callBack != null) {
|
||||
callBack.openLiveClass(classBean);
|
||||
}
|
||||
});
|
||||
//設置清晰度
|
||||
ViewClicksAntiShake.clicksAntiShake(findViewById(R.id.line_clarity), () -> {
|
||||
if (callBack != null) {
|
||||
callBack.selectClarity(selectClarity);
|
||||
}
|
||||
});
|
||||
//設置房間類型
|
||||
ViewClicksAntiShake.clicksAntiShake(findViewById(R.id.line_live_room_type), () -> {
|
||||
if (callBack != null) {
|
||||
callBack.openLiveRoomType(liveRoomTypeBean);
|
||||
}
|
||||
});
|
||||
//打開心願單
|
||||
ViewClicksAntiShake.clicksAntiShake(findViewById(R.id.line_live_wishlist), () -> {
|
||||
if (callBack != null) {
|
||||
callBack.openWishlist();
|
||||
}
|
||||
});
|
||||
//設置機器人
|
||||
ViewClicksAntiShake.clicksAntiShake(findViewById(R.id.line_robot), new ViewClicksAntiShake.ViewClicksCallBack() {
|
||||
@Override
|
||||
public void onViewClicks() {
|
||||
if (callBack != null) {
|
||||
callBack.openRobot();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void setSelectClarity(int selectClarity) {
|
||||
switch (selectClarity) {
|
||||
case 0:
|
||||
textClarity.setText(R.string.standard_clear);
|
||||
break;
|
||||
case 1:
|
||||
textClarity.setText(R.string.high_definition);
|
||||
break;
|
||||
case 2:
|
||||
textClarity.setText(R.string.ultra_hd);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public void initDate() {
|
||||
LiveNetManager.get(getContext())
|
||||
.getLiveStetUpStatus(String.valueOf(IMLoginManager.get(getContext()).getUserInfo().getId()),
|
||||
new HttpCallback<LiveStetUpStatusModel>() {
|
||||
@Override
|
||||
public void onSuccess(LiveStetUpStatusModel data) {
|
||||
textLiveWishlist.setText(data.getWishListState() ? R.string.do_set : R.string.not_set);
|
||||
textRobot.setText(data.getAiStateState() ? R.string.robot_yes : R.string.robot_no);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(String error) {
|
||||
ToastUtil.show(error);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
|
||||
private LiveOpenCallBack callBack;
|
||||
|
||||
public LiveOpenCustomPopup setCallBack(LiveOpenCallBack callBack) {
|
||||
this.callBack = callBack;
|
||||
return this;
|
||||
}
|
||||
|
||||
public interface LiveOpenCallBack {
|
||||
//開播
|
||||
void startLive(LiveRoomTypeBean liveRoomTypeBean, LiveClassBean classBean);
|
||||
|
||||
//選擇清晰度
|
||||
void selectClarity(int selectClarity);
|
||||
|
||||
//打開機器人
|
||||
void openRobot();
|
||||
|
||||
//打開直播間類型
|
||||
void openLiveRoomType(LiveRoomTypeBean liveRoomTypeBean);
|
||||
|
||||
//打開直播類型
|
||||
void openLiveClass(LiveClassBean classBean);
|
||||
|
||||
//打開心願單
|
||||
void openWishlist();
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,6 @@
|
||||
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;
|
||||
@@ -24,8 +23,6 @@ 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;
|
||||
@@ -36,6 +33,10 @@ public class LiveRobotSettingCustomPopup extends BottomPopupView implements View
|
||||
|
||||
private int robotStateInt = 1;
|
||||
|
||||
public int getRobotStateInt() {
|
||||
return robotStateInt;
|
||||
}
|
||||
|
||||
public LiveRobotSettingCustomPopup(@NonNull Context context) {
|
||||
super(context);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user