From d20210f291a641c32db722dd7f58e77c1a680486 Mon Sep 17 00:00:00 2001 From: zlzw <583819556@qq.com> Date: Tue, 15 Nov 2022 09:53:15 +0800 Subject: [PATCH 1/6] =?UTF-8?q?=E5=88=9B=E5=BB=BAPK=E6=8E=92=E4=BD=8D?= =?UTF-8?q?=E8=B5=9B=E5=88=86=E6=94=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/yunbao/common/Constants.java | 1 + .../com/yunbao/common/bean/PkRankBean.java | 39 +++++++++++ .../com/yunbao/common/glide/ImgLoader.java | 2 +- .../com/yunbao/common/http/PDLiveApi.java | 7 ++ .../src/main/res/mipmap-mdpi/icon_pk_rank.png | Bin 0 -> 6266 bytes .../live/dialog/LiveUserDialogFragment.java | 1 - .../yunbao/live/event/LiveAudienceEvent.java | 3 +- .../yunbao/live/socket/SocketRyClient.java | 12 +++- .../yunbao/live/views/LiveRoomViewHolder.java | 64 ++++++++++++++++-- .../res/drawable/bg_live_item_pk_rank.xml | 10 +++ live/src/main/res/layout/view_live_room.xml | 27 ++++++++ 11 files changed, 158 insertions(+), 8 deletions(-) create mode 100644 common/src/main/java/com/yunbao/common/bean/PkRankBean.java create mode 100644 common/src/main/res/mipmap-mdpi/icon_pk_rank.png create mode 100644 live/src/main/res/drawable/bg_live_item_pk_rank.xml diff --git a/common/src/main/java/com/yunbao/common/Constants.java b/common/src/main/java/com/yunbao/common/Constants.java index 6625e23cc..aa5c3c898 100644 --- a/common/src/main/java/com/yunbao/common/Constants.java +++ b/common/src/main/java/com/yunbao/common/Constants.java @@ -169,6 +169,7 @@ public class Constants { public static final String AI_AUTOMATIC_SPEECH = "aiAutomaticSpeech";//机器人助手 public static final String STAR_CHALLENGE_UPGRADE_NOTIFY = "starChallengeUpgradeNotify";//星级挑战成功 public static final String SUPER_VISION = "supervision";//超级发言警告 + public static final String PK_RANK_UPDATE = "RankingRankUpdate";//PK排位赛更新数据 //游戏socket public static final String SOCKET_GAME_ZJH = "startGame";//炸金花 diff --git a/common/src/main/java/com/yunbao/common/bean/PkRankBean.java b/common/src/main/java/com/yunbao/common/bean/PkRankBean.java new file mode 100644 index 000000000..67af66531 --- /dev/null +++ b/common/src/main/java/com/yunbao/common/bean/PkRankBean.java @@ -0,0 +1,39 @@ +package com.yunbao.common.bean; + +import com.google.gson.annotations.SerializedName; + +/** + * 直播间PK排位赛 + */ +public class PkRankBean extends BaseModel{ + @SerializedName("anchor_id") + public int id; + @SerializedName("rank_name") + public String name; + @SerializedName("rank_img") + public String img; + + public int getId() { + return id; + } + + public void setId(int id) { + this.id = id; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getImg() { + return img; + } + + public void setImg(String img) { + this.img = img; + } +} diff --git a/common/src/main/java/com/yunbao/common/glide/ImgLoader.java b/common/src/main/java/com/yunbao/common/glide/ImgLoader.java index d936265d7..15ef5591a 100644 --- a/common/src/main/java/com/yunbao/common/glide/ImgLoader.java +++ b/common/src/main/java/com/yunbao/common/glide/ImgLoader.java @@ -29,7 +29,7 @@ public class ImgLoader { private static final boolean SKIP_MEMORY_CACHE = true; private static BlurTransformation sBlurTransformation; - private final static float thumbnail = 0.1f; + private final static float thumbnail = 1.0f; static { sBlurTransformation = new BlurTransformation(25); 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 0b42fddcd..f1d73bb6b 100644 --- a/common/src/main/java/com/yunbao/common/http/PDLiveApi.java +++ b/common/src/main/java/com/yunbao/common/http/PDLiveApi.java @@ -14,6 +14,7 @@ import com.yunbao.common.bean.MsgSwitchDetailModel; import com.yunbao.common.bean.NewPeopleInfo; import com.yunbao.common.bean.NobleRankHideUserListModel; import com.yunbao.common.bean.NobleTrumpetModel; +import com.yunbao.common.bean.PkRankBean; import com.yunbao.common.bean.SearchModel; import com.yunbao.common.bean.SetAttentsModel; import com.yunbao.common.bean.SlideInBannerModel; @@ -262,4 +263,10 @@ public interface PDLiveApi { */ @GET("/api/public/?service=Task.sendTaskGift") Observable> sendTaskGift(@Query("flag") String flag, @Query("type") String type); + + /** + * PK排位赛接口 + */ + @GET("/api/public/?service=Ranking.getAnchorRankData") + Observable> getPkRanksList(@Query("anchor_id") String anchorId); } diff --git a/common/src/main/res/mipmap-mdpi/icon_pk_rank.png b/common/src/main/res/mipmap-mdpi/icon_pk_rank.png new file mode 100644 index 0000000000000000000000000000000000000000..afb95207b869af4046410a3638d81c65df266e31 GIT binary patch literal 6266 zcmX|FbyO8ju%?lalvI%r6-6YarAtDkxinn5yE`w9fLvO-n|qN4flGHIppw$vv5((7 z=e=`wXZD+&Z)WzK*?$K1SxM$0J}o{P8rnlSSxM!4eSE)#9$?IC ztvZ(A#t{1+qdO_fh@({uKiNb>!$kY6peiL}uTY@{Tt9kh|JMBh`oHqtUiN4@(dQ1xMGn*0x~jH>fcHRS>YZ z2THWT@y%Vn4!Af6u0bHg6qworge5R_0ktN;&IcUr0B1L_e|1;maeHtG>KefMA}E0X z?=WzD0;Xnwmm_Fy2X!vDNc+3lgIiBukPQWk$JhV10L%u=9$clGfvs&YFanSnU~CfP z`(C29FSCk3na}m#hQNSfHIumZp4K|u}(_1uf{0)v$LGJ8H@bK>1I#}GluyX?0uArzCg!gZ2q%URL zfw2xSv~jk#4!rs{6HGv;6G(Cc8V+-#Lty{n2Gs_>27_E3@WpqiW9n!E32I9~csLLZ z{R1!B4oKQA4!@r71NMmZZ_yyW`+!AtA+LF-838i-k276&<|crX^Pf-AOI+5AJ(U0v z1v~?GBkdO?3>Qpu|3!rFzSl&i1)n(OZ`g!vRNG&cxn6f>1OMDL^MvK9p~LvvjbgVG zEyFGcs|gdEH6i(AY1M|#2H(TvD_E0^YRbRMBuT{ca?|G&>n5cNs6hOFO|W)KC76~qQpLbS!E0q z&@*-IU&h`yr;zM;g;mUmPe8f$Rkrpa{d4mUQGBs*{1;&ljpA4%$gorm9zB_)X9|s= zEmEaAz?m#JFNT;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LnvxLr;e@S3!g;0vVD1%pnA$r9h{cr@Ebe~*yRbrE~a7ao7gR}67R%)nehWZw- zoS3Y}z-`ii>N@_H3v&oyH`$EY6XK9$C64({1of7ho0q+@|=~)laVsE z4Z!@l5ik1h%!opceq%Ab!PdIF6UMEUugOWh9EuCEtxb9v&t^UpSYgK?guIWut2gNO z6wR*K|J+LPH`2={{B6y6{gGmg&avQ()PvSSXJ#Nh#--fndi8R0WxBS#e4BmwwxNk$ z_JyN*%7kCW00!;Mk8d8g*c}xW-?T?E7X@M`sCfz(^hwH+`CEdkmKx%}(ICq9?FKYC z-XplD1HvAsrRr^Acl>(yE}o%+cf9Pl9?wr!n*-w?98dU#qr2DvS*K_1FD#wDC3mM^ z)pZ1cK?X^?4g&u$C$T-)9hH8xDfy zKzcKSW7nP8R-aN{6TY99zdCGif0I+vwf({F5PY0ip%cb);a2;r1EBqFj_Low|Izn; PMv5jUr6gG)ZV>oC= 1) { JSONObject display = (JSONObject) dress.getJSONArray("wraps").get(0); - shawl.setTag("test"); ImgLoader.display(mContext, display.getString("display_src"), shawl); } if (dress.getJSONArray("avatar_frame").size() == 1) { diff --git a/live/src/main/java/com/yunbao/live/event/LiveAudienceEvent.java b/live/src/main/java/com/yunbao/live/event/LiveAudienceEvent.java index 7177d2ddd..88cd47779 100644 --- a/live/src/main/java/com/yunbao/live/event/LiveAudienceEvent.java +++ b/live/src/main/java/com/yunbao/live/event/LiveAudienceEvent.java @@ -174,7 +174,8 @@ public class LiveAudienceEvent extends BaseModel { LUCKY_ANGEL(31, "幸运天使"), WE_CHEAT(32, "整蛊"), WISH_LIST_UPDATE(33, "心愿单更新推送"), - UN_LEAVELIVE(34, "取消暂时离开") + UN_LEAVELIVE(34, "取消暂时离开"), + PK_RANK_UPDATE(35, "PK排位赛更新") ; private int type; 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 35ba07be9..b02dc58d8 100644 --- a/live/src/main/java/com/yunbao/live/socket/SocketRyClient.java +++ b/live/src/main/java/com/yunbao/live/socket/SocketRyClient.java @@ -24,6 +24,7 @@ import com.yunbao.common.Constants; import com.yunbao.common.bean.AiAutomaticSpeechModel; import com.yunbao.common.bean.FansMedalBean; import com.yunbao.common.bean.MsgModel; +import com.yunbao.common.bean.PkRankBean; import com.yunbao.common.bean.SocketModel; import com.yunbao.common.bean.UserBean; import com.yunbao.common.http.HttpCallback; @@ -515,6 +516,15 @@ public class SocketRyClient { .setType(LiveAudienceEvent.LiveAudienceType.LUCKY_ANGEL) .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(); + pkRankBean.setId(Integer.parseInt(item.getString("new_rank_id"))); + pkRankBean.setName(item.getString("new_rank_name")); + pkRankBean.setImg(item.getString("new_rank_img")); + EventBus.getDefault().post(pkRankBean); + break; } } @@ -980,7 +990,7 @@ public class SocketRyClient { */ private static void processAnchorLinkMicPk(JSONObject map) { int action = map.getIntValue("action"); - Log.i("Socket", "action = "+action+" json = "+map.toString()); + Log.i("Socket", "action = " + action + " json = " + map.toString()); switch (action) { case 1://收到对方主播PK回调 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 320707f6a..59693cb4f 100644 --- a/live/src/main/java/com/yunbao/live/views/LiveRoomViewHolder.java +++ b/live/src/main/java/com/yunbao/live/views/LiveRoomViewHolder.java @@ -70,6 +70,7 @@ import com.yunbao.common.bean.LiveBean; import com.yunbao.common.bean.LiveGiftBean; import com.yunbao.common.bean.LiveRoomActivityBanner; import com.yunbao.common.bean.MsgModel; +import com.yunbao.common.bean.PkRankBean; import com.yunbao.common.bean.StarChallengeStatusModel; import com.yunbao.common.bean.UserBean; import com.yunbao.common.glide.ImgLoader; @@ -307,6 +308,10 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis private FullServiceNotificationView fullScreen;//全副喇叭 private NobleNoticeView noble;//全副喇叭 private FaceManager manager; + private LinearLayout pkRankLayout; + private ViewFlipper pkRankVf; + private ImageView mPkRankIcon; + private TextView mPkRankText; public LiveRoomViewHolder(boolean isRys, int forActivity, Context context, ViewGroup parentView, GifImageView gifImageView, SVGAImageView svgaImageView, ViewGroup liveGiftPrizePoolContainer, WindowManager windowManager) { super(context, parentView); @@ -769,6 +774,8 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis wishListLayout = (LinearLayout) findViewById(R.id.wish_list_layout); mAnchorLayout = (LinearLayout) findViewById(R.id.group_1); mGoodNumberIcon = (ImageView) findViewById(R.id.good_nub_ico); + pkRankLayout = (LinearLayout) findViewById(R.id.live_rank_pk); + pkRankVf = (ViewFlipper) findViewById(R.id.rank_pk_vf); if (LivePushTxViewHolder.mTRTCCloud != null || LivePushRyViewHolder.rtcRoom != null) { fans_btn.setVisibility(View.GONE); @@ -1056,16 +1063,19 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis }); } - public void clearChat(){ - if(mLiveChatAdapter!=null){ + + public void clearChat() { + if (mLiveChatAdapter != null) { mLiveChatAdapter.clear(); } } - public void clearGuardIcon(){ - if(userGuard!=null){ + + public void clearGuardIcon() { + if (userGuard != null) { userGuard.setImageResource(R.mipmap.img_guardian_empty); } } + public synchronized void showStart(StarChallengeStatusModel data) { boolean upData = false; if (mBannerList2 != null && mBannerList2.size() == 0) { @@ -1491,6 +1501,40 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis } }, Throwable::printStackTrace) .isDisposed(); + initPkRank(); + } + + private void initPkRank() { + API.get().pdLiveApi(mContext) + .getPkRanksList(mLiveUid) + .observeOn(AndroidSchedulers.mainThread()) + .subscribeOn(Schedulers.io()) + .subscribe(listResponseModel -> { + PkRankBean bean = listResponseModel.getData().getInfo(); + + if (bean != null) { + 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 hourView = LayoutInflater.from(mContext).inflate(R.layout.view_wish_list, null); + ImageView titleIcon = new ImageView(mContext); + mPkRankIcon = hourView.findViewById(R.id.wish_pic); + mPkRankText = hourView.findViewById(R.id.wish_index); + mPkRankText.setText(bean.getName()); + mPkRankText.setLayoutParams(textParams); + mPkRankText.setGravity(Gravity.CENTER); + titleIcon.setImageResource(R.mipmap.icon_pk_rank); + ImgLoader.display(mContext, bean.getImg(), mPkRankIcon); + titleIcon.setLayoutParams(params); + mPkRankIcon.setLayoutParams(params); + pkRankVf.addView(titleIcon); + pkRankVf.addView(hourView); + pkRankVf.startFlipping(); + } + }, Throwable::printStackTrace) + .isDisposed(); + } /** @@ -1523,6 +1567,11 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis } } + private void updatePkRank(PkRankBean bean) { + mPkRankText.setText(bean.getName()); + ImgLoader.display(mContext, bean.getImg(), mPkRankIcon); + } + /** * 设置热度值 * @@ -3472,4 +3521,11 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis mLiveChatAdapter.insertItem(bean); } } + + @Subscribe(threadMode = ThreadMode.MAIN) + public void imUpdatePkRank(PkRankBean bean) { + if (bean != null) { + updatePkRank(bean); + } + } } diff --git a/live/src/main/res/drawable/bg_live_item_pk_rank.xml b/live/src/main/res/drawable/bg_live_item_pk_rank.xml new file mode 100644 index 000000000..220b6230d --- /dev/null +++ b/live/src/main/res/drawable/bg_live_item_pk_rank.xml @@ -0,0 +1,10 @@ + + + + + + + + + + \ No newline at end of file diff --git a/live/src/main/res/layout/view_live_room.xml b/live/src/main/res/layout/view_live_room.xml index b6fe3828a..993205bcd 100644 --- a/live/src/main/res/layout/view_live_room.xml +++ b/live/src/main/res/layout/view_live_room.xml @@ -488,6 +488,7 @@ + + + + + + + + + Date: Tue, 15 Nov 2022 11:35:03 +0800 Subject: [PATCH 2/6] =?UTF-8?q?=E6=96=B0=E5=A2=9EPK=20TOP?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/res/mipmap-mdpi/icon_rank_top_box.png | Bin 0 -> 13121 bytes .../yunbao/live/views/LiveRoomViewHolder.java | 7 ++++--- live/src/main/res/layout/view_live_room.xml | 13 +++++++++---- 3 files changed, 13 insertions(+), 7 deletions(-) create mode 100644 common/src/main/res/mipmap-mdpi/icon_rank_top_box.png diff --git a/common/src/main/res/mipmap-mdpi/icon_rank_top_box.png b/common/src/main/res/mipmap-mdpi/icon_rank_top_box.png new file mode 100644 index 0000000000000000000000000000000000000000..25e96cfa4d002ed61be4c2517e1aba1ea95defff GIT binary patch literal 13121 zcmV-HGrr7;P)Px&08mU+MMrQZP$^2u6e zilg&bgXwg${POeqe3|aKkK}Wf?fPKC>}}74p736a>1ci7PKWAVbLmBo?}MrJ#!0#2 zZp&`1`qw_OexmXJx#9gmaqDWx_*=MLmhp0V-rq@%X_D;YX~cT0_~2l(;$^#Ni|S~6 z?7`doXPoj@XXf-}#^F+&a-;Kna@qVdU{jIrb&BoW<@Zl?=>9&0;5exLQ-t4IsZ3nu z=j!;0?Q{7`n?L4NQ}o4MBeiEGsAWWUSi{q0AN`zch?+VzrV&;2lXt60VD zTeE1S_J)k)nqtlMRH~-O_{_)g{?hi=^8V@a`~GQ~>Q$!b)$+Z^^8Sv%{+-aXRKl;$ z`m($7pT6||eXEzV@$zB5_oub~N|*fM^t^o4ppojPu(L}8%aTac0* zRy0r3&Ady4@eLr5X6yQUQshOr?Tc%( zHg_#G*y=-E{Nv4zAwKMDgw0)@%>z?f|vz>1+H#x>q0}}!Pql^{SW6TL@*3W3NP{C{g-;M zdUhVj5%@|T00K%uL4flhK=42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z%fxbLDas@c`aGH>+9VFjb(zo`W0B$j86Yk#1p{kf=<@@EpOc+|E`S{kFbq$?jtvk} zPY-v25fHOOtsJ%y03lGrpB*MK_*^?&;{iE4Kt0JmhytA*7WBh8{Mk{{7dxyJ7zLwX b6i^HRc8pa@kemw)00000NkvXXu0mjfb{EZ! literal 0 HcmV?d00001 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 59693cb4f..f9428c15f 100644 --- a/live/src/main/java/com/yunbao/live/views/LiveRoomViewHolder.java +++ b/live/src/main/java/com/yunbao/live/views/LiveRoomViewHolder.java @@ -1513,9 +1513,10 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis PkRankBean bean = listResponseModel.getData().getInfo(); if (bean != null) { - LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(DpUtil.dp2px(44), DpUtil.dp2px(16)); + LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(DpUtil.dp2px(20), DpUtil.dp2px(22)); LinearLayout.LayoutParams textParams = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT); - textParams.leftMargin = DpUtil.dp2px(5); + params.leftMargin=DpUtil.dp2px(2); + textParams.setMarginStart(DpUtil.dp2px(1)); View hourView = LayoutInflater.from(mContext).inflate(R.layout.view_wish_list, null); ImageView titleIcon = new ImageView(mContext); @@ -1526,7 +1527,7 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis mPkRankText.setGravity(Gravity.CENTER); titleIcon.setImageResource(R.mipmap.icon_pk_rank); ImgLoader.display(mContext, bean.getImg(), mPkRankIcon); - titleIcon.setLayoutParams(params); + titleIcon.setLayoutParams(new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT)); mPkRankIcon.setLayoutParams(params); pkRankVf.addView(titleIcon); pkRankVf.addView(hourView); diff --git a/live/src/main/res/layout/view_live_room.xml b/live/src/main/res/layout/view_live_room.xml index 993205bcd..760fb8a0a 100644 --- a/live/src/main/res/layout/view_live_room.xml +++ b/live/src/main/res/layout/view_live_room.xml @@ -518,7 +518,7 @@ @@ -1244,7 +1242,14 @@ - + Date: Wed, 16 Nov 2022 11:27:44 +0800 Subject: [PATCH 3/6] =?UTF-8?q?=E6=96=B0=E5=A2=9EPK=20TOP?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/shayu/phonelive/AppContext.java | 2 +- .../com/yunbao/common/bean/PkRankBean.java | 51 ++++++++++++++++- .../com/yunbao/common/http/PDLiveApi.java | 2 +- .../yunbao/live/activity/LiveActivity.java | 4 +- .../yunbao/live/event/LiveAudienceEvent.java | 15 ++++- .../presenter/LiveRyLinkMicPkPresenter.java | 3 + .../yunbao/live/socket/SocketRyClient.java | 4 +- .../live/views/LiveLinkMicPkViewHolder.java | 11 ++-- .../yunbao/live/views/LiveRoomViewHolder.java | 56 ++++++++++++++----- .../drawable/bg_live_item_pk_rank_blue.xml | 9 +++ .../res/drawable/bg_live_item_pk_rank_red.xml | 9 +++ live/src/main/res/layout/view_live_room.xml | 56 +++++++++++++++---- 12 files changed, 188 insertions(+), 34 deletions(-) create mode 100644 live/src/main/res/drawable/bg_live_item_pk_rank_blue.xml create mode 100644 live/src/main/res/drawable/bg_live_item_pk_rank_red.xml diff --git a/app/src/main/java/com/shayu/phonelive/AppContext.java b/app/src/main/java/com/shayu/phonelive/AppContext.java index e1ddc7225..4818972de 100644 --- a/app/src/main/java/com/shayu/phonelive/AppContext.java +++ b/app/src/main/java/com/shayu/phonelive/AppContext.java @@ -138,7 +138,7 @@ public class AppContext extends CommonAppContext { CrashSaveBean.getInstance().setStartTime(System.currentTimeMillis()); registerError(); registerFirebaseCrash(); - // LogUtils.start(this); + LogUtils.start(this); sInstance = this; L.setDeBug(BuildConfig.DEBUG); AppEventsLogger.activateApp(this); diff --git a/common/src/main/java/com/yunbao/common/bean/PkRankBean.java b/common/src/main/java/com/yunbao/common/bean/PkRankBean.java index 67af66531..16a3e90e8 100644 --- a/common/src/main/java/com/yunbao/common/bean/PkRankBean.java +++ b/common/src/main/java/com/yunbao/common/bean/PkRankBean.java @@ -1,17 +1,24 @@ package com.yunbao.common.bean; import com.google.gson.annotations.SerializedName; +import com.yunbao.common.utils.StringUtil; /** * 直播间PK排位赛 */ -public class PkRankBean extends BaseModel{ +public class PkRankBean extends BaseModel { @SerializedName("anchor_id") public int id; @SerializedName("rank_name") public String name; @SerializedName("rank_img") public String img; + @SerializedName("win_continuity1") + public String redVal; + @SerializedName("win_continuity2") + public String blueVal; + @SerializedName("pktt_img") + public String pkTopImgUrl; public int getId() { return id; @@ -36,4 +43,46 @@ public class PkRankBean extends BaseModel{ public void setImg(String img) { this.img = img; } + + public String getRedVal() { + if (StringUtil.isEmpty(redVal)) { + redVal = "0"; + } + return redVal; + } + + public void setRedVal(String redVal) { + this.redVal = redVal; + } + + public String getBlueVal() { + if (StringUtil.isEmpty(blueVal)) { + blueVal = "0"; + } + return blueVal; + } + + public void setBlueVal(String blueVal) { + this.blueVal = blueVal; + } + + public String getPkTopImgUrl() { + return pkTopImgUrl; + } + + public void setPkTopImgUrl(String pkTopImgUrl) { + this.pkTopImgUrl = pkTopImgUrl; + } + + @Override + public String toString() { + return "PkRankBean{" + + "id=" + id + + ", name='" + name + '\'' + + ", img='" + img + '\'' + + ", redVal='" + redVal + '\'' + + ", blueVal='" + blueVal + '\'' + + ", pkTopImgUrl='" + pkTopImgUrl + '\'' + + '}'; + } } 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 96bec2d61..8ebe3d505 100644 --- a/common/src/main/java/com/yunbao/common/http/PDLiveApi.java +++ b/common/src/main/java/com/yunbao/common/http/PDLiveApi.java @@ -268,5 +268,5 @@ public interface PDLiveApi { * PK排位赛接口 */ @GET("/api/public/?service=Ranking.getAnchorRankData") - Observable> getPkRanksList(@Query("anchor_id") String anchorId); + Observable> getPkRanksList(@Query("anchor_id") String anchorId,@Query("anchor_id2")String pkUid); } 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 a8fd702d6..e98110c2d 100644 --- a/live/src/main/java/com/yunbao/live/activity/LiveActivity.java +++ b/live/src/main/java/com/yunbao/live/activity/LiveActivity.java @@ -120,8 +120,8 @@ public abstract class LiveActivity extends AbsActivity implements SocketMessageL protected LiveLinkMicAnchorPresenter mLiveLinkMicAnchorPresenter;//主播与主播连麦逻辑 protected LiveLinkMicPkPresenter mLiveLinkMicPkPresenter;//主播与主播PK逻辑 public static LiveRyLinkMicPkPresenter mLiveRyLinkMicPkPresenter;//主播与主播PK逻辑 - public static SocketClient mSocketClient; - public static SocketRyClient mSocketRyClient; + public SocketClient mSocketClient; + public SocketRyClient mSocketRyClient; protected LiveBean mLiveBean; protected int mLiveSDK;//sdk类型 0金山 1腾讯 diff --git a/live/src/main/java/com/yunbao/live/event/LiveAudienceEvent.java b/live/src/main/java/com/yunbao/live/event/LiveAudienceEvent.java index 88cd47779..183e6bf26 100644 --- a/live/src/main/java/com/yunbao/live/event/LiveAudienceEvent.java +++ b/live/src/main/java/com/yunbao/live/event/LiveAudienceEvent.java @@ -16,6 +16,7 @@ public class LiveAudienceEvent extends BaseModel { private AnchorRecommendItemModel anchorRecommendItemModel = new AnchorRecommendItemModel(); private int micIng = 0;//连麦状态 private LiveBean bean; + private Object object; private int liveType; private int liveTypeVal; private MsgModel msgModel;//全服消息 @@ -140,6 +141,15 @@ public class LiveAudienceEvent extends BaseModel { return this; } + public Object getObject() { + return object; + } + + public LiveAudienceEvent setObject(Object object) { + this.object = object; + return this; + } + public enum LiveAudienceType { SIDEBAR(1, "侧边栏"), BOTTOM_COLLECTION(2, "底部合集"), @@ -175,7 +185,10 @@ public class LiveAudienceEvent extends BaseModel { WE_CHEAT(32, "整蛊"), WISH_LIST_UPDATE(33, "心愿单更新推送"), UN_LEAVELIVE(34, "取消暂时离开"), - PK_RANK_UPDATE(35, "PK排位赛更新") + PK_RANK_UPDATE(35, "PK排位赛更新"), + PK_TWO_START(36, "双人PK开始"), + PK_TWO_UPDATE_HEAD_DATA(37, "更新PK头像信息"), + PK_TWO_END(38, "双人PK开始"), ; private int type; diff --git a/live/src/main/java/com/yunbao/live/presenter/LiveRyLinkMicPkPresenter.java b/live/src/main/java/com/yunbao/live/presenter/LiveRyLinkMicPkPresenter.java index a33315537..5bef0d5ee 100644 --- a/live/src/main/java/com/yunbao/live/presenter/LiveRyLinkMicPkPresenter.java +++ b/live/src/main/java/com/yunbao/live/presenter/LiveRyLinkMicPkPresenter.java @@ -82,6 +82,8 @@ import static com.yunbao.live.views.LivePushRyViewHolder.dr_pk_view; import static com.yunbao.live.views.LivePushRyViewHolder.rcrtcLiveInfo; import static com.yunbao.live.views.LivePushRyViewHolder.rtcRoom; +import org.greenrobot.eventbus.EventBus; + //import cn.rongcloud.rtc.jni.video.RCRect; /** @@ -1839,6 +1841,7 @@ public class LiveRyLinkMicPkPresenter implements View.OnClickListener { } mLiveLinkMicPkViewHolder.startAnim(); + EventBus.getDefault().post(new LiveAudienceEvent().setType(LiveAudienceEvent.LiveAudienceType.PK_TWO_START).setObject(pkUid)); mLiveLinkMicPkViewHolder.showTime(); nextPkTimeCountDown(); if (mIsAnchor) { 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 b02dc58d8..3e6643e18 100644 --- a/live/src/main/java/com/yunbao/live/socket/SocketRyClient.java +++ b/live/src/main/java/com/yunbao/live/socket/SocketRyClient.java @@ -523,7 +523,9 @@ public class SocketRyClient { pkRankBean.setId(Integer.parseInt(item.getString("new_rank_id"))); pkRankBean.setName(item.getString("new_rank_name")); pkRankBean.setImg(item.getString("new_rank_img")); - EventBus.getDefault().post(pkRankBean); + EventBus.getDefault().post(new LiveAudienceEvent() + .setType(LiveAudienceEvent.LiveAudienceType.PK_RANK_UPDATE) + .setObject(pkRankBean)); break; } } diff --git a/live/src/main/java/com/yunbao/live/views/LiveLinkMicPkViewHolder.java b/live/src/main/java/com/yunbao/live/views/LiveLinkMicPkViewHolder.java index 98b20a3a5..c1b6fd9c6 100644 --- a/live/src/main/java/com/yunbao/live/views/LiveLinkMicPkViewHolder.java +++ b/live/src/main/java/com/yunbao/live/views/LiveLinkMicPkViewHolder.java @@ -20,6 +20,7 @@ import android.widget.RelativeLayout; import android.widget.TextView; import com.yunbao.common.CommonAppConfig; +import com.yunbao.common.utils.Bus; import com.yunbao.common.utils.DpUtil; import com.yunbao.common.utils.ScreenDimenUtil; import com.yunbao.common.utils.WordUtil; @@ -29,8 +30,11 @@ import com.yunbao.live.bean.LivePKUserListBean; import com.yunbao.live.custom.FrameImageView; import com.yunbao.live.custom.PkProgressBar; import com.yunbao.live.custom.ProgressTextView; +import com.yunbao.live.event.LiveAudienceEvent; import com.yunbao.live.utils.LiveIconUtil; +import org.greenrobot.eventbus.EventBus; + import cn.qqtheme.framework.util.ScreenUtils; /** @@ -177,7 +181,6 @@ public class LiveLinkMicPkViewHolder extends AbsViewHolder { animationDrawable = (AnimationDrawable) frame_img_pk.getBackground(); animationDrawable.start(); } - LiveRoomViewHolder.UpPkTwo(); } public void showTime() { @@ -239,7 +242,7 @@ public class LiveLinkMicPkViewHolder extends AbsViewHolder { animationDrawable.start(); } - LiveRoomViewHolder.setHeadData(bean); + EventBus.getDefault().post(new LiveAudienceEvent().setType(LiveAudienceEvent.LiveAudienceType.PK_TWO_UPDATE_HEAD_DATA).setObject(bean)); } private void changeLine(float nowIndex, long leftGift, long rightGift) { @@ -496,8 +499,8 @@ public class LiveLinkMicPkViewHolder extends AbsViewHolder { if (animationDrawable != null) { animationDrawable.stop(); } - - LiveRoomViewHolder.closePkTwo(); + + EventBus.getDefault().post(new LiveAudienceEvent().setType(LiveAudienceEvent.LiveAudienceType.PK_TWO_END)); } public void setIsAnchor(boolean flag) { 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 f9428c15f..d06188889 100644 --- a/live/src/main/java/com/yunbao/live/views/LiveRoomViewHolder.java +++ b/live/src/main/java/com/yunbao/live/views/LiveRoomViewHolder.java @@ -91,6 +91,7 @@ import com.yunbao.common.utils.SVGAViewUtils; import com.yunbao.common.utils.ScreenDimenUtil; import com.yunbao.common.utils.SpUtil; import com.yunbao.common.utils.StringUtil; +import com.yunbao.common.utils.ToastUtil; import com.yunbao.common.utils.WordUtil; import com.yunbao.common.utils.formatBigNum; import com.yunbao.common.views.AbsViewHolder; @@ -275,8 +276,8 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis public static ImageView img_pk_fist_l, img_pk_fist_r; public static RoundedImageView avatar_l1, avatar_l2, avatar_l3, avatar_r1, avatar_r2, avatar_r3; public static LivePKUserListBean livePKUserListBean; - public static String uidL1, uidL2, uidL3, uidR1, uidR2, uidR3; - public static RelativeLayout lt_pk_line; + public String uidL1, uidL2, uidL3, uidR1, uidR2, uidR3; + public RelativeLayout lt_pk_line; public WindowManager windowManager; // public boolean isRy = false; @@ -312,6 +313,9 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis private ViewFlipper pkRankVf; private ImageView mPkRankIcon; private TextView mPkRankText; + private ImageView mPkRankTopIcon; + private TextView mRedVal, mBlueVal; + private String pkUid = ""; public LiveRoomViewHolder(boolean isRys, int forActivity, Context context, ViewGroup parentView, GifImageView gifImageView, SVGAImageView svgaImageView, ViewGroup liveGiftPrizePoolContainer, WindowManager windowManager) { super(context, parentView); @@ -776,6 +780,9 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis mGoodNumberIcon = (ImageView) findViewById(R.id.good_nub_ico); pkRankLayout = (LinearLayout) findViewById(R.id.live_rank_pk); pkRankVf = (ViewFlipper) findViewById(R.id.rank_pk_vf); + mPkRankTopIcon = (ImageView) findViewById(R.id.icon_pk_top); + mRedVal = (TextView) findViewById(R.id.pk_rank_red_val); + mBlueVal = (TextView) findViewById(R.id.pk_rank_blue_val); if (LivePushTxViewHolder.mTRTCCloud != null || LivePushRyViewHolder.rtcRoom != null) { fans_btn.setVisibility(View.GONE); @@ -791,9 +798,8 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis }); findViewById(R.id.hot_btn).setOnClickListener(this); try { - Glide.with(mContext).asGif().load(R.drawable.fans_medal).into(mViewMedal); + ImgLoader.displayGif(mContext, R.drawable.fans_medal, mViewMedal); } catch (Exception e) { - System.err.println("发生异常行为"); e.printStackTrace(); } @@ -1041,6 +1047,7 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis if (mContext instanceof LiveRyAnchorActivity) { findViewById(R.id.open_sidebar).setVisibility(View.GONE); findViewById(R.id.btn_follow).setVisibility(View.GONE); + findViewById(R.id.live_rank_pk).setVisibility(View.GONE); } else { configBanner3(); } @@ -1506,16 +1513,17 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis private void initPkRank() { API.get().pdLiveApi(mContext) - .getPkRanksList(mLiveUid) + .getPkRanksList(mLiveUid, pkUid) .observeOn(AndroidSchedulers.mainThread()) .subscribeOn(Schedulers.io()) .subscribe(listResponseModel -> { PkRankBean bean = listResponseModel.getData().getInfo(); - + ToastUtil.show("触发PK排位赛"); + Log.i("PK", bean.toString()); if (bean != null) { LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(DpUtil.dp2px(20), DpUtil.dp2px(22)); LinearLayout.LayoutParams textParams = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT); - params.leftMargin=DpUtil.dp2px(2); + params.leftMargin = DpUtil.dp2px(2); textParams.setMarginStart(DpUtil.dp2px(1)); View hourView = LayoutInflater.from(mContext).inflate(R.layout.view_wish_list, null); @@ -1532,6 +1540,10 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis pkRankVf.addView(titleIcon); pkRankVf.addView(hourView); pkRankVf.startFlipping(); + + mRedVal.setText(bean.getRedVal()+"連勝"); + mBlueVal.setText(bean.getBlueVal()+"連勝"); + //ImgLoader.display(mContext,bean.getPkTopImgUrl(),mPkRankTopIcon); } }, Throwable::printStackTrace) .isDisposed(); @@ -1686,7 +1698,7 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis } //头像显示 - public static void setHeadData(LivePKUserListBean bean) { + public void setHeadData(LivePKUserListBean bean) { livePKUserListBean = bean; String mLiveuid = LiveRoomViewHolder.mLiveUid; if (livePKUserListBean != null) { @@ -1739,7 +1751,7 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis } //双人pk显示 - public static void UpPkTwo() { + public void UpPkTwo() { ScreenDimenUtil util = ScreenDimenUtil.getInstance(); int mScreenWdith = util.getScreenWdith(); RelativeLayout.LayoutParams params = (RelativeLayout.LayoutParams) lt_pk_line.getLayoutParams(); @@ -1747,6 +1759,7 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis lt_pk_line.requestLayout(); lt_pk_line.setVisibility(View.VISIBLE); + mPkRankTopIcon.setVisibility(View.VISIBLE); img_pk_fist_l.setBackgroundResource(R.mipmap.icon_red_no1); img_pk_fist_r.setBackgroundResource(R.mipmap.icon_blue_no1); ImgLoader.display2((LiveActivity) Contexts, "", avatar_l1); @@ -1762,12 +1775,16 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis uidR2 = ""; uidR1 = ""; uidR3 = ""; + + initPkRank(); } //双人pk关闭 - public static void closePkTwo() { + public void closePkTwo() { + mPkRankTopIcon.setVisibility(View.GONE); lt_pk_line.setVisibility(View.GONE); livePKUserListBean = new LivePKUserListBean(); + pkUid=""; } /** @@ -3524,9 +3541,22 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis } @Subscribe(threadMode = ThreadMode.MAIN) - public void imUpdatePkRank(PkRankBean bean) { - if (bean != null) { - updatePkRank(bean); + public void updateSub(LiveAudienceEvent event) { + switch (event.getType()) { + case PK_RANK_UPDATE: + updatePkRank((PkRankBean) event.getObject()); + break; + case PK_TWO_UPDATE_HEAD_DATA: + setHeadData((LivePKUserListBean) event.getObject()); + break; + case PK_TWO_START: + pkUid = event.getObject().toString(); + UpPkTwo(); + break; + case PK_TWO_END: + closePkTwo(); + break; } + } } diff --git a/live/src/main/res/drawable/bg_live_item_pk_rank_blue.xml b/live/src/main/res/drawable/bg_live_item_pk_rank_blue.xml new file mode 100644 index 000000000..87dbd29ee --- /dev/null +++ b/live/src/main/res/drawable/bg_live_item_pk_rank_blue.xml @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/live/src/main/res/drawable/bg_live_item_pk_rank_red.xml b/live/src/main/res/drawable/bg_live_item_pk_rank_red.xml new file mode 100644 index 000000000..20019514e --- /dev/null +++ b/live/src/main/res/drawable/bg_live_item_pk_rank_red.xml @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/live/src/main/res/layout/view_live_room.xml b/live/src/main/res/layout/view_live_room.xml index 760fb8a0a..49a08a858 100644 --- a/live/src/main/res/layout/view_live_room.xml +++ b/live/src/main/res/layout/view_live_room.xml @@ -488,7 +488,6 @@ + android:gravity="center" + android:visibility="invisible"> + android:focusable="true" + android:visibility="visible"> - @@ -1242,14 +1241,17 @@ + + android:layout_centerHorizontal="true" + android:layout_marginTop="40dp" + android:src="@mipmap/icon_rank_top_box" + android:visibility="gone" /> + + + + + From 7842c1b8389dadf77af117b65353c4a9e2b56e09 Mon Sep 17 00:00:00 2001 From: zlzw <583819556@qq.com> Date: Wed, 16 Nov 2022 13:47:05 +0800 Subject: [PATCH 4/6] =?UTF-8?q?=E8=B0=83=E6=95=B4PK=E6=8E=92=E4=BD=8D?= =?UTF-8?q?=E8=B5=9B=E4=B8=AD=EF=BC=8C=E8=BF=9E=E8=83=9C=E5=A4=A7=E4=BA=8E?= =?UTF-8?q?=E7=AD=89=E4=BA=8E3=E5=9C=BA=E6=89=8D=E6=98=BE=E7=A4=BA?= =?UTF-8?q?=E8=BF=9E=E8=83=9C=E5=AD=97=E6=A0=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/yunbao/live/views/LiveRoomViewHolder.java | 11 ++++++++--- live/src/main/res/layout/view_live_room.xml | 6 ++++-- 2 files changed, 12 insertions(+), 5 deletions(-) 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 d06188889..f1baed586 100644 --- a/live/src/main/java/com/yunbao/live/views/LiveRoomViewHolder.java +++ b/live/src/main/java/com/yunbao/live/views/LiveRoomViewHolder.java @@ -1540,9 +1540,14 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis pkRankVf.addView(titleIcon); pkRankVf.addView(hourView); pkRankVf.startFlipping(); - - mRedVal.setText(bean.getRedVal()+"連勝"); - mBlueVal.setText(bean.getBlueVal()+"連勝"); + if(Integer.parseInt(bean.getRedVal())>2) { + mRedVal.setVisibility(View.VISIBLE); + mRedVal.setText(bean.getRedVal() + "連勝"); + } + if(Integer.parseInt(bean.getBlueVal())>2) { + mBlueVal.setVisibility(View.VISIBLE); + mBlueVal.setText(bean.getBlueVal() + "連勝"); + } //ImgLoader.display(mContext,bean.getPkTopImgUrl(),mPkRankTopIcon); } }, Throwable::printStackTrace) diff --git a/live/src/main/res/layout/view_live_room.xml b/live/src/main/res/layout/view_live_room.xml index 49a08a858..a00d8eec5 100644 --- a/live/src/main/res/layout/view_live_room.xml +++ b/live/src/main/res/layout/view_live_room.xml @@ -1273,7 +1273,8 @@ android:paddingBottom="8dp" android:textColor="#FFFFFF" android:textSize="15sp" - android:textStyle="bold" /> + android:textStyle="bold" + android:visibility="gone" /> + android:textStyle="bold" + android:visibility="gone" /> Date: Wed, 16 Nov 2022 14:07:07 +0800 Subject: [PATCH 5/6] =?UTF-8?q?=E8=B0=83=E6=95=B4=E4=BB=85=E6=8E=A5?= =?UTF-8?q?=E5=8F=A3=E8=BF=94=E5=9B=9E=E6=9C=89top=E5=9B=BE=E7=89=87?= =?UTF-8?q?=E6=97=B6=E6=89=8D=E8=AE=A4=E4=B8=BA=E6=98=AF=E6=8E=92=E4=BD=8D?= =?UTF-8?q?=E8=B5=9B=E5=B9=B6=E6=98=BE=E7=A4=BAUI?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/yunbao/live/views/LiveRoomViewHolder.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) 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 f1baed586..b7e187654 100644 --- a/live/src/main/java/com/yunbao/live/views/LiveRoomViewHolder.java +++ b/live/src/main/java/com/yunbao/live/views/LiveRoomViewHolder.java @@ -1540,6 +1540,10 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis pkRankVf.addView(titleIcon); pkRankVf.addView(hourView); pkRankVf.startFlipping(); + + if(StringUtil.isEmpty(bean.getPkTopImgUrl())){ + return; + } if(Integer.parseInt(bean.getRedVal())>2) { mRedVal.setVisibility(View.VISIBLE); mRedVal.setText(bean.getRedVal() + "連勝"); @@ -1548,7 +1552,8 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis mBlueVal.setVisibility(View.VISIBLE); mBlueVal.setText(bean.getBlueVal() + "連勝"); } - //ImgLoader.display(mContext,bean.getPkTopImgUrl(),mPkRankTopIcon); + mPkRankTopIcon.setVisibility(View.VISIBLE); + ImgLoader.display(mContext,bean.getPkTopImgUrl(),mPkRankTopIcon); } }, Throwable::printStackTrace) .isDisposed(); @@ -1764,7 +1769,6 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis lt_pk_line.requestLayout(); lt_pk_line.setVisibility(View.VISIBLE); - mPkRankTopIcon.setVisibility(View.VISIBLE); img_pk_fist_l.setBackgroundResource(R.mipmap.icon_red_no1); img_pk_fist_r.setBackgroundResource(R.mipmap.icon_blue_no1); ImgLoader.display2((LiveActivity) Contexts, "", avatar_l1); From d53d250e6f52c1060d5fb07d5f60d5a190659891 Mon Sep 17 00:00:00 2001 From: zlzw <583819556@qq.com> Date: Wed, 16 Nov 2022 15:03:25 +0800 Subject: [PATCH 6/6] =?UTF-8?q?=E8=B0=83=E6=95=B4PK=E6=8E=92=E4=BD=8D?= =?UTF-8?q?=E8=B5=9B=E5=88=A4=E6=96=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../yunbao/live/activity/LiveActivity.java | 3 +- .../com/yunbao/live/socket/SocketClient.java | 4 +- .../live/socket/SocketMessageListener.java | 2 +- .../yunbao/live/socket/SocketRyClient.java | 4 +- .../yunbao/live/views/LiveRoomViewHolder.java | 66 +++++++++++-------- .../live/views/PortraitLiveManager.java | 3 +- 6 files changed, 49 insertions(+), 33 deletions(-) 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 e98110c2d..d5571c190 100644 --- a/live/src/main/java/com/yunbao/live/activity/LiveActivity.java +++ b/live/src/main/java/com/yunbao/live/activity/LiveActivity.java @@ -706,7 +706,7 @@ public abstract class LiveActivity extends AbsActivity implements SocketMessageL * 主播与主播PK 所有人收到PK开始的回调 */ @Override - public void onLinkMicPkStart(final String pkUid, final String pkhead, final String pkname) { + public void onLinkMicPkStart(final String pkUid, final String pkhead, final String pkname,String isLadders) { Log.e("ry", "pkUid" + pkUid + "pkhead" + pkhead + "pkname" + pkname); if (mLiveRyLinkMicPkPresenter != null && mLiveRoomViewHolder != null) { mLiveRyLinkMicPkPresenter.onLinkMicPkStart(pkUid, 1); @@ -718,6 +718,7 @@ public abstract class LiveActivity extends AbsActivity implements SocketMessageL Log.e("tasdsdg", mLiveUid + "1111" + CommonAppConfig.getInstance().getUid()); if (!mLiveUid.equals(CommonAppConfig.getInstance().getUid())) { mLiveRoomViewHolder.setOtherInfo(pkUid, pkhead, pkname); + mLiveRoomViewHolder.initPkRank(isLadders); } } } 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 04db014d1..1752860c3 100644 --- a/live/src/main/java/com/yunbao/live/socket/SocketClient.java +++ b/live/src/main/java/com/yunbao/live/socket/SocketClient.java @@ -763,13 +763,13 @@ public class SocketClient { 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")); + mListener.onLinkMicPkStart(map.getString("uid"), map.getString("pkhead"), map.getString("pkname"),map.getString("is_ladders")); break; case 3://对方主播拒绝PK的回调 mListener.onLinkMicPkRefuse(); break; case 4://所有人收到PK开始址的回调 - mListener.onLinkMicPkStart(map.getString("pkuid"), map.getString("pkhead"), map.getString("pkname")); + mListener.onLinkMicPkStart(map.getString("pkuid"), map.getString("pkhead"), map.getString("pkname"),map.getString("is_ladders")); break; case 5://PK时候断开连麦的回调 if (LivePushTxViewHolder.mTRTCCloud != null) { 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 fe4426d69..664feb37f 100644 --- a/live/src/main/java/com/yunbao/live/socket/SocketMessageListener.java +++ b/live/src/main/java/com/yunbao/live/socket/SocketMessageListener.java @@ -247,7 +247,7 @@ public interface SocketMessageListener { /** * 主播与主播PK 所有人收到PK开始的回调 */ - void onLinkMicPkStart(String pkUid, String pkhead, String pkname); + void onLinkMicPkStart(String pkUid, String pkhead, String pkname,String isLadders); /** * 主播与主播PK 断开连麦pk的回调 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 3e6643e18..098d32eb9 100644 --- a/live/src/main/java/com/yunbao/live/socket/SocketRyClient.java +++ b/live/src/main/java/com/yunbao/live/socket/SocketRyClient.java @@ -1004,13 +1004,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"));// 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")); + mListener.onLinkMicPkStart(map.getString("pkuid"), map.getString("pkhead"), map.getString("pkname"),map.getString("is_ladders")); break; case 5://PK时候断开连麦的回调 if (rtcRoom != null) { 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 b7e187654..ca2da5816 100644 --- a/live/src/main/java/com/yunbao/live/views/LiveRoomViewHolder.java +++ b/live/src/main/java/com/yunbao/live/views/LiveRoomViewHolder.java @@ -1511,49 +1511,63 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis initPkRank(); } + private void initPkRankView() { + if(pkRankVf.getTag()!=null){ + return; + } + LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(DpUtil.dp2px(20), DpUtil.dp2px(22)); + LinearLayout.LayoutParams textParams = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT); + params.leftMargin = DpUtil.dp2px(2); + textParams.setMarginStart(DpUtil.dp2px(1)); + + View hourView = LayoutInflater.from(mContext).inflate(R.layout.view_wish_list, null); + ImageView titleIcon = new ImageView(mContext); + mPkRankIcon = hourView.findViewById(R.id.wish_pic); + mPkRankText = hourView.findViewById(R.id.wish_index); + mPkRankText.setLayoutParams(textParams); + mPkRankText.setGravity(Gravity.CENTER); + titleIcon.setImageResource(R.mipmap.icon_pk_rank); + titleIcon.setLayoutParams(new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT)); + mPkRankIcon.setLayoutParams(params); + pkRankVf.addView(titleIcon); + pkRankVf.addView(hourView); + pkRankVf.startFlipping(); + pkRankVf.setTag("start"); + } + private void initPkRank() { + initPkRank(null); + } + + public void initPkRank(String isLadders) { API.get().pdLiveApi(mContext) .getPkRanksList(mLiveUid, pkUid) .observeOn(AndroidSchedulers.mainThread()) .subscribeOn(Schedulers.io()) .subscribe(listResponseModel -> { PkRankBean bean = listResponseModel.getData().getInfo(); - ToastUtil.show("触发PK排位赛"); - Log.i("PK", bean.toString()); if (bean != null) { - LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(DpUtil.dp2px(20), DpUtil.dp2px(22)); - LinearLayout.LayoutParams textParams = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT); - params.leftMargin = DpUtil.dp2px(2); - textParams.setMarginStart(DpUtil.dp2px(1)); + Log.i("PK", bean.toString() + " | " + isLadders); + initPkRankView(); - View hourView = LayoutInflater.from(mContext).inflate(R.layout.view_wish_list, null); - ImageView titleIcon = new ImageView(mContext); - mPkRankIcon = hourView.findViewById(R.id.wish_pic); - mPkRankText = hourView.findViewById(R.id.wish_index); mPkRankText.setText(bean.getName()); - mPkRankText.setLayoutParams(textParams); - mPkRankText.setGravity(Gravity.CENTER); - titleIcon.setImageResource(R.mipmap.icon_pk_rank); ImgLoader.display(mContext, bean.getImg(), mPkRankIcon); - titleIcon.setLayoutParams(new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT)); - mPkRankIcon.setLayoutParams(params); - pkRankVf.addView(titleIcon); - pkRankVf.addView(hourView); - pkRankVf.startFlipping(); - - if(StringUtil.isEmpty(bean.getPkTopImgUrl())){ + if (StringUtil.isEmpty(bean.getPkTopImgUrl()) || StringUtil.isEmpty(isLadders)) { return; } - if(Integer.parseInt(bean.getRedVal())>2) { + if (!StringUtil.isEmpty(isLadders)) { + bean.setPkTopImgUrl(isLadders); + } + if (Integer.parseInt(bean.getRedVal()) > 2) { mRedVal.setVisibility(View.VISIBLE); mRedVal.setText(bean.getRedVal() + "連勝"); } - if(Integer.parseInt(bean.getBlueVal())>2) { + if (Integer.parseInt(bean.getBlueVal()) > 2) { mBlueVal.setVisibility(View.VISIBLE); mBlueVal.setText(bean.getBlueVal() + "連勝"); } mPkRankTopIcon.setVisibility(View.VISIBLE); - ImgLoader.display(mContext,bean.getPkTopImgUrl(),mPkRankTopIcon); + ImgLoader.display(mContext, bean.getPkTopImgUrl(), mPkRankTopIcon); } }, Throwable::printStackTrace) .isDisposed(); @@ -1593,6 +1607,7 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis private void updatePkRank(PkRankBean bean) { mPkRankText.setText(bean.getName()); ImgLoader.display(mContext, bean.getImg(), mPkRankIcon); + initPkRank(); } /** @@ -1784,8 +1799,6 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis uidR2 = ""; uidR1 = ""; uidR3 = ""; - - initPkRank(); } //双人pk关闭 @@ -1793,7 +1806,7 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis mPkRankTopIcon.setVisibility(View.GONE); lt_pk_line.setVisibility(View.GONE); livePKUserListBean = new LivePKUserListBean(); - pkUid=""; + pkUid = ""; } /** @@ -3561,6 +3574,7 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis case PK_TWO_START: pkUid = event.getObject().toString(); UpPkTwo(); + initPkRank(); break; case PK_TWO_END: closePkTwo(); 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 339e3c83b..c0b64f482 100644 --- a/live/src/main/java/com/yunbao/live/views/PortraitLiveManager.java +++ b/live/src/main/java/com/yunbao/live/views/PortraitLiveManager.java @@ -923,7 +923,7 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe } @Override - public void onLinkMicPkStart(String pkUid, String pkhead, String pkname) { + public void onLinkMicPkStart(String pkUid, String pkhead, String pkname,String isLadders) { if (mLiveRyLinkMicPkPresenter != null && mLiveRoomViewHolder != null) { mLiveRyLinkMicPkPresenter.onLinkMicPkStart(pkUid, 1); Handler handler = new Handler(); @@ -934,6 +934,7 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe Log.e("tasdsdg", liveID + "1111" + CommonAppConfig.getInstance().getUid()); if (!liveID.equals(CommonAppConfig.getInstance().getUid())) { mLiveRoomViewHolder.setOtherInfo(pkUid, pkhead, pkname); + mLiveRoomViewHolder.initPkRank(isLadders); } } }