心愿榜 主播和普通用户做区别

This commit is contained in:
ningwenqiang 2024-09-18 15:52:34 +08:00
parent 330cf1faa2
commit a55f370871
4 changed files with 281 additions and 63 deletions

View File

@ -332,8 +332,8 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
static ImageView pk5Ico;
static RelativeLayout pk5;
Group mic_view,mic_view1,mic_view2;
View video_chat_bg1,video_chat_bg2,video_chat_bg3;
Group mic_view, mic_view1, mic_view2;
View video_chat_bg1, video_chat_bg2, video_chat_bg3;
static ImageView mic_ico;
@ -460,7 +460,7 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
public static SVGAVideoEntity drawableTitleEn;
public static SVGAVideoEntity drawableBg;
// private LinearLayout giftLayout;
// private LinearLayout giftLayout;
// private TextView gift_number;
// private TextView gift_total;
// private ProgressBar gift_progressbar;
@ -519,15 +519,18 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
private ProgressBar wish_progressbar;
private Group newWishGroup;
private View wishFlipperRoot;
// 周星榜相关控件
private View newWeekBgView;
// private ImageView newWeekImg;
// private ImageView newWeekImg;
// private TextView newWeekTitleTv;
private TextView newWeekNowTv;
private TextView newWeekTotalTv;
private ProgressBar weekProgressbar;
private Group newWeekGroup;
public ViewFlipper newPart2Flipper;
//
private Group newGodSayGroup;
private View goddessSayBgView;
@ -1661,10 +1664,11 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
mAnchorSay = findViewById(R.id.anchor_say_layout);
titleTv = findViewById(R.id.titleTv);
contentTv = findViewById(R.id.contentTv);
mAnchorSayImage= findViewById(R.id.anchorSayImage);
mAnchorSayImage = findViewById(R.id.anchorSayImage);
goddessSayTitleTv = findViewById(R.id.goddessSayTitleTv);
newGodSayGroup =findViewById(R.id.newGodSayGroup);
goddessSayBgView =findViewById(R.id.goddessSayBgView);
newGodSayGroup = findViewById(R.id.newGodSayGroup);
goddessSayBgView = findViewById(R.id.goddessSayBgView);
newPart2Flipper = findViewById(R.id.wishViewFlipper);
mAnchorSay.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
@ -1864,7 +1868,7 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
fans_btn = (LinearLayout) findViewById(R.id.fans_btn);
mAnchorLayout = findViewById(R.id.group_1);
liveRankPk2 = (LinearLayout) findViewById(R.id.live_rank_pk2);
findViewById(R.id.topLayout1_line).setVisibility(isAnchorLive()?View.GONE:View.VISIBLE);
findViewById(R.id.topLayout1_line).setVisibility(isAnchorLive() ? View.GONE : View.VISIBLE);
mGoodNumberIcon = (ImageView) findViewById(R.id.good_nub_ico);
pkRankLayout = (FrameLayout) findViewById(R.id.live_rank_pk);
pkRankVf = (ViewFlipper) findViewById(R.id.rank_pk_vf);
@ -2152,8 +2156,6 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
});
//redPacket = findViewById(R.id.red_packet);
// redPacketCountdown = (TextView) findViewById(R.id.red_packet_countdown);
// redSchedule = (TextView) findViewById(R.id.red_schedule);
@ -2258,9 +2260,6 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
combo_layout.setVisibility(View.GONE);
// dragonImmediateParticipation = (RelativeLayout) findViewById(R.id.dragon_immediate_participation);
// dragonImmediateParticipationTime = (RelativeLayout) findViewById(R.id.dragon_immediate_participation_time);
// participation_time = (TextView) findViewById(R.id.participation_time);
@ -3394,6 +3393,55 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
});
}
/**
* 启动新的翻转动画
* 本方法主要用于启动一个翻转动画器当添加新的视图时如果视图容器中
* 的视图数量超过一个则启动翻转动画以实现视图的翻转效果
*
* @param view 要添加到翻转动画器的视图
*/
private void startNewPart2Flipper(View view){
if(view == null)
return;
// 获取当前翻转动画器中的视图数量
newPart2Flipper.getChildCount();
// 检查传入的视图是否已存在于翻转动画器中
if (newPart2Flipper.indexOfChild(view) == -1) {
// 如果视图不存在则将其添加到翻转动画器中
newPart2Flipper.addView(view);
}
// 如果翻转动画器中的视图数量超过一个
if (newPart2Flipper.getChildCount() > 1) {
// 启动翻转动画以便于多个视图可以进行翻转显示
newPart2Flipper.startFlipping();
}
}
/**
* 停止第二个部分的翻页器并移除指定的视图
* 这个方法主要用于管理第二个部分翻页器中的视图当需要移除某个视图并可能停止翻页器时调用
*
* @param view 要从翻页器中移除的视图
*/
private void stopPart2Flipper(View view){
if(view == null)
return;
// 获取翻页器中当前的子视图数量以判断是否满足停止翻页的条件
newPart2Flipper.getChildCount();
// 检查指定的视图是否存在于翻页器中如果存在则移除它
if (newPart2Flipper.indexOfChild(view) != -1) {
newPart2Flipper.removeView(view);
}
// 如果翻页器中的子视图数量小于等于1则停止翻页器的翻页动作
// 这是因为翻页器通常需要至少两个视图来展示翻页效果当视图数量不足时翻页变得没有意义
if (newPart2Flipper.getChildCount() <=1) {
newPart2Flipper.stopFlipping();
}
}
/**
* 初始化心愿单列表轮播
*/
@ -3401,14 +3449,22 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
if (wishlist.size() > 0) {
this.wishlist = wishlist;
//wishlistLayout.setVisibility(View.VISIBLE);
Log.i("nwq","initWishList VISIBLE");
Log.i("nwq", "initWishList VISIBLE");
if (isAnchorLive()){
startNewPart2Flipper(wishFlipperRoot);
}else {
newWishGroup.setVisibility(View.VISIBLE);
}
} else {
//wishlistLayout.setVisibility(View.GONE);
Log.i("nwq","initWishList GONE");
Log.i("nwq", "initWishList GONE");
if (isAnchorLive()){
stopPart2Flipper(wishFlipperRoot);
}else {
newWishGroup.setVisibility(View.GONE);
}
}
}
public void initHourRank(RankHourModel model) {
if (flipper.getChildCount() > 0) {
@ -4332,6 +4388,11 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
// }
}
private void findViewByTag(View view, Object tag) {
view.findViewWithTag("giftWall");
}
/**
* 设置礼物墙和周星榜
*/
@ -4339,6 +4400,34 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
newWeekGroup = findViewById(R.id.newWeekGroup);
if (!TextUtils.isEmpty(giftWallLightenNumber) && !TextUtils.isEmpty(giftWallLightenTotal)) {
if (isAnchorLive()) {
View view = newPart2Flipper.findViewWithTag("giftWall");
if (view == null) {
view = LayoutInflater.from(mContext).inflate(R.layout.view_live_room_part2_item, null);
view.setTag("giftWall");
}
View newItemBgView = view.findViewById(R.id.newItemBgView);
// ImageView newItemImg = view.findViewById(R.id.newItemImg);
// TextView newItemTitleTv = view.findViewById(R.id.newItemTitleTv);
TextView newItemNowTv = view.findViewById(R.id.newItemNowTv);
TextView newItemTotalTv = view.findViewById(R.id.newItemTotalTv);
ProgressBar itemProgressbar = view.findViewById(R.id.itemProgressbar);
TextView newItemTitleTv = view.findViewById(R.id.newItemTitleTv);
newItemTitleTv.setText(R.string.live_room_gift);
newItemNowTv.setText(giftWallLightenNumber);
newItemTotalTv.setText("/" + giftWallLightenTotal);
itemProgressbar.setMax(Integer.parseInt(giftWallLightenTotal));
itemProgressbar.setProgress(Integer.parseInt(giftWallLightenNumber));
ViewClicksAntiShake.clicksAntiShake(newItemBgView, new ViewClicksAntiShake.ViewClicksCallBack() {
@Override
public void onViewClicks() {
new com.yunbao.common.dialog.GiftWallDialog(mContext, mLiveUid, mAnchorName, mLiveUid, true).setFullWindows(false).showDialog();
}
});
startNewPart2Flipper(view);
} else {
// 初始化周星榜相关控件
newWeekGroup.setVisibility(View.VISIBLE);
newWeekBgView = findViewById(R.id.newWeekBgView);
@ -4365,10 +4454,18 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
new com.yunbao.common.dialog.GiftWallDialog(mContext, mLiveUid, mAnchorName, mLiveUid, true).setFullWindows(false).showDialog();
}
});
}
} else {
if (isAnchorLive()) {
View view = newPart2Flipper.findViewWithTag("giftWall");
stopPart2Flipper(view);
}else {
newWeekGroup.setVisibility(View.GONE);
}
}
}
/**
* 守护信息发生变化
@ -6224,9 +6321,13 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
newWishTotalTv.setText("/" + model.getWishlistNum());
wish_progressbar.setMax(Integer.parseInt(model.getWishlistNum()));
wish_progressbar.setProgress(Integer.parseInt(model.getWishlistProgress()));
if (isAnchorLive()){
startNewPart2Flipper(wishFlipperRoot);
}else {
newWishGroup.setVisibility(View.VISIBLE);
Log.i("nwq","initWishListData");
ViewClicksAntiShake.clicksAntiShake(newWeekBgView, new ViewClicksAntiShake.ViewClicksCallBack() {
}
Log.i("nwq", "initWishListData");
ViewClicksAntiShake.clicksAntiShake(newWishBgView, new ViewClicksAntiShake.ViewClicksCallBack() {
@Override
public void onViewClicks() {
MobclickAgent.onEvent(mContext, "live_room_wish", "心愿单按钮");
@ -6863,9 +6964,8 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
sayModel = data;
LiveAnchorSayModel.LivePreview preview = data.getLivePreview();
if (preview != null) {
String title=data.getLivePreview().getTitle();
if (!TextUtils.isEmpty(title))
{
String title = data.getLivePreview().getTitle();
if (!TextUtils.isEmpty(title)) {
titleTv.setText(title);
goddessSayTitleTv.setText(title);
}
@ -6957,22 +7057,48 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
if (!TextUtils.isEmpty(wishListProgress.getWishlistName()) || !TextUtils.isEmpty(wishListProgress.getWishlistProgress())) {
initWishListData(wishListProgress);
//wishlistLayout.setVisibility(View.VISIBLE);
Log.i("nwq","updateTopBanner VISIBLE");
Log.i("nwq", "updateTopBanner VISIBLE");
if (isAnchorLive()){
startNewPart2Flipper(wishFlipperRoot);
}else {
newWishGroup.setVisibility(View.VISIBLE);
}
} else {
//wishlistLayout.setVisibility(View.GONE);
Log.i("nwq","updateTopBanner GONE");
Log.i("nwq", "updateTopBanner GONE");
if (isAnchorLive()){
stopPart2Flipper(wishFlipperRoot);
}else {
newWishGroup.setVisibility(View.GONE);
}
}
}
public void initWishListView() {
if (isAnchorLive()) {
wishFlipperRoot = newPart2Flipper.findViewWithTag("wishList");
if (wishFlipperRoot == null) {
wishFlipperRoot = LayoutInflater.from(mContext).inflate(R.layout.view_live_room_part2_item, null);
wishFlipperRoot.setTag("wishList");
//newPart2Flipper.addView(view);
}
newWishBgView = wishFlipperRoot.findViewById(R.id.newItemBgView);
newWishImg = wishFlipperRoot.findViewById(R.id.newItemImg);
newWishNowTv = wishFlipperRoot.findViewById(R.id.newItemNowTv);
TextView newItemTitleTv = wishFlipperRoot.findViewById(R.id.newItemTitleTv);
newItemTitleTv.setText(R.string.live_room_wishlist);
newWishTotalTv = wishFlipperRoot.findViewById(R.id.newItemTotalTv);
wish_progressbar= wishFlipperRoot.findViewById(R.id.itemProgressbar);
} else {
newWishBgView = findViewById(R.id.newWishBgView);
newWishImg = findViewById(R.id.newWishImg);
newWishNowTv = findViewById(R.id.newWishNowTv);
newWishTotalTv = findViewById(R.id.newWishTotalTv);
wish_progressbar = findViewById(R.id.wish_progressbar);
newWishGroup = findViewById(R.id.newWishGroup);
}
// wishlistLayout = findViewById(R.id.wishlistLayout);
// wish_icon = findViewById(R.id.wish_icon);
// wish_number = findViewById(R.id.wish_number);

View File

@ -2540,6 +2540,8 @@
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_marginTop="190dp"
android:visibility="gone"
tools:visibility="visible"
android:layout_marginRight="10dp" />
<com.yunbao.common.views.weight.FullServiceNotificationView

View File

@ -197,8 +197,18 @@
android:layout_height="wrap_content"
android:visibility="gone"
app:constraint_referenced_ids="newWishBgView,newWishImg,newWishTitleTv,newWishNowTv,newWishTotalTv,wish_progressbar"
tools:visibility="visible" />
tools:visibility="invisible" />
<ViewFlipper
android:id="@+id/wishViewFlipper"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_marginEnd="10dp"
android:flipInterval="5000"
tools:background="@drawable/bg_live_item_rank"
app:layout_constraintDimensionRatio="2.4"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent"/>
<!--周星榜-->
<View
@ -278,6 +288,7 @@
app:constraint_referenced_ids="newWeekBgView,newWeekImg,newWeekTitleTv,newWeekNowTv,newWeekTotalTv,week_progressbar"
tools:visibility="visible" />
<!-- 女神说的 -->
<View
android:id="@+id/goddessSayBgView"
android:layout_width="0dp"
@ -323,7 +334,8 @@
android:layout_height="wrap_content"
android:visibility="gone"
app:constraint_referenced_ids="goddessSayBgView,goddessSayTitleTv,goddessSayImg"
tools:visibility="visible" />
tools:visibility="gone" />
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@ -0,0 +1,78 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:layout_height="36dp">
<View
android:id="@+id/newItemBgView"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_marginEnd="10dp"
android:background="@drawable/bg_live_item_rank"
app:layout_constraintDimensionRatio="2.4"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<ImageView
android:id="@+id/newItemImg"
android:layout_width="0dp"
android:layout_height="0dp"
android:src="@mipmap/ic_live_week_rank"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintDimensionRatio="1.05"
app:layout_constraintEnd_toEndOf="@+id/newItemBgView"
app:layout_constraintHeight_percent="0.64"
app:layout_constraintHorizontal_bias="0.87"
app:layout_constraintStart_toStartOf="@+id/newItemBgView"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/newItemTitleTv"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="7dp"
android:layout_marginTop="1dp"
android:text="@string/live_wks"
android:textColor="#FFFFFF"
android:textSize="9sp"
app:layout_constraintStart_toStartOf="@+id/newItemBgView"
app:layout_constraintTop_toTopOf="@+id/newItemBgView" />
<TextView
android:id="@+id/newItemNowTv"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="#FFC949 "
android:textSize="12sp"
app:layout_constraintStart_toStartOf="@+id/newItemTitleTv"
app:layout_constraintTop_toBottomOf="@+id/newItemTitleTv"
tools:text="5" />
<TextView
android:id="@+id/newItemTotalTv"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="bottom"
android:textColor="#FFFFFF"
android:textSize="10sp"
app:layout_constraintBottom_toBottomOf="@+id/newItemNowTv"
app:layout_constraintStart_toEndOf="@+id/newItemNowTv"
tools:text="/26" />
<ProgressBar
android:id="@+id/itemProgressbar"
style="@android:style/Widget.ProgressBar.Horizontal"
android:layout_width="0dp"
android:layout_height="2dp"
android:layout_marginEnd="10dp"
android:progressDrawable="@drawable/bg_gift_progressbar"
app:layout_constraintEnd_toStartOf="@+id/newItemImg"
app:layout_constraintStart_toStartOf="@+id/newItemTitleTv"
app:layout_constraintTop_toBottomOf="@+id/newItemNowTv"
tools:progress="10" />
</androidx.constraintlayout.widget.ConstraintLayout>