From 450047aae22e7f6cc3959bc7ebc0077e356bd8d3 Mon Sep 17 00:00:00 2001 From: 18401019693 Date: Fri, 25 Nov 2022 16:26:56 +0800 Subject: [PATCH] =?UTF-8?q?=E5=90=88=E5=B9=B6=E6=8E=A5=E5=8F=A3=E7=AC=AC?= =?UTF-8?q?=E4=B8=80=E6=AC=A1=E4=B8=8A=E4=BC=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/yunbao/common/Constants.java | 2 + .../common/bean/AnchorRecommendItemModel.java | 2 +- .../yunbao/common/bean/CheckLiveModel.java | 53 ++ .../common/bean/EnterRoomInfoModel.java | 540 ++++++++++++++++++ .../yunbao/common/bean/EnterRoomNewModel.java | 111 ++++ .../com/yunbao/common/bean/GuardModel.java | 29 + .../yunbao/common/bean/GuardUserModel.java | 33 ++ .../com/yunbao/common/bean/IMLoginModel.java | 121 ++++ .../java/com/yunbao/common/bean/LiveBean.java | 43 +- .../common/bean/LiveRoomActivityModel.java | 66 +++ .../yunbao/common}/bean/LiveUserGiftBean.java | 12 +- .../com/yunbao/common/bean/LminfoModel.java | 23 + .../common/bean/NewPeopleTaskModel.java | 14 + .../yunbao/common/bean/PKTopThreeModel.java | 39 ++ .../yunbao/common/bean/PkTopUsersModel.java | 18 + .../com/yunbao/common/bean/PkinfoModel.java | 161 ++++++ .../com/yunbao/common/bean/RankHourModel.java | 61 ++ .../com/yunbao/common/bean/WishListModel.java | 30 + .../com/yunbao/common/bean/WishModel.java | 106 ++++ .../com/yunbao/common/http/PDLiveApi.java | 47 +- .../common/http/base/CheckLiveCallBack.java | 30 + .../common/http/live/LiveNetManager.java | 117 +++- .../com/yunbao/common/utils/RouteUtil.java | 5 +- config.gradle | 4 +- .../yunbao/live/activity/LiveActivity.java | 2 +- .../live/activity/LiveAudienceActivity.java | 166 ++++-- .../live/activity/LiveRyAnchorActivity.java | 2 +- .../yunbao/live/adapter/LiveUserAdapter.java | 2 +- .../live/adapter/UserMoreInfoAdapter.java | 2 +- .../yunbao/live/bean/LiveEnterRoomBean.java | 2 + .../dialog/LiveMicAnchorDialogFragment.java | 2 +- .../dialog/LiveUserMoreDialogFragment.java | 2 +- .../presenter/LiveRoomCheckLivePresenter.java | 88 ++- .../com/yunbao/live/socket/SocketClient.java | 2 +- .../live/socket/SocketMessageListener.java | 2 +- .../yunbao/live/socket/SocketRyClient.java | 27 +- .../yunbao/live/views/LiveRoomViewHolder.java | 80 ++- .../live/views/PortraitLiveManager.java | 455 ++++++++------- .../yunbao/main/activity/MainActivity.java | 21 +- .../views/AbsMainListChildViewHolder.java | 2 + 40 files changed, 2197 insertions(+), 327 deletions(-) create mode 100644 common/src/main/java/com/yunbao/common/bean/CheckLiveModel.java create mode 100644 common/src/main/java/com/yunbao/common/bean/EnterRoomInfoModel.java create mode 100644 common/src/main/java/com/yunbao/common/bean/EnterRoomNewModel.java create mode 100644 common/src/main/java/com/yunbao/common/bean/GuardModel.java create mode 100644 common/src/main/java/com/yunbao/common/bean/GuardUserModel.java create mode 100644 common/src/main/java/com/yunbao/common/bean/LiveRoomActivityModel.java rename {live/src/main/java/com/yunbao/live => common/src/main/java/com/yunbao/common}/bean/LiveUserGiftBean.java (81%) create mode 100644 common/src/main/java/com/yunbao/common/bean/LminfoModel.java create mode 100644 common/src/main/java/com/yunbao/common/bean/NewPeopleTaskModel.java create mode 100644 common/src/main/java/com/yunbao/common/bean/PKTopThreeModel.java create mode 100644 common/src/main/java/com/yunbao/common/bean/PkTopUsersModel.java create mode 100644 common/src/main/java/com/yunbao/common/bean/PkinfoModel.java create mode 100644 common/src/main/java/com/yunbao/common/bean/RankHourModel.java create mode 100644 common/src/main/java/com/yunbao/common/bean/WishListModel.java create mode 100644 common/src/main/java/com/yunbao/common/bean/WishModel.java create mode 100644 common/src/main/java/com/yunbao/common/http/base/CheckLiveCallBack.java diff --git a/common/src/main/java/com/yunbao/common/Constants.java b/common/src/main/java/com/yunbao/common/Constants.java index aa5c3c898..19eba69b3 100644 --- a/common/src/main/java/com/yunbao/common/Constants.java +++ b/common/src/main/java/com/yunbao/common/Constants.java @@ -10,6 +10,8 @@ import java.util.List; */ public class Constants { + public static final String NEW_ENTER_ROOM = "enterRoom"; + public static final String URL = "url"; public static final String PAYLOAD = "payload"; public static final String SEX = "sex"; diff --git a/common/src/main/java/com/yunbao/common/bean/AnchorRecommendItemModel.java b/common/src/main/java/com/yunbao/common/bean/AnchorRecommendItemModel.java index c41269d80..6c4673751 100644 --- a/common/src/main/java/com/yunbao/common/bean/AnchorRecommendItemModel.java +++ b/common/src/main/java/com/yunbao/common/bean/AnchorRecommendItemModel.java @@ -75,7 +75,7 @@ public class AnchorRecommendItemModel extends BaseModel { private String avatarThumb = ""; @SerializedName("avatar2") private String avatar2 = ""; - @SerializedName("user_nicename") + @SerializedName(value = "user_nicename", alternate = "userNiceName") private String userNicename = ""; @SerializedName("level") private String level = ""; diff --git a/common/src/main/java/com/yunbao/common/bean/CheckLiveModel.java b/common/src/main/java/com/yunbao/common/bean/CheckLiveModel.java new file mode 100644 index 000000000..ccb6274c8 --- /dev/null +++ b/common/src/main/java/com/yunbao/common/bean/CheckLiveModel.java @@ -0,0 +1,53 @@ +package com.yunbao.common.bean; + +import com.google.gson.Gson; +import com.google.gson.annotations.SerializedName; + +public class CheckLiveModel extends BaseModel { + + @SerializedName("type") + private int type; + @SerializedName("type_val") + private String typeVal; + @SerializedName("type_msg") + private String typeMsg; + @SerializedName("live_sdk") + private String liveSdk; + + public static CheckLiveModel objectFromData(String str) { + + return new Gson().fromJson(str, CheckLiveModel.class); + } + + public int getType() { + return type; + } + + public void setType(int type) { + this.type = type; + } + + public String getTypeVal() { + return typeVal; + } + + public void setTypeVal(String typeVal) { + this.typeVal = typeVal; + } + + public String getTypeMsg() { + return typeMsg; + } + + public void setTypeMsg(String typeMsg) { + this.typeMsg = typeMsg; + } + + public String getLiveSdk() { + return liveSdk; + } + + public void setLiveSdk(String liveSdk) { + this.liveSdk = liveSdk; + } +} diff --git a/common/src/main/java/com/yunbao/common/bean/EnterRoomInfoModel.java b/common/src/main/java/com/yunbao/common/bean/EnterRoomInfoModel.java new file mode 100644 index 000000000..502eb757d --- /dev/null +++ b/common/src/main/java/com/yunbao/common/bean/EnterRoomInfoModel.java @@ -0,0 +1,540 @@ +package com.yunbao.common.bean; + +import com.google.gson.Gson; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; + +import java.util.List; + +public class EnterRoomInfoModel extends BaseModel { + @SerializedName("votestotal") + private String votestotal; + @SerializedName("medalRankNum") + private String medalRankNum; + @SerializedName("barrage_fee") + private String barrageFee; + @SerializedName("userlist_time") + private String userlistTime; + @SerializedName("chatserver") + private String chatserver; + @SerializedName("linkmic_uid") + private String linkmicUid; + @SerializedName("linkmic_pull") + private String linkmicPull; + @SerializedName("nums") + private String nums; + @SerializedName("game") + private List game; + @SerializedName("gamebet") + private List gamebet; + @SerializedName("gametime") + private String gametime; + @SerializedName("gameid") + private String gameid; + @SerializedName("gameaction") + private String gameaction; + @SerializedName("game_bankerid") + private String gameBankerid; + @SerializedName("game_banker_name") + private String gameBankerName; + @SerializedName("game_banker_avatar") + private String gameBankerAvatar; + @SerializedName("game_banker_coin") + private String gameBankerCoin; + @SerializedName("game_banker_limit") + private String gameBankerLimit; + @SerializedName("shut_time") + private String shutTime; + @SerializedName("kick_time") + private String kickTime; + @SerializedName("speak_limit") + private String speakLimit; + @SerializedName("barrage_limit") + private String barrageLimit; + @SerializedName("coin") + private String coin; + @SerializedName("vip") + private VipModel vip; + @SerializedName("liang") + private LiangModel liang; + @SerializedName("medal_level") + private String medalLevel; + @SerializedName("medal_name") + private String medalName; + @SerializedName("issuper") + private String issuper; + @SerializedName("usertype") + private String usertype; + @SerializedName("front_task") + private String frontTask; + @SerializedName("ismic") + private String ismic; + @SerializedName("isattention") + private String isattention; + @SerializedName("userlists") + private List userlists; + @SerializedName("guard") + private GuardModel guard; + @SerializedName("guard_nums") + private String guardNums; + @SerializedName("pkinfo") + private PkinfoModel pkinfo; + @SerializedName("lminfo") + private LminfoModel lminfo; + @SerializedName("isred") + private String isred; + @SerializedName("is_fans") + private String isFans; + @SerializedName("count_fans") + private String countFans; + @SerializedName("isconnection") + private String isconnection; + @SerializedName("isleave") + private String isleave; + @SerializedName("landscape") + private String landscape; + @SerializedName("un_charge") + private String unCharge; + @SerializedName("see_time") + private String seeTime; + @SerializedName("greetings") + private List greetings; + @SerializedName("live_bg") + private String liveBg; + @SerializedName("anchor_goodnum") + private String anchorGoodnum; + + public String getVotestotal() { + return votestotal; + } + + public EnterRoomInfoModel setVotestotal(String votestotal) { + this.votestotal = votestotal; + return this; + } + + public String getMedalRankNum() { + return medalRankNum; + } + + public EnterRoomInfoModel setMedalRankNum(String medalRankNum) { + this.medalRankNum = medalRankNum; + return this; + } + + public String getBarrageFee() { + return barrageFee; + } + + public EnterRoomInfoModel setBarrageFee(String barrageFee) { + this.barrageFee = barrageFee; + return this; + } + + public String getUserlistTime() { + return userlistTime; + } + + public EnterRoomInfoModel setUserlistTime(String userlistTime) { + this.userlistTime = userlistTime; + return this; + } + + public String getChatserver() { + return chatserver; + } + + public EnterRoomInfoModel setChatserver(String chatserver) { + this.chatserver = chatserver; + return this; + } + + public String getLinkmicUid() { + return linkmicUid; + } + + public EnterRoomInfoModel setLinkmicUid(String linkmicUid) { + this.linkmicUid = linkmicUid; + return this; + } + + public String getLinkmicPull() { + return linkmicPull; + } + + public EnterRoomInfoModel setLinkmicPull(String linkmicPull) { + this.linkmicPull = linkmicPull; + return this; + } + + public String getNums() { + return nums; + } + + public EnterRoomInfoModel setNums(String nums) { + this.nums = nums; + return this; + } + + public List getGame() { + return game; + } + + public EnterRoomInfoModel setGame(List game) { + this.game = game; + return this; + } + + public List getGamebet() { + return gamebet; + } + + public EnterRoomInfoModel setGamebet(List gamebet) { + this.gamebet = gamebet; + return this; + } + + public String getGametime() { + return gametime; + } + + public EnterRoomInfoModel setGametime(String gametime) { + this.gametime = gametime; + return this; + } + + public String getGameid() { + return gameid; + } + + public EnterRoomInfoModel setGameid(String gameid) { + this.gameid = gameid; + return this; + } + + public String getGameaction() { + return gameaction; + } + + public EnterRoomInfoModel setGameaction(String gameaction) { + this.gameaction = gameaction; + return this; + } + + public String getGameBankerid() { + return gameBankerid; + } + + public EnterRoomInfoModel setGameBankerid(String gameBankerid) { + this.gameBankerid = gameBankerid; + return this; + } + + public String getGameBankerName() { + return gameBankerName; + } + + public EnterRoomInfoModel setGameBankerName(String gameBankerName) { + this.gameBankerName = gameBankerName; + return this; + } + + public String getGameBankerAvatar() { + return gameBankerAvatar; + } + + public EnterRoomInfoModel setGameBankerAvatar(String gameBankerAvatar) { + this.gameBankerAvatar = gameBankerAvatar; + return this; + } + + public String getGameBankerCoin() { + return gameBankerCoin; + } + + public EnterRoomInfoModel setGameBankerCoin(String gameBankerCoin) { + this.gameBankerCoin = gameBankerCoin; + return this; + } + + public String getGameBankerLimit() { + return gameBankerLimit; + } + + public EnterRoomInfoModel setGameBankerLimit(String gameBankerLimit) { + this.gameBankerLimit = gameBankerLimit; + return this; + } + + public String getShutTime() { + return shutTime; + } + + public EnterRoomInfoModel setShutTime(String shutTime) { + this.shutTime = shutTime; + return this; + } + + public String getKickTime() { + return kickTime; + } + + public EnterRoomInfoModel setKickTime(String kickTime) { + this.kickTime = kickTime; + return this; + } + + public String getSpeakLimit() { + return speakLimit; + } + + public EnterRoomInfoModel setSpeakLimit(String speakLimit) { + this.speakLimit = speakLimit; + return this; + } + + public String getBarrageLimit() { + return barrageLimit; + } + + public EnterRoomInfoModel setBarrageLimit(String barrageLimit) { + this.barrageLimit = barrageLimit; + return this; + } + + public String getCoin() { + return coin; + } + + public EnterRoomInfoModel setCoin(String coin) { + this.coin = coin; + return this; + } + + public VipModel getVip() { + return vip; + } + + public EnterRoomInfoModel setVip(VipModel vip) { + this.vip = vip; + return this; + } + + public LiangModel getLiang() { + return liang; + } + + public EnterRoomInfoModel setLiang(LiangModel liang) { + this.liang = liang; + return this; + } + + public String getMedalLevel() { + return medalLevel; + } + + public EnterRoomInfoModel setMedalLevel(String medalLevel) { + this.medalLevel = medalLevel; + return this; + } + + public String getMedalName() { + return medalName; + } + + public EnterRoomInfoModel setMedalName(String medalName) { + this.medalName = medalName; + return this; + } + + public String getIssuper() { + return issuper; + } + + public EnterRoomInfoModel setIssuper(String issuper) { + this.issuper = issuper; + return this; + } + + public String getUsertype() { + return usertype; + } + + public EnterRoomInfoModel setUsertype(String usertype) { + this.usertype = usertype; + return this; + } + + public String getFrontTask() { + return frontTask; + } + + public EnterRoomInfoModel setFrontTask(String frontTask) { + this.frontTask = frontTask; + return this; + } + + public String getIsmic() { + return ismic; + } + + public EnterRoomInfoModel setIsmic(String ismic) { + this.ismic = ismic; + return this; + } + + public String getIsattention() { + return isattention; + } + + public EnterRoomInfoModel setIsattention(String isattention) { + this.isattention = isattention; + return this; + } + + public List getUserlists() { + return userlists; + } + + public EnterRoomInfoModel setUserlists(List userlists) { + this.userlists = userlists; + return this; + } + + public GuardModel getGuard() { + return guard; + } + + public EnterRoomInfoModel setGuard(GuardModel guard) { + this.guard = guard; + return this; + } + + public String getGuardNums() { + return guardNums; + } + + public EnterRoomInfoModel setGuardNums(String guardNums) { + this.guardNums = guardNums; + return this; + } + + public PkinfoModel getPkinfo() { + return pkinfo; + } + + public EnterRoomInfoModel setPkinfo(PkinfoModel pkinfo) { + this.pkinfo = pkinfo; + return this; + } + + public LminfoModel getLminfo() { + return lminfo; + } + + public EnterRoomInfoModel setLminfo(LminfoModel lminfo) { + this.lminfo = lminfo; + return this; + } + + public String getIsred() { + return isred; + } + + public EnterRoomInfoModel setIsred(String isred) { + this.isred = isred; + return this; + } + + public String getIsFans() { + return isFans; + } + + public EnterRoomInfoModel setIsFans(String isFans) { + this.isFans = isFans; + return this; + } + + public String getCountFans() { + return countFans; + } + + public EnterRoomInfoModel setCountFans(String countFans) { + this.countFans = countFans; + return this; + } + + public String getIsconnection() { + return isconnection; + } + + public EnterRoomInfoModel setIsconnection(String isconnection) { + this.isconnection = isconnection; + return this; + } + + public String getIsleave() { + return isleave; + } + + public EnterRoomInfoModel setIsleave(String isleave) { + this.isleave = isleave; + return this; + } + + public String getLandscape() { + return landscape; + } + + public EnterRoomInfoModel setLandscape(String landscape) { + this.landscape = landscape; + return this; + } + + public String getUnCharge() { + return unCharge; + } + + public EnterRoomInfoModel setUnCharge(String unCharge) { + this.unCharge = unCharge; + return this; + } + + public String getSeeTime() { + return seeTime; + } + + public EnterRoomInfoModel setSeeTime(String seeTime) { + this.seeTime = seeTime; + return this; + } + + public List getGreetings() { + return greetings; + } + + public EnterRoomInfoModel setGreetings(List greetings) { + this.greetings = greetings; + return this; + } + + public String getLiveBg() { + return liveBg; + } + + public EnterRoomInfoModel setLiveBg(String liveBg) { + this.liveBg = liveBg; + return this; + } + + public String getAnchorGoodnum() { + return anchorGoodnum; + } + + public EnterRoomInfoModel setAnchorGoodnum(String anchorGoodnum) { + this.anchorGoodnum = anchorGoodnum; + return this; + } + + +} diff --git a/common/src/main/java/com/yunbao/common/bean/EnterRoomNewModel.java b/common/src/main/java/com/yunbao/common/bean/EnterRoomNewModel.java new file mode 100644 index 000000000..e07c1c5eb --- /dev/null +++ b/common/src/main/java/com/yunbao/common/bean/EnterRoomNewModel.java @@ -0,0 +1,111 @@ +package com.yunbao.common.bean; + +import com.google.gson.annotations.SerializedName; + +import java.util.List; + +/** + * 整合进入直播间接口 + */ +public class EnterRoomNewModel extends BaseModel { + + @SerializedName("liveInfo") + private LiveInfoModel liveInfo;//直播间信息 + @SerializedName("enterRoomInfo") + private EnterRoomInfoModel enterRoomInfo;//原接口进入直播间数据返回 + @SerializedName("rankHour") + private RankHourModel rankHour;//.热度卡 + @SerializedName("newPeopleTask") + private NewPeopleTaskModel newPeopleTask;//新人任务 + @SerializedName("wishList") + private WishListModel wishList;//心愿单 + @SerializedName("guardUser") + private GuardUserModel guardUserAvatar;//守护 + @SerializedName("activeList") + private List activeList;//活动列表 + @SerializedName("isUseHotCard") + private String isUseHotCard;//是否使用热度卡 + @SerializedName("liveRoomActivity") + private List liveRoomActivityModels;//活动列表 + + public List getLiveRoomActivityModels() { + return liveRoomActivityModels; + } + + public EnterRoomNewModel setLiveRoomActivityModels(List liveRoomActivityModels) { + this.liveRoomActivityModels = liveRoomActivityModels; + return this; + } + + public LiveInfoModel getLiveInfo() { + return liveInfo; + } + + public EnterRoomNewModel setLiveInfo(LiveInfoModel liveInfo) { + this.liveInfo = liveInfo; + return this; + } + + public EnterRoomInfoModel getEnterRoomInfo() { + return enterRoomInfo; + } + + public EnterRoomNewModel setEnterRoomInfo(EnterRoomInfoModel enterRoomInfo) { + this.enterRoomInfo = enterRoomInfo; + return this; + } + + public RankHourModel getRankHour() { + return rankHour; + } + + public EnterRoomNewModel setRankHour(RankHourModel rankHour) { + this.rankHour = rankHour; + return this; + } + + public NewPeopleTaskModel getNewPeopleTask() { + return newPeopleTask; + } + + public EnterRoomNewModel setNewPeopleTask(NewPeopleTaskModel newPeopleTask) { + this.newPeopleTask = newPeopleTask; + return this; + } + + public WishListModel getWishList() { + return wishList; + } + + public EnterRoomNewModel setWishList(WishListModel wishList) { + this.wishList = wishList; + return this; + } + + public GuardUserModel getGuardUserAvatar() { + return guardUserAvatar; + } + + public EnterRoomNewModel setGuardUserAvatar(GuardUserModel guardUserAvatar) { + this.guardUserAvatar = guardUserAvatar; + return this; + } + + public List getActiveList() { + return activeList; + } + + public EnterRoomNewModel setActiveList(List activeList) { + this.activeList = activeList; + return this; + } + + public String getIsUseHotCard() { + return isUseHotCard; + } + + public EnterRoomNewModel setIsUseHotCard(String isUseHotCard) { + this.isUseHotCard = isUseHotCard; + return this; + } +} diff --git a/common/src/main/java/com/yunbao/common/bean/GuardModel.java b/common/src/main/java/com/yunbao/common/bean/GuardModel.java new file mode 100644 index 000000000..c89531dcf --- /dev/null +++ b/common/src/main/java/com/yunbao/common/bean/GuardModel.java @@ -0,0 +1,29 @@ +package com.yunbao.common.bean; + +import com.google.gson.annotations.SerializedName; + +public class GuardModel extends BaseModel { + + @SerializedName("type") + private String type; + @SerializedName("endtime") + private String endtime; + + public String getType() { + return type; + } + + public GuardModel setType(String type) { + this.type = type; + return this; + } + + public String getEndtime() { + return endtime; + } + + public GuardModel setEndtime(String endtime) { + this.endtime = endtime; + return this; + } +} diff --git a/common/src/main/java/com/yunbao/common/bean/GuardUserModel.java b/common/src/main/java/com/yunbao/common/bean/GuardUserModel.java new file mode 100644 index 000000000..2d8a12f2f --- /dev/null +++ b/common/src/main/java/com/yunbao/common/bean/GuardUserModel.java @@ -0,0 +1,33 @@ +package com.yunbao.common.bean; + +import com.google.gson.Gson; +import com.google.gson.annotations.SerializedName; + +public class GuardUserModel extends BaseModel{ + + @SerializedName("guardUserAvatar") + private String guardUserAvatar; + @SerializedName("guardType") + private String guardType; + + public static GuardUserModel objectFromData(String str) { + + return new Gson().fromJson(str, GuardUserModel.class); + } + + public String getGuardUserAvatar() { + return guardUserAvatar; + } + + public void setGuardUserAvatar(String guardUserAvatar) { + this.guardUserAvatar = guardUserAvatar; + } + + public String getGuardType() { + return guardType; + } + + public void setGuardType(String guardType) { + this.guardType = guardType; + } +} diff --git a/common/src/main/java/com/yunbao/common/bean/IMLoginModel.java b/common/src/main/java/com/yunbao/common/bean/IMLoginModel.java index e7cbf396a..c9c22e008 100644 --- a/common/src/main/java/com/yunbao/common/bean/IMLoginModel.java +++ b/common/src/main/java/com/yunbao/common/bean/IMLoginModel.java @@ -66,6 +66,7 @@ public class IMLoginModel extends BaseModel { * noble_name : 贵族 * sex : 1 * slide : [{"listorder":0,"slide_cid":4,"slide_content":"","slide_des":"首充特惠大禮包","slide_id":91,"slide_name":"首充特惠大禮包","slide_pic":"https://qny.shayucm.com/20220531/90f6942fb928c3034baeb380b9c4003d.gif","slide_status":1,"slide_url":"https://ceshi.yaoulive.com/h5/activity/firstTopUp/newUp.html"},{"listorder":0,"slide_cid":4,"slide_content":"","slide_des":"充值反饋活動","slide_id":88,"slide_name":"充值反饋活動","slide_pic":"https://qny.shayucm.com/20220511/faacb51d5a45f7ff24a6f0314df133fb.gif","slide_status":1,"slide_url":"https://ceshi.yaoulive.com/h5/GuildTournament/202204/Tournament.html"}] + * slide : [{"listorder":0,"slide_cid":4,"slide_content":"","slide_des":"首充特惠大禮包","slide_id":91,"slide_name":"首充特惠大禮包","slide_pic":"https://qny.shayucm.com/20220531/90f6942fb928c3034baeb380b9c4003d.gif","slide_status":1,"slide_url":"https://ceshi.yaoulive.com/h5/activity/firstTopUp/newUp.html"},{"listorder":0,"slide_cid":4,"slide_content":"","slide_des":"充值反饋活動","slide_id":88,"slide_name":"充值反饋活動","slide_pic":"https://qny.shayucm.com/20220511/faacb51d5a45f7ff24a6f0314df133fb.gif","slide_status":1,"slide_url":"https://ceshi.yaoulive.com/h5/GuildTournament/202204/Tournament.html"}] * users_type : A * votes : 0.00 * votestotal : 0 @@ -224,6 +225,126 @@ public class IMLoginModel extends BaseModel { //超皇字体颜色 @SerializedName("contentColor") private String contentColor = ""; + //创建时间 + @SerializedName("create_time") + private String createTime = ""; + + @SerializedName("is_guess") + private String isGuess = ""; + + @SerializedName("goodnum_expire_time") + private String goodnumExpireTime = ""; + + @SerializedName("version") + private String version = ""; + + @SerializedName("max_noble_end_time") + private String maxNobleEndTime = ""; + + @SerializedName("custom_color_id") + private String customColorId = ""; + + @SerializedName("is_chat") + private String isChat = ""; + + @SerializedName("is_rong") + private String isRong = ""; + + @SerializedName("contribution") + private String contribution = ""; + + @SerializedName("guard_type") + private String guardType = ""; + + public String getCreateTime() { + return createTime; + } + + public IMLoginModel setCreateTime(String createTime) { + this.createTime = createTime; + return this; + } + + public String getIsGuess() { + return isGuess; + } + + public IMLoginModel setIsGuess(String isGuess) { + this.isGuess = isGuess; + return this; + } + + public String getGoodnumExpireTime() { + return goodnumExpireTime; + } + + public IMLoginModel setGoodnumExpireTime(String goodnumExpireTime) { + this.goodnumExpireTime = goodnumExpireTime; + return this; + } + + public String getVersion() { + return version; + } + + public IMLoginModel setVersion(String version) { + this.version = version; + return this; + } + + public String getMaxNobleEndTime() { + return maxNobleEndTime; + } + + public IMLoginModel setMaxNobleEndTime(String maxNobleEndTime) { + this.maxNobleEndTime = maxNobleEndTime; + return this; + } + + public String getCustomColorId() { + return customColorId; + } + + public IMLoginModel setCustomColorId(String customColorId) { + this.customColorId = customColorId; + return this; + } + + public String getIsChat() { + return isChat; + } + + public IMLoginModel setIsChat(String isChat) { + this.isChat = isChat; + return this; + } + + public String getIsRong() { + return isRong; + } + + public IMLoginModel setIsRong(String isRong) { + this.isRong = isRong; + return this; + } + + public String getContribution() { + return contribution; + } + + public IMLoginModel setContribution(String contribution) { + this.contribution = contribution; + return this; + } + + public String getGuardType() { + return guardType; + } + + public IMLoginModel setGuardType(String guardType) { + this.guardType = guardType; + return this; + } public String getNobleEndTime() { return nobleEndTime; diff --git a/common/src/main/java/com/yunbao/common/bean/LiveBean.java b/common/src/main/java/com/yunbao/common/bean/LiveBean.java index 3637a43da..906107c95 100644 --- a/common/src/main/java/com/yunbao/common/bean/LiveBean.java +++ b/common/src/main/java/com/yunbao/common/bean/LiveBean.java @@ -5,8 +5,6 @@ import android.os.Parcelable; import android.text.TextUtils; import com.alibaba.fastjson.annotation.JSONField; -import com.yunbao.common.R; -import com.yunbao.common.utils.WordUtil; import java.util.ArrayList; import java.util.List; @@ -380,25 +378,26 @@ public class LiveBean implements Parcelable { if (!TextUtils.isEmpty(this.goodNum) && !"0".equals(this.goodNum)) { return this.goodNum; } - return this.uid; + return this.uid; } public LiveBean() { } + private LiveBean(Parcel in) { this.uid = in.readString(); this.avatar = in.readString(); this.avatarThumb = in.readString(); this.userNiceName = in.readString(); - this.sex = in.readInt(); this.title = in.readString(); this.city = in.readString(); this.stream = in.readString(); this.pull = in.readString(); this.thumb = in.readString(); this.nums = in.readString(); + this.sex = in.readInt(); this.distance = in.readString(); this.levelAnchor = in.readInt(); this.type = in.readInt(); @@ -406,6 +405,23 @@ public class LiveBean implements Parcelable { this.goodNum = in.readString(); this.gameAction = in.readInt(); this.game = in.readString(); + this.islive = in.readString(); + this.isTop = in.readString(); + this.pk_avatar_thumb = in.readString(); + this.landscape = in.readInt(); + this.hot_num = in.readString(); + this.content_pic_size_one = in.readString(); + this.content_pic_size_two = in.readString(); + this.content_pic_size_three = in.readString(); + this.is_week = in.readString(); + this.img = in.readString(); + this.url = in.readString(); + this.drpk_status = in.readString(); + this.is_rong = in.readInt(); + this.isattention = in.readString(); + this.recommendCardtype = in.readString(); + this.recommendCardIconSizeTwo = in.readString(); + this.recommendCardIconSizeThree = in.readString(); } @Override @@ -419,13 +435,13 @@ public class LiveBean implements Parcelable { dest.writeString(this.avatar); dest.writeString(this.avatarThumb); dest.writeString(this.userNiceName); - dest.writeInt(this.sex); dest.writeString(this.title); dest.writeString(this.city); dest.writeString(this.stream); dest.writeString(this.pull); dest.writeString(this.thumb); dest.writeString(this.nums); + dest.writeInt(this.sex); dest.writeString(this.distance); dest.writeInt(this.levelAnchor); dest.writeInt(this.type); @@ -433,6 +449,23 @@ public class LiveBean implements Parcelable { dest.writeString(this.goodNum); dest.writeInt(this.gameAction); dest.writeString(this.game); + dest.writeString(this.islive); + dest.writeString(this.isTop); + dest.writeString(this.pk_avatar_thumb); + dest.writeInt(this.landscape); + dest.writeString(this.hot_num); + dest.writeString(this.content_pic_size_one); + dest.writeString(this.content_pic_size_two); + dest.writeString(this.content_pic_size_three); + dest.writeString(this.is_week); + dest.writeString(this.img); + dest.writeString(this.url); + dest.writeString(this.drpk_status); + dest.writeInt(this.is_rong); + dest.writeString(this.isattention); + dest.writeString(this.recommendCardtype); + dest.writeString(this.recommendCardIconSizeTwo); + dest.writeString(this.recommendCardIconSizeThree); } public static final Creator CREATOR = new Creator() { diff --git a/common/src/main/java/com/yunbao/common/bean/LiveRoomActivityModel.java b/common/src/main/java/com/yunbao/common/bean/LiveRoomActivityModel.java new file mode 100644 index 000000000..f060c64db --- /dev/null +++ b/common/src/main/java/com/yunbao/common/bean/LiveRoomActivityModel.java @@ -0,0 +1,66 @@ +package com.yunbao.common.bean; + +import com.google.gson.Gson; +import com.google.gson.annotations.SerializedName; + +/** + * 活动列表 + */ +public class LiveRoomActivityModel extends BaseModel { + + @SerializedName("name") + private String name; + @SerializedName("img") + private String img; + @SerializedName("link") + private String link; + @SerializedName("is_hidden") + private String isHidden; + @SerializedName("show_type") + private String showType; + + public String getName() { + return name; + } + + public LiveRoomActivityModel setName(String name) { + this.name = name; + return this; + } + + public String getImg() { + return img; + } + + public LiveRoomActivityModel setImg(String img) { + this.img = img; + return this; + } + + public String getLink() { + return link; + } + + public LiveRoomActivityModel setLink(String link) { + this.link = link; + return this; + } + + public String getIsHidden() { + return isHidden; + } + + public LiveRoomActivityModel setIsHidden(String isHidden) { + this.isHidden = isHidden; + return this; + } + + public String getShowType() { + return showType; + } + + public LiveRoomActivityModel setShowType(String showType) { + this.showType = showType; + return this; + } +} diff --git a/live/src/main/java/com/yunbao/live/bean/LiveUserGiftBean.java b/common/src/main/java/com/yunbao/common/bean/LiveUserGiftBean.java similarity index 81% rename from live/src/main/java/com/yunbao/live/bean/LiveUserGiftBean.java rename to common/src/main/java/com/yunbao/common/bean/LiveUserGiftBean.java index 37d01b5d8..d68617c3e 100644 --- a/live/src/main/java/com/yunbao/live/bean/LiveUserGiftBean.java +++ b/common/src/main/java/com/yunbao/common/bean/LiveUserGiftBean.java @@ -1,5 +1,6 @@ -package com.yunbao.live.bean; +package com.yunbao.common.bean; +import android.os.Parcel; import android.text.TextUtils; import android.util.Log; @@ -51,4 +52,13 @@ public class LiveUserGiftBean extends UserBean { public void setGuardType(int guardType) { this.guardType = guardType; } + + public LiveUserGiftBean(Parcel in) { + super(in); + } + + @Override + public void writeToParcel(Parcel dest, int flags) { + super.writeToParcel(dest, flags); + } } diff --git a/common/src/main/java/com/yunbao/common/bean/LminfoModel.java b/common/src/main/java/com/yunbao/common/bean/LminfoModel.java new file mode 100644 index 000000000..749f1da7c --- /dev/null +++ b/common/src/main/java/com/yunbao/common/bean/LminfoModel.java @@ -0,0 +1,23 @@ +package com.yunbao.common.bean; + +import com.google.gson.Gson; +import com.google.gson.annotations.SerializedName; + +public class LminfoModel extends BaseModel{ + + @SerializedName("status") + private int status; + + public static LminfoModel objectFromData(String str) { + + return new Gson().fromJson(str, LminfoModel.class); + } + + public int getStatus() { + return status; + } + + public void setStatus(int status) { + this.status = status; + } +} diff --git a/common/src/main/java/com/yunbao/common/bean/NewPeopleTaskModel.java b/common/src/main/java/com/yunbao/common/bean/NewPeopleTaskModel.java new file mode 100644 index 000000000..8d13676fa --- /dev/null +++ b/common/src/main/java/com/yunbao/common/bean/NewPeopleTaskModel.java @@ -0,0 +1,14 @@ +package com.yunbao.common.bean; + +import com.google.gson.annotations.SerializedName; + +public class NewPeopleTaskModel extends BaseModel { +// @SerializedName("task") +// private TaskModel task; +// @SerializedName("gift") +// private GiftModel gift; +// @SerializedName("reward_all") +// private RewardAllModel rewardAll; +// @SerializedName("reward_one") +// private RewardAllModel rewardOne; +} diff --git a/common/src/main/java/com/yunbao/common/bean/PKTopThreeModel.java b/common/src/main/java/com/yunbao/common/bean/PKTopThreeModel.java new file mode 100644 index 000000000..7230497e4 --- /dev/null +++ b/common/src/main/java/com/yunbao/common/bean/PKTopThreeModel.java @@ -0,0 +1,39 @@ +package com.yunbao.common.bean; + +import com.google.gson.annotations.SerializedName; + +public class PKTopThreeModel extends BaseModel { + @SerializedName("uid") + private String uid; + @SerializedName("img") + private String img; + @SerializedName("liveuid") + private String liveuid; + + public String getUid() { + return uid; + } + + public PKTopThreeModel setUid(String uid) { + this.uid = uid; + return this; + } + + public String getImg() { + return img; + } + + public PKTopThreeModel setImg(String img) { + this.img = img; + return this; + } + + public String getLiveuid() { + return liveuid; + } + + public PKTopThreeModel setLiveuid(String liveuid) { + this.liveuid = liveuid; + return this; + } +} diff --git a/common/src/main/java/com/yunbao/common/bean/PkTopUsersModel.java b/common/src/main/java/com/yunbao/common/bean/PkTopUsersModel.java new file mode 100644 index 000000000..11a138222 --- /dev/null +++ b/common/src/main/java/com/yunbao/common/bean/PkTopUsersModel.java @@ -0,0 +1,18 @@ +package com.yunbao.common.bean; + +import com.google.gson.annotations.SerializedName; + +public class PkTopUsersModel extends BaseModel { + @SerializedName("red_one") + private PKTopThreeModel redOne; + @SerializedName("red_two") + private PKTopThreeModel redTwo; + @SerializedName("red_three") + private PKTopThreeModel redThree; + @SerializedName("blue_one") + private PKTopThreeModel blueOne; + @SerializedName("blue_two") + private PKTopThreeModel blueTwo; + @SerializedName("blue_three") + private PKTopThreeModel blueThree; +} diff --git a/common/src/main/java/com/yunbao/common/bean/PkinfoModel.java b/common/src/main/java/com/yunbao/common/bean/PkinfoModel.java new file mode 100644 index 000000000..b6e43738a --- /dev/null +++ b/common/src/main/java/com/yunbao/common/bean/PkinfoModel.java @@ -0,0 +1,161 @@ +package com.yunbao.common.bean; + +import com.google.gson.annotations.SerializedName; + +public class PkinfoModel extends BaseModel { + + @SerializedName("pkuid") + private String pkuid; + @SerializedName("pkuname") + private String pkuname; + @SerializedName("pkuimg") + private String pkuimg; + @SerializedName("pkpull") + private String pkpull; + @SerializedName("ifpk") + private String ifpk; + @SerializedName("pk_time") + private String pkTime; + @SerializedName("end_pk_time") + private String endPkTime; + @SerializedName("pk_gift_liveuid") + private String pkGiftLiveuid; + @SerializedName("pk_gift_pkuid") + private String pkGiftPkuid; + @SerializedName("anyway") + private String anyway; + @SerializedName("drpk_status") + private String drpkStatus; + @SerializedName("drpk_roomid") + private String drpkRoomid; + @SerializedName("drpk_time") + private String drpkTime; + @SerializedName("pk_top_users") + private PkTopUsersModel pkTopUsers; + + public String getPkuid() { + return pkuid; + } + + public PkinfoModel setPkuid(String pkuid) { + this.pkuid = pkuid; + return this; + } + + public String getPkuname() { + return pkuname; + } + + public PkinfoModel setPkuname(String pkuname) { + this.pkuname = pkuname; + return this; + } + + public String getPkuimg() { + return pkuimg; + } + + public PkinfoModel setPkuimg(String pkuimg) { + this.pkuimg = pkuimg; + return this; + } + + public String getPkpull() { + return pkpull; + } + + public PkinfoModel setPkpull(String pkpull) { + this.pkpull = pkpull; + return this; + } + + public String getIfpk() { + return ifpk; + } + + public PkinfoModel setIfpk(String ifpk) { + this.ifpk = ifpk; + return this; + } + + public String getPkTime() { + return pkTime; + } + + public PkinfoModel setPkTime(String pkTime) { + this.pkTime = pkTime; + return this; + } + + public String getEndPkTime() { + return endPkTime; + } + + public PkinfoModel setEndPkTime(String endPkTime) { + this.endPkTime = endPkTime; + return this; + } + + public String getPkGiftLiveuid() { + return pkGiftLiveuid; + } + + public PkinfoModel setPkGiftLiveuid(String pkGiftLiveuid) { + this.pkGiftLiveuid = pkGiftLiveuid; + return this; + } + + public String getPkGiftPkuid() { + return pkGiftPkuid; + } + + public PkinfoModel setPkGiftPkuid(String pkGiftPkuid) { + this.pkGiftPkuid = pkGiftPkuid; + return this; + } + + public String getAnyway() { + return anyway; + } + + public PkinfoModel setAnyway(String anyway) { + this.anyway = anyway; + return this; + } + + public String getDrpkStatus() { + return drpkStatus; + } + + public PkinfoModel setDrpkStatus(String drpkStatus) { + this.drpkStatus = drpkStatus; + return this; + } + + public String getDrpkRoomid() { + return drpkRoomid; + } + + public PkinfoModel setDrpkRoomid(String drpkRoomid) { + this.drpkRoomid = drpkRoomid; + return this; + } + + public String getDrpkTime() { + return drpkTime; + } + + public PkinfoModel setDrpkTime(String drpkTime) { + this.drpkTime = drpkTime; + return this; + } + + public PkTopUsersModel getPkTopUsers() { + return pkTopUsers; + } + + public PkinfoModel setPkTopUsers(PkTopUsersModel pkTopUsers) { + this.pkTopUsers = pkTopUsers; + return this; + } +} diff --git a/common/src/main/java/com/yunbao/common/bean/RankHourModel.java b/common/src/main/java/com/yunbao/common/bean/RankHourModel.java new file mode 100644 index 000000000..cdf33eb76 --- /dev/null +++ b/common/src/main/java/com/yunbao/common/bean/RankHourModel.java @@ -0,0 +1,61 @@ +package com.yunbao.common.bean; + +import com.google.gson.annotations.SerializedName; + +public class RankHourModel extends BaseModel { + @SerializedName("liveuid") + private String liveuid; + @SerializedName("hourchart_h5_url") + private String hourchartH5Url; + @SerializedName("rank") + private String rank; + @SerializedName("starlightVal") + private String starlightVal; + @SerializedName("isshow") + private String isshow; + + public String getLiveuid() { + return liveuid; + } + + public RankHourModel setLiveuid(String liveuid) { + this.liveuid = liveuid; + return this; + } + + public String getHourchartH5Url() { + return hourchartH5Url; + } + + public RankHourModel setHourchartH5Url(String hourchartH5Url) { + this.hourchartH5Url = hourchartH5Url; + return this; + } + + public String getRank() { + return rank; + } + + public RankHourModel setRank(String rank) { + this.rank = rank; + return this; + } + + public String getStarlightVal() { + return starlightVal; + } + + public RankHourModel setStarlightVal(String starlightVal) { + this.starlightVal = starlightVal; + return this; + } + + public String getIsshow() { + return isshow; + } + + public RankHourModel setIsshow(String isshow) { + this.isshow = isshow; + return this; + } +} diff --git a/common/src/main/java/com/yunbao/common/bean/WishListModel.java b/common/src/main/java/com/yunbao/common/bean/WishListModel.java new file mode 100644 index 000000000..fef8be6b9 --- /dev/null +++ b/common/src/main/java/com/yunbao/common/bean/WishListModel.java @@ -0,0 +1,30 @@ +package com.yunbao.common.bean; + +import com.google.gson.annotations.SerializedName; + +import java.util.List; + +public class WishListModel extends BaseModel { + @SerializedName("wishList") + private List wishList; + @SerializedName("img") + private String img; + + public List getWishList() { + return wishList; + } + + public WishListModel setWishList(List wishList) { + this.wishList = wishList; + return this; + } + + public String getImg() { + return img; + } + + public WishListModel setImg(String img) { + this.img = img; + return this; + } +} diff --git a/common/src/main/java/com/yunbao/common/bean/WishModel.java b/common/src/main/java/com/yunbao/common/bean/WishModel.java new file mode 100644 index 000000000..e4429727d --- /dev/null +++ b/common/src/main/java/com/yunbao/common/bean/WishModel.java @@ -0,0 +1,106 @@ +package com.yunbao.common.bean; + +import com.google.gson.annotations.SerializedName; + +public class WishModel extends BaseModel { + + @SerializedName("id") + private String id; + @SerializedName("dtime") + private String dtime; + @SerializedName("luid") + private String luid; + @SerializedName("lid") + private String lid; + @SerializedName("wishlist_icon") + private String wishlistIcon; + @SerializedName("wishlist_num") + private String wishlistNum; + @SerializedName("wishlist_progress") + private String wishlistProgress; + @SerializedName("wishlist_name") + private String wishlistName; + @SerializedName("create_time") + private String createTime; + + public String getId() { + return id; + } + + public WishModel setId(String id) { + this.id = id; + return this; + } + + public String getDtime() { + return dtime; + } + + public WishModel setDtime(String dtime) { + this.dtime = dtime; + return this; + } + + public String getLuid() { + return luid; + } + + public WishModel setLuid(String luid) { + this.luid = luid; + return this; + } + + public String getLid() { + return lid; + } + + public WishModel setLid(String lid) { + this.lid = lid; + return this; + } + + public String getWishlistIcon() { + return wishlistIcon; + } + + public WishModel setWishlistIcon(String wishlistIcon) { + this.wishlistIcon = wishlistIcon; + return this; + } + + public String getWishlistNum() { + return wishlistNum; + } + + public WishModel setWishlistNum(String wishlistNum) { + this.wishlistNum = wishlistNum; + return this; + } + + public String getWishlistProgress() { + return wishlistProgress; + } + + public WishModel setWishlistProgress(String wishlistProgress) { + this.wishlistProgress = wishlistProgress; + return this; + } + + public String getWishlistName() { + return wishlistName; + } + + public WishModel setWishlistName(String wishlistName) { + this.wishlistName = wishlistName; + return this; + } + + public String getCreateTime() { + return createTime; + } + + public WishModel setCreateTime(String createTime) { + this.createTime = createTime; + return this; + } +} 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 a77531577..467a7900b 100644 --- a/common/src/main/java/com/yunbao/common/http/PDLiveApi.java +++ b/common/src/main/java/com/yunbao/common/http/PDLiveApi.java @@ -3,8 +3,10 @@ package com.yunbao.common.http; import com.yunbao.common.bean.ActiveModel; import com.yunbao.common.bean.AnchorRecommendModel; import com.yunbao.common.bean.BaseModel; +import com.yunbao.common.bean.CheckLiveModel; import com.yunbao.common.bean.ContributeModel; 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.IMLoginModel; @@ -268,17 +270,58 @@ public interface PDLiveApi { * PK排位赛接口 */ @GET("/api/public/?service=Ranking.getAnchorRankData") - Observable> getPkRanksList(@Query("anchor_id") String anchorId,@Query("anchor_id2")String pkUid); /** + Observable> getPkRanksList(@Query("anchor_id") String anchorId, @Query("anchor_id2") String pkUid); + + /** * PK排位赛接口 */ @GET("/api/public/?service=Live.createDrLm") Observable> createDrLm(); + /* PK排位赛接口 */ @GET("/api/public/?service=Live.delDrLm") Observable> delDrLm(); + /* PK排位赛接口 */ @GET("/api/public/?service=Live.killDrLm") - Observable> killDrLm(@Query("uid")String uid,@Query("roomid")String roomId); + Observable> killDrLm(@Query("uid") String uid, @Query("roomid") String roomId); + + /** + * 新进入房间接口 + * + * @param groupId 房间名 g+liveUid + * @param stream + * @param liveUid + * @param city + * @return + */ + @GET("/api/public/?service=Live.enterRoomNew") + Observable> enterRoomNew( + @Query("GroupId") String groupId, + @Query("stream") String stream, + @Query("liveuid") String liveUid, + @Query("city") String city + ); + + /** + * 检查直播间状态 + * + * @return + */ + @GET("/api/public/?service=Live.checkLive") + Observable>> checkLive( + @Query("liveuid") String liveUid, + @Query("stream") String stream + ); + + /** + * 加入房间推送Im欢迎语 + */ + @GET("/api/public/?service=Tx.userJoinRoomNew") + Observable> userJoinRoomNew( + @Query("GroupId") String GroupId, + @Query("stream") String stream + ); } diff --git a/common/src/main/java/com/yunbao/common/http/base/CheckLiveCallBack.java b/common/src/main/java/com/yunbao/common/http/base/CheckLiveCallBack.java new file mode 100644 index 000000000..56e1d2067 --- /dev/null +++ b/common/src/main/java/com/yunbao/common/http/base/CheckLiveCallBack.java @@ -0,0 +1,30 @@ +package com.yunbao.common.http.base; + +import com.yunbao.common.bean.CheckLiveModel; + +/** + * 直播间类型返回 + */ +public interface CheckLiveCallBack { + /** + * ;普通房 + */ + void forwardNormalRoom(CheckLiveModel model); + + /** + * 密码房 + */ + void forwardPwdRoom(CheckLiveModel model); + + /** + * 收费房 + */ + void forwardPayRoom(CheckLiveModel model); + + /** + * 请求失败 + * + * @param error + */ + void onError(String error); +} 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 4083c7650..55de6fc4e 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 @@ -3,10 +3,13 @@ package com.yunbao.common.http.live; import android.content.Context; import android.text.TextUtils; +import com.yunbao.common.Constants; import com.yunbao.common.R; import com.yunbao.common.bean.ActiveModel; import com.yunbao.common.bean.BaseModel; +import com.yunbao.common.bean.CheckLiveModel; import com.yunbao.common.bean.CustomSidebarInfoModel; +import com.yunbao.common.bean.EnterRoomNewModel; import com.yunbao.common.bean.LiveInfoModel; import com.yunbao.common.bean.LiveRoomActivityBanner; import com.yunbao.common.bean.NobleRankHideUserListModel; @@ -16,11 +19,11 @@ import com.yunbao.common.bean.StarChallengeStatusModel; import com.yunbao.common.bean.VipModel; import com.yunbao.common.http.API; import com.yunbao.common.http.ResponseModel; +import com.yunbao.common.http.base.CheckLiveCallBack; import com.yunbao.common.http.base.HttpCallback; import java.util.List; -import io.reactivex.Observable; import io.reactivex.android.schedulers.AndroidSchedulers; import io.reactivex.functions.Consumer; import io.reactivex.schedulers.Schedulers; @@ -291,4 +294,116 @@ public class LiveNetManager { } }, throwable -> callback.onError(throwable.getMessage())).isDisposed(); } + + /** + * 检查直播间状态 + * + * @param liveUid + * @param stream + * @param callBack + */ + public void checkLive(String liveUid, String stream, CheckLiveCallBack callBack) { + API.get().pdLiveApi(mContext) + .checkLive(liveUid, stream) + .subscribeOn(Schedulers.io()) + .observeOn(AndroidSchedulers.mainThread()) + .subscribe(new Consumer>>() { + @Override + public void accept(ResponseModel> listResponseModel) throws Exception { + if (listResponseModel.getData().getCode() == 0) { + List checkLiveModels = listResponseModel.getData().getInfo(); + if (checkLiveModels.size() > 0) { + CheckLiveModel liveModel = checkLiveModels.get(0); + switch (liveModel.getType()) { + case Constants.LIVE_TYPE_NORMAL: + if (callBack != null) { + callBack.forwardNormalRoom(liveModel); + } + break; + case Constants.LIVE_TYPE_PWD: + if (callBack != null) { + callBack.forwardPwdRoom(liveModel); + } + break; + case Constants.LIVE_TYPE_PAY: + case Constants.LIVE_TYPE_TIME: + if (callBack != null) { + callBack.forwardPayRoom(liveModel); + } + break; + } + } else { + if (callBack != null) { + callBack.onError(listResponseModel.getData().getMsg()); + } + } + } else { + if (callBack != null) { + callBack.onError(listResponseModel.getData().getMsg()); + } + } + } + }, new Consumer() { + @Override + public void accept(Throwable throwable) throws Exception { + if (callBack != null) { + callBack.onError(throwable.getMessage()); + } + } + }).isDisposed(); + } + + /** + * 新进入直播间接口 + * + * @param stream + * @param liveUid + * @param city + * @param callback + */ + public void enterRoomNew(String stream, String liveUid, String city, HttpCallback callback) { + API.get().pdLiveApi(mContext) + .enterRoomNew("g" + liveUid, stream, liveUid, city) + .subscribeOn(Schedulers.io()) + .observeOn(AndroidSchedulers.mainThread()) + .subscribe(new Consumer>() { + @Override + public void accept(ResponseModel enterRoomNewModelResponseModel) throws Exception { + if (callback != null) { + callback.onSuccess(enterRoomNewModelResponseModel.getData().getInfo()); + } + } + }, new Consumer() { + @Override + public void accept(Throwable throwable) throws Exception { + if (callback != null) { + callback.onError(throwable.getMessage()); + } + } + }).isDisposed(); + } + + /** + * 加入房间推送IM消息 + * + * @param stream + * @param liveUid + */ + public void userJoinRoomNew(String stream, String liveUid) { + API.get().pdLiveApi(mContext) + .userJoinRoomNew("g" + liveUid, stream) + .subscribeOn(Schedulers.io()) + .observeOn(AndroidSchedulers.mainThread()) + .subscribe(new Consumer>() { + @Override + public void accept(ResponseModel stringResponseModel) throws Exception { + + } + }, new Consumer() { + @Override + public void accept(Throwable throwable) throws Exception { + + } + }).isDisposed(); + } } diff --git a/common/src/main/java/com/yunbao/common/utils/RouteUtil.java b/common/src/main/java/com/yunbao/common/utils/RouteUtil.java index 9af0bfdd2..ec29fff8a 100644 --- a/common/src/main/java/com/yunbao/common/utils/RouteUtil.java +++ b/common/src/main/java/com/yunbao/common/utils/RouteUtil.java @@ -100,7 +100,7 @@ public class RouteUtil { } Constants.myUrl = url + "&uid=" + CommonAppConfig.getInstance().getUid() + "&token=" + CommonAppConfig.getInstance().getToken() + "&t=" + System.currentTimeMillis(); ARouter.getInstance().build(PATH_MYWEBVIEWACTIVTITY) - .withString(Constants.URL,url) + .withString(Constants.URL, url) .navigation(); } @@ -186,6 +186,7 @@ public class RouteUtil { */ public static void forwardLiveAudienceActivity(LiveBean mLiveBean, int mLiveType, int mLiveSDK, int mLiveTypeVal) { ARouter.getInstance().build(PATH_LIVE_AUDIENCE) + .withBoolean(Constants.NEW_ENTER_ROOM, false) .withParcelable(Constants.LIVE_BEAN, mLiveBean) .withInt(Constants.LIVE_TYPE, mLiveType) .withInt(Constants.LIVE_SDK, mLiveSDK) @@ -193,6 +194,8 @@ public class RouteUtil { .navigation(); } + + /** * 举报个人 */ diff --git a/config.gradle b/config.gradle index 9b9ac5933..d73f7bbfa 100644 --- a/config.gradle +++ b/config.gradle @@ -10,9 +10,9 @@ ext { manifestPlaceholders = [ //正式 - serverHost : "https://napi.yaoulive.com", +// serverHost : "https://napi.yaoulive.com", //測試 -// serverHost : "https://ceshi.yaoulive.com", + serverHost : "https://ceshi.yaoulive.com", //腾讯地图 txMapAppKey : "EOZBZ-ASLCU-4XPV3-BDCHZ-4E3Q7-H4BWB", diff --git a/live/src/main/java/com/yunbao/live/activity/LiveActivity.java b/live/src/main/java/com/yunbao/live/activity/LiveActivity.java index 450101a5d..9d1fa1241 100644 --- a/live/src/main/java/com/yunbao/live/activity/LiveActivity.java +++ b/live/src/main/java/com/yunbao/live/activity/LiveActivity.java @@ -51,7 +51,7 @@ import com.yunbao.live.bean.LiveGuardInfo; import com.yunbao.live.bean.LiveLuckGiftWinBean; import com.yunbao.live.bean.LivePKUserListBean; import com.yunbao.live.bean.LiveReceiveGiftBean; -import com.yunbao.live.bean.LiveUserGiftBean; +import com.yunbao.common.bean.LiveUserGiftBean; import com.yunbao.live.dialog.GiftPrizePoolFragment; import com.yunbao.live.dialog.LiveChatRoomDialogFragment; import com.yunbao.live.dialog.LiveFansFragment; diff --git a/live/src/main/java/com/yunbao/live/activity/LiveAudienceActivity.java b/live/src/main/java/com/yunbao/live/activity/LiveAudienceActivity.java index 3dc90b8e2..ce7189271 100644 --- a/live/src/main/java/com/yunbao/live/activity/LiveAudienceActivity.java +++ b/live/src/main/java/com/yunbao/live/activity/LiveAudienceActivity.java @@ -170,15 +170,14 @@ public class LiveAudienceActivity extends LiveActivity { L.e(TAG, "直播sdk----->" + (mLiveSDK == Constants.LIVE_SDK_KSY ? "金山云" : "腾讯云")); mLiveType = intent.getIntExtra(Constants.LIVE_TYPE, Constants.LIVE_TYPE_NORMAL); mLiveTypeVal = intent.getIntExtra(Constants.LIVE_TYPE_VAL, 0); + initView(); + setVolumeControlStream(AudioManager.STREAM_MUSIC); + manager = new PortraitLiveManager(this, intent); mLiveBean = intent.getParcelableExtra(Constants.LIVE_BEAN); mLiveUid = mLiveBean.getUid(); mStream = mLiveBean.getStream(); - setVolumeControlStream(AudioManager.STREAM_MUSIC); - manager = new PortraitLiveManager(this, intent); - initView(); initData(); } - /** * 初始化界面 */ @@ -303,11 +302,42 @@ public class LiveAudienceActivity extends LiveActivity { private Runnable liveRunnable = new Runnable() { @Override public void run() { - AnchorRecommendItemModel data = itemModelList.get(mCurrentPage); + new LiveRoomCheckLivePresenter(mContext, data.getUid(), data.getStream(), new LiveRoomCheckLivePresenter.NewActionListener() { + @Override + public void onLiveRoomChanged(String liveUid, String stream, int liveType, String liveTypeVal, String liveSdk) { + + try { + mLiveSDK = Integer.parseInt(liveSdk); + mLiveTypeVal = Integer.parseInt(liveTypeVal); + } catch (NumberFormatException e) { + mLiveSDK = 0; + mLiveTypeVal = 0; + } + mLiveType = liveType; + String json = GsonUtils.toJson(data); + mLiveBean = GsonUtils.fromJson(json, LiveBean.class); + mLiveBean.setUserNiceName(data.getUserNicename()); + mLiveUid = mLiveBean.getUid(); + mStream = mLiveBean.getStream(); + mAncherName = mLiveBean.getUserNiceName(); + mAncherIcon = mLiveBean.getAvatar(); + Log.e(TAG, "mLiveUid--------------------------->" + mLiveUid); + //加载当前页面数据 + View rootView = manager.getRootView(); + if (rootView.getParent() != null && rootView.getParent() instanceof ViewGroup) { + ((ViewGroup) (rootView.getParent())).removeView(rootView); + manager.onRemove(false); + } + mViewGroup.addView(manager.getRootView()); + + manager.onAdd(mLiveBean, liveType, mLiveTypeVal, mLiveSDK); + //加载完页面后再后台静默下载礼物svga + downloadAllGift(); + over(); + } + }); - //获取直播间状态 - LiveHttpUtil.getLiveInfo(data.getUid(), liveInfo); } }; @@ -315,51 +345,50 @@ public class LiveAudienceActivity extends LiveActivity { /** * 获取直播间状态 */ - private HttpCallback liveInfo = new HttpCallback() { - @Override - public void onSuccess(int code, String msg, String[] info) { - if (code == 0 && info.length > 0) { - LiveBean liveBean = JSON.parseObject(info[0], LiveBean.class); - LiveRoomCheckLivePresenter mCheckLivePresenter = new LiveRoomCheckLivePresenter(mContext, (liveBean1, liveType, liveTypeVal, liveSdk) -> { - //主播正在直播 - if (liveBean1 == null) { - return; - } - runOnUiThread(() -> { - mLiveSDK = liveSdk; - mLiveType = liveType; - mLiveTypeVal = liveTypeVal; - mLiveBean = liveBean1; - mLiveUid = liveBean1.getUid(); - mStream = liveBean1.getStream(); - mAncherName = liveBean1.getUserNiceName(); - mAncherIcon = liveBean1.getAvatar(); - Log.e(TAG, "mLiveUid--------------------------->" + mLiveUid); - //加载当前页面数据 - View rootView = manager.getRootView(); - if (rootView.getParent() != null && rootView.getParent() instanceof ViewGroup) { - ((ViewGroup) (rootView.getParent())).removeView(rootView); - manager.onRemove(false); - } - mViewGroup.addView(manager.getRootView()); - - manager.onAdd(liveBean1, liveType, liveTypeVal, liveSdk); - //加载完页面后再后台静默下载礼物svga - downloadAllGift(); - over(); - }); - - - }); - - mCheckLivePresenter.checkLive(liveBean); - } else { - //主播未直播时自动下滑至下一个直播间 - verticalViewPager.setCurrentItem(mCurrentPage + 1); - } - } - }; - +// private HttpCallback liveInfo = new HttpCallback() { +// @Override +// public void onSuccess(int code, String msg, String[] info) { +// if (code == 0 && info.length > 0) { +// LiveBean liveBean = JSON.parseObject(info[0], LiveBean.class); +// LiveRoomCheckLivePresenter mCheckLivePresenter = new LiveRoomCheckLivePresenter(mContext, (liveBean1, liveType, liveTypeVal, liveSdk) -> { +// //主播正在直播 +// if (liveBean1 == null) { +// return; +// } +// runOnUiThread(() -> { +// mLiveSDK = liveSdk; +// mLiveType = liveType; +// mLiveTypeVal = liveTypeVal; +// mLiveBean = liveBean1; +// mLiveUid = liveBean1.getUid(); +// mStream = liveBean1.getStream(); +// mAncherName = liveBean1.getUserNiceName(); +// mAncherIcon = liveBean1.getAvatar(); +// Log.e(TAG, "mLiveUid--------------------------->" + mLiveUid); +// //加载当前页面数据 +// View rootView = manager.getRootView(); +// if (rootView.getParent() != null && rootView.getParent() instanceof ViewGroup) { +// ((ViewGroup) (rootView.getParent())).removeView(rootView); +// manager.onRemove(false); +// } +// mViewGroup.addView(manager.getRootView()); +// +// manager.onAdd(liveBean1, liveType, liveTypeVal, liveSdk); +// //加载完页面后再后台静默下载礼物svga +// downloadAllGift(); +// over(); +// }); +// +// +// }); +// +// mCheckLivePresenter.checkLive(liveBean); +// } else { +// //主播未直播时自动下滑至下一个直播间 +// verticalViewPager.setCurrentItem(mCurrentPage + 1); +// } +// } +// }; private void over() { if ("NEWUSER".equals(getIntent().getStringExtra("OPEN"))) { Intent intent = getIntent(); @@ -529,21 +558,30 @@ public class LiveAudienceActivity extends LiveActivity { @Override protected void onPause() { super.onPause(); - manager.onPause(); + if (manager != null) { + manager.onPause(); + } + GiftCacheUtil.getInstance().pause(); } @Override protected void onStop() { super.onStop(); - manager.onStop(); + if (manager != null) { + manager.onStop(); + } + } /** * 点亮 */ public void light() { - manager.light(); + if (manager != null) { + manager.light(); + } + } @@ -551,21 +589,24 @@ public class LiveAudienceActivity extends LiveActivity { * 计时收费更新主播映票数 */ public void roomChargeUpdateVotes() { - manager.sendUpdateVotesMessage(); + if (manager != null) + manager.sendUpdateVotesMessage(); } /** * 暂停播放 */ public void pausePlay() { - manager.pausePlay(); + if (manager != null) + manager.pausePlay(); } /** * 恢复播放 */ public void resumePlay() { - manager.resumePlay(); + if (manager != null) + manager.resumePlay(); } public CountDownTimer getCountDownTimer() { @@ -576,7 +617,8 @@ public class LiveAudienceActivity extends LiveActivity { * 充值成功 */ public void onChargeSuccess() { - manager.onChargeSuccess(); + if (manager != null) + manager.onChargeSuccess(); } public void setCoinNotEnough(boolean coinNotEnough) { @@ -663,7 +705,9 @@ public class LiveAudienceActivity extends LiveActivity { @Override protected void onResume() { super.onResume(); - manager.onResume(); + if (manager != null) { + manager.onResume(); + } GiftCacheUtil.getInstance().restart(); } @@ -732,7 +776,7 @@ public class LiveAudienceActivity extends LiveActivity { @Override public void goToLive(AnchorRecommendItemModel model) { //获取直播间状态 - LiveHttpUtil.getLiveInfo(model.getUid(), liveInfo); +// LiveHttpUtil.getLiveInfo(model.getUid(), liveInfo); customDrawerPopupView.dismiss(); } diff --git a/live/src/main/java/com/yunbao/live/activity/LiveRyAnchorActivity.java b/live/src/main/java/com/yunbao/live/activity/LiveRyAnchorActivity.java index 82a9de24b..2bf6e8519 100644 --- a/live/src/main/java/com/yunbao/live/activity/LiveRyAnchorActivity.java +++ b/live/src/main/java/com/yunbao/live/activity/LiveRyAnchorActivity.java @@ -65,7 +65,7 @@ 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.bean.LiveUserGiftBean; +import com.yunbao.common.bean.LiveUserGiftBean; import com.yunbao.live.bean.MicUserBean; import com.yunbao.live.dialog.LiveLinkMicListDialogFragment; import com.yunbao.live.dialog.LiveMicAnchorDialogFragment; diff --git a/live/src/main/java/com/yunbao/live/adapter/LiveUserAdapter.java b/live/src/main/java/com/yunbao/live/adapter/LiveUserAdapter.java index 5a1f0b1ed..148dfee98 100644 --- a/live/src/main/java/com/yunbao/live/adapter/LiveUserAdapter.java +++ b/live/src/main/java/com/yunbao/live/adapter/LiveUserAdapter.java @@ -24,7 +24,7 @@ import com.yunbao.common.interfaces.OnItemClickListener; import com.yunbao.common.utils.SVGAViewUtils; import com.yunbao.common.views.weight.ClipPathCircleImage; import com.yunbao.live.R; -import com.yunbao.live.bean.LiveUserGiftBean; +import com.yunbao.common.bean.LiveUserGiftBean; import java.net.MalformedURLException; import java.net.URL; diff --git a/live/src/main/java/com/yunbao/live/adapter/UserMoreInfoAdapter.java b/live/src/main/java/com/yunbao/live/adapter/UserMoreInfoAdapter.java index 16c39a661..2917dc937 100644 --- a/live/src/main/java/com/yunbao/live/adapter/UserMoreInfoAdapter.java +++ b/live/src/main/java/com/yunbao/live/adapter/UserMoreInfoAdapter.java @@ -35,7 +35,7 @@ import com.yunbao.common.utils.ToastUtil; import com.yunbao.common.views.weight.ClipPathCircleImage; import com.yunbao.live.R; import com.yunbao.live.activity.LiveActivity; -import com.yunbao.live.bean.LiveUserGiftBean; +import com.yunbao.common.bean.LiveUserGiftBean; import com.yunbao.live.dialog.LiveUserMoreDialogFragment; import com.yunbao.live.utils.LiveTextRender; diff --git a/live/src/main/java/com/yunbao/live/bean/LiveEnterRoomBean.java b/live/src/main/java/com/yunbao/live/bean/LiveEnterRoomBean.java index 1b42f5177..bf728a951 100644 --- a/live/src/main/java/com/yunbao/live/bean/LiveEnterRoomBean.java +++ b/live/src/main/java/com/yunbao/live/bean/LiveEnterRoomBean.java @@ -1,5 +1,7 @@ package com.yunbao.live.bean; +import com.yunbao.common.bean.LiveUserGiftBean; + /** * Created by cxf on 2018/10/12. */ diff --git a/live/src/main/java/com/yunbao/live/dialog/LiveMicAnchorDialogFragment.java b/live/src/main/java/com/yunbao/live/dialog/LiveMicAnchorDialogFragment.java index 76a43e668..5a2189cac 100644 --- a/live/src/main/java/com/yunbao/live/dialog/LiveMicAnchorDialogFragment.java +++ b/live/src/main/java/com/yunbao/live/dialog/LiveMicAnchorDialogFragment.java @@ -31,7 +31,7 @@ import com.yunbao.live.R; import com.yunbao.live.activity.LiveActivity; import com.yunbao.live.adapter.AnchorUserMicInfoAdapter; import com.yunbao.live.bean.LiveGuardInfo; -import com.yunbao.live.bean.LiveUserGiftBean; +import com.yunbao.common.bean.LiveUserGiftBean; import com.yunbao.live.bean.MicUserBean; import com.yunbao.live.http.LiveHttpUtil; import com.yunbao.live.utils.LiveImDeletUtil; diff --git a/live/src/main/java/com/yunbao/live/dialog/LiveUserMoreDialogFragment.java b/live/src/main/java/com/yunbao/live/dialog/LiveUserMoreDialogFragment.java index a5e9cdf4e..98a39b92f 100644 --- a/live/src/main/java/com/yunbao/live/dialog/LiveUserMoreDialogFragment.java +++ b/live/src/main/java/com/yunbao/live/dialog/LiveUserMoreDialogFragment.java @@ -38,7 +38,7 @@ import com.yunbao.live.activity.LiveActivity; import com.yunbao.live.activity.LiveRyAnchorActivity; import com.yunbao.live.adapter.UserMoreInfoAdapter; import com.yunbao.live.bean.LiveGuardInfo; -import com.yunbao.live.bean.LiveUserGiftBean; +import com.yunbao.common.bean.LiveUserGiftBean; import com.yunbao.live.http.LiveHttpUtil; import java.util.ArrayList; diff --git a/live/src/main/java/com/yunbao/live/presenter/LiveRoomCheckLivePresenter.java b/live/src/main/java/com/yunbao/live/presenter/LiveRoomCheckLivePresenter.java index 1bc0616cf..333629212 100644 --- a/live/src/main/java/com/yunbao/live/presenter/LiveRoomCheckLivePresenter.java +++ b/live/src/main/java/com/yunbao/live/presenter/LiveRoomCheckLivePresenter.java @@ -9,14 +9,17 @@ import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONObject; import com.yunbao.common.CommonAppConfig; import com.yunbao.common.Constants; +import com.yunbao.common.bean.CheckLiveModel; +import com.yunbao.common.bean.LiveBean; import com.yunbao.common.http.HttpCallback; +import com.yunbao.common.http.base.CheckLiveCallBack; +import com.yunbao.common.http.live.LiveNetManager; import com.yunbao.common.utils.Bus; import com.yunbao.common.utils.DialogUitl; import com.yunbao.common.utils.MD5Util; import com.yunbao.common.utils.ToastUtil; import com.yunbao.common.utils.WordUtil; import com.yunbao.live.R; -import com.yunbao.common.bean.LiveBean; import com.yunbao.live.event.LiveAudienceEvent; import com.yunbao.live.http.LiveHttpConsts; import com.yunbao.live.http.LiveHttpUtil; @@ -37,6 +40,83 @@ public class LiveRoomCheckLivePresenter { //搜索页面不提示密码 public static boolean isRoom = false; + /** + * 新的检查直播间状态方法 + * + * @param context 上下文 + * @param liveUid 直播间ID + * @param stream + */ + public LiveRoomCheckLivePresenter(Context context, String liveUid, String stream, NewActionListener actionListener) { + LiveNetManager.get(context) + .checkLive(liveUid, stream, new CheckLiveCallBack() { + @Override + public void forwardNormalRoom(CheckLiveModel model) { + if (actionListener != null) { + actionListener.onLiveRoomChanged(liveUid, stream, model.getType(), model.getTypeVal(), model.getLiveSdk()); + } + } + + @Override + public void forwardPwdRoom(CheckLiveModel model) { + DialogUitl.showSimpleInputDialog(mContext, WordUtil.getString(R.string.live_input_password), DialogUitl.INPUT_TYPE_NUMBER_PASSWORD, new DialogUitl.SimpleCallback2() { + @Override + public void onCancelClick() { + if (mContext instanceof Activity) { + ((Activity) mContext).finish(); + } + } + + @Override + public void onConfirmClick(Dialog dialog, String content) { + if (TextUtils.isEmpty(content)) { + ToastUtil.show(WordUtil.getString(R.string.live_input_password)); + return; + } + String password = MD5Util.getMD5(content); + if (mLiveTypeMsg.equalsIgnoreCase(password)) { + dialog.dismiss(); + if (actionListener != null) { + actionListener.onLiveRoomChanged(liveUid, stream, model.getType(), model.getTypeVal(), model.getLiveSdk()); + } + } else { + ToastUtil.show(WordUtil.getString(R.string.live_password_error)); + } + } + }); + } + + @Override + public void forwardPayRoom(CheckLiveModel model) { + DialogUitl.showSimpleDialog(mContext, mLiveTypeMsg, new DialogUitl.SimpleCallback() { + @Override + public void onConfirmClick(Dialog dialog, String content) { + LiveHttpUtil.roomCharge(liveUid, stream, new HttpCallback() { + @Override + public void onSuccess(int code, String msg, String[] info) { + if (code == 0) { + if (actionListener != null) { + actionListener.onLiveRoomChanged(liveUid, stream, model.getType(), model.getTypeVal(), model.getLiveSdk()); + } + } else { + ToastUtil.show(msg); + } + } + }); + } + }); + } + + @Override + public void onError(String error) { + Bus.get().post(new LiveAudienceEvent() + .setType(LiveAudienceEvent.LiveAudienceType.LIVE_ROOM_EXCEPTION)); + ToastUtil.show(error); + } + }); + } + + public LiveRoomCheckLivePresenter(Context context, ActionListener actionListener) { mContext = context; mActionListener = actionListener; @@ -110,7 +190,7 @@ public class LiveRoomCheckLivePresenter { DialogUitl.showSimpleInputDialog(mContext, WordUtil.getString(R.string.live_input_password), DialogUitl.INPUT_TYPE_NUMBER_PASSWORD, new DialogUitl.SimpleCallback2() { @Override public void onCancelClick() { - if(mContext instanceof Activity) { + if (mContext instanceof Activity) { ((Activity) mContext).finish(); } } @@ -194,4 +274,8 @@ public class LiveRoomCheckLivePresenter { public interface ActionListener { void onLiveRoomChanged(LiveBean liveBean, int liveType, int liveTypeVal, int liveSdk); } + + public interface NewActionListener { + void onLiveRoomChanged(String liveUid, String stream, int liveType, String liveTypeVal, String liveSdk); + } } diff --git a/live/src/main/java/com/yunbao/live/socket/SocketClient.java b/live/src/main/java/com/yunbao/live/socket/SocketClient.java index 1752860c3..7342b8199 100644 --- a/live/src/main/java/com/yunbao/live/socket/SocketClient.java +++ b/live/src/main/java/com/yunbao/live/socket/SocketClient.java @@ -32,7 +32,7 @@ import com.yunbao.live.bean.LiveGiftPrizePoolWinBean; import com.yunbao.live.bean.LiveLuckGiftWinBean; import com.yunbao.live.bean.LivePKUserListBean; import com.yunbao.live.bean.LiveReceiveGiftBean; -import com.yunbao.live.bean.LiveUserGiftBean; +import com.yunbao.common.bean.LiveUserGiftBean; import com.yunbao.live.presenter.LiveLinkMicPkPresenter; import com.yunbao.live.views.LivePlayKsyViewHolder; import com.yunbao.live.views.LivePushTxViewHolder; diff --git a/live/src/main/java/com/yunbao/live/socket/SocketMessageListener.java b/live/src/main/java/com/yunbao/live/socket/SocketMessageListener.java index 664feb37f..3d5040038 100644 --- a/live/src/main/java/com/yunbao/live/socket/SocketMessageListener.java +++ b/live/src/main/java/com/yunbao/live/socket/SocketMessageListener.java @@ -10,7 +10,7 @@ import com.yunbao.live.bean.LiveGiftPrizePoolWinBean; import com.yunbao.live.bean.LiveLuckGiftWinBean; import com.yunbao.live.bean.LivePKUserListBean; import com.yunbao.live.bean.LiveReceiveGiftBean; -import com.yunbao.live.bean.LiveUserGiftBean; +import com.yunbao.common.bean.LiveUserGiftBean; import java.util.List; diff --git a/live/src/main/java/com/yunbao/live/socket/SocketRyClient.java b/live/src/main/java/com/yunbao/live/socket/SocketRyClient.java index b75ef4e28..389604dd0 100644 --- a/live/src/main/java/com/yunbao/live/socket/SocketRyClient.java +++ b/live/src/main/java/com/yunbao/live/socket/SocketRyClient.java @@ -19,12 +19,14 @@ import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONObject; import com.blankj.utilcode.util.GsonUtils; +import com.google.gson.reflect.TypeToken; import com.yunbao.common.CommonAppConfig; import com.yunbao.common.CommonAppContext; import com.yunbao.common.Constants; import com.yunbao.common.bean.AiAutomaticSpeechModel; import com.yunbao.common.bean.FansMedalBean; import com.yunbao.common.bean.LinkMicUserBean; +import com.yunbao.common.bean.LiveUserGiftBean; import com.yunbao.common.bean.MsgModel; import com.yunbao.common.bean.PkRankBean; import com.yunbao.common.bean.SocketModel; @@ -47,7 +49,6 @@ import com.yunbao.live.bean.LiveGiftPrizePoolWinBean; import com.yunbao.live.bean.LiveLuckGiftWinBean; import com.yunbao.live.bean.LivePKUserListBean; import com.yunbao.live.bean.LiveReceiveGiftBean; -import com.yunbao.live.bean.LiveUserGiftBean; import com.yunbao.live.event.LiveAudienceEvent; import com.yunbao.live.views.LiveEndViewHolder; import com.yunbao.live.views.LivePlayKsyViewHolder; @@ -174,7 +175,7 @@ public class SocketRyClient { LiveRoomViewHolder.updataMicList(mic_data.getJSONArray("userlist")); EventBus.getDefault().post(new LiveAudienceEvent() .setType(LiveAudienceEvent.LiveAudienceType.LINK_MIC_UPDATE_MIC_LIST) - .setObject(JSONArray.parseArray(mic_data.getJSONArray("userlist").toString(),LinkMicUserBean.class)) + .setObject(JSONArray.parseArray(mic_data.getJSONArray("userlist").toString(), LinkMicUserBean.class)) ); } else if (actions == 6) { ToastUtil.show("主播已關閉當前語音連麥功能"); @@ -183,12 +184,12 @@ public class SocketRyClient { } else if (actions == 8) { ToastUtil.show("您已被移出多人語音連麥"); EventBus.getDefault().post("endMic"); - }else if(actions==3){ + } else if (actions == 3) { Bus.get().post(new LiveAudienceEvent() .setType(LiveAudienceEvent.LiveAudienceType.LINK_MIC) .setObject(map.toJavaObject(LinkMicUserBean.class)) ); - }else if (actions==7){//取消连麦 + } else if (actions == 7) {//取消连麦 EventBus.getDefault().post(new LiveAudienceEvent() .setType(LiveAudienceEvent.LiveAudienceType.LINK_MIC_CANCEL) .setObject(map.toJavaObject(LinkMicUserBean.class)) @@ -199,7 +200,8 @@ public class SocketRyClient { mListener.onUpUserList(map.getJSONObject("ct")); EventBus.getDefault().post(new LiveAudienceEvent() .setType(LiveAudienceEvent.LiveAudienceType.LINK_MIC_UPDATE_AUDIENCE_LIST) - .setObject(JSON.parseArray(map.getJSONObject("ct").getString("userlist"), LiveUserGiftBean.class)) + .setObject( GsonUtils.fromJson(map.getJSONObject("ct").getString("userlist"), new TypeToken>() { + }.getType())) ); break; case Constants.CARD: @@ -537,9 +539,9 @@ public class SocketRyClient { .setMsgModel(GsonUtils.fromJson(map.getJSONObject("ct").toString(), MsgModel.class))); break; case Constants.PK_RANK_UPDATE: - Log.i("PK排位",map.toString()); - JSONObject item=map.getJSONObject("ct"); - PkRankBean pkRankBean=new PkRankBean(); + Log.i("PK排位", map.toString()); + JSONObject item = map.getJSONObject("ct"); + PkRankBean pkRankBean = new PkRankBean(); pkRankBean.setId(Integer.parseInt(item.getString("new_rank_id"))); pkRankBean.setName(item.getString("new_rank_name")); pkRankBean.setImg(item.getString("new_rank_img")); @@ -708,7 +710,7 @@ public class SocketRyClient { mListener.onChat(chatBean, 1); } else if ("0".equals(msgtype)) {//用户进入房间 JSONObject obj = JSON.parseObject(map.getString("ct")); - LiveUserGiftBean u = JSON.toJavaObject(obj, LiveUserGiftBean.class); + LiveUserGiftBean u = GsonUtils.fromJson(obj.toJSONString(), LiveUserGiftBean.class); UserBean.Vip vip = new UserBean.Vip(); int vipType = obj.getIntValue("vip_type"); vip.setType(vipType); @@ -751,6 +753,7 @@ public class SocketRyClient { chatBean.setBubbleSrc(obj.getString("bubbleSrc"));//氣泡 //增加粉丝徽章信息 chatBean.setMedalNmae(obj.getString("medal_name")); + chatBean.setUserNiceName(obj.getString("user_nicename"));//名字 FansMedalBean fansMedalBean = CommonAppConfig.getInstance().getAnchorFansMedal(obj.getIntValue("medal_level")); if (fansMedalBean != null) chatBean.setMedalLevelImageUrl(fansMedalBean.getThumb()); @@ -1024,13 +1027,13 @@ public class SocketRyClient { break; case 2://收到对方主播PK回调 mListener.onLinkMicToPk(map.getString("uid"), map.getString("pkhead"), map.getString("pkname")); - mListener.onLinkMicPkStart(map.getString("uid"), map.getString("pkhead"), map.getString("pkname"),map.getString("is_ladders"));// mListener.onLinkMicPkStart(map.getString("uid")); + mListener.onLinkMicPkStart(map.getString("uid"), map.getString("pkhead"), map.getString("pkname"), map.getString("is_ladders"));// mListener.onLinkMicPkStart(map.getString("uid")); break; case 3://对方主播拒绝PK的回调 mListener.onLinkMicPkRefuse(); break; case 4://所有人收到PK开始址的回调 - mListener.onLinkMicPkStart(map.getString("pkuid"), map.getString("pkhead"), map.getString("pkname"),map.getString("is_ladders")); + mListener.onLinkMicPkStart(map.getString("pkuid"), map.getString("pkhead"), map.getString("pkname"), map.getString("is_ladders")); break; case 5://PK时候断开连麦的回调 if (rtcRoom != null) { @@ -1071,7 +1074,7 @@ public class SocketRyClient { msg1.put("pkuid", CommonAppConfig.getInstance().getUid()); msg1.put("pkname", CommonAppConfig.getInstance().getUserBean().getUserNiceName()); msg1.put("pkhead", CommonAppConfig.getInstance().getUserBean().getAvatar()); - if(rtcRoom==null){ + if (rtcRoom == null) { return; } rtcRoom.getLocalUser().requestJoinOtherRoom(map.getString("uid"), map.getString("uid"), true, msg1.toString(), new IRCRTCResultCallback() { diff --git a/live/src/main/java/com/yunbao/live/views/LiveRoomViewHolder.java b/live/src/main/java/com/yunbao/live/views/LiveRoomViewHolder.java index 60f516f41..e9981e70a 100644 --- a/live/src/main/java/com/yunbao/live/views/LiveRoomViewHolder.java +++ b/live/src/main/java/com/yunbao/live/views/LiveRoomViewHolder.java @@ -39,6 +39,7 @@ import androidx.recyclerview.widget.RecyclerView; import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONObject; +import com.blankj.utilcode.util.GsonUtils; import com.bumptech.glide.Glide; import com.bumptech.glide.load.DataSource; import com.bumptech.glide.load.engine.GlideException; @@ -46,6 +47,7 @@ import com.bumptech.glide.load.resource.gif.GifDrawable; import com.bumptech.glide.request.RequestListener; import com.bumptech.glide.request.RequestOptions; import com.bumptech.glide.request.target.Target; +import com.google.gson.reflect.TypeToken; import com.makeramen.roundedimageview.RoundedImageView; import com.ms.banner.Banner; import com.ms.banner.BannerConfig; @@ -59,14 +61,18 @@ import com.yunbao.common.Constants; import com.yunbao.common.activity.AbsActivity; import com.yunbao.common.bean.AiAutomaticSpeechModel; import com.yunbao.common.bean.BannerBean; +import com.yunbao.common.bean.GuardUserModel; import com.yunbao.common.bean.HourRank; import com.yunbao.common.bean.IMLoginModel; import com.yunbao.common.bean.LevelBean; import com.yunbao.common.bean.LiveBean; import com.yunbao.common.bean.LiveGiftBean; import com.yunbao.common.bean.LiveRoomActivityBanner; +import com.yunbao.common.bean.LiveUserGiftBean; import com.yunbao.common.bean.MsgModel; +import com.yunbao.common.bean.NewLevelModel; import com.yunbao.common.bean.PkRankBean; +import com.yunbao.common.bean.RankHourModel; import com.yunbao.common.bean.StarChallengeStatusModel; import com.yunbao.common.bean.UserBean; import com.yunbao.common.glide.ImgLoader; @@ -112,7 +118,6 @@ import com.yunbao.live.bean.LiveGiftPrizePoolWinBean; import com.yunbao.live.bean.LiveLuckGiftWinBean; import com.yunbao.live.bean.LivePKUserListBean; import com.yunbao.live.bean.LiveReceiveGiftBean; -import com.yunbao.live.bean.LiveUserGiftBean; import com.yunbao.live.bean.LiveWishlistBean; import com.yunbao.live.bean.WishlistItemModel; import com.yunbao.live.custom.LiveLightView; @@ -313,6 +318,9 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis private TextView mRedVal, mBlueVal; private String pkUid = ""; + //接口整合新加参数 + private GuardUserModel guardUserModel; + public LiveRoomViewHolder(boolean isRys, int forActivity, Context context, ViewGroup parentView, GifImageView gifImageView, SVGAImageView svgaImageView, ViewGroup liveGiftPrizePoolContainer, WindowManager windowManager) { super(context, parentView); Contexts = context; @@ -1145,8 +1153,11 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis msgLayout.setVisibility(View.GONE); } - public void addWishList(BannerBean bannerModel) { - mBannerList2.add(bannerModel); + /** + * 添加心愿单轮播he活动 + */ + public void addWishListActivity(List bannerModels) { + mBannerList2.addAll(bannerModels); if (mBanner2.isStart()) { mBanner2.update(mBannerList2); } else { @@ -1476,6 +1487,49 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis }); } + public void initHourRank(RankHourModel model) { + ViewFlipper flipper = (ViewFlipper) findViewById(R.id.hour_rank_list); + LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(DpUtil.dp2px(44), DpUtil.dp2px(16)); + LinearLayout.LayoutParams textParams = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT); + textParams.leftMargin = DpUtil.dp2px(5); + View hotView = LayoutInflater.from(mContext).inflate(R.layout.view_wish_list, null); + View hourView = LayoutInflater.from(mContext).inflate(R.layout.view_wish_list, null); + ImageView hotPic = hotView.findViewById(R.id.wish_pic); + ImageView hourPic = hourView.findViewById(R.id.wish_pic); + mHotText = hotView.findViewById(R.id.wish_index); + mHourRank = hourView.findViewById(R.id.wish_index); + mHotText.setText("0"); + mHotText.setLayoutParams(textParams); + mHourRank.setLayoutParams(textParams); + mHotText.setGravity(Gravity.CENTER); + mHourRank.setGravity(Gravity.CENTER); + setHourRankData(Long.parseLong(model.getRank())); + hotPic.setImageResource(WordUtil.isZh() ? R.drawable.live_tags_hot : R.drawable.live_tags_hot_en); + hourPic.setImageResource(WordUtil.isZh() ? R.drawable.live_tags_hour_list : R.drawable.live_tags_hour_list_en); + hotPic.setLayoutParams(params); + hourPic.setLayoutParams(params); + flipper.addView(hotView); + flipper.addView(hourView); + flipper.startFlipping(); + flipper.setOnClickListener(view -> { + Bundle bundle = new Bundle(); + String path = model.getHourchartH5Url(); + if (!path.startsWith("/")) { + path = "/" + path; + } + String url = CommonAppConfig.HOST + path; + url += "&uid=" + CommonAppConfig.getInstance().getUid() + "&token=" + + CommonAppConfig.getInstance().getToken() + "&anchorUid=" + mLiveUid; + bundle.putString("url", url); + bundle.putInt("height", DpUtil.dp2px(500)); + bundle.putInt("show_type", 0); + bundle.putString("roomId", mLiveUid); + LiveHDDialogFragment liveHDDialogFragment = new LiveHDDialogFragment(); + liveHDDialogFragment.setArguments(bundle); + liveHDDialogFragment.show(((AbsActivity) mContext).getSupportFragmentManager(), "LiveHDDialogFragment"); + }); + } + /** * 初始化小时榜 */ @@ -2068,6 +2122,23 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis } } + /** + * 接口整合守护展示 + * + * @param model + */ + public void setGuardIcon(GuardUserModel model) { + if (model != null && !TextUtils.isEmpty(model.getGuardUserAvatar())) { + guardUserModel = model; + ViewGroup.LayoutParams params = userGuard.getLayoutParams(); + params.height = DpUtil.dp2px(30); + params.width = DpUtil.dp2px(30); + userGuard.setLayoutParams(params); + ImgLoader.displayAvatar(mContext, model.getGuardUserAvatar(), userGuard); + gift_svga.setVisibility(View.VISIBLE); + } + } + /** * 守护信息发生变化 @@ -2403,7 +2474,8 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis * 刷新用户列表 */ public void refreshUserList(JSONObject obj) { - List list = JSON.parseArray(obj.getString("userlist"), LiveUserGiftBean.class); + List list = GsonUtils.fromJson(obj.getString("userlist"), new TypeToken>() { + }.getType()); mLiveUserAdapter.refreshList(list); } diff --git a/live/src/main/java/com/yunbao/live/views/PortraitLiveManager.java b/live/src/main/java/com/yunbao/live/views/PortraitLiveManager.java index f7e1ad746..d6de73b49 100644 --- a/live/src/main/java/com/yunbao/live/views/PortraitLiveManager.java +++ b/live/src/main/java/com/yunbao/live/views/PortraitLiveManager.java @@ -34,7 +34,10 @@ import com.yunbao.common.CommonAppContext; import com.yunbao.common.Constants; import com.yunbao.common.bean.AiAutomaticSpeechModel; import com.yunbao.common.bean.BannerBean; +import com.yunbao.common.bean.EnterRoomNewModel; import com.yunbao.common.bean.LiveBean; +import com.yunbao.common.bean.LiveRoomActivityModel; +import com.yunbao.common.bean.LiveUserGiftBean; import com.yunbao.common.bean.MsgModel; import com.yunbao.common.bean.StarChallengeStatusModel; import com.yunbao.common.bean.UserBean; @@ -46,6 +49,7 @@ import com.yunbao.common.http.CommonHttpConsts; import com.yunbao.common.http.CommonHttpUtil; import com.yunbao.common.http.HttpCallback; import com.yunbao.common.http.HttpClient; +import com.yunbao.common.http.live.LiveNetManager; import com.yunbao.common.manager.IMLoginManager; import com.yunbao.common.utils.Bus; import com.yunbao.common.utils.DialogUitl; @@ -67,9 +71,7 @@ import com.yunbao.live.bean.LiveGuardInfo; import com.yunbao.live.bean.LiveLuckGiftWinBean; import com.yunbao.live.bean.LivePKUserListBean; import com.yunbao.live.bean.LiveReceiveGiftBean; -import com.yunbao.live.bean.LiveUserGiftBean; import com.yunbao.live.bean.OpenParametersModel; -import com.yunbao.live.bean.WishlistModel; import com.yunbao.live.dialog.BlowkissDialog; import com.yunbao.live.dialog.NewUserDialog; import com.yunbao.live.event.LinkMicTxAccEvent; @@ -275,46 +277,253 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe mLiveRoomViewHolder.clearGuardIcon(); mLiveRoomViewHolder.releaseGift(); mLiveRyLinkMicPkPresenter.setLiveUid(data.getUid(), ""); - - mLiveRoomViewHolder.setLiveUid(data.getUid()); - mSocketRyClient = new SocketRyClient(mLiveBean.getUid(), PortraitLiveManager.this); if (mLiveLinkMicPresenter != null) { mLiveLinkMicPresenter.setSocketClient(mSocketClient); } - //心愿单 - LiveHttpUtil.getWishList(mLiveBean.getUid(), new HttpCallback() { - @Override - public void onSuccess(int code, String msg, String[] info) { - if (info.length > 0) { - String json = info[0]; - WishlistModel model = GsonUtils.fromJson(json, WishlistModel.class); - if (mLiveRoomViewHolder != null && model != null && model.getWishlist().size() > 0) { - BannerBean bannerModel = new BannerBean(); - bannerModel.setShow_type("2"); - bannerModel.setLink(CommonAppConfig.HOST + "/index.php"); - bannerModel.setImageUrl(model.getImg()); - mLiveRoomViewHolder.addWishList(bannerModel); - - } - - } - } - - @Override - public void onFinish() { - - - } - }); - enterRoom(); - mLiveRoomViewHolder.initHourRankList(); - mLiveRoomViewHolder.showLiveRoomActivityBanner(); + enterRoomNew(); } }); } + private void enterRoom() { + //进入直播间IM + + + timeIndex = 0; + LiveHttpUtil.enterRoom(mLiveBean.getUid(), mLiveBean.getStream(), new HttpCallback() { + @Override + public void onSuccess(int code, String msg, String[] info) { + isEnterRoom = true; + if (code == 0 && info.length > 0) { + JSONObject obj = JSON.parseObject(info[0]); + + + //连接socket + LiveHttpUtil.enterBackRoom(mLiveBean.getUid(), mLiveBean.getStream(), new HttpCallback() { + @Override + public void onSuccess(int code, String msg, String[] info) { + //链接上socket以后隐藏Loading加载直播间内容 + } + }); + if (mLiveRoomViewHolder != null) { + LivePlayKsyViewHolder.setLandscape(obj.getIntValue("landscape")); + + mLiveRoomViewHolder.setLiveInfo(mLiveBean.getUid(), mLiveBean.getStream(), obj.getIntValue("userlist_time") * 4000); + mLiveRoomViewHolder.setFastMessage(greetings); + mLiveRoomViewHolder.setVotes(obj.getString("votestotal")); + //真爱排行 数量 + mLiveRoomViewHolder.setMedaRankNum(obj.getString("medalRankNum")); + isattention = obj.getIntValue("isattention"); + if (isattention == 0) { + if (countDownTimer != null) { + countDownTimer.cancel(); + timeIndex = 0; + countDownTimer = null; + setTime(); + } else { + setTime(); + } + } else { + if (countDownTimer != null) { + countDownTimer.cancel(); + countDownTimer = null; + } + } + mLiveAudienceViewHolder.setLiveInfo(mLiveBean.getUid(), mLiveBean.getStream(), mLiveBean.getAvatar(), isattention); + mLiveRoomViewHolder.setAttention(isattention); + if (obj.containsKey("lminfo")) { + JSONObject mic_data = obj.getJSONObject("lminfo"); + if (mic_data.containsKey("userlist")) { + mLiveRoomViewHolder.updataMicList(mic_data.getJSONArray("userlist")); + } + } + List list = JSON.parseArray(obj.getString("userlists"), LiveUserGiftBean.class); + mLiveRoomViewHolder.setUserList(list); + // resetUserListWidth(list); + mLiveRoomViewHolder.startRefreshUserList(); + if (mLiveType == Constants.LIVE_TYPE_TIME) {//计时收费 + mLiveRoomViewHolder.startRequestTimeCharge(); + } + } + if (leave == 1) { + if (LivePlayRyViewHolder.leave != null) { + LivePlayRyViewHolder.leave.setVisibility(View.VISIBLE); + } + } + //判断是否有连麦,要显示连麦窗口 + String linkMicUid = obj.getString("linkmic_uid"); + String linkMicPull = obj.getString("linkmic_pull"); + if (!TextUtils.isEmpty(linkMicUid) && !"0".equals(linkMicUid) && !TextUtils.isEmpty(linkMicPull)) { + if (mLiveSDK != Constants.LIVE_SDK_TX && mLiveLinkMicPresenter != null) { + mLiveLinkMicPresenter.onLinkMicPlay(linkMicUid, linkMicPull); + } + } + //判断是否有主播连麦 + pkInfo = JSON.parseObject(obj.getString("pkinfo")); + if (pkInfo != null && pkInfo.getIntValue("drpk_status") != 1) { + String pkUid = pkInfo.getString("pkuid"); + anyway = "1"; + if (!TextUtils.isEmpty(pkUid) && !"0".equals(pkUid) && anyway.equals("0")) { + if (mLiveSDK != Constants.LIVE_SDK_TX) { + String pkPull = pkInfo.getString("pkpull"); + if (!TextUtils.isEmpty(pkPull) && mLiveLinkMicAnchorPresenter != null) { + mLiveLinkMicAnchorPresenter.onLinkMicAnchorPlayUrl(pkUid, pkPull); + } + } else { + if (mLivePlayViewHolder instanceof LivePlayTxViewHolder) { + ((LivePlayTxViewHolder) mLivePlayViewHolder).setAnchorLinkMic(true, 0); + } + } + } + + if (obj.getString("isconnection") != null && obj.getString("isconnection").equals("1")) { + + LivePlayRyViewHolder.setViewUP(1); + + } + if (pkInfo.getIntValue("ifpk") == 1 && pkInfo.getString("end_pk_time").equals("0")) {//pk开始了 + + LivePlayRyViewHolder.setViewUP(2); + + //pk排名数据 + LivePKUserListBean livePKUserListBean = JSON.parseObject(pkInfo.getString("pk_top_users"), LivePKUserListBean.class); + if (mLiveRoomViewHolder != null) { + mLiveRoomViewHolder.setOtherInfo(pkInfo.getString("pkuid"), pkInfo.getString("pkuimg"), pkInfo.getString("pkuname")); + } + mLiveRyLinkMicPkPresenter.onEnterRoomPkStart(pkUid, pkInfo.getLongValue("pk_gift_liveuid"), pkInfo.getLongValue("pk_gift_pkuid"), pkInfo.getIntValue("pk_time"), livePKUserListBean); + } else if (!pkInfo.getString("end_pk_time").equals("0")) { + + LivePlayRyViewHolder.setViewUP(3); + + //pk排名数据 + LivePKUserListBean livePKUserListBean = JSON.parseObject(pkInfo.getString("pk_top_users"), LivePKUserListBean.class); + mLiveRyLinkMicPkPresenter.onEnterRoomCFStart(pkUid, pkInfo.getLongValue("pk_gift_liveuid"), pkInfo.getLongValue("pk_gift_pkuid"), pkInfo.getIntValue("end_pk_time"), livePKUserListBean); + } + //多人PK + } else if (pkInfo != null && pkInfo.getIntValue("drpk_status") == 1) { + + LivePlayRyViewHolder.setViewUP(4); + + mLiveRoomViewHolder.UpPkBar(pkInfo.getJSONArray("userlist"), mLiveBean.getUid(), pkInfo.getIntValue("drpk_time")); + } + + //守护相关 + mLiveGuardInfo = new LiveGuardInfo(); + int guardNum = obj.getIntValue("guard_nums"); + fansNum = obj.getIntValue("count_fans"); + is_fans = obj.getString("is_fans") + ""; + mLiveGuardInfo.setGuardNum(guardNum); + JSONObject guardObj = obj.getJSONObject("guard"); + if (guardObj != null) { + mLiveGuardInfo.setMyGuardType(guardObj.getIntValue("type")); + mLiveGuardInfo.setMyGuardEndTime(guardObj.getString("endtime")); + } + Bus.get().post(new LiveAudienceEvent() + .setType(LiveAudienceEvent.LiveAudienceType.OPEN_PARAMETERS) + .setParametersModel(openParametersModel.setmLiveGuardInfo(mLiveGuardInfo) + .setFansNum(fansNum) + .setIs_fans(is_fans))); + if (mLiveRoomViewHolder != null) { + mLiveRoomViewHolder.setGuardNum(guardNum); + mLiveRoomViewHolder.setFansNum(fansNum); + //红包相关 + mLiveRoomViewHolder.setRedPackBtnVisible(obj.getIntValue("isred") == 1); + } + //奖池等级 + int giftPrizePoolLevel = obj.getIntValue("jackpot_level"); + if (giftPrizePoolLevel >= 0) { + if (mLiveRoomViewHolder != null) { + mLiveRoomViewHolder.showPrizePoolLevel(String.valueOf(giftPrizePoolLevel)); + } + } + } + } + }); + } + + /** + * 新进入房间接口 + */ + private void enterRoomNew() { + LiveNetManager.get(mContext) + .enterRoomNew(mLiveBean.getStream(), mLiveBean.getUid(), mLiveBean.getCity(), new com.yunbao.common.http.base.HttpCallback() { + @Override + public void onSuccess(EnterRoomNewModel data) { + //小时榜 + mLiveRoomViewHolder.initHourRank(data.getRankHour()); + //守护 + mLiveRoomViewHolder.setGuardIcon(data.getGuardUserAvatar()); + //在线列表 + mLiveRoomViewHolder.setUserList(data.getEnterRoomInfo().getUserlists()); + List bannerBeans = new ArrayList<>(); + //心愿单 + if (data.getWishList().getWishList().size() > 0) { + BannerBean bannerModel = new BannerBean(); + bannerModel.setShow_type("2"); + bannerModel.setLink(CommonAppConfig.HOST + "/index.php"); + bannerModel.setImageUrl(data.getWishList().getImg()); + bannerBeans.add(bannerModel); + } + //活动列表 + if (data.getLiveRoomActivityModels().size() > 0) { + + for (LiveRoomActivityModel model : data.getLiveRoomActivityModels()) { + BannerBean bannerModel = new BannerBean(); + bannerModel.setShow_type(model.getShowType()); + bannerModel.setStart(false); + bannerModel.setLink(model.getLink()); + bannerModel.setImageUrl(model.getImg()); + bannerBeans.add(bannerModel); + } + + } + //底部轮播 + mLiveRoomViewHolder.addWishListActivity(bannerBeans); + //直播间上部轮播【新人特惠】【趣味游戏】【幸运天使】 轮播接口 + mLiveRoomViewHolder.showLiveRoomActivityBanner(); + //兼容老接口数据 + mDanmuPrice = data.getEnterRoomInfo().getBarrageFee(); + mSocketUserType = Integer.parseInt(data.getEnterRoomInfo().getUsertype()); + mChatLevel = Integer.parseInt(data.getEnterRoomInfo().getSpeakLimit()); + mDanMuLevel = Integer.parseInt(data.getEnterRoomInfo().getBarrageLimit()); + + leave = Integer.parseInt(data.getEnterRoomInfo().getIsleave()); + if (!data.getEnterRoomInfo().getGreetings().isEmpty()) { + greetings = data.getEnterRoomInfo().getGreetings(); + } + if (!TextUtils.isEmpty(data.getEnterRoomInfo().getLiveBg())) { + if (liveBg == 0) { + + //直播间背景 + ImgLoader.display(mContext, R.mipmap.live_bg, liveBack); + mask.setVisibility(View.GONE); + } + } else { + liveBg = -1; + } + //回传参数 + Bus.get().post(new LiveAudienceEvent() + .setType(LiveAudienceEvent.LiveAudienceType.OPEN_PARAMETERS) + .setParametersModel(openParametersModel.setmDanmuPrice(mDanmuPrice) + .setmSocketUserType(mSocketUserType) + .setmChatLevel(mChatLevel) + .setmDanMuLevel(mDanMuLevel) + .setLiveBg(liveBg))); + //加入房间发送Im消息 + LiveNetManager.get(mContext).userJoinRoomNew(mLiveBean.getStream(), mLiveBean.getUid()); + } + + @Override + public void onError(String error) { + ToastUtil.show(error); + //直播间上部轮播【新人特惠】【趣味游戏】【幸运天使】 轮播接口 + mLiveRoomViewHolder.showLiveRoomActivityBanner(); + } + }); + } + public void removeLiveEnd() { if (mLiveAudienceViewHolder != null) { mLiveAudienceViewHolder.removeFromParent(); @@ -1098,186 +1307,6 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe }; - private void enterRoom() { - //进入直播间IM - - - timeIndex = 0; - LiveHttpUtil.enterRoom(mLiveBean.getUid(), mLiveBean.getStream(), new HttpCallback() { - @Override - public void onSuccess(int code, String msg, String[] info) { - isEnterRoom = true; - if (code == 0 && info.length > 0) { - JSONObject obj = JSON.parseObject(info[0]); - mDanmuPrice = obj.getString("barrage_fee"); - mSocketUserType = obj.getIntValue("usertype"); - mChatLevel = obj.getIntValue("speak_limit"); - mDanMuLevel = obj.getIntValue("barrage_limit"); - liveBg = obj.getIntValue("live_bg"); - leave = obj.getInteger("isleave"); - if (obj.containsKey("greetings")) { - greetings = JSONArray.parseArray(obj.getJSONArray("greetings").toJSONString(), String.class); - } - if (obj.containsKey("live_bg")) { - if (liveBg == 0) { - - //直播间背景 - ImgLoader.display(mContext, R.mipmap.live_bg, liveBack); - mask.setVisibility(View.GONE); - } - } - //回传参数 - Bus.get().post(new LiveAudienceEvent() - .setType(LiveAudienceEvent.LiveAudienceType.OPEN_PARAMETERS) - .setParametersModel(openParametersModel.setmDanmuPrice(mDanmuPrice) - .setmSocketUserType(mSocketUserType) - .setmChatLevel(mChatLevel) - .setmDanMuLevel(mDanMuLevel) - .setLiveBg(liveBg))); - - //连接socket - LiveHttpUtil.enterBackRoom(mLiveBean.getUid(), mLiveBean.getStream(), new HttpCallback() { - @Override - public void onSuccess(int code, String msg, String[] info) { - //链接上socket以后隐藏Loading加载直播间内容 - } - }); - if (mLiveRoomViewHolder != null) { - LivePlayKsyViewHolder.setLandscape(obj.getIntValue("landscape")); - - mLiveRoomViewHolder.setLiveInfo(mLiveBean.getUid(), mLiveBean.getStream(), obj.getIntValue("userlist_time") * 4000); - mLiveRoomViewHolder.setFastMessage(greetings); - mLiveRoomViewHolder.setVotes(obj.getString("votestotal")); - //真爱排行 数量 - mLiveRoomViewHolder.setMedaRankNum(obj.getString("medalRankNum")); - isattention = obj.getIntValue("isattention"); - if (isattention == 0) { - if (countDownTimer != null) { - countDownTimer.cancel(); - timeIndex = 0; - countDownTimer = null; - setTime(); - } else { - setTime(); - } - } else { - if (countDownTimer != null) { - countDownTimer.cancel(); - countDownTimer = null; - } - } - mLiveAudienceViewHolder.setLiveInfo(mLiveBean.getUid(), mLiveBean.getStream(), mLiveBean.getAvatar(), isattention); - mLiveRoomViewHolder.setAttention(isattention); - if (obj.containsKey("lminfo")) { - JSONObject mic_data = obj.getJSONObject("lminfo"); - if (mic_data.containsKey("userlist")) { - mLiveRoomViewHolder.updataMicList(mic_data.getJSONArray("userlist")); - } - } - List list = JSON.parseArray(obj.getString("userlists"), LiveUserGiftBean.class); - mLiveRoomViewHolder.setUserList(list); - // resetUserListWidth(list); - mLiveRoomViewHolder.startRefreshUserList(); - if (mLiveType == Constants.LIVE_TYPE_TIME) {//计时收费 - mLiveRoomViewHolder.startRequestTimeCharge(); - } - } - if (leave == 1) { - if (LivePlayRyViewHolder.leave != null) { - LivePlayRyViewHolder.leave.setVisibility(View.VISIBLE); - } - } - //判断是否有连麦,要显示连麦窗口 - String linkMicUid = obj.getString("linkmic_uid"); - String linkMicPull = obj.getString("linkmic_pull"); - if (!TextUtils.isEmpty(linkMicUid) && !"0".equals(linkMicUid) && !TextUtils.isEmpty(linkMicPull)) { - if (mLiveSDK != Constants.LIVE_SDK_TX && mLiveLinkMicPresenter != null) { - mLiveLinkMicPresenter.onLinkMicPlay(linkMicUid, linkMicPull); - } - } - //判断是否有主播连麦 - pkInfo = JSON.parseObject(obj.getString("pkinfo")); - if (pkInfo != null && pkInfo.getIntValue("drpk_status") != 1) { - String pkUid = pkInfo.getString("pkuid"); - anyway = "1"; - if (!TextUtils.isEmpty(pkUid) && !"0".equals(pkUid) && anyway.equals("0")) { - if (mLiveSDK != Constants.LIVE_SDK_TX) { - String pkPull = pkInfo.getString("pkpull"); - if (!TextUtils.isEmpty(pkPull) && mLiveLinkMicAnchorPresenter != null) { - mLiveLinkMicAnchorPresenter.onLinkMicAnchorPlayUrl(pkUid, pkPull); - } - } else { - if (mLivePlayViewHolder instanceof LivePlayTxViewHolder) { - ((LivePlayTxViewHolder) mLivePlayViewHolder).setAnchorLinkMic(true, 0); - } - } - } - - if (obj.getString("isconnection") != null && obj.getString("isconnection").equals("1")) { - - LivePlayRyViewHolder.setViewUP(1); - - } - if (pkInfo.getIntValue("ifpk") == 1 && pkInfo.getString("end_pk_time").equals("0")) {//pk开始了 - - LivePlayRyViewHolder.setViewUP(2); - - //pk排名数据 - LivePKUserListBean livePKUserListBean = JSON.parseObject(pkInfo.getString("pk_top_users"), LivePKUserListBean.class); - if (mLiveRoomViewHolder != null) { - mLiveRoomViewHolder.setOtherInfo(pkInfo.getString("pkuid"), pkInfo.getString("pkuimg"), pkInfo.getString("pkuname")); - } - mLiveRyLinkMicPkPresenter.onEnterRoomPkStart(pkUid, pkInfo.getLongValue("pk_gift_liveuid"), pkInfo.getLongValue("pk_gift_pkuid"), pkInfo.getIntValue("pk_time"), livePKUserListBean); - } else if (!pkInfo.getString("end_pk_time").equals("0")) { - - LivePlayRyViewHolder.setViewUP(3); - - //pk排名数据 - LivePKUserListBean livePKUserListBean = JSON.parseObject(pkInfo.getString("pk_top_users"), LivePKUserListBean.class); - mLiveRyLinkMicPkPresenter.onEnterRoomCFStart(pkUid, pkInfo.getLongValue("pk_gift_liveuid"), pkInfo.getLongValue("pk_gift_pkuid"), pkInfo.getIntValue("end_pk_time"), livePKUserListBean); - } - //多人PK - } else if (pkInfo != null && pkInfo.getIntValue("drpk_status") == 1) { - - LivePlayRyViewHolder.setViewUP(4); - - mLiveRoomViewHolder.UpPkBar(pkInfo.getJSONArray("userlist"), mLiveBean.getUid(), pkInfo.getIntValue("drpk_time")); - } - - //守护相关 - mLiveGuardInfo = new LiveGuardInfo(); - int guardNum = obj.getIntValue("guard_nums"); - fansNum = obj.getIntValue("count_fans"); - is_fans = obj.getString("is_fans") + ""; - mLiveGuardInfo.setGuardNum(guardNum); - JSONObject guardObj = obj.getJSONObject("guard"); - if (guardObj != null) { - mLiveGuardInfo.setMyGuardType(guardObj.getIntValue("type")); - mLiveGuardInfo.setMyGuardEndTime(guardObj.getString("endtime")); - } - Bus.get().post(new LiveAudienceEvent() - .setType(LiveAudienceEvent.LiveAudienceType.OPEN_PARAMETERS) - .setParametersModel(openParametersModel.setmLiveGuardInfo(mLiveGuardInfo) - .setFansNum(fansNum) - .setIs_fans(is_fans))); - if (mLiveRoomViewHolder != null) { - mLiveRoomViewHolder.setGuardNum(guardNum); - mLiveRoomViewHolder.setFansNum(fansNum); - //红包相关 - mLiveRoomViewHolder.setRedPackBtnVisible(obj.getIntValue("isred") == 1); - } - //奖池等级 - int giftPrizePoolLevel = obj.getIntValue("jackpot_level"); - if (giftPrizePoolLevel >= 0) { - if (mLiveRoomViewHolder != null) { - mLiveRoomViewHolder.showPrizePoolLevel(String.valueOf(giftPrizePoolLevel)); - } - } - } - } - }); - } - //定时器 public CountDownTimer countDownTimer = null; private int timeIndex = 1; diff --git a/main/src/main/java/com/yunbao/main/activity/MainActivity.java b/main/src/main/java/com/yunbao/main/activity/MainActivity.java index 0def9b415..20d5aecd4 100644 --- a/main/src/main/java/com/yunbao/main/activity/MainActivity.java +++ b/main/src/main/java/com/yunbao/main/activity/MainActivity.java @@ -105,7 +105,6 @@ import com.yunbao.main.http.MainHttpConsts; import com.yunbao.main.http.MainHttpUtil; import com.yunbao.main.interfaces.MainAppBarLayoutListener; import com.yunbao.main.manager.imrongcloud.ConversationIMListManager; -import com.yunbao.main.presenter.CheckLivePresenter; import com.yunbao.main.utils.GenerateTestUserSig; import com.yunbao.main.views.FloatBannerView; import com.yunbao.main.views.MainHomeCommunityViewHolder; @@ -167,10 +166,8 @@ public class MainActivity extends AbsActivity implements MainAppBarLayoutListene private boolean mHided; private ProcessResultUtil mProcessResultUtil; - private CheckLivePresenter mCheckLivePresenter; private boolean mFristLoad; private long mLastClickBackTime;//上次点击back键的时间 - private HttpCallback mGetLiveSdkCallback; private String mUrlCsd; private TextView v_table_redpoint; private View v_table_redpoint_me; @@ -878,9 +875,7 @@ public class MainActivity extends AbsActivity implements MainAppBarLayoutListene MainHttpUtil.cancel(MainHttpConsts.REQUEST_BONUS); MainHttpUtil.cancel(MainHttpConsts.GET_BONUS); MainHttpUtil.cancel(MainHttpConsts.SET_DISTRIBUT); - if (mCheckLivePresenter != null) { - mCheckLivePresenter.cancel(); - } + LocationUtil.getInstance().stopLocation(); if (mProcessResultUtil != null) { mProcessResultUtil.release(); @@ -907,14 +902,12 @@ public class MainActivity extends AbsActivity implements MainAppBarLayoutListene * 观看直播 */ public void watchLive(LiveBean liveBean, String key, int position) { - if (mCheckLivePresenter == null) { - mCheckLivePresenter = new CheckLivePresenter(mContext); - } - if (CommonAppConfig.LIVE_ROOM_SCROLL) { - mCheckLivePresenter.watchLive(liveBean, key, position); - } else { - mCheckLivePresenter.watchLive(liveBean); - } + new LiveRoomCheckLivePresenter(mContext, liveBean.getUid(), liveBean.getStream(), new LiveRoomCheckLivePresenter.NewActionListener() { + @Override + public void onLiveRoomChanged(String liveUid, String stream, int liveType, String liveTypeVal, String liveSdk) { + RouteUtil.forwardLiveAudienceActivity(liveBean, liveType, Integer.parseInt(liveTypeVal), Integer.parseInt(liveSdk)); + } + }); } diff --git a/main/src/main/java/com/yunbao/main/views/AbsMainListChildViewHolder.java b/main/src/main/java/com/yunbao/main/views/AbsMainListChildViewHolder.java index c93587f1b..60a4a2050 100644 --- a/main/src/main/java/com/yunbao/main/views/AbsMainListChildViewHolder.java +++ b/main/src/main/java/com/yunbao/main/views/AbsMainListChildViewHolder.java @@ -144,6 +144,8 @@ public abstract class AbsMainListChildViewHolder extends AbsMainViewHolder imple @Override public void onItemClick(ListBean bean, int position) { if (bean.getIslive() == 1) { + + LiveHttpUtil.getLiveInfo(bean.getUid(), new HttpCallback() { @Override public void onSuccess(int code, String msg, String[] info) {