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] =?UTF-8?q?=E5=88=9B=E5=BB=BAPK=E6=8E=92=E4=BD=8D=E8=B5=9B?= =?UTF-8?q?=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;QYMP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Lr;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 @@ + + + + + + + + +