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 {