From c033340aadc0e479a9cf13e8ef92791ef523ca5b Mon Sep 17 00:00:00 2001 From: zlzw <583819556@qq.com> Date: Fri, 24 May 2024 14:49:14 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E9=A6=96=E9=A1=B5=E5=8F=B3?= =?UTF-8?q?=E4=B8=8B=E8=A7=92=E6=82=AC=E6=B5=AE=E5=B1=82=E9=9A=90=E8=97=8F?= =?UTF-8?q?=E6=98=BE=E7=A4=BA=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../live/views/PortraitLiveManager.java | 2 +- .../yunbao/main/activity/MainActivity.java | 66 ++++++++++++++----- .../yunbao/main/views/MainHomeViewHolder.java | 8 +-- 3 files changed, 55 insertions(+), 21 deletions(-) diff --git a/live/src/main/java/com/yunbao/live/views/PortraitLiveManager.java b/live/src/main/java/com/yunbao/live/views/PortraitLiveManager.java index 92f1f4996..f266f585b 100644 --- a/live/src/main/java/com/yunbao/live/views/PortraitLiveManager.java +++ b/live/src/main/java/com/yunbao/live/views/PortraitLiveManager.java @@ -323,7 +323,7 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe public void run() { loading.setVisibility(View.GONE); enterRoomLeaveHandler.post(enterRoomLeaveRunnable); - ToastUtil.show(mContext.getString(R.string.net_error) + " :500");//异常下播,等待加载时间过了后弹出 + //ToastUtil.show(mContext.getString(R.string.net_error) + " :500");//异常下播,等待加载时间过了后弹出 } }; diff --git a/main/src/main/java/com/yunbao/main/activity/MainActivity.java b/main/src/main/java/com/yunbao/main/activity/MainActivity.java index 60c1a7fa3..5a35b8efb 100644 --- a/main/src/main/java/com/yunbao/main/activity/MainActivity.java +++ b/main/src/main/java/com/yunbao/main/activity/MainActivity.java @@ -51,6 +51,7 @@ import com.tencent.imsdk.v2.V2TIMManager; import com.tencent.imsdk.v2.V2TIMSDKConfig; import com.tencent.imsdk.v2.V2TIMSDKListener; import com.tencent.imsdk.v2.V2TIMUserFullInfo; +import com.yunbao.common.dialog.DebugDialog; import com.yunbao.common.utils.MobclickAgent; import com.yunbao.common.CommonAppConfig; import com.yunbao.common.Constants; @@ -517,8 +518,20 @@ public class MainActivity extends AbsActivity implements MainAppBarLayoutListene mTabButtonGroup.addTabButtonGroupChangeListener((view, index) -> { if (index == 0) { - isfloatBannernet = true; - initAnchorRecommendBanner(); + // isfloatBannernet = true; + // initAnchorRecommendBanner(); + if (floatEventShow) { + if (floatWarOrder.getTag() != null) { + floatWarOrder.setVisibility(View.VISIBLE); + } else { + floatWarOrder.setVisibility(View.GONE); + if (floatBanner.getTag() != null) { + floatBanner.setVisibility(View.VISIBLE); + } else { + floatBanner.setVisibility(View.GONE); + } + } + } } else if (index == 2) { floatBanner.setVisibility(View.GONE); floatRedPacket.setVisibility(View.GONE); @@ -621,30 +634,26 @@ public class MainActivity extends AbsActivity implements MainAppBarLayoutListene if (isFinishing()) return; if (data.getListShow() == 1 && data.getList().size() > 2) { floatBanner.setVisibility(View.VISIBLE); + floatBanner.setTag(data); findViewById(R.id.banner_click).setVisibility(View.VISIBLE); floatBanner.showBanner(data.getList()); } else { floatBanner.setVisibility(View.GONE); + floatBanner.setTag(null); findViewById(R.id.banner_click).setVisibility(View.GONE); } - if (data.getShowRedPacket() == 0) { - floatRedPacket.setVisibility(View.GONE); - } else { - floatRedPacket.setVisibility(View.VISIBLE); - ((ProgressBar) floatRedPacket.findViewById(R.id.progress)).setMax(data.getRedPacketTotal()); - ((ProgressBar) floatRedPacket.findViewById(R.id.progress)).setProgress(data.getRedPacketNum()); - ((TextView) floatRedPacket.findViewById(R.id.progressText)).setText(data.getRedPacketNum() + "/" + data.getRedPacketTotal()); - } if (data.getShowWarOrder() == 0) { floatWarOrder.setVisibility(View.GONE); floatWarOrder.setTag(null); //战令关闭情况下,在判断一次Banner是否足够 if (data.getListShow() == 1 && data.getList().size() > 2) { floatBanner.setVisibility(View.VISIBLE); + floatBanner.setTag(data); findViewById(R.id.banner_click).setVisibility(View.VISIBLE); floatBanner.showBanner(data.getList()); } else { floatBanner.setVisibility(View.GONE); + floatBanner.setTag(null); findViewById(R.id.banner_click).setVisibility(View.GONE); } } else { @@ -657,8 +666,17 @@ public class MainActivity extends AbsActivity implements MainAppBarLayoutListene } floatBanner.setVisibility(View.GONE); + floatBanner.setTag(null); findViewById(R.id.banner_click).setVisibility(View.GONE); } + if (data.getShowRedPacket() == 0) { + floatRedPacket.setVisibility(View.GONE); + } else if (floatWarOrder.getTag() == null && floatWarOrder.getTag() == null) { + floatRedPacket.setVisibility(View.VISIBLE); + ((ProgressBar) floatRedPacket.findViewById(R.id.progress)).setMax(data.getRedPacketTotal()); + ((ProgressBar) floatRedPacket.findViewById(R.id.progress)).setProgress(data.getRedPacketNum()); + ((TextView) floatRedPacket.findViewById(R.id.progressText)).setText(data.getRedPacketNum() + "/" + data.getRedPacketTotal()); + } } @@ -1499,18 +1517,34 @@ public class MainActivity extends AbsActivity implements MainAppBarLayoutListene } } + boolean floatEventShow = true; + @Subscribe(threadMode = ThreadMode.MAIN) public void onFloatWarOrderEvent(FloatWarOrderEvent event) { - /* if (event.isFloatWarOrder()) { - floatWarOrder.setVisibility(View.GONE); + System.out.println("FloatWarOrderEvent:事件" + event.isFloatWarOrder()); + System.out.println("战令:" + floatWarOrder.getTag()); + System.out.println("Banner:" + floatBanner.getTag()); + floatEventShow = event.isFloatWarOrder(); + if (event.isFloatWarOrder()) { + if (floatWarOrder.getTag() == null) { + floatWarOrder.setVisibility(View.GONE); + } else { + floatWarOrder.setVisibility(View.VISIBLE); + } + if (floatBanner.getTag() == null) { + floatBanner.setVisibility(View.GONE); + } else { + floatBanner.setVisibility(View.VISIBLE); + } } else { - floatWarOrder.setVisibility(View.VISIBLE); - }*/ - if(floatWarOrder.getTag()!=null){ + floatBanner.setVisibility(View.GONE); + floatWarOrder.setVisibility(View.GONE); + } + /* if(floatWarOrder.getTag()!=null){ floatWarOrder.setVisibility(View.VISIBLE); }else{ floatWarOrder.setVisibility(View.GONE); - } + }*/ } private void initRedPacket() { diff --git a/main/src/main/java/com/yunbao/main/views/MainHomeViewHolder.java b/main/src/main/java/com/yunbao/main/views/MainHomeViewHolder.java index 39c8120e9..995c72a96 100644 --- a/main/src/main/java/com/yunbao/main/views/MainHomeViewHolder.java +++ b/main/src/main/java/com/yunbao/main/views/MainHomeViewHolder.java @@ -85,22 +85,22 @@ public class MainHomeViewHolder extends AbsMainHomeParentViewHolder { case 0: floatWarOrder = false; MobclickAgent.onEvent(mContext, "home_page_follow", "首页关注列表按钮"); - EventBus.getDefault().post(new FloatWarOrderEvent().setFloatWarOrder(false)); + EventBus.getDefault().post(new FloatWarOrderEvent().setFloatWarOrder(true)); break; case 1: floatWarOrder = false; MobclickAgent.onEvent(mContext, "home_page_hot", "首页热门列表按钮"); - EventBus.getDefault().post(new FloatWarOrderEvent().setFloatWarOrder(false)); + EventBus.getDefault().post(new FloatWarOrderEvent().setFloatWarOrder(true)); break; case 2: floatWarOrder = false; MobclickAgent.onEvent(mContext, "home_page_recommend", "首页推荐列表按钮"); - EventBus.getDefault().post(new FloatWarOrderEvent().setFloatWarOrder(false)); + EventBus.getDefault().post(new FloatWarOrderEvent().setFloatWarOrder(true)); break; case 3: floatWarOrder = true; MobclickAgent.onEvent(mContext, "home_page_redpk", "首页红包列表按钮"); - EventBus.getDefault().post(new FloatWarOrderEvent().setFloatWarOrder(true)); + EventBus.getDefault().post(new FloatWarOrderEvent().setFloatWarOrder(false)); break; } if (mViewHolders == null) {