From b0ed276e2364aec6d11df228c3aa751b12ca085d Mon Sep 17 00:00:00 2001 From: 18142669586 <1669783059@qq.com> Date: Fri, 7 Apr 2023 14:42:07 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=96=B0=E4=BA=BA=E4=BB=BB?= =?UTF-8?q?=E5=8A=A1=E7=9A=84=E5=B1=95=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../live/views/LiveAudienceViewHolder.java | 99 +-------- .../yunbao/live/views/LiveRoomViewHolder.java | 198 +++++++++++++----- .../main/res/layout/view_live_audience.xml | 25 --- live/src/main/res/layout/view_live_room.xml | 28 +++ 4 files changed, 175 insertions(+), 175 deletions(-) diff --git a/live/src/main/java/com/yunbao/live/views/LiveAudienceViewHolder.java b/live/src/main/java/com/yunbao/live/views/LiveAudienceViewHolder.java index 85237fae8..8d8267731 100644 --- a/live/src/main/java/com/yunbao/live/views/LiveAudienceViewHolder.java +++ b/live/src/main/java/com/yunbao/live/views/LiveAudienceViewHolder.java @@ -79,7 +79,6 @@ public class LiveAudienceViewHolder extends AbsLiveViewHolder { private String url; private View v_msg_redpoint, stationHornBanner; private Activity context; - private SVGAImageView svga_new_user_gif, svga_new_user_double, svga_new_user_follow; private ViewFlipper viewFlipper; private TextView goToRomm; private int icon = 0; @@ -97,95 +96,8 @@ public class LiveAudienceViewHolder extends AbsLiveViewHolder { this.context = (Activity) context; } - @Subscribe(threadMode = ThreadMode.MAIN) - public void onUpdata(String str) { - if ("svga_new_user_gif".equals(str)) { - svga_new_user_gif(); - } else if ("svga_new_user_double".equals(str)) { - svga_new_user_double(); - } else if ("svga_new_user_follow".equals(str)) { - svga_new_user_follow(); - } else if ("stop_svga_new_user_double".equals(str)) { - svga_new_user_double.setVisibility(View.GONE); - svga_new_user_double.stopAnimation(); - svga_new_user_double.clear(); - } else if ("stop_svga_new_user_follow".equals(str)) { - svga_new_user_follow.setVisibility(View.GONE); - svga_new_user_follow.stopAnimation(); - svga_new_user_follow.clear(); - } else if ("stop_svga_new_user_gif".equals(str)) { - svga_new_user_gif.setVisibility(View.GONE); - svga_new_user_gif.stopAnimation(); - svga_new_user_gif.clear(); - } else if ("name_true".equals(str)) { - if (LiveRoomViewHolder.mName != null && LiveRoomViewHolder.mName.getText().length() <= 4) { - RelativeLayout.LayoutParams layoutParams = new RelativeLayout.LayoutParams(DpUtil.dp2px(116), DpUtil.dp2px(40)); - layoutParams.setMargins(DpUtil.dp2px(80), DpUtil.dp2px(80), 0, 0); - svga_new_user_follow.setLayoutParams(layoutParams); - } else { - RelativeLayout.LayoutParams layoutParams = new RelativeLayout.LayoutParams(DpUtil.dp2px(116), DpUtil.dp2px(40)); - layoutParams.setMargins(DpUtil.dp2px(100), DpUtil.dp2px(80), 0, 0); - svga_new_user_follow.setLayoutParams(layoutParams); - } - } - - } - private void svga_new_user_gif() { - svga_new_user_gif.setVisibility(View.VISIBLE); - new SVGAParser(mContext).decodeFromAssets("free_gift_tip.svga", new SVGAParser.ParseCompletion() { - @Override - public void onComplete(SVGAVideoEntity videoItem) { - SVGADrawable drawable = new SVGADrawable(videoItem); - svga_new_user_gif.setImageDrawable(drawable); - SVGAViewUtils.playEndClear(svga_new_user_gif); - - } - - @Override - public void onError() { - Log.e("errqs", "errl"); - } - }, null); - - } - - private void svga_new_user_double() { - svga_new_user_double.setVisibility(View.VISIBLE); - new SVGAParser(mContext).decodeFromAssets("double_click_tip.svga", new SVGAParser.ParseCompletion() { - @Override - public void onComplete(SVGAVideoEntity videoItem) { - SVGADrawable drawable = new SVGADrawable(videoItem); - svga_new_user_double.setImageDrawable(drawable); - svga_new_user_double.setBackgroundResource(R.mipmap.black_bg); - SVGAViewUtils.playEndClear(svga_new_user_double); - } - - @Override - public void onError() { - Log.e("errqs", "errl"); - } - }, null); - } - - private void svga_new_user_follow() { - svga_new_user_follow.setVisibility(View.VISIBLE); - new SVGAParser(mContext).decodeFromAssets("live_follow_tip.svga", new SVGAParser.ParseCompletion() { - @Override - public void onComplete(SVGAVideoEntity videoItem) { - SVGADrawable drawable = new SVGADrawable(videoItem); - svga_new_user_follow.setImageDrawable(drawable); - SVGAViewUtils.playEndClear(svga_new_user_follow); - } - - @Override - public void onError() { - Log.e("errqs", "errl"); - } - }, null); - - } @Override protected int getLayoutId() { @@ -205,9 +117,7 @@ public class LiveAudienceViewHolder extends AbsLiveViewHolder { voiceButton = (LinearLayout) findViewById(R.id.voice_button); giftImage = (ImageView) findViewById(R.id.gift_image); liveNewPeople = (ImageView) findViewById(R.id.live_new_people); - svga_new_user_gif = (SVGAImageView) findViewById(R.id.svga_new_user_gif); - svga_new_user_double = (SVGAImageView) findViewById(R.id.svga_new_user_double); - svga_new_user_follow = (SVGAImageView) findViewById(R.id.svga_new_user_follow); + viewFlipper = (ViewFlipper) findViewById(R.id.viewflipper_banner); mRole = (ImageView) findViewById(R.id.live_privilege); mCheat = (ImageView) findViewById(R.id.live_cheat); @@ -218,12 +128,7 @@ public class LiveAudienceViewHolder extends AbsLiveViewHolder { mRole.setOnClickListener(this); mCheat.setOnClickListener(this); mPlay.setOnClickListener(this); - svga_new_user_double.setOnClickListener(new View.OnClickListener() { - @Override - public void onClick(View v) { - ((LiveAudienceActivity) mContext).light(); - } - }); + findViewById(R.id.btn_mic).setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { 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 be23fe9c7..ca6d2a537 100644 --- a/live/src/main/java/com/yunbao/live/views/LiveRoomViewHolder.java +++ b/live/src/main/java/com/yunbao/live/views/LiveRoomViewHolder.java @@ -353,7 +353,143 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis private ImageView mAnchorSayHide; //----!主播说组件---// private Banner topBanner1;//心愿单&联系方式 + public SVGAImageView svga_new_user_gif, svga_new_user_double, svga_new_user_follow; + @Subscribe(threadMode = ThreadMode.MAIN) + public void onUpdata(String str) { + if ("svga_new_user_gif".equals(str)) { + svga_new_user_gif(); + } else if ("svga_new_user_double".equals(str)) { + svga_new_user_double(); + } else if ("svga_new_user_follow".equals(str)) { + svga_new_user_follow(); + } else if ("stop_svga_new_user_double".equals(str)) { + svga_new_user_double.setVisibility(View.GONE); + svga_new_user_double.stopAnimation(); + svga_new_user_double.clear(); + } else if ("stop_svga_new_user_follow".equals(str)) { + svga_new_user_follow.setVisibility(View.GONE); + svga_new_user_follow.stopAnimation(); + svga_new_user_follow.clear(); + } else if ("stop_svga_new_user_gif".equals(str)) { + svga_new_user_gif.setVisibility(View.GONE); + svga_new_user_gif.stopAnimation(); + svga_new_user_gif.clear(); + } else if ("name_true".equals(str)) { + if (LiveRoomViewHolder.mName != null && LiveRoomViewHolder.mName.getText().length() <= 4) { + RelativeLayout.LayoutParams layoutParams = new RelativeLayout.LayoutParams(DpUtil.dp2px(116), DpUtil.dp2px(40)); + layoutParams.setMargins(DpUtil.dp2px(80), DpUtil.dp2px(80), 0, 0); + svga_new_user_follow.setLayoutParams(layoutParams); + } else { + RelativeLayout.LayoutParams layoutParams = new RelativeLayout.LayoutParams(DpUtil.dp2px(116), DpUtil.dp2px(40)); + layoutParams.setMargins(DpUtil.dp2px(100), DpUtil.dp2px(80), 0, 0); + svga_new_user_follow.setLayoutParams(layoutParams); + } + } + if ("svga_new_user_gif".equals(str)) { + if (fastMsgRecyclerView == null) return; + RelativeLayout.LayoutParams params1 = (RelativeLayout.LayoutParams) + fastMsgRecyclerView.getLayoutParams(); + params1.rightMargin = DeviceUtils.getScreenWidth((Activity) mContext) / 3; + fastMsgRecyclerView.setLayoutParams(params1); + } else if ("stop_svga_new_user_gif".equals(str)) { + if (fastMsgRecyclerView == null) return; + RelativeLayout.LayoutParams params1 = (RelativeLayout.LayoutParams) + fastMsgRecyclerView.getLayoutParams(); + params1.rightMargin = 0; + fastMsgRecyclerView.setLayoutParams(params1); + } else if ("showBanner".equals(str)) { + showBanner3(bean1); + } else if ("stop_svga_new_user_double".equals(str) && mBannerList3.size() > 2) { + + mBannerList3.get(2).setLink("1"); + mBanner3.update(mBannerList3); + if (mBannerList3.get(0).getLink().equals("1")) { + if (mBannerList3.get(1).getLink().equals("1")) { + if (mBannerList3.get(2).getLink().equals("1")) { + btn_event3.setVisibility(View.GONE); + } + } + } + } else if ("stop_svga_new_user_follow".equals(str) && mBannerList3.size() > 1) { + mBannerList3.get(1).setLink("1"); + + mBanner3.update(mBannerList3); + if (mBannerList3.get(0).getLink().equals("1")) { + if (mBannerList3.get(1).getLink().equals("1")) { + if (mBannerList3.get(2).getLink().equals("1")) { + btn_event3.setVisibility(View.GONE); + } + } + } + } else if ("stop_new_user_gif".equals(str) && mBannerList3.size() > 0) { + IMLoginManager.get(mContext).setNewUserGif(false); + mBannerList3.get(0).setLink("1"); + mBanner3.update(mBannerList3); + if (mBannerList3.get(0).getLink().equals("1")) { + if (mBannerList3.get(1).getLink().equals("1")) { + if (mBannerList3.get(2).getLink().equals("1")) { + btn_event3.setVisibility(View.GONE); + } + } + } + } + } + + private void svga_new_user_gif() { + svga_new_user_gif.setVisibility(View.VISIBLE); + new SVGAParser(mContext).decodeFromAssets("free_gift_tip.svga", new SVGAParser.ParseCompletion() { + @Override + public void onComplete(SVGAVideoEntity videoItem) { + SVGADrawable drawable = new SVGADrawable(videoItem); + svga_new_user_gif.setImageDrawable(drawable); + SVGAViewUtils.playEndClear(svga_new_user_gif); + + } + + @Override + public void onError() { + Log.e("errqs", "errl"); + } + }, null); + + } + + private void svga_new_user_double() { + svga_new_user_double.setVisibility(View.VISIBLE); + new SVGAParser(mContext).decodeFromAssets("double_click_tip.svga", new SVGAParser.ParseCompletion() { + @Override + public void onComplete(SVGAVideoEntity videoItem) { + SVGADrawable drawable = new SVGADrawable(videoItem); + svga_new_user_double.setImageDrawable(drawable); + svga_new_user_double.setBackgroundResource(R.mipmap.black_bg); + SVGAViewUtils.playEndClear(svga_new_user_double); + } + + @Override + public void onError() { + Log.e("errqs", "errl"); + } + }, null); + } + + private void svga_new_user_follow() { + svga_new_user_follow.setVisibility(View.VISIBLE); + new SVGAParser(mContext).decodeFromAssets("live_follow_tip.svga", new SVGAParser.ParseCompletion() { + @Override + public void onComplete(SVGAVideoEntity videoItem) { + SVGADrawable drawable = new SVGADrawable(videoItem); + svga_new_user_follow.setImageDrawable(drawable); + SVGAViewUtils.playEndClear(svga_new_user_follow); + } + + @Override + public void onError() { + Log.e("errqs", "errl"); + } + }, null); + + } public LiveRoomViewHolder(boolean isRys, int forActivity, Context context, ViewGroup parentView, GifImageView gifImageView, SVGAImageView svgaImageView, ViewGroup liveGiftPrizePoolContainer, WindowManager windowManager) { super(context, parentView); Contexts = context; @@ -700,8 +836,15 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis mAnchorSayText = (TextView) findViewById(R.id.anchor_say_text); mAnchorSayHide = (ImageView) findViewById(R.id.anchor_say_hide); mAnchorSayHide.setOnClickListener(v -> hideAnchorSay()); - - + svga_new_user_gif = (SVGAImageView) findViewById(R.id.svga_new_user_gif); + svga_new_user_double = (SVGAImageView) findViewById(R.id.svga_new_user_double); + svga_new_user_follow = (SVGAImageView) findViewById(R.id.svga_new_user_follow); + svga_new_user_double.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + ((LiveAudienceActivity) mContext).light(); + } + }); btnEvent = findViewById(R.id.btn_event); fullScreen = (FullServiceNotificationView) findViewById(R.id.full_screen); noble = (NobleNoticeView) findViewById(R.id.noble); @@ -3809,57 +3952,6 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis CommonHttpUtil.cancel(CommonHttpConsts.SET_ATTENTION); } - @Subscribe(threadMode = ThreadMode.MAIN) - public void onUpdata(String str) { - if ("svga_new_user_gif".equals(str)) { - if (fastMsgRecyclerView == null) return; - RelativeLayout.LayoutParams params1 = (RelativeLayout.LayoutParams) - fastMsgRecyclerView.getLayoutParams(); - params1.rightMargin = DeviceUtils.getScreenWidth((Activity) mContext) / 3; - fastMsgRecyclerView.setLayoutParams(params1); - } else if ("stop_svga_new_user_gif".equals(str)) { - if (fastMsgRecyclerView == null) return; - RelativeLayout.LayoutParams params1 = (RelativeLayout.LayoutParams) - fastMsgRecyclerView.getLayoutParams(); - params1.rightMargin = 0; - fastMsgRecyclerView.setLayoutParams(params1); - } else if ("showBanner".equals(str)) { - showBanner3(bean1); - } else if ("stop_svga_new_user_double".equals(str) && mBannerList3.size() > 2) { - - mBannerList3.get(2).setLink("1"); - mBanner3.update(mBannerList3); - if (mBannerList3.get(0).getLink().equals("1")) { - if (mBannerList3.get(1).getLink().equals("1")) { - if (mBannerList3.get(2).getLink().equals("1")) { - btn_event3.setVisibility(View.GONE); - } - } - } - } else if ("stop_svga_new_user_follow".equals(str) && mBannerList3.size() > 1) { - mBannerList3.get(1).setLink("1"); - - mBanner3.update(mBannerList3); - if (mBannerList3.get(0).getLink().equals("1")) { - if (mBannerList3.get(1).getLink().equals("1")) { - if (mBannerList3.get(2).getLink().equals("1")) { - btn_event3.setVisibility(View.GONE); - } - } - } - } else if ("stop_new_user_gif".equals(str) && mBannerList3.size() > 0) { - IMLoginManager.get(mContext).setNewUserGif(false); - mBannerList3.get(0).setLink("1"); - mBanner3.update(mBannerList3); - if (mBannerList3.get(0).getLink().equals("1")) { - if (mBannerList3.get(1).getLink().equals("1")) { - if (mBannerList3.get(2).getLink().equals("1")) { - btn_event3.setVisibility(View.GONE); - } - } - } - } - } /** * 全服喇叭 diff --git a/live/src/main/res/layout/view_live_audience.xml b/live/src/main/res/layout/view_live_audience.xml index 8292712d8..e4267d176 100644 --- a/live/src/main/res/layout/view_live_audience.xml +++ b/live/src/main/res/layout/view_live_audience.xml @@ -408,35 +408,10 @@ - - - - + + + + + + + \ No newline at end of file