From 86735ab81fde460bfbba7a7bfbbd1cf30a6fb411 Mon Sep 17 00:00:00 2001 From: 18401019693 Date: Mon, 19 Sep 2022 17:59:15 +0800 Subject: [PATCH] =?UTF-8?q?=E7=9B=B4=E6=92=AD=E9=97=B4=E5=BC=80=E9=80=9A?= =?UTF-8?q?=E8=B4=B5=E6=97=8F=E7=BB=93=E6=9D=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../common/views/weight/NobleNoticeView.java | 28 +++++++-- .../src/main/res/layout/view_noble_notice.xml | 59 ++++++++++--------- common/src/main/res/values/strings.xml | 1 + .../yunbao/live/views/LiveRoomViewHolder.java | 14 ++--- 4 files changed, 63 insertions(+), 39 deletions(-) diff --git a/common/src/main/java/com/yunbao/common/views/weight/NobleNoticeView.java b/common/src/main/java/com/yunbao/common/views/weight/NobleNoticeView.java index c0a97cae2..3a231da57 100644 --- a/common/src/main/java/com/yunbao/common/views/weight/NobleNoticeView.java +++ b/common/src/main/java/com/yunbao/common/views/weight/NobleNoticeView.java @@ -3,6 +3,7 @@ package com.yunbao.common.views.weight; import android.animation.ValueAnimator; import android.content.Context; import android.graphics.Bitmap; +import android.text.TextUtils; import android.util.AttributeSet; import android.view.LayoutInflater; import android.view.View; @@ -51,8 +52,8 @@ public class NobleNoticeView extends FrameLayout { private SVGAImageView svagaBc; private RelativeLayout rootLayout; private long animationTime = 8000; - private TextView gotoRoomView, nobleNickname, userName, anchorNickname; - private String mSvgaName, uhead, anchorUid; + private TextView gotoRoomView, nobleNickname, userName, anchorNickname, openNoble; + private String mSvgaName, uhead, anchorNicknameStr; private RoleType roleType; private HorizontalScrollView contextLayout; private RelativeLayout scrollLayout; @@ -83,6 +84,7 @@ public class NobleNoticeView extends FrameLayout { scrollLayout = rootView.findViewById(R.id.scroll_layout); nobleIcon = rootView.findViewById(R.id.noble_icon); nobleNickname = rootView.findViewById(R.id.noble_nickname); + openNoble = rootView.findViewById(R.id.open_noble); userName = rootView.findViewById(R.id.user_name); anchorNickname = rootView.findViewById(R.id.anchor_nickname); contextLayout.setVisibility(GONE); @@ -99,9 +101,20 @@ public class NobleNoticeView extends FrameLayout { public NobleNoticeView setRootView(String uHead, String userNameStr, String anchorNicknameStr, String anchorUid) { this.uhead = uHead; - this.anchorUid = anchorUid; + this.anchorNicknameStr = anchorNicknameStr.trim(); userName.setText(userNameStr); - anchorNickname.setText(anchorNicknameStr); + anchorNickname.setText(anchorNicknameStr.trim()); + if (TextUtils.isEmpty(anchorNicknameStr.trim())) { + gotoRoomView.setVisibility(GONE); + findViewById(R.id.in).setVisibility(GONE); + findViewById(R.id.anchor_nickname).setVisibility(GONE); + openNoble.setText(mContext.getString(R.string.open_noble2)); + }else { + gotoRoomView.setVisibility(VISIBLE); + findViewById(R.id.in).setVisibility(VISIBLE); + findViewById(R.id.anchor_nickname).setVisibility(VISIBLE); + openNoble.setText(mContext.getString(R.string.open_noble)); + } return this; } @@ -348,8 +361,13 @@ public class NobleNoticeView extends FrameLayout { } gotoRoomView.setLayoutParams(layoutParams); contextLayout.setLayoutParams(contextLayoutParams); + if (!TextUtils.isEmpty(anchorNicknameStr)) { + gotoRoomView.setVisibility(VISIBLE); + findViewById(R.id.in).setVisibility(VISIBLE); + findViewById(R.id.anchor_nickname).setVisibility(VISIBLE); + } contextLayout.setVisibility(VISIBLE); - gotoRoomView.setVisibility(VISIBLE); + }); diff --git a/common/src/main/res/layout/view_noble_notice.xml b/common/src/main/res/layout/view_noble_notice.xml index ca2830b5d..0d540e02e 100644 --- a/common/src/main/res/layout/view_noble_notice.xml +++ b/common/src/main/res/layout/view_noble_notice.xml @@ -50,45 +50,50 @@ android:textColor="#F7FF74" android:textSize="14sp" /> - + android:visibility="visible"> - + + + + + + - diff --git a/common/src/main/res/values/strings.xml b/common/src/main/res/values/strings.xml index 737d08c8d..1da6cbd77 100644 --- a/common/src/main/res/values/strings.xml +++ b/common/src/main/res/values/strings.xml @@ -907,5 +907,6 @@ 昭告天下! %s 向所有人推薦了主播 %s , 一眼萬年情之所鐘! 昭告天下! %s 向所有人推薦了主播 %s , 灼灼風華一瞥驚鴻! 數據加載失敗,請稍後再試 + 開通了 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 fb3b46c72..fdf97fbd5 100644 --- a/live/src/main/java/com/yunbao/live/views/LiveRoomViewHolder.java +++ b/live/src/main/java/com/yunbao/live/views/LiveRoomViewHolder.java @@ -2273,7 +2273,7 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis noble.setRootView(bean.getUhead(), bean.getUname(), bean.getAncherName(), - bean.getAnchorUid()) + bean.getRoomnum()) .setRoleType(NobleNoticeView.RoleType.BARON) .setCallBack(() -> gotoLive(bean.getRoomnum())); break; @@ -2281,7 +2281,7 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis noble.setRootView(bean.getUhead(), bean.getUname(), bean.getAncherName(), - bean.getAnchorUid()) + bean.getRoomnum()) .setRoleType(NobleNoticeView.RoleType.VISCOUNT) .setCallBack(() -> gotoLive(bean.getRoomnum())); break; @@ -2289,7 +2289,7 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis noble.setRootView(bean.getUhead(), bean.getUname(), bean.getAncherName(), - bean.getAnchorUid()) + bean.getRoomnum()) .setRoleType(NobleNoticeView.RoleType.MARQUIS) .setCallBack(() -> gotoLive(bean.getRoomnum())); break; @@ -2297,7 +2297,7 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis noble.setRootView(bean.getUhead(), bean.getUname(), bean.getAncherName(), - bean.getAnchorUid()) + bean.getRoomnum()) .setRoleType(NobleNoticeView.RoleType.DUKE) .setCallBack(() -> gotoLive(bean.getRoomnum())); break; @@ -2305,7 +2305,7 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis noble.setRootView(bean.getUhead(), bean.getUname(), bean.getAncherName(), - bean.getAnchorUid()) + bean.getRoomnum()) .setRoleType(NobleNoticeView.RoleType.KING) .setCallBack(() -> gotoLive(bean.getRoomnum())); break; @@ -2313,7 +2313,7 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis noble.setRootView(bean.getUhead(), bean.getUname(), bean.getAncherName(), - bean.getAnchorUid()) + bean.getRoomnum()) .setRoleType(NobleNoticeView.RoleType.EMPEROR) .setCallBack(() -> gotoLive(bean.getRoomnum())); break; @@ -2321,7 +2321,7 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis noble.setRootView(bean.getUhead(), bean.getUname(), bean.getAncherName(), - bean.getAnchorUid()) + bean.getRoomnum()) .setRoleType(NobleNoticeView.RoleType.BETTER_EMPEROR) .setCallBack(() -> gotoLive(bean.getRoomnum())); break;