From ad0282b066bcdf58b53f59be1744099248de3dea Mon Sep 17 00:00:00 2001 From: 18401019693 Date: Tue, 23 Aug 2022 10:21:34 +0800 Subject: [PATCH] =?UTF-8?q?=E7=9B=B4=E6=92=AD=E9=97=B4=E5=8F=82=E6=95=B0?= =?UTF-8?q?=E7=9A=84=E5=9B=9E=E4=BC=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../live/activity/LiveAudienceActivity.java | 20 ++++- .../yunbao/live}/adapter/FunGamesAdapter.java | 4 +- .../yunbao/live/bean/OpenParametersModel.java | 81 +++++++++++++++++++ .../yunbao/live}/dialog/LiveTotalDialog.java | 7 +- .../yunbao/live}/event/LiveAudienceEvent.java | 16 +++- .../live}/views/FunGamesViewHolder.java | 4 +- .../live/views/LiveAudienceViewHolder.java | 2 +- .../yunbao/live/views/LiveRoomViewHolder.java | 2 +- .../live/views/PortraitLiveManager.java | 38 +++++---- 9 files changed, 141 insertions(+), 33 deletions(-) rename {common/src/main/java/com/yunbao/common => live/src/main/java/com/yunbao/live}/adapter/FunGamesAdapter.java (94%) create mode 100644 live/src/main/java/com/yunbao/live/bean/OpenParametersModel.java rename {common/src/main/java/com/yunbao/common => live/src/main/java/com/yunbao/live}/dialog/LiveTotalDialog.java (96%) rename {common/src/main/java/com/yunbao/common => live/src/main/java/com/yunbao/live}/event/LiveAudienceEvent.java (73%) rename {common/src/main/java/com/yunbao/common => live/src/main/java/com/yunbao/live}/views/FunGamesViewHolder.java (93%) diff --git a/live/src/main/java/com/yunbao/live/activity/LiveAudienceActivity.java b/live/src/main/java/com/yunbao/live/activity/LiveAudienceActivity.java index 431008c80..171199895 100644 --- a/live/src/main/java/com/yunbao/live/activity/LiveAudienceActivity.java +++ b/live/src/main/java/com/yunbao/live/activity/LiveAudienceActivity.java @@ -29,8 +29,7 @@ import com.yunbao.common.bean.IMLoginModel; import com.yunbao.common.bean.UserBean; import com.yunbao.common.dialog.EffectsSettingsDialog; import com.yunbao.common.dialog.LiveChargeDialogFragment; -import com.yunbao.common.dialog.LiveTotalDialog; -import com.yunbao.common.event.LiveAudienceEvent; +import com.yunbao.live.dialog.LiveTotalDialog; import com.yunbao.common.http.CommonHttpConsts; import com.yunbao.common.http.CommonHttpUtil; import com.yunbao.common.http.HttpCallback; @@ -56,6 +55,7 @@ import com.yunbao.live.dialog.LiveMicUserDialogFragment; import com.yunbao.live.dialog.LiveWishListDialogFragment4Audience; import com.yunbao.live.dialog.SidebarLiveAudience; import com.yunbao.live.event.LinkMicTxAccEvent; +import com.yunbao.live.event.LiveAudienceEvent; import com.yunbao.live.event.LiveRoomChangeEvent; import com.yunbao.live.http.LiveHttpConsts; import com.yunbao.live.http.LiveHttpUtil; @@ -794,6 +794,22 @@ public class LiveAudienceActivity extends LiveActivity { fragment4Audience.show(((LiveAudienceActivity) mContext).getSupportFragmentManager(), "LiveWishListDialogFragmentAudience"); } break; + case OPEN_PARAMETERS: + mDanmuPrice = TextUtils.equals(event.getParametersModel().getmDanmuPrice(), mDanmuPrice) ? + mDanmuPrice : event.getParametersModel().getmDanmuPrice(); + mSocketUserType = TextUtils.equals(String.valueOf(mSocketUserType), String.valueOf(event.getParametersModel().getmSocketUserType())) ? + mSocketUserType : event.getParametersModel().getmSocketUserType(); + mChatLevel = TextUtils.equals(String.valueOf(mChatLevel), String.valueOf(event.getParametersModel().getmChatLevel())) ? + mChatLevel : event.getParametersModel().getmChatLevel(); + mDanMuLevel = TextUtils.equals(String.valueOf(mDanMuLevel), String.valueOf(event.getParametersModel().getmDanMuLevel())) ? + mDanMuLevel : event.getParametersModel().getmDanMuLevel(); + mLiveType = TextUtils.equals(String.valueOf(mLiveType), String.valueOf(event.getParametersModel().getmLiveType())) ? + mLiveType : event.getParametersModel().getmLiveType(); + mLiveTypeVal = TextUtils.equals(String.valueOf(mLiveTypeVal), String.valueOf(event.getParametersModel().getmLiveTypeVal())) ? + mLiveTypeVal : event.getParametersModel().getmLiveTypeVal(); + mLiveGuardInfo = event.getParametersModel().getmLiveGuardInfo() == null ? + mLiveGuardInfo : event.getParametersModel().getmLiveGuardInfo(); + break; } diff --git a/common/src/main/java/com/yunbao/common/adapter/FunGamesAdapter.java b/live/src/main/java/com/yunbao/live/adapter/FunGamesAdapter.java similarity index 94% rename from common/src/main/java/com/yunbao/common/adapter/FunGamesAdapter.java rename to live/src/main/java/com/yunbao/live/adapter/FunGamesAdapter.java index 575baaa88..1b3c0c726 100644 --- a/common/src/main/java/com/yunbao/common/adapter/FunGamesAdapter.java +++ b/live/src/main/java/com/yunbao/live/adapter/FunGamesAdapter.java @@ -1,4 +1,4 @@ -package com.yunbao.common.adapter; +package com.yunbao.live.adapter; import android.view.LayoutInflater; import android.view.View; @@ -9,7 +9,7 @@ import androidx.recyclerview.widget.RecyclerView; import com.yunbao.common.R; import com.yunbao.common.bean.ActiveModel; -import com.yunbao.common.views.FunGamesViewHolder; +import com.yunbao.live.views.FunGamesViewHolder; import java.util.ArrayList; import java.util.List; diff --git a/live/src/main/java/com/yunbao/live/bean/OpenParametersModel.java b/live/src/main/java/com/yunbao/live/bean/OpenParametersModel.java new file mode 100644 index 000000000..b30e16ca6 --- /dev/null +++ b/live/src/main/java/com/yunbao/live/bean/OpenParametersModel.java @@ -0,0 +1,81 @@ +package com.yunbao.live.bean; + +import com.yunbao.common.bean.BaseModel; + +/** + * 直播间基类的参数回传 + */ +public class OpenParametersModel extends BaseModel { + private String mDanmuPrice;//弹幕价格 + private int mSocketUserType;//socket用户类型 30 普通用户 40 管理员 50 主播 60超管 + private int mChatLevel;//发言等级限制 + private int mDanMuLevel;//弹幕等级限制 + //直播间的类型 普通 密码 门票 计时等 + private int mLiveType = 0; + //收费价格,计时收费每次扣费的值 + private int mLiveTypeVal = 0; + private LiveGuardInfo mLiveGuardInfo = null; + + public int getmLiveType() { + return mLiveType; + } + + public OpenParametersModel setmLiveType(int mLiveType) { + this.mLiveType = mLiveType; + return this; + } + + public int getmLiveTypeVal() { + return mLiveTypeVal; + } + + public OpenParametersModel setmLiveTypeVal(int mLiveTypeVal) { + this.mLiveTypeVal = mLiveTypeVal; + return this; + } + + public LiveGuardInfo getmLiveGuardInfo() { + return mLiveGuardInfo; + } + + public OpenParametersModel setmLiveGuardInfo(LiveGuardInfo mLiveGuardInfo) { + this.mLiveGuardInfo = mLiveGuardInfo; + return this; + } + + public String getmDanmuPrice() { + return mDanmuPrice; + } + + public OpenParametersModel setmDanmuPrice(String mDanmuPrice) { + this.mDanmuPrice = mDanmuPrice; + return this; + } + + public int getmSocketUserType() { + return mSocketUserType; + } + + public OpenParametersModel setmSocketUserType(int mSocketUserType) { + this.mSocketUserType = mSocketUserType; + return this; + } + + public int getmChatLevel() { + return mChatLevel; + } + + public OpenParametersModel setmChatLevel(int mChatLevel) { + this.mChatLevel = mChatLevel; + return this; + } + + public int getmDanMuLevel() { + return mDanMuLevel; + } + + public OpenParametersModel setmDanMuLevel(int mDanMuLevel) { + this.mDanMuLevel = mDanMuLevel; + return this; + } +} diff --git a/common/src/main/java/com/yunbao/common/dialog/LiveTotalDialog.java b/live/src/main/java/com/yunbao/live/dialog/LiveTotalDialog.java similarity index 96% rename from common/src/main/java/com/yunbao/common/dialog/LiveTotalDialog.java rename to live/src/main/java/com/yunbao/live/dialog/LiveTotalDialog.java index 86d877872..1d53b8877 100644 --- a/common/src/main/java/com/yunbao/common/dialog/LiveTotalDialog.java +++ b/live/src/main/java/com/yunbao/live/dialog/LiveTotalDialog.java @@ -1,4 +1,4 @@ -package com.yunbao.common.dialog; +package com.yunbao.live.dialog; import android.os.Bundle; import android.view.Gravity; @@ -9,14 +9,15 @@ import androidx.recyclerview.widget.LinearLayoutManager; import androidx.recyclerview.widget.RecyclerView; import com.yunbao.common.R; -import com.yunbao.common.adapter.FunGamesAdapter; +import com.yunbao.live.adapter.FunGamesAdapter; import com.yunbao.common.bean.ActiveModel; -import com.yunbao.common.event.LiveAudienceEvent; +import com.yunbao.common.dialog.AbsDialogFragment; import com.yunbao.common.http.base.HttpCallback; import com.yunbao.common.http.live.LiveNetManager; import com.yunbao.common.utils.Bus; import com.yunbao.common.utils.ToastUtil; import com.yunbao.common.views.weight.ViewClicksAntiShake; +import com.yunbao.live.event.LiveAudienceEvent; import org.greenrobot.eventbus.Subscribe; import org.greenrobot.eventbus.ThreadMode; diff --git a/common/src/main/java/com/yunbao/common/event/LiveAudienceEvent.java b/live/src/main/java/com/yunbao/live/event/LiveAudienceEvent.java similarity index 73% rename from common/src/main/java/com/yunbao/common/event/LiveAudienceEvent.java rename to live/src/main/java/com/yunbao/live/event/LiveAudienceEvent.java index 715cfea8f..a60d19a5f 100644 --- a/common/src/main/java/com/yunbao/common/event/LiveAudienceEvent.java +++ b/live/src/main/java/com/yunbao/live/event/LiveAudienceEvent.java @@ -1,12 +1,23 @@ -package com.yunbao.common.event; +package com.yunbao.live.event; import com.yunbao.common.bean.ActiveModel; import com.yunbao.common.bean.BaseModel; +import com.yunbao.live.bean.OpenParametersModel; public class LiveAudienceEvent extends BaseModel { private LiveAudienceType type; private ActiveModel model = new ActiveModel(); private String avatar = ""; + private OpenParametersModel parametersModel = new OpenParametersModel(); + + public OpenParametersModel getParametersModel() { + return parametersModel; + } + + public LiveAudienceEvent setParametersModel(OpenParametersModel parametersModel) { + this.parametersModel = parametersModel; + return this; + } public String getAvatar() { return avatar; @@ -46,7 +57,8 @@ public class LiveAudienceEvent extends BaseModel { NOBLE(8, "贵族"), LIAN_MAI(9, "连麦"), EFFECTS_SETTINGS(10, "特效設置"), - WISH_LIST(11, "心愿单"); + WISH_LIST(11, "心愿单"), + OPEN_PARAMETERS(12, "开放参数"); private int type; diff --git a/common/src/main/java/com/yunbao/common/views/FunGamesViewHolder.java b/live/src/main/java/com/yunbao/live/views/FunGamesViewHolder.java similarity index 93% rename from common/src/main/java/com/yunbao/common/views/FunGamesViewHolder.java rename to live/src/main/java/com/yunbao/live/views/FunGamesViewHolder.java index 7614cff7f..3dfa840c4 100644 --- a/common/src/main/java/com/yunbao/common/views/FunGamesViewHolder.java +++ b/live/src/main/java/com/yunbao/live/views/FunGamesViewHolder.java @@ -1,4 +1,4 @@ -package com.yunbao.common.views; +package com.yunbao.live.views; import android.view.View; import android.widget.ImageView; @@ -9,10 +9,10 @@ import androidx.recyclerview.widget.RecyclerView; import com.yunbao.common.R; import com.yunbao.common.bean.ActiveModel; -import com.yunbao.common.event.LiveAudienceEvent; import com.yunbao.common.glide.ImgLoader; import com.yunbao.common.utils.Bus; import com.yunbao.common.views.weight.ViewClicksAntiShake; +import com.yunbao.live.event.LiveAudienceEvent; public class FunGamesViewHolder extends RecyclerView.ViewHolder { private ImageView funGamePic; diff --git a/live/src/main/java/com/yunbao/live/views/LiveAudienceViewHolder.java b/live/src/main/java/com/yunbao/live/views/LiveAudienceViewHolder.java index f7e4e2ed5..42d550077 100644 --- a/live/src/main/java/com/yunbao/live/views/LiveAudienceViewHolder.java +++ b/live/src/main/java/com/yunbao/live/views/LiveAudienceViewHolder.java @@ -33,7 +33,7 @@ import com.opensource.svgaplayer.SVGAVideoEntity; import com.yunbao.common.CommonAppConfig; import com.yunbao.common.Constants; import com.yunbao.common.bean.MsgModel; -import com.yunbao.common.event.LiveAudienceEvent; +import com.yunbao.live.event.LiveAudienceEvent; import com.yunbao.common.event.MessageIMEvent; import com.yunbao.common.glide.ImgLoader; import com.yunbao.common.http.HttpCallback; 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 d285f4f9d..b4397e9e2 100644 --- a/live/src/main/java/com/yunbao/live/views/LiveRoomViewHolder.java +++ b/live/src/main/java/com/yunbao/live/views/LiveRoomViewHolder.java @@ -45,7 +45,7 @@ import com.yunbao.common.CommonAppConfig; import com.yunbao.common.Constants; import com.yunbao.common.bean.LevelBean; import com.yunbao.common.bean.UserBean; -import com.yunbao.common.event.LiveAudienceEvent; +import com.yunbao.live.event.LiveAudienceEvent; import com.yunbao.common.glide.ImgLoader; import com.yunbao.common.http.CommonHttpConsts; import com.yunbao.common.http.CommonHttpUtil; 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 c06d8f2a2..f8702b73d 100644 --- a/live/src/main/java/com/yunbao/live/views/PortraitLiveManager.java +++ b/live/src/main/java/com/yunbao/live/views/PortraitLiveManager.java @@ -4,22 +4,17 @@ import android.app.Activity; import android.app.Dialog; import android.content.Intent; import android.content.res.Configuration; -import android.graphics.Outline; import android.os.CountDownTimer; import android.text.TextUtils; import android.util.Log; -import android.view.Display; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; -import android.view.ViewOutlineProvider; import android.widget.FrameLayout; import android.widget.ImageView; import androidx.annotation.NonNull; -import androidx.core.view.GravityCompat; import androidx.drawerlayout.widget.DrawerLayout; -import androidx.recyclerview.widget.GridLayoutManager; import androidx.viewpager.widget.PagerAdapter; import com.adjust.sdk.Adjust; @@ -27,37 +22,28 @@ import com.adjust.sdk.AdjustEvent; import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONObject; import com.blankj.utilcode.util.GsonUtils; -import com.ms.banner.Banner; import com.tencent.imsdk.v2.V2TIMCallback; import com.tencent.imsdk.v2.V2TIMManager; import com.yunbao.common.CommonAppConfig; import com.yunbao.common.CommonAppContext; import com.yunbao.common.Constants; -import com.yunbao.common.activity.WebViewActivity; -import com.yunbao.common.bean.AnchorRecommendModel; -import com.yunbao.common.bean.SlideInfoModel; import com.yunbao.common.bean.UserBean; -import com.yunbao.common.custom.CommonRefreshView; -import com.yunbao.common.custom.ItemDecoration; import com.yunbao.common.custom.MyViewPager; import com.yunbao.common.glide.ImgLoader; import com.yunbao.common.http.CommonHttpConsts; import com.yunbao.common.http.CommonHttpUtil; import com.yunbao.common.http.HttpCallback; -import com.yunbao.common.http.main.MainNetManager; import com.yunbao.common.manager.IMLoginManager; -import com.yunbao.common.utils.DeviceUtils; +import com.yunbao.common.utils.Bus; import com.yunbao.common.utils.DialogUitl; import com.yunbao.common.utils.RandomUtil; import com.yunbao.common.utils.RouteUtil; import com.yunbao.common.utils.ToastUtil; import com.yunbao.common.utils.WordUtil; import com.yunbao.common.utils.formatBigNum; -import com.yunbao.common.views.SlideInBannerViewHolder; import com.yunbao.live.R; import com.yunbao.live.activity.LiveActivity; import com.yunbao.live.activity.LiveAudienceActivity; -import com.yunbao.live.adapter.SidebarAdapter; import com.yunbao.live.bean.LiveBean; import com.yunbao.live.bean.LiveBuyGuardMsgBean; import com.yunbao.live.bean.LiveChatBean; @@ -69,16 +55,17 @@ import com.yunbao.live.bean.LiveLuckGiftWinBean; import com.yunbao.live.bean.LivePKUserListBean; import com.yunbao.live.bean.LiveReceiveGiftBean; import com.yunbao.live.bean.LiveUserGiftBean; +import com.yunbao.live.bean.OpenParametersModel; import com.yunbao.live.bean.WishlistModel; import com.yunbao.live.dialog.BlowkissDialog; import com.yunbao.live.dialog.NewUserDialog; import com.yunbao.live.event.LinkMicTxAccEvent; +import com.yunbao.live.event.LiveAudienceEvent; import com.yunbao.live.http.LiveHttpConsts; import com.yunbao.live.http.LiveHttpUtil; import com.yunbao.live.presenter.LiveLinkMicAnchorPresenter; import com.yunbao.live.presenter.LiveLinkMicPkPresenter; import com.yunbao.live.presenter.LiveLinkMicPresenter; -import com.yunbao.live.presenter.LiveRoomCheckLivePresenter; import com.yunbao.live.presenter.LiveRyLinkMicPkPresenter; import com.yunbao.live.socket.SocketChatUtil; import com.yunbao.live.socket.SocketClient; @@ -209,6 +196,11 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe mLiveType = liveType; mLiveTypeVal = liveTypeVal; liveID = data.getUid(); + Bus.get().post(new LiveAudienceEvent() + .setType(LiveAudienceEvent.LiveAudienceType.OPEN_PARAMETERS) + .setParametersModel(new OpenParametersModel() + .setmLiveType(mLiveType) + .setmLiveTypeVal(mLiveTypeVal))); if (mIntent.getIntExtra("isry", 0) == 1) { mLivePlayViewHolder = new LivePlayRyViewHolder(mContext, playContainer, mIntent.getIntExtra("landscape", 0)); } else { @@ -841,7 +833,13 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe mSocketUserType = obj.getIntValue("usertype"); mChatLevel = obj.getIntValue("speak_limit"); mDanMuLevel = obj.getIntValue("barrage_limit"); - + //回传参数 + Bus.get().post(new LiveAudienceEvent() + .setType(LiveAudienceEvent.LiveAudienceType.OPEN_PARAMETERS) + .setParametersModel(new OpenParametersModel().setmDanmuPrice(mDanmuPrice) + .setmSocketUserType(mSocketUserType) + .setmChatLevel(mChatLevel) + .setmDanMuLevel(mDanMuLevel))); EventBus.getDefault().post("close_login"); EventBus.getDefault().post("oneUesrOver"); @@ -1028,6 +1026,9 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe mLiveGuardInfo.setMyGuardType(guardObj.getIntValue("type")); mLiveGuardInfo.setMyGuardEndTime(guardObj.getString("endtime")); } + Bus.get().post(new LiveAudienceEvent() + .setType(LiveAudienceEvent.LiveAudienceType.OPEN_PARAMETERS) + .setParametersModel(new OpenParametersModel().setmLiveGuardInfo(mLiveGuardInfo))); if (mLiveRoomViewHolder != null) { mLiveRoomViewHolder.setGuardNum(guardNum); mLiveRoomViewHolder.setFansNum(fansNum); @@ -1098,9 +1099,6 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe } - - - /** * 暂停播放 */