心愿榜 主播和普通用户做区别
This commit is contained in:
parent
330cf1faa2
commit
a55f370871
@ -519,6 +519,8 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
|
||||
private ProgressBar wish_progressbar;
|
||||
private Group newWishGroup;
|
||||
|
||||
private View wishFlipperRoot;
|
||||
|
||||
// 周星榜相关控件
|
||||
private View newWeekBgView;
|
||||
// private ImageView newWeekImg;
|
||||
@ -528,6 +530,7 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
|
||||
private ProgressBar weekProgressbar;
|
||||
private Group newWeekGroup;
|
||||
|
||||
public ViewFlipper newPart2Flipper;
|
||||
//
|
||||
private Group newGodSayGroup;
|
||||
private View goddessSayBgView;
|
||||
@ -1665,6 +1668,7 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
|
||||
goddessSayTitleTv = findViewById(R.id.goddessSayTitleTv);
|
||||
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) {
|
||||
@ -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();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 初始化心愿单列表轮播
|
||||
*/
|
||||
@ -3402,13 +3450,21 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
|
||||
this.wishlist = wishlist;
|
||||
//wishlistLayout.setVisibility(View.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");
|
||||
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() {
|
||||
ViewClicksAntiShake.clicksAntiShake(newWishBgView, new ViewClicksAntiShake.ViewClicksCallBack() {
|
||||
@Override
|
||||
public void onViewClicks() {
|
||||
MobclickAgent.onEvent(mContext, "live_room_wish", "心愿单按钮");
|
||||
@ -6864,8 +6965,7 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
|
||||
LiveAnchorSayModel.LivePreview preview = data.getLivePreview();
|
||||
if (preview != null) {
|
||||
String title = data.getLivePreview().getTitle();
|
||||
if (!TextUtils.isEmpty(title))
|
||||
{
|
||||
if (!TextUtils.isEmpty(title)) {
|
||||
titleTv.setText(title);
|
||||
goddessSayTitleTv.setText(title);
|
||||
}
|
||||
@ -6958,21 +7058,47 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
|
||||
initWishListData(wishListProgress);
|
||||
//wishlistLayout.setVisibility(View.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");
|
||||
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);
|
||||
|
@ -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
|
||||
|
@ -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>
|
78
live/src/main/res/layout/view_live_room_part2_item.xml
Normal file
78
live/src/main/res/layout/view_live_room_part2_item.xml
Normal 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>
|
Loading…
Reference in New Issue
Block a user