主播协议,

This commit is contained in:
18401019693 2023-02-24 14:22:49 +08:00
parent d6eddeb130
commit ea9807dcdc
6 changed files with 86 additions and 3 deletions

View File

@ -559,6 +559,7 @@ public interface PDLiveApi {
@Query("type") int type, @Query("type") int type,
@Query("liveuid") String liveUid @Query("liveuid") String liveUid
); );
/** /**
* 获取直播数据 * 获取直播数据
*/ */
@ -566,4 +567,12 @@ public interface PDLiveApi {
Observable<ResponseModel<LiveDataInfoModel>> getLiveDataInfo( Observable<ResponseModel<LiveDataInfoModel>> getLiveDataInfo(
@Query("liveuid") String liveUid @Query("liveuid") String liveUid
); );
/**
* 获取直播数据
*/
@GET("/api/public/?service=Message.getAnchorMsg")
Observable<ResponseModel<List<ListInfoMessageModel>>> getAnchorMsg(
@Query("liveuid") String liveUid, @Query("page") int page, @Query("limit") int limit
);
} }

View File

@ -1092,6 +1092,7 @@ public class LiveNetManager {
/** /**
* 获取直播任务 * 获取直播任务
*
* @param type 1 直播任务 2粉丝任务 * @param type 1 直播任务 2粉丝任务
*/ */
public void getLiveTask(int type, String liveUid, HttpCallback<LiveTaskModel> callback) { public void getLiveTask(int type, String liveUid, HttpCallback<LiveTaskModel> callback) {
@ -1105,6 +1106,7 @@ public class LiveNetManager {
callback.onError(throwable.getMessage()); callback.onError(throwable.getMessage());
}).isDisposed(); }).isDisposed();
} }
/** /**
* 获取直播数据 * 获取直播数据
*/ */
@ -1120,6 +1122,29 @@ public class LiveNetManager {
}).isDisposed(); }).isDisposed();
} }
/**
* 获取主播消息
*
* @param liveUid 直播间id
* @param page 页码
* @param callback 回调
*/
public void getAnchorMsg(String liveUid, int page, HttpCallback<List<ListInfoMessageModel>> callback) {
API.get().pdLiveApi(mContext)
.getAnchorMsg(liveUid, page, 10)
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(listResponseModel -> {
if (callback != null) {
callback.onSuccess(listResponseModel.getData().getInfo());
}
}, throwable -> {
if (callback != null) {
callback.onError(throwable.getMessage());
}
}).isDisposed();
}
/** /**
* 直播间取消网络请求 * 直播间取消网络请求
*/ */

View File

@ -13,6 +13,7 @@ import com.yunbao.common.bean.ListInfoMessageModel;
import com.yunbao.common.http.base.HttpCallback; import com.yunbao.common.http.base.HttpCallback;
import com.yunbao.common.http.live.LiveNetManager; import com.yunbao.common.http.live.LiveNetManager;
import com.yunbao.common.utils.ToastUtil; import com.yunbao.common.utils.ToastUtil;
import com.yunbao.common.views.weight.OnRecyclerViewScrollListener;
import java.util.List; import java.util.List;
@ -22,6 +23,13 @@ import java.util.List;
public class LiveAnchorMessageCustomPopup extends BottomPopupView { public class LiveAnchorMessageCustomPopup extends BottomPopupView {
private LiveSystemMessageAdapter adapter; private LiveSystemMessageAdapter adapter;
private RecyclerView liveMessage; private RecyclerView liveMessage;
private String liveUid;
private int page = 1, size = 0;
public LiveAnchorMessageCustomPopup(@NonNull Context context, String liveUid) {
super(context);
this.liveUid = liveUid;
}
public LiveAnchorMessageCustomPopup(@NonNull Context context) { public LiveAnchorMessageCustomPopup(@NonNull Context context) {
super(context); super(context);
@ -43,9 +51,10 @@ public class LiveAnchorMessageCustomPopup extends BottomPopupView {
private void initDate() { private void initDate() {
LiveNetManager.get(getContext()) LiveNetManager.get(getContext())
.getListInfo("1", 1, new HttpCallback<List<ListInfoMessageModel>>() { .getAnchorMsg(liveUid, page, new HttpCallback<List<ListInfoMessageModel>>() {
@Override @Override
public void onSuccess(List<ListInfoMessageModel> data) { public void onSuccess(List<ListInfoMessageModel> data) {
size = data.size();
adapter.addData(data); adapter.addData(data);
} }
@ -63,6 +72,16 @@ public class LiveAnchorMessageCustomPopup extends BottomPopupView {
liveMessage.setLayoutManager(new LinearLayoutManager(getContext(), LinearLayoutManager.VERTICAL, false)); liveMessage.setLayoutManager(new LinearLayoutManager(getContext(), LinearLayoutManager.VERTICAL, false));
adapter = new LiveSystemMessageAdapter(getContext()); adapter = new LiveSystemMessageAdapter(getContext());
liveMessage.setAdapter(adapter); liveMessage.setAdapter(adapter);
liveMessage.addOnScrollListener(new OnRecyclerViewScrollListener() {
@Override
public void onBottom() {
if (size > 0) {
page = page + 1;
initDate();
}
}
});
} }
@Override @Override

View File

@ -12,6 +12,7 @@ import androidx.recyclerview.widget.RecyclerView;
import com.yunbao.common.R; import com.yunbao.common.R;
import com.yunbao.common.bean.ListInfoMessageModel; import com.yunbao.common.bean.ListInfoMessageModel;
import com.yunbao.common.glide.ImgLoader; import com.yunbao.common.glide.ImgLoader;
import com.yunbao.common.utils.RouteUtil;
public class LiveSystemMessageViewHolder extends RecyclerView.ViewHolder { public class LiveSystemMessageViewHolder extends RecyclerView.ViewHolder {
private TextView titleText, timeText, contextLayout, toView; private TextView titleText, timeText, contextLayout, toView;
@ -42,6 +43,12 @@ public class LiveSystemMessageViewHolder extends RecyclerView.ViewHolder {
toView.setVisibility(View.GONE); toView.setVisibility(View.GONE);
} else { } else {
toView.setVisibility(View.VISIBLE); toView.setVisibility(View.VISIBLE);
toView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
RouteUtil.forwardLiveZhuangBanActivity(model.getLink(), false);
}
});
} }
} }
} }

View File

@ -176,7 +176,7 @@ public class LiveNewFunctionDialogFragment extends AbsDialogFragment implements
dismiss(); dismiss();
} else if (id == R.id.message_linear) { } else if (id == R.id.message_linear) {
new XPopup.Builder(getContext()) new XPopup.Builder(getContext())
.asCustom(new LiveAnchorMessageCustomPopup(getContext())) .asCustom(new LiveAnchorMessageCustomPopup(getContext(), liveUid))
.show(); .show();
dismiss(); dismiss();
} else if (id == R.id.broadcast_data) { } else if (id == R.id.broadcast_data) {

View File

@ -26,6 +26,7 @@ import com.lxj.xpopup.core.BasePopupView;
import com.lxj.xpopup.interfaces.XPopupCallback; import com.lxj.xpopup.interfaces.XPopupCallback;
import com.yunbao.common.CommonAppConfig; import com.yunbao.common.CommonAppConfig;
import com.yunbao.common.Constants; import com.yunbao.common.Constants;
import com.yunbao.common.bean.IMLoginModel;
import com.yunbao.common.bean.LiveClassBean; import com.yunbao.common.bean.LiveClassBean;
import com.yunbao.common.bean.LiveRoomTypeBean; import com.yunbao.common.bean.LiveRoomTypeBean;
import com.yunbao.common.bean.UserBean; import com.yunbao.common.bean.UserBean;
@ -39,6 +40,7 @@ import com.yunbao.common.utils.Bus;
import com.yunbao.common.utils.DialogUitl; import com.yunbao.common.utils.DialogUitl;
import com.yunbao.common.utils.L; import com.yunbao.common.utils.L;
import com.yunbao.common.utils.ProcessImageUtil; import com.yunbao.common.utils.ProcessImageUtil;
import com.yunbao.common.utils.RouteUtil;
import com.yunbao.common.utils.StringUtil; import com.yunbao.common.utils.StringUtil;
import com.yunbao.common.utils.ToastUtil; import com.yunbao.common.utils.ToastUtil;
import com.yunbao.common.utils.WordUtil; import com.yunbao.common.utils.WordUtil;
@ -64,6 +66,7 @@ import org.greenrobot.eventbus.Subscribe;
import org.greenrobot.eventbus.ThreadMode; import org.greenrobot.eventbus.ThreadMode;
import java.io.File; import java.io.File;
import java.util.Locale;
import cn.rongcloud.rtc.api.RCRTCEngine; import cn.rongcloud.rtc.api.RCRTCEngine;
import cn.rongcloud.rtc.api.stream.RCRTCCameraOutputStream; import cn.rongcloud.rtc.api.stream.RCRTCCameraOutputStream;
@ -92,7 +95,7 @@ public class LiveNewReadyRyViewHolder extends AbsViewHolder implements View.OnCl
private ImageView imgClarity, selectorProtocol; private ImageView imgClarity, selectorProtocol;
private int selectClarity = 1; private int selectClarity = 1;
private LiveOpenCustomPopup liveOpenCustomPopup; private LiveOpenCustomPopup liveOpenCustomPopup;
private boolean selector = false; private boolean selector = true;
public LiveNewReadyRyViewHolder(Context context, ViewGroup parentView, int liveSdk) { public LiveNewReadyRyViewHolder(Context context, ViewGroup parentView, int liveSdk) {
super(context, parentView, liveSdk); super(context, parentView, liveSdk);
@ -191,6 +194,7 @@ public class LiveNewReadyRyViewHolder extends AbsViewHolder implements View.OnCl
findViewById(R.id.btn_start_live).setOnClickListener(this); findViewById(R.id.btn_start_live).setOnClickListener(this);
findViewById(R.id.btn_wishlist).setOnClickListener(this); findViewById(R.id.btn_wishlist).setOnClickListener(this);
findViewById(R.id.btn_horizontally).setOnClickListener(this); findViewById(R.id.btn_horizontally).setOnClickListener(this);
findViewById(R.id.anchor_agreement_layout).setOnClickListener(this);
if (manager != null) { if (manager != null) {
manager.setFaceStatusChanged(new FaceManager.FaceStatusChanged() { manager.setFaceStatusChanged(new FaceManager.FaceStatusChanged() {
@ -375,6 +379,10 @@ public class LiveNewReadyRyViewHolder extends AbsViewHolder implements View.OnCl
} else if (i == R.id.btn_room_type) { } else if (i == R.id.btn_room_type) {
chooseLiveType(); chooseLiveType();
} else if (i == R.id.btn_start_live) { } else if (i == R.id.btn_start_live) {
if (!selector) {
ToastUtil.show(R.string.anchor_agreement_hint);
return;
}
if (mLiveClassID == 0) { if (mLiveClassID == 0) {
ToastUtil.show(R.string.live_choose_live_class); ToastUtil.show(R.string.live_choose_live_class);
return; return;
@ -542,6 +550,21 @@ public class LiveNewReadyRyViewHolder extends AbsViewHolder implements View.OnCl
new XPopup.Builder(mContext) new XPopup.Builder(mContext)
.asCustom(new LiveRobotSettingCustomPopup(mContext)) .asCustom(new LiveRobotSettingCustomPopup(mContext))
.show(); .show();
} else if (i == R.id.anchor_agreement_layout) {
String ct = Locale.getDefault().getLanguage();
IMLoginModel model = IMLoginManager.get(mContext).getUserInfo();
StringBuffer url = new StringBuffer();
url.append(CommonAppConfig.HOST);
if (TextUtils.equals(ct, "zh")) {
url.append("/index.php?g=portal&m=page&a=index&id=66");
} else {
url.append("/index.php?g=portal&m=page&a=index&id=67");
}
url.append("&uid=")
.append(model.getId())
.append("&token=")
.append(model.getToken());
RouteUtil.forwardLiveZhuangBanActivity(url.toString(), false);
} }
} }