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 8088cbd92..46ee47367 100644
--- a/live/src/main/java/com/yunbao/live/views/LiveRoomViewHolder.java
+++ b/live/src/main/java/com/yunbao/live/views/LiveRoomViewHolder.java
@@ -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,17 +519,20 @@ 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 Group newGodSayGroup;
private View goddessSayBgView;
private TextView goddessSayTitleTv;
@@ -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);
@@ -2424,7 +2423,7 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
public void closePrankView() {
if (prank_group.getVisibility() == View.VISIBLE) {
prank_group.setVisibility(View.GONE);
- // prank_small_icon.setVisibility(View.VISIBLE);
+ // prank_small_icon.setVisibility(View.VISIBLE);
zhengguTv.setVisibility(View.VISIBLE);
}
}
@@ -2463,7 +2462,7 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
@Override
public void onError(String error) {
prank_group.setVisibility(View.GONE);
- // prank_small_icon.setVisibility(View.GONE);
+ // prank_small_icon.setVisibility(View.GONE);
zhengguTv.setVisibility(View.GONE);
prank_group_turntable_icon.setVisibility(View.GONE);
ToastUtil.show(WordUtil.isNewZh() ? "抱歉!出錯了!" : "i \\'m sorry! An error occurred");
@@ -2605,7 +2604,7 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
}
} else {
prank_group.setVisibility(View.GONE);
- // prank_small_icon.setVisibility(View.GONE);
+ // prank_small_icon.setVisibility(View.GONE);
zhengguTv.setVisibility(View.GONE);
}
if (CommonAppConfig.getInstance().getUid().equals(mLiveUid)) {
@@ -2639,7 +2638,7 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
}
} else {
prank_group.setVisibility(View.GONE);
- // prank_small_icon.setVisibility(View.GONE);
+ // prank_small_icon.setVisibility(View.GONE);
zhengguTv.setVisibility(View.GONE);
}
}
@@ -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,12 +3449,20 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
if (wishlist.size() > 0) {
this.wishlist = wishlist;
//wishlistLayout.setVisibility(View.VISIBLE);
- Log.i("nwq","initWishList VISIBLE");
- newWishGroup.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");
- newWishGroup.setVisibility(View.GONE);
+ Log.i("nwq", "initWishList GONE");
+ if (isAnchorLive()){
+ stopPart2Flipper(wishFlipperRoot);
+ }else {
+ newWishGroup.setVisibility(View.GONE);
+ }
}
}
@@ -4240,9 +4296,9 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
if (mLiveUid.contains(String.valueOf(IMLoginManager.get(mContext).getUserInfo().getId()))) {
mSendMoneyLongModel = sendMoneyLongModel;
sendMoneyTime = Long.parseLong(sendMoneyLongModel.getCountdown());
- // participation_time.removeCallbacks(sendMoneyRunnable);
+ // participation_time.removeCallbacks(sendMoneyRunnable);
newDragonTv.removeCallbacks(sendMoneyRunnable);
- // dragonImmediateParticipationTime.setVisibility(View.VISIBLE);
+ // dragonImmediateParticipationTime.setVisibility(View.VISIBLE);
setDragonTime(true);
// if (redPacket.getVisibility() == View.VISIBLE) {
// RelativeLayout.LayoutParams layoutParams = (RelativeLayout.LayoutParams) dragonImmediateParticipation.getLayoutParams();
@@ -4259,7 +4315,7 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
// participation_time.post(sendMoneyRunnable);
newDragonTv.post(sendMoneyRunnable);
} else {
- setDragonTime(false);
+ setDragonTime(false);
// dragonImmediateParticipation.setVisibility(View.VISIBLE);
// if (redPacket.getVisibility() == View.VISIBLE) {
// RelativeLayout.LayoutParams layoutParams = (RelativeLayout.LayoutParams) dragonImmediateParticipation.getLayoutParams();
@@ -4275,7 +4331,7 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
}
public void onSendMoneyLongEndEvent(SendMoneyLongEndEvent moneyLongEndEvent) {
- newDragonGroup.setVisibility(View.GONE);
+ newDragonGroup.setVisibility(View.GONE);
// if (mLiveUid.contains(String.valueOf(IMLoginManager.get(mContext).getUserInfo().getId()))) {
// dragonImmediateParticipationTime.setVisibility(View.GONE);
// if (redPacket.getVisibility() == View.VISIBLE) {
@@ -4319,7 +4375,7 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
};
public void onSendMoneyLong() {
- setDragonTime(false);
+ setDragonTime(false);
// dragonImmediateParticipation.setVisibility(View.VISIBLE);
// if (redPacket.getVisibility() == View.VISIBLE) {
// RelativeLayout.LayoutParams layoutParams = (RelativeLayout.LayoutParams) dragonImmediateParticipation.getLayoutParams();
@@ -4332,6 +4388,11 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
// }
}
+
+ private void findViewByTag(View view, Object tag) {
+ view.findViewWithTag("giftWall");
+ }
+
/**
* 设置礼物墙和周星榜
*/
@@ -4339,17 +4400,45 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
newWeekGroup = findViewById(R.id.newWeekGroup);
if (!TextUtils.isEmpty(giftWallLightenNumber) && !TextUtils.isEmpty(giftWallLightenTotal)) {
- // 初始化周星榜相关控件
- newWeekGroup.setVisibility(View.VISIBLE);
- newWeekBgView = findViewById(R.id.newWeekBgView);
- newWeekNowTv = findViewById(R.id.newWeekNowTv);
- newWeekTotalTv = findViewById(R.id.newWeekTotalTv);
- weekProgressbar = findViewById(R.id.week_progressbar);
+ 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");
+ }
- newWeekNowTv.setText(giftWallLightenNumber);
- newWeekTotalTv.setText("/" + giftWallLightenTotal);
- weekProgressbar.setMax(Integer.parseInt(giftWallLightenTotal));
- weekProgressbar.setProgress(Integer.parseInt(giftWallLightenNumber));
+ 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);
+ newWeekNowTv = findViewById(R.id.newWeekNowTv);
+ newWeekTotalTv = findViewById(R.id.newWeekTotalTv);
+ weekProgressbar = findViewById(R.id.week_progressbar);
+
+ newWeekNowTv.setText(giftWallLightenNumber);
+ newWeekTotalTv.setText("/" + giftWallLightenTotal);
+ weekProgressbar.setMax(Integer.parseInt(giftWallLightenTotal));
+ weekProgressbar.setProgress(Integer.parseInt(giftWallLightenNumber));
//
// gift_number = findViewById(R.id.gift_number);
@@ -4359,14 +4448,22 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
// gift_total.setText("/" + giftWallLightenTotal);
// gift_progressbar.setMax(Integer.parseInt(giftWallLightenTotal));
// gift_progressbar.setProgress(Integer.parseInt(giftWallLightenNumber));
- ViewClicksAntiShake.clicksAntiShake(newWeekBgView, new ViewClicksAntiShake.ViewClicksCallBack() {
- @Override
- public void onViewClicks() {
- new com.yunbao.common.dialog.GiftWallDialog(mContext, mLiveUid, mAnchorName, mLiveUid, true).setFullWindows(false).showDialog();
- }
- });
+ ViewClicksAntiShake.clicksAntiShake(newWeekBgView, new ViewClicksAntiShake.ViewClicksCallBack() {
+ @Override
+ public void onViewClicks() {
+ new com.yunbao.common.dialog.GiftWallDialog(mContext, mLiveUid, mAnchorName, mLiveUid, true).setFullWindows(false).showDialog();
+ }
+ });
+ }
+
+
} else {
- newWeekGroup.setVisibility(View.GONE);
+ 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()));
- newWishGroup.setVisibility(View.VISIBLE);
- Log.i("nwq","initWishListData");
- ViewClicksAntiShake.clicksAntiShake(newWeekBgView, new ViewClicksAntiShake.ViewClicksCallBack() {
+ if (isAnchorLive()){
+ startNewPart2Flipper(wishFlipperRoot);
+ }else {
+ newWishGroup.setVisibility(View.VISIBLE);
+ }
+ Log.i("nwq", "initWishListData");
+ ViewClicksAntiShake.clicksAntiShake(newWishBgView, new ViewClicksAntiShake.ViewClicksCallBack() {
@Override
public void onViewClicks() {
MobclickAgent.onEvent(mContext, "live_room_wish", "心愿单按钮");
@@ -6863,14 +6964,13 @@ 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);
}
contentTv.setText(data.getLivePreview().getContent());
- // ImgLoader.display(mContext, preview.getStyleImage(), mAnchorSayImage);
+ // ImgLoader.display(mContext, preview.getStyleImage(), mAnchorSayImage);
if (preview.getIsShow() == 1) {
mAnchorSay.setVisibility(View.VISIBLE);
newGodSayGroup.setVisibility(View.GONE);
@@ -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");
- newWishGroup.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");
- newWishGroup.setVisibility(View.GONE);
+ Log.i("nwq", "updateTopBanner GONE");
+ if (isAnchorLive()){
+ stopPart2Flipper(wishFlipperRoot);
+ }else {
+ newWishGroup.setVisibility(View.GONE);
+ }
}
}
public void initWishListView() {
- 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);
+ 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);
diff --git a/live/src/main/res/layout/view_live_room.xml b/live/src/main/res/layout/view_live_room.xml
index 3df61433c..2ce052307 100644
--- a/live/src/main/res/layout/view_live_room.xml
+++ b/live/src/main/res/layout/view_live_room.xml
@@ -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" />
+ tools:visibility="invisible" />
+
+
+ tools:visibility="gone" />
+
\ No newline at end of file
diff --git a/live/src/main/res/layout/view_live_room_part2_item.xml b/live/src/main/res/layout/view_live_room_part2_item.xml
new file mode 100644
index 000000000..a3e0114c4
--- /dev/null
+++ b/live/src/main/res/layout/view_live_room_part2_item.xml
@@ -0,0 +1,78 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file