主播协议,
This commit is contained in:
@@ -559,6 +559,7 @@ public interface PDLiveApi {
|
||||
@Query("type") int type,
|
||||
@Query("liveuid") String liveUid
|
||||
);
|
||||
|
||||
/**
|
||||
* 获取直播数据
|
||||
*/
|
||||
@@ -566,4 +567,12 @@ public interface PDLiveApi {
|
||||
Observable<ResponseModel<LiveDataInfoModel>> getLiveDataInfo(
|
||||
@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
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1092,6 +1092,7 @@ public class LiveNetManager {
|
||||
|
||||
/**
|
||||
* 获取直播任务
|
||||
*
|
||||
* @param type 1 直播任务 2粉丝任务
|
||||
*/
|
||||
public void getLiveTask(int type, String liveUid, HttpCallback<LiveTaskModel> callback) {
|
||||
@@ -1105,6 +1106,7 @@ public class LiveNetManager {
|
||||
callback.onError(throwable.getMessage());
|
||||
}).isDisposed();
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取直播数据
|
||||
*/
|
||||
@@ -1120,6 +1122,29 @@ public class LiveNetManager {
|
||||
}).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();
|
||||
}
|
||||
|
||||
/**
|
||||
* 直播间取消网络请求
|
||||
*/
|
||||
|
||||
@@ -13,6 +13,7 @@ import com.yunbao.common.bean.ListInfoMessageModel;
|
||||
import com.yunbao.common.http.base.HttpCallback;
|
||||
import com.yunbao.common.http.live.LiveNetManager;
|
||||
import com.yunbao.common.utils.ToastUtil;
|
||||
import com.yunbao.common.views.weight.OnRecyclerViewScrollListener;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -22,6 +23,13 @@ import java.util.List;
|
||||
public class LiveAnchorMessageCustomPopup extends BottomPopupView {
|
||||
private LiveSystemMessageAdapter adapter;
|
||||
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) {
|
||||
super(context);
|
||||
@@ -43,9 +51,10 @@ public class LiveAnchorMessageCustomPopup extends BottomPopupView {
|
||||
|
||||
private void initDate() {
|
||||
LiveNetManager.get(getContext())
|
||||
.getListInfo("1", 1, new HttpCallback<List<ListInfoMessageModel>>() {
|
||||
.getAnchorMsg(liveUid, page, new HttpCallback<List<ListInfoMessageModel>>() {
|
||||
@Override
|
||||
public void onSuccess(List<ListInfoMessageModel> data) {
|
||||
size = data.size();
|
||||
adapter.addData(data);
|
||||
}
|
||||
|
||||
@@ -63,6 +72,16 @@ public class LiveAnchorMessageCustomPopup extends BottomPopupView {
|
||||
liveMessage.setLayoutManager(new LinearLayoutManager(getContext(), LinearLayoutManager.VERTICAL, false));
|
||||
adapter = new LiveSystemMessageAdapter(getContext());
|
||||
liveMessage.setAdapter(adapter);
|
||||
liveMessage.addOnScrollListener(new OnRecyclerViewScrollListener() {
|
||||
@Override
|
||||
public void onBottom() {
|
||||
if (size > 0) {
|
||||
page = page + 1;
|
||||
initDate();
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -12,6 +12,7 @@ import androidx.recyclerview.widget.RecyclerView;
|
||||
import com.yunbao.common.R;
|
||||
import com.yunbao.common.bean.ListInfoMessageModel;
|
||||
import com.yunbao.common.glide.ImgLoader;
|
||||
import com.yunbao.common.utils.RouteUtil;
|
||||
|
||||
public class LiveSystemMessageViewHolder extends RecyclerView.ViewHolder {
|
||||
private TextView titleText, timeText, contextLayout, toView;
|
||||
@@ -42,6 +43,12 @@ public class LiveSystemMessageViewHolder extends RecyclerView.ViewHolder {
|
||||
toView.setVisibility(View.GONE);
|
||||
} else {
|
||||
toView.setVisibility(View.VISIBLE);
|
||||
toView.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
RouteUtil.forwardLiveZhuangBanActivity(model.getLink(), false);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user