From 7ae32bbe77246b6c15676a81001df744987c619b Mon Sep 17 00:00:00 2001 From: ningwenqiang Date: Sat, 21 Sep 2024 11:01:28 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A5=B3=E7=A5=9E=E8=AF=B4=E5=AE=9A=E6=97=B6?= =?UTF-8?q?=E6=94=B6=E9=BD=90=E6=9D=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../yunbao/live/views/LiveRoomViewHolder.java | 36 +++++++++++++------ live/src/main/res/layout/view_live_room.xml | 7 ++-- .../res/layout/view_live_room_video_chat.xml | 9 +++-- live/src/main/res/layout/view_wish_list2.xml | 5 +-- 4 files changed, 38 insertions(+), 19 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 793815d89..30c772604 100644 --- a/live/src/main/java/com/yunbao/live/views/LiveRoomViewHolder.java +++ b/live/src/main/java/com/yunbao/live/views/LiveRoomViewHolder.java @@ -983,8 +983,8 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis sud_layout_name.post(new Runnable() { @Override public void run() { - //TODO 这里报了类型错误 - RelativeLayout.LayoutParams params1 = (RelativeLayout.LayoutParams) sud_layout_name.getLayoutParams(); + //TODO 这里报了类型错误 android.widget.LinearLayout$LayoutParams cannot be cast to android.widget.RelativeLayout$LayoutParams + ViewGroup.LayoutParams params1 = sud_layout_name.getLayoutParams(); params1.width = mChatRecyclerView.getWidth() - DpUtil.dp2px(85); sud_layout_name.setLayoutParams(params1); } @@ -1675,14 +1675,16 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis public void onClick(View view) { MobclickAgent.onEvent(mContext, "live_room_goddess_say", "女神说按钮"); hideAnchorSay(); - newGodSayGroup.setVisibility(View.VISIBLE); } }); goddessSayBgView.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { - mAnchorSay.setVisibility(View.VISIBLE); - newGodSayGroup.setVisibility(View.GONE); + if(!isHinde){ + mAnchorSay.setVisibility(View.VISIBLE); + newGodSayGroup.setVisibility(View.GONE); + mLiveRoomHandler.removeMessages(LiveRoomHandler.WHAT_ANCHOR_GOD_SHOW_HIDE); + } } }); // mAnchorSay.setOnClickListener(new View.OnClickListener() { @@ -2930,12 +2932,16 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis new XPopup.Builder(mContext).asCustom(new ReceiveRendPacketPopup(mContext, 0, mLiveUid, mStream, redPacket.getRedPacketId(), redPacket, true, isFans)).show(); } + + /** * 隐藏女神说 */ private void hideAnchorSay() { - mAnchorSay.setVisibility(View.GONE); - + if (mAnchorSay.getVisibility() == View.VISIBLE){ + mAnchorSay.setVisibility(View.GONE); + newGodSayGroup.setVisibility(View.VISIBLE); + } // boolean hide = mAnchorSay.getTag() == null || (boolean) mAnchorSay.getTag(); // Animation animation; // if (hide) { @@ -5666,6 +5672,7 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis private static final int WHAT_FIRST_LOOK_LIVE = 7;//用户首次进入该直播间计时 private static final int WHAT_LOOK_5_MIN_LIVE = 8;//用户首次进入该直播间计时 private static final int WHAT_TASK_INLET_LIVE = 9;//打开活动页 + static final int WHAT_ANCHOR_GOD_SHOW_HIDE = 10; //延迟十秒收起女神说 public LiveRoomHandler(LiveRoomViewHolder liveRoomViewHolder) { mLiveRoomViewHolder = new WeakReference<>(liveRoomViewHolder).get(); @@ -5703,6 +5710,9 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis case WHAT_TASK_INLET_LIVE: mLiveRoomViewHolder.showSendGiftTaskMsg(); break; + case WHAT_ANCHOR_GOD_SHOW_HIDE: + mLiveRoomViewHolder.hideAnchorSay(); + break; } } } @@ -6296,10 +6306,12 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis changeView(); break; case LIVE_PK_ING: + //Pk中收齐女神说 hideAnchorSayAndCallAnchor(); break; case LIVE_PK_END: - //showAnchorSayAndCallAnchor(); + //Pk结束可以展开女神说 + showAnchorSayAndCallAnchor(); break; case LIVE_FONT_SIZE: int fount = event.getNums(); @@ -6984,6 +6996,7 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis mAnchorSay.setVisibility(View.INVISIBLE); newGodSayGroup.setVisibility(View.GONE); } + mLiveRoomHandler.sendEmptyMessageDelayed(LiveRoomHandler.WHAT_ANCHOR_GOD_SHOW_HIDE,10000); } else { mAnchorSay.setVisibility(View.INVISIBLE); } @@ -7026,7 +7039,10 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis public void hideAnchorSayAndCallAnchor() { isHinde = true; - mAnchorSay.setVisibility(View.GONE); + if(mAnchorSay.getVisibility() == View.VISIBLE){ + mAnchorSay.setVisibility(View.GONE); + newGodSayGroup.setVisibility(View.VISIBLE); + } if (!TextUtils.isEmpty(wishListProgress.getWishlistName()) || !TextUtils.isEmpty(wishListProgress.getWishlistProgress())) { //topBanner2.setVisibility(View.VISIBLE); } else { @@ -7039,7 +7055,7 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis isHinde = false; if (mAnchorSay.getVisibility() != View.VISIBLE && sayModel != null && sayModel.getLivePreview() != null && sayModel.getLivePreview().getIsShow() == 1) { Log.i("女神说", "sayModel: " + sayModel); - mAnchorSay.setVisibility(View.VISIBLE); + //mAnchorSay.setVisibility(View.VISIBLE); } if (topBanner1.getVisibility() == View.GONE && mTopBannerList != null && !mTopBannerList.isEmpty()) { Log.i("女神说", "mTopBannerList: " + mTopBannerList.size()); diff --git a/live/src/main/res/layout/view_live_room.xml b/live/src/main/res/layout/view_live_room.xml index 1a5a52a5f..43be18b8e 100644 --- a/live/src/main/res/layout/view_live_room.xml +++ b/live/src/main/res/layout/view_live_room.xml @@ -2544,9 +2544,8 @@ android:layout_width="68dp" android:layout_height="wrap_content" android:layout_alignParentRight="true" - android:layout_marginTop="190dp" - android:visibility="gone" - tools:visibility="visible" + android:layout_marginTop="180dp" + android:visibility="visible" android:layout_marginRight="10dp" /> diff --git a/live/src/main/res/layout/view_live_room_video_chat.xml b/live/src/main/res/layout/view_live_room_video_chat.xml index b7b40a6d8..de4e192eb 100644 --- a/live/src/main/res/layout/view_live_room_video_chat.xml +++ b/live/src/main/res/layout/view_live_room_video_chat.xml @@ -101,7 +101,8 @@ android:id="@+id/mic_view" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:visibility="visible" + android:visibility="gone" + tools:visibility="visible" app:constraint_referenced_ids="video_chat_bg1,video_chat_circle1,mic_ico,mic_gift_svga,userVoice,userName,sorNumberTv" /> @@ -200,7 +201,8 @@ android:id="@+id/mic_view1" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:visibility="visible" + android:visibility="gone" + tools:visibility="visible" app:constraint_referenced_ids="video_chat_bg2,video_chat_circle2,mic_ico1,mic_gift_svga1,userVoice1,userName1,sorNumberTv1" /> @@ -298,7 +300,8 @@ android:id="@+id/mic_view2" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:visibility="visible" + android:visibility="gone" + tools:visibility="visible" app:constraint_referenced_ids="video_chat_bg3,video_chat_circle3,mic_ico2,mic_gift_svga2,userVoice2,userName2,sorNumberTv2" /> \ No newline at end of file diff --git a/live/src/main/res/layout/view_wish_list2.xml b/live/src/main/res/layout/view_wish_list2.xml index d05e16598..12c8d25cb 100644 --- a/live/src/main/res/layout/view_wish_list2.xml +++ b/live/src/main/res/layout/view_wish_list2.xml @@ -23,10 +23,11 @@ app:layout_constraintTop_toTopOf="parent" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintStart_toEndOf="@+id/wish_pic" - android:layout_width="0dp" + android:layout_width="match_parent" + android:layout_height="wrap_content" tools:text="热度加成" - android:layout_marginStart="2dp" + android:layout_marginStart="17dp" android:ellipsize="marquee" android:focusable="true" android:gravity="center"