From 733678532a05613f7d7819d72937fff990594975 Mon Sep 17 00:00:00 2001 From: zlzw <583819556@qq.com> Date: Mon, 28 Nov 2022 15:57:50 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E9=A6=96=E9=A1=B5Banner?= =?UTF-8?q?=E8=BF=9B=E7=9B=B4=E6=92=AD=E9=97=B4=E6=B2=A1=E6=9C=89=E5=BC=B9?= =?UTF-8?q?=E6=96=B0=E4=BA=BA=E7=89=B9=E6=83=A0=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/yunbao/common/bean/LiveBean.java | 11 +++++++++++ .../java/com/yunbao/common/utils/RouteUtil.java | 15 ++++++++++----- .../yunbao/main/views/MainHomeLiveViewHolder.java | 1 + 3 files changed, 22 insertions(+), 5 deletions(-) diff --git a/common/src/main/java/com/yunbao/common/bean/LiveBean.java b/common/src/main/java/com/yunbao/common/bean/LiveBean.java index 906107c95..b5567764b 100644 --- a/common/src/main/java/com/yunbao/common/bean/LiveBean.java +++ b/common/src/main/java/com/yunbao/common/bean/LiveBean.java @@ -8,6 +8,7 @@ import com.alibaba.fastjson.annotation.JSONField; import java.util.ArrayList; import java.util.List; +import java.util.Map; /** * Created by cxf on 2017/8/9. @@ -51,6 +52,8 @@ public class LiveBean implements Parcelable { private String recommendCardIconSizeTwo = ""; private String recommendCardIconSizeThree = ""; + private Map params;//用于跳转Activity时扩展参数,例:从首页Banner跳转到直播间时需要根据携带参数判断是否弹出新人特惠对话框 + public String getRecommendCardIconSizeTwo() { return recommendCardIconSizeTwo; } @@ -81,6 +84,14 @@ public class LiveBean implements Parcelable { return this; } + public Map getParams() { + return params; + } + + public void setParams(Map params) { + this.params = params; + } + public String getRecommendcardtype() { return recommendCardtype; } diff --git a/common/src/main/java/com/yunbao/common/utils/RouteUtil.java b/common/src/main/java/com/yunbao/common/utils/RouteUtil.java index 8a8351275..34a1be8cd 100644 --- a/common/src/main/java/com/yunbao/common/utils/RouteUtil.java +++ b/common/src/main/java/com/yunbao/common/utils/RouteUtil.java @@ -3,6 +3,7 @@ package com.yunbao.common.utils; import android.content.Context; import android.content.Intent; +import com.alibaba.android.arouter.facade.Postcard; import com.alibaba.android.arouter.launcher.ARouter; import com.yunbao.common.CommonAppConfig; import com.yunbao.common.CommonAppContext; @@ -186,21 +187,25 @@ public class RouteUtil { * 打开直播页面 */ public static void forwardLiveAudienceActivity(LiveBean mLiveBean, int mLiveType, int mLiveSDK, int mLiveTypeVal) { - if(MicStatusManager.getInstance().isMic(mLiveBean.getUid())){ + if (MicStatusManager.getInstance().isMic(mLiveBean.getUid())) { MicStatusManager.getInstance().showDownMicDialog(CommonAppContext.activityWeakReference.get()); return; } - ARouter.getInstance().build(PATH_LIVE_AUDIENCE) + Postcard postcard = ARouter.getInstance().build(PATH_LIVE_AUDIENCE) .withBoolean(Constants.NEW_ENTER_ROOM, false) .withParcelable(Constants.LIVE_BEAN, mLiveBean) .withInt(Constants.LIVE_TYPE, mLiveType) .withInt(Constants.LIVE_SDK, mLiveSDK) - .withInt(Constants.LIVE_TYPE_VAL, mLiveTypeVal) - .navigation(); + .withInt(Constants.LIVE_TYPE_VAL, mLiveTypeVal); + if (mLiveBean.getParams() != null) { + for (String key : mLiveBean.getParams().keySet()) { + postcard.withString(key, mLiveBean.getParams().get(key)); + } + } + postcard.navigation(); } - /** * 举报个人 */ diff --git a/main/src/main/java/com/yunbao/main/views/MainHomeLiveViewHolder.java b/main/src/main/java/com/yunbao/main/views/MainHomeLiveViewHolder.java index af16cb288..ca0957320 100644 --- a/main/src/main/java/com/yunbao/main/views/MainHomeLiveViewHolder.java +++ b/main/src/main/java/com/yunbao/main/views/MainHomeLiveViewHolder.java @@ -326,6 +326,7 @@ public class MainHomeLiveViewHolder extends AbsMainHomeChildViewHolder implement if (gotoRoomKey != null && gotoRoomKey.isEmpty()) { gotoRoomKey = null; } + liveBean.setParams(gotoRoomKey); RouteUtil.forwardLiveAudienceActivity(liveBean, 0, 0, 0); } else {