From 37217e529e850456b500d6bf814cf5ad66e404d1 Mon Sep 17 00:00:00 2001 From: 18401019693 Date: Mon, 25 Sep 2023 09:52:31 +0800 Subject: [PATCH] =?UTF-8?q?=E5=88=9B=E5=BB=BA=E6=B8=B8=E6=88=8F=EF=BC=8C?= =?UTF-8?q?=E6=B8=B8=E6=88=8F=E7=95=8C=E9=9D=A2=E5=AE=8C=E6=88=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../yunbao/common/bean/SudRoomListModel.java | 34 +++++++++++++++++++ .../common/dialog/SudGameListPopup.java | 21 +++++++++++- .../common/dialog/SudGameListSelectPopup.java | 3 +- .../yunbao/common/event/SudGameListEvent.java | 10 ++++++ .../com/yunbao/common/http/PDLiveApi.java | 15 ++++++++ .../common/http/live/LiveNetManager.java | 22 ++++++++++++ .../main/res/layout/dialog_sud_game_list.xml | 13 +++---- .../live/activity/LiveAudienceActivity.java | 4 +-- 8 files changed, 112 insertions(+), 10 deletions(-) create mode 100644 common/src/main/java/com/yunbao/common/bean/SudRoomListModel.java diff --git a/common/src/main/java/com/yunbao/common/bean/SudRoomListModel.java b/common/src/main/java/com/yunbao/common/bean/SudRoomListModel.java new file mode 100644 index 000000000..40d1729ef --- /dev/null +++ b/common/src/main/java/com/yunbao/common/bean/SudRoomListModel.java @@ -0,0 +1,34 @@ +package com.yunbao.common.bean; + +import com.google.gson.annotations.SerializedName; + +public class SudRoomListModel extends BaseModel { + + + @SerializedName("id") + private String id; + @SerializedName("room_holder_id") + private String roomHolderId; + @SerializedName("room_name") + private String roomName; + @SerializedName("room_holder_type") + private String roomHolderType; + @SerializedName("sud_game_id") + private String sudGameId; + @SerializedName("golden_bean_number") + private String goldenBeanNumber; + @SerializedName("room_status") + private String roomStatus; + @SerializedName("sud_game_room_id") + private String sudGameRoomId; + @SerializedName("room_holder_name") + private String roomHolderName; + @SerializedName("avatar") + private String avatar; + @SerializedName("sud_game_name") + private String sudGameName; + @SerializedName("player_total") + private String playerTotal; + @SerializedName("ob_total") + private String obTotal; +} diff --git a/common/src/main/java/com/yunbao/common/dialog/SudGameListPopup.java b/common/src/main/java/com/yunbao/common/dialog/SudGameListPopup.java index ef7c05b96..67ead1b0f 100644 --- a/common/src/main/java/com/yunbao/common/dialog/SudGameListPopup.java +++ b/common/src/main/java/com/yunbao/common/dialog/SudGameListPopup.java @@ -14,8 +14,11 @@ import com.lxj.xpopup.core.BottomPopupView; import com.lxj.xpopup.enums.PopupPosition; import com.yunbao.common.R; import com.yunbao.common.bean.CustomSidebarChildModel; +import com.yunbao.common.bean.SudRoomListModel; import com.yunbao.common.event.SudGameListDissMissEvent; import com.yunbao.common.event.SudGameListEvent; +import com.yunbao.common.http.base.HttpCallback; +import com.yunbao.common.http.live.LiveNetManager; import com.yunbao.common.utils.Bus; import com.yunbao.common.views.weight.ViewClicksAntiShake; @@ -31,11 +34,14 @@ public class SudGameListPopup extends BottomPopupView { private ImageView roomGameArrow; private TextView gameTitle; + private String id = "0", mLiveUid; + private int page = 0; - public SudGameListPopup(@NonNull Context context, long interactionID, List child) { + public SudGameListPopup(@NonNull Context context, long interactionID, List child, String liveUid) { super(context); this.interactionID = interactionID; customSidebarChildModels = child; + mLiveUid = liveUid; } // 返回自定义弹窗的布局 @@ -55,7 +61,18 @@ public class SudGameListPopup extends BottomPopupView { } private void initDate() { + LiveNetManager.get(getContext()) + .getRoomList(id, "0,0", "0", mLiveUid, page, new HttpCallback>() { + @Override + public void onSuccess(List data) { + } + + @Override + public void onError(String error) { + + } + }); } private void initView() { @@ -64,6 +81,7 @@ public class SudGameListPopup extends BottomPopupView { for (CustomSidebarChildModel model : customSidebarChildModels) { if (TextUtils.equals(String.valueOf(interactionID), model.getSrc())) { gameTitle.setText(model.getTitle().substring(0, 2)); + id = model.getId(); } } @@ -109,6 +127,7 @@ public class SudGameListPopup extends BottomPopupView { public void onSudGameListEvent(SudGameListEvent event) { interactionID = event.getInteractionID(); gameTitle.setText(event.getTitle().substring(0, 2)); + id = event.getId(); ObjectAnimator animator = ObjectAnimator.ofFloat(roomGameArrow, "rotation", 90f, 0f); animator.setDuration(500); animator.setInterpolator(new LinearInterpolator()); diff --git a/common/src/main/java/com/yunbao/common/dialog/SudGameListSelectPopup.java b/common/src/main/java/com/yunbao/common/dialog/SudGameListSelectPopup.java index afb5760fc..b269d0323 100644 --- a/common/src/main/java/com/yunbao/common/dialog/SudGameListSelectPopup.java +++ b/common/src/main/java/com/yunbao/common/dialog/SudGameListSelectPopup.java @@ -71,6 +71,7 @@ public class SudGameListSelectPopup extends AttachPopupView { if (mType == 0) { Bus.get().post(new SudGameListEvent() .setInteractionID(Long.parseLong(customSidebarChildModels.get(index).getSrc())) + .setId(customSidebarChildModels.get(index).getId()) .setTitle(customSidebarChildModels.get(index).getTitle())); } else { Bus.get().post(new CreateSudGameEvent() @@ -86,7 +87,7 @@ public class SudGameListSelectPopup extends AttachPopupView { ViewClicksAntiShake.clicksAntiShake(topSelect, new ViewClicksAntiShake.ViewClicksCallBack() { @Override public void onViewClicks() { - Bus.get().post(new SudGameListEvent().setInteractionID(0L).setTitle(getContext().getString(R.string.interactive_game_room_all))); + Bus.get().post(new SudGameListEvent().setInteractionID(0L).setTitle(getContext().getString(R.string.interactive_game_room_all)).setId("0")); dialog.dismiss(); } }); diff --git a/common/src/main/java/com/yunbao/common/event/SudGameListEvent.java b/common/src/main/java/com/yunbao/common/event/SudGameListEvent.java index 26b145d1f..35d05b6df 100644 --- a/common/src/main/java/com/yunbao/common/event/SudGameListEvent.java +++ b/common/src/main/java/com/yunbao/common/event/SudGameListEvent.java @@ -5,6 +5,16 @@ import com.yunbao.common.bean.BaseModel; public class SudGameListEvent extends BaseModel { private long interactionID = 0; private String title; + private String id; + + public String getId() { + return id; + } + + public SudGameListEvent setId(String id) { + this.id = id; + return this; + } public String getTitle() { return title; diff --git a/common/src/main/java/com/yunbao/common/http/PDLiveApi.java b/common/src/main/java/com/yunbao/common/http/PDLiveApi.java index d6c52afae..10a7ec9c9 100644 --- a/common/src/main/java/com/yunbao/common/http/PDLiveApi.java +++ b/common/src/main/java/com/yunbao/common/http/PDLiveApi.java @@ -54,6 +54,7 @@ import com.yunbao.common.bean.SearchModel; import com.yunbao.common.bean.SetAttentsModel; import com.yunbao.common.bean.SlideInBannerModel; import com.yunbao.common.bean.StarChallengeStatusModel; +import com.yunbao.common.bean.SudRoomListModel; import com.yunbao.common.bean.SudgameCodeModel; import com.yunbao.common.bean.UserAreaBean; import com.yunbao.common.bean.UserAvatarSelectBean; @@ -990,5 +991,19 @@ public interface PDLiveApi { @Query("golden_bean_number") String goldenBeanNumber, @Query("game_id") String gameId); + /** + * 获取游戏房列表 + * + * @return + */ + @GET("/api/public/?service=Sudgameserver.getRoomList") + Observable>> getRoomList( + @Query("sud_game_id") String sudGameId, + @Query("threshold") String threshold, + @Query("room_holder_type") String roomHolderType, + @Query("liveuid") String liveUid, + @Query("page") int page + ); + } diff --git a/common/src/main/java/com/yunbao/common/http/live/LiveNetManager.java b/common/src/main/java/com/yunbao/common/http/live/LiveNetManager.java index 11af25791..d6b338e12 100644 --- a/common/src/main/java/com/yunbao/common/http/live/LiveNetManager.java +++ b/common/src/main/java/com/yunbao/common/http/live/LiveNetManager.java @@ -50,6 +50,7 @@ import com.yunbao.common.bean.RedPacketInfoModel; import com.yunbao.common.bean.RedPacketListBean; import com.yunbao.common.bean.SetAttentsModel; import com.yunbao.common.bean.StarChallengeStatusModel; +import com.yunbao.common.bean.SudRoomListModel; import com.yunbao.common.bean.SudgameCodeModel; import com.yunbao.common.bean.UserAreaBean; import com.yunbao.common.bean.UserAvatarSelectBean; @@ -2239,6 +2240,27 @@ public class LiveNetManager { }).isDisposed(); } + public void getRoomList(String sudGameId, String threshold, String roomHolderType, String liveUid, int page, HttpCallback> callback) { + API.get().pdLiveApi(mContext) + .getRoomList(sudGameId, threshold, roomHolderType, liveUid, page) + .subscribeOn(Schedulers.io()) + .observeOn(AndroidSchedulers.mainThread()) + .subscribe(new Consumer>>() { + @Override + public void accept(ResponseModel> listResponseModel) throws Exception { + if (callback != null) { + callback.onSuccess(listResponseModel.getData().getInfo()); + } + } + }, new Consumer() { + @Override + public void accept(Throwable throwable) throws Exception { + if (callback != null) { + callback.onError(mContext.getString(R.string.net_error)); + } + } + }).isDisposed(); + } /** * 直播间取消网络请求 diff --git a/common/src/main/res/layout/dialog_sud_game_list.xml b/common/src/main/res/layout/dialog_sud_game_list.xml index 8e6574470..04041e402 100644 --- a/common/src/main/res/layout/dialog_sud_game_list.xml +++ b/common/src/main/res/layout/dialog_sud_game_list.xml @@ -102,27 +102,28 @@ android:textColor="#fff" android:textSize="14sp" /> - + android:background="@drawable/bg_live_sud_list_btn"> - +