From d81e6b9f049a21592c520bb0df23e9e499760f68 Mon Sep 17 00:00:00 2001 From: 18401019693 Date: Thu, 29 Dec 2022 17:04:23 +0800 Subject: [PATCH] =?UTF-8?q?=E9=96=8B=E6=92=AD=E8=A8=AD=E7=BD=AE=EF=BC=8C?= =?UTF-8?q?=E4=BF=AE=E6=94=B9=E9=96=8B=E6=92=AD=E6=8E=A5=E5=8F=A3=E6=96=B0?= =?UTF-8?q?=E5=A2=9E=E5=88=86=E8=BE=A8=E7=8E=87=E8=A8=AD=E7=BD=AE=E5=8F=83?= =?UTF-8?q?=E6=95=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../yunbao/common}/bean/LiveRoomTypeBean.java | 4 +- .../common/http/live/LiveNetManager.java | 29 +++ .../common/views/LiveOpenCustomPopup.java | 178 +++++++++++++ .../views/LiveRobotSettingCustomPopup.java | 7 +- .../res/drawable/backgroud_live_open_lfet.xml | 8 + .../drawable/backgroud_live_open_right.xml | 5 + common/src/main/res/layout/view_live_open.xml | 245 ++++++++++++++++++ .../icon_live_type_normal_1.png | Bin .../icon_live_type_normal_2.png | Bin .../mipmap-xxhdpi}/icon_live_type_pay_1.png | Bin .../mipmap-xxhdpi}/icon_live_type_pay_2.png | Bin .../mipmap-xxhdpi}/icon_live_type_pwd_1.png | Bin .../mipmap-xxhdpi}/icon_live_type_pwd_2.png | Bin .../mipmap-xxhdpi}/icon_live_type_time_1.png | Bin .../mipmap-xxhdpi}/icon_live_type_time_2.png | Bin .../main/res/mipmap-xxhdpi/icon_more_open.png | Bin 0 -> 632 bytes common/src/main/res/values/strings.xml | 9 + .../live/activity/LiveTRTCAnchorActivity.java | 4 +- .../live/adapter/LiveRoomTypeAdapter.java | 2 +- .../LiveNewRoomClassDialogFragment.java | 1 - .../dialog/LiveNewRoomTypeDialogFragment.java | 2 +- .../dialog/LiveRoomTypeDialogFragment.java | 2 +- .../com/yunbao/live/http/LiveHttpUtil.java | 15 +- .../live/views/LiveNewReadyRyViewHolder.java | 186 ++++++++++++- .../live/views/LivePushRyViewHolder.java | 4 +- .../live/views/LiveReadyRyViewHolder.java | 4 +- .../live/views/LiveReadyViewHolder.java | 21 +- 27 files changed, 691 insertions(+), 35 deletions(-) rename {live/src/main/java/com/yunbao/live => common/src/main/java/com/yunbao/common}/bean/LiveRoomTypeBean.java (97%) create mode 100644 common/src/main/java/com/yunbao/common/views/LiveOpenCustomPopup.java create mode 100644 common/src/main/res/drawable/backgroud_live_open_lfet.xml create mode 100644 common/src/main/res/drawable/backgroud_live_open_right.xml create mode 100644 common/src/main/res/layout/view_live_open.xml rename {live/src/main/res/mipmap-mdpi => common/src/main/res/mipmap-xxhdpi}/icon_live_type_normal_1.png (100%) rename {live/src/main/res/mipmap-mdpi => common/src/main/res/mipmap-xxhdpi}/icon_live_type_normal_2.png (100%) rename {live/src/main/res/mipmap-mdpi => common/src/main/res/mipmap-xxhdpi}/icon_live_type_pay_1.png (100%) rename {live/src/main/res/mipmap-mdpi => common/src/main/res/mipmap-xxhdpi}/icon_live_type_pay_2.png (100%) rename {live/src/main/res/mipmap-mdpi => common/src/main/res/mipmap-xxhdpi}/icon_live_type_pwd_1.png (100%) rename {live/src/main/res/mipmap-mdpi => common/src/main/res/mipmap-xxhdpi}/icon_live_type_pwd_2.png (100%) rename {live/src/main/res/mipmap-mdpi => common/src/main/res/mipmap-xxhdpi}/icon_live_type_time_1.png (100%) rename {live/src/main/res/mipmap-mdpi => common/src/main/res/mipmap-xxhdpi}/icon_live_type_time_2.png (100%) create mode 100644 common/src/main/res/mipmap-xxhdpi/icon_more_open.png diff --git a/live/src/main/java/com/yunbao/live/bean/LiveRoomTypeBean.java b/common/src/main/java/com/yunbao/common/bean/LiveRoomTypeBean.java similarity index 97% rename from live/src/main/java/com/yunbao/live/bean/LiveRoomTypeBean.java rename to common/src/main/java/com/yunbao/common/bean/LiveRoomTypeBean.java index ab4370e58..8151367e3 100644 --- a/live/src/main/java/com/yunbao/live/bean/LiveRoomTypeBean.java +++ b/common/src/main/java/com/yunbao/common/bean/LiveRoomTypeBean.java @@ -1,7 +1,7 @@ -package com.yunbao.live.bean; +package com.yunbao.common.bean; import com.yunbao.common.Constants; -import com.yunbao.live.R; +import com.yunbao.common.R; import java.util.ArrayList; import java.util.List; diff --git a/common/src/main/java/com/yunbao/common/http/live/LiveNetManager.java b/common/src/main/java/com/yunbao/common/http/live/LiveNetManager.java index d83668492..fee7cbbc5 100644 --- a/common/src/main/java/com/yunbao/common/http/live/LiveNetManager.java +++ b/common/src/main/java/com/yunbao/common/http/live/LiveNetManager.java @@ -17,6 +17,7 @@ import com.yunbao.common.bean.LinkMicUserBeanV2; import com.yunbao.common.bean.LiveAiRobotBean; import com.yunbao.common.bean.LiveInfoModel; import com.yunbao.common.bean.LiveRoomActivityBanner; +import com.yunbao.common.bean.LiveStetUpStatusModel; import com.yunbao.common.bean.NobleRankHideUserListModel; import com.yunbao.common.bean.NobleTrumpetModel; import com.yunbao.common.bean.PkRankBean; @@ -1034,6 +1035,34 @@ public class LiveNetManager { }).isDisposed(); } + /** + * 开播设置数据获取 + * + * @param liveUid + * @param callback + */ + public void getLiveStetUpStatus(String liveUid, HttpCallback callback) { + API.get().pdLiveApi(mContext) + .getLiveStetUpStatus(liveUid) + .subscribeOn(Schedulers.io()) + .observeOn(AndroidSchedulers.mainThread()) + .subscribe(new Consumer>() { + @Override + public void accept(ResponseModel liveStetUpStatusModelResponseModel) throws Exception { + if (callback != null) { + callback.onSuccess(liveStetUpStatusModelResponseModel.getData().getInfo()); + } + } + }, new Consumer() { + @Override + public void accept(Throwable throwable) throws Exception { + if (callback != null) { + callback.onError(throwable.getMessage()); + } + } + }).isDisposed(); + } + /** * 直播间取消网络请求 */ diff --git a/common/src/main/java/com/yunbao/common/views/LiveOpenCustomPopup.java b/common/src/main/java/com/yunbao/common/views/LiveOpenCustomPopup.java new file mode 100644 index 000000000..784fd7004 --- /dev/null +++ b/common/src/main/java/com/yunbao/common/views/LiveOpenCustomPopup.java @@ -0,0 +1,178 @@ +package com.yunbao.common.views; + +import android.content.Context; +import android.widget.TextView; + +import androidx.annotation.NonNull; + +import com.lxj.xpopup.core.CenterPopupView; +import com.yunbao.common.R; +import com.yunbao.common.bean.LiveClassBean; +import com.yunbao.common.bean.LiveRoomTypeBean; +import com.yunbao.common.bean.LiveStetUpStatusModel; +import com.yunbao.common.http.base.HttpCallback; +import com.yunbao.common.http.live.LiveNetManager; +import com.yunbao.common.manager.IMLoginManager; +import com.yunbao.common.utils.ToastUtil; +import com.yunbao.common.views.weight.ViewClicksAntiShake; + +public class LiveOpenCustomPopup extends CenterPopupView { + //清晰度 + private int selectClarity; + //直播类型 + private LiveClassBean classBean; + //房间类型 + private LiveRoomTypeBean liveRoomTypeBean; + + private TextView textClarity, textLiveRoomType, textLiveClass, textLiveWishlist, textRobot; + + public LiveOpenCustomPopup setClassBean(LiveClassBean classBean) { + this.classBean = classBean; + textLiveClass.setText(classBean.getName()); + return this; + } + + public LiveOpenCustomPopup setLiveRoomTypeBean(LiveRoomTypeBean liveRoomTypeBean) { + this.liveRoomTypeBean = liveRoomTypeBean; + textLiveRoomType.setText(liveRoomTypeBean.getName()); + return this; + } + + public LiveOpenCustomPopup(@NonNull Context context, int selectClarity, LiveClassBean classBean, LiveRoomTypeBean liveRoomTypeBean) { + super(context); + this.selectClarity = selectClarity; + this.classBean = classBean; + this.liveRoomTypeBean = liveRoomTypeBean; + } + + // 返回自定义弹窗的布局 + @Override + protected int getImplLayoutId() { + return R.layout.view_live_open; + } + + // 执行初始化操作,比如:findView,设置点击,或者任何你弹窗内的业务逻辑 + @Override + protected void onCreate() { + super.onCreate(); + initView(); + initDate(); + } + + private void initView() { + textClarity = findViewById(R.id.text_clarity); + textLiveRoomType = findViewById(R.id.text_live_room_type); + textLiveClass = findViewById(R.id.text_live_class); + textLiveWishlist = findViewById(R.id.text_live_wishlist); + textRobot = findViewById(R.id.text_robot); + if (classBean != null) { + textLiveClass.setText(classBean.getName()); + } + if (liveRoomTypeBean != null) { + textLiveRoomType.setText(liveRoomTypeBean.getName()); + } + setSelectClarity(selectClarity); + //關閉彈窗 + ViewClicksAntiShake.clicksAntiShake(findViewById(R.id.live_open_cancel), () -> dismiss()); + //開播 + ViewClicksAntiShake.clicksAntiShake(findViewById(R.id.live_open_ok), () -> { + if (callBack != null) { + callBack.startLive(liveRoomTypeBean, classBean); + } + dismiss(); + }); + //設置直播類型 + ViewClicksAntiShake.clicksAntiShake(findViewById(R.id.line_live_class), () -> { + if (callBack != null) { + callBack.openLiveClass(classBean); + } + }); + //設置清晰度 + ViewClicksAntiShake.clicksAntiShake(findViewById(R.id.line_clarity), () -> { + if (callBack != null) { + callBack.selectClarity(selectClarity); + } + }); + //設置房間類型 + ViewClicksAntiShake.clicksAntiShake(findViewById(R.id.line_live_room_type), () -> { + if (callBack != null) { + callBack.openLiveRoomType(liveRoomTypeBean); + } + }); + //打開心願單 + ViewClicksAntiShake.clicksAntiShake(findViewById(R.id.line_live_wishlist), () -> { + if (callBack != null) { + callBack.openWishlist(); + } + }); + //設置機器人 + ViewClicksAntiShake.clicksAntiShake(findViewById(R.id.line_robot), new ViewClicksAntiShake.ViewClicksCallBack() { + @Override + public void onViewClicks() { + if (callBack != null) { + callBack.openRobot(); + } + } + }); + } + + public void setSelectClarity(int selectClarity) { + switch (selectClarity) { + case 0: + textClarity.setText(R.string.standard_clear); + break; + case 1: + textClarity.setText(R.string.high_definition); + break; + case 2: + textClarity.setText(R.string.ultra_hd); + break; + } + } + + public void initDate() { + LiveNetManager.get(getContext()) + .getLiveStetUpStatus(String.valueOf(IMLoginManager.get(getContext()).getUserInfo().getId()), + new HttpCallback() { + @Override + public void onSuccess(LiveStetUpStatusModel data) { + textLiveWishlist.setText(data.getWishListState() ? R.string.do_set : R.string.not_set); + textRobot.setText(data.getAiStateState() ? R.string.robot_yes : R.string.robot_no); + } + + @Override + public void onError(String error) { + ToastUtil.show(error); + } + }); + + + } + + private LiveOpenCallBack callBack; + + public LiveOpenCustomPopup setCallBack(LiveOpenCallBack callBack) { + this.callBack = callBack; + return this; + } + + public interface LiveOpenCallBack { + //開播 + void startLive(LiveRoomTypeBean liveRoomTypeBean, LiveClassBean classBean); + + //選擇清晰度 + void selectClarity(int selectClarity); + + //打開機器人 + void openRobot(); + + //打開直播間類型 + void openLiveRoomType(LiveRoomTypeBean liveRoomTypeBean); + + //打開直播類型 + void openLiveClass(LiveClassBean classBean); + + //打開心願單 + void openWishlist(); + } +} diff --git a/common/src/main/java/com/yunbao/common/views/LiveRobotSettingCustomPopup.java b/common/src/main/java/com/yunbao/common/views/LiveRobotSettingCustomPopup.java index f954a8ce7..e8e195c49 100644 --- a/common/src/main/java/com/yunbao/common/views/LiveRobotSettingCustomPopup.java +++ b/common/src/main/java/com/yunbao/common/views/LiveRobotSettingCustomPopup.java @@ -1,7 +1,6 @@ package com.yunbao.common.views; import android.content.Context; -import android.util.Log; import android.view.KeyEvent; import android.view.View; import android.view.inputmethod.EditorInfo; @@ -24,8 +23,6 @@ import com.yunbao.common.http.base.HttpCallback; import com.yunbao.common.http.live.LiveNetManager; import com.yunbao.common.utils.ToastUtil; -import java.util.List; - public class LiveRobotSettingCustomPopup extends BottomPopupView implements View.OnClickListener { private static String TAG = "AI机器人"; private EditText robotNameSetting; @@ -36,6 +33,10 @@ public class LiveRobotSettingCustomPopup extends BottomPopupView implements View private int robotStateInt = 1; + public int getRobotStateInt() { + return robotStateInt; + } + public LiveRobotSettingCustomPopup(@NonNull Context context) { super(context); } diff --git a/common/src/main/res/drawable/backgroud_live_open_lfet.xml b/common/src/main/res/drawable/backgroud_live_open_lfet.xml new file mode 100644 index 000000000..d35f34c4c --- /dev/null +++ b/common/src/main/res/drawable/backgroud_live_open_lfet.xml @@ -0,0 +1,8 @@ + + + + + + \ No newline at end of file diff --git a/common/src/main/res/drawable/backgroud_live_open_right.xml b/common/src/main/res/drawable/backgroud_live_open_right.xml new file mode 100644 index 000000000..314b5166d --- /dev/null +++ b/common/src/main/res/drawable/backgroud_live_open_right.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/common/src/main/res/layout/view_live_open.xml b/common/src/main/res/layout/view_live_open.xml new file mode 100644 index 000000000..d40b58280 --- /dev/null +++ b/common/src/main/res/layout/view_live_open.xml @@ -0,0 +1,245 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/live/src/main/res/mipmap-mdpi/icon_live_type_normal_1.png b/common/src/main/res/mipmap-xxhdpi/icon_live_type_normal_1.png similarity index 100% rename from live/src/main/res/mipmap-mdpi/icon_live_type_normal_1.png rename to common/src/main/res/mipmap-xxhdpi/icon_live_type_normal_1.png diff --git a/live/src/main/res/mipmap-mdpi/icon_live_type_normal_2.png b/common/src/main/res/mipmap-xxhdpi/icon_live_type_normal_2.png similarity index 100% rename from live/src/main/res/mipmap-mdpi/icon_live_type_normal_2.png rename to common/src/main/res/mipmap-xxhdpi/icon_live_type_normal_2.png diff --git a/live/src/main/res/mipmap-mdpi/icon_live_type_pay_1.png b/common/src/main/res/mipmap-xxhdpi/icon_live_type_pay_1.png similarity index 100% rename from live/src/main/res/mipmap-mdpi/icon_live_type_pay_1.png rename to common/src/main/res/mipmap-xxhdpi/icon_live_type_pay_1.png diff --git a/live/src/main/res/mipmap-mdpi/icon_live_type_pay_2.png b/common/src/main/res/mipmap-xxhdpi/icon_live_type_pay_2.png similarity index 100% rename from live/src/main/res/mipmap-mdpi/icon_live_type_pay_2.png rename to common/src/main/res/mipmap-xxhdpi/icon_live_type_pay_2.png diff --git a/live/src/main/res/mipmap-mdpi/icon_live_type_pwd_1.png b/common/src/main/res/mipmap-xxhdpi/icon_live_type_pwd_1.png similarity index 100% rename from live/src/main/res/mipmap-mdpi/icon_live_type_pwd_1.png rename to common/src/main/res/mipmap-xxhdpi/icon_live_type_pwd_1.png diff --git a/live/src/main/res/mipmap-mdpi/icon_live_type_pwd_2.png b/common/src/main/res/mipmap-xxhdpi/icon_live_type_pwd_2.png similarity index 100% rename from live/src/main/res/mipmap-mdpi/icon_live_type_pwd_2.png rename to common/src/main/res/mipmap-xxhdpi/icon_live_type_pwd_2.png diff --git a/live/src/main/res/mipmap-mdpi/icon_live_type_time_1.png b/common/src/main/res/mipmap-xxhdpi/icon_live_type_time_1.png similarity index 100% rename from live/src/main/res/mipmap-mdpi/icon_live_type_time_1.png rename to common/src/main/res/mipmap-xxhdpi/icon_live_type_time_1.png diff --git a/live/src/main/res/mipmap-mdpi/icon_live_type_time_2.png b/common/src/main/res/mipmap-xxhdpi/icon_live_type_time_2.png similarity index 100% rename from live/src/main/res/mipmap-mdpi/icon_live_type_time_2.png rename to common/src/main/res/mipmap-xxhdpi/icon_live_type_time_2.png diff --git a/common/src/main/res/mipmap-xxhdpi/icon_more_open.png b/common/src/main/res/mipmap-xxhdpi/icon_more_open.png new file mode 100644 index 0000000000000000000000000000000000000000..36f5f84f322ad836b7b5b95eb6787de9d8a5aced GIT binary patch literal 632 zcmV-;0*C#HP)Px%GD$>1R7gw3*H1_kVHgJR=b3h;s4O8uf)IBsFbd5icZML$2s%eb5J3lzMMk$S z9lTbQojTMZIz$u^1mP{R{Z^6wK^NVbI;T-awX4{?;b==b-#Rn$MSK1B{qYR*?)Sb+ zd24UQPq_o&00cu=SKr6IZ@yxcABt+e4?%CWo*c#&>o9keW>#ZTRBjp~^~;JM!0}Iz zl(Z2jA6*}I<^q|W1L*#0W!n1Tg+)RT~LH{; z$;*Kb)q;y?A0)V?Pr~bT{qw27MRWiXT+*WC1v>t<fDFF1!5k`Lje|h>qIZ zF&7j8Y||w5v35{V2Fn(?E-ls$fjW)KJ{^^Oy%R!WF?)nmCo4a6*jsT-W z%IFxC*X^58nJyR^^hQ?^nC+h>+cy??QA8eWNwFYSi^R{REafH>d! SN902Q0000流暢 超高清 確定清晰度開播後,需要重新開播才能更改 + 開播設置確認 + 清晰度 + 直播頻道 + 開播 + 機器人 + 已設置 + 未設置 + + diff --git a/live/src/main/java/com/yunbao/live/activity/LiveTRTCAnchorActivity.java b/live/src/main/java/com/yunbao/live/activity/LiveTRTCAnchorActivity.java index 4694aa2bc..205fd0032 100644 --- a/live/src/main/java/com/yunbao/live/activity/LiveTRTCAnchorActivity.java +++ b/live/src/main/java/com/yunbao/live/activity/LiveTRTCAnchorActivity.java @@ -31,7 +31,7 @@ import com.yunbao.common.utils.StringUtil; import com.yunbao.common.utils.ToastUtil; import com.yunbao.common.utils.WordUtil; import com.yunbao.live.R; -import com.yunbao.live.bean.LiveRoomTypeBean; +import com.yunbao.common.bean.LiveRoomTypeBean; import com.yunbao.live.dialog.LiveBeautyDialogFragment; import com.yunbao.live.dialog.LiveRoomTypeDialogFragment; import com.yunbao.live.http.LiveHttpUtil; @@ -213,7 +213,7 @@ public class LiveTRTCAnchorActivity extends TRTCBaseActivity { return; } String title = mEditTitle.getText().toString().trim(); - LiveHttpUtil.newcreateRoom(title, mLiveClassID, mLiveType, mLiveTypeVal, null, new HttpCallback() { + LiveHttpUtil.newcreateRoom(title, mLiveClassID, mLiveType, mLiveTypeVal, null,0, new HttpCallback() { @Override public void onSuccess(int code, String msg, final String[] info) { if (code == 0 && info.length > 0) { diff --git a/live/src/main/java/com/yunbao/live/adapter/LiveRoomTypeAdapter.java b/live/src/main/java/com/yunbao/live/adapter/LiveRoomTypeAdapter.java index 431ea0971..61dc2da23 100644 --- a/live/src/main/java/com/yunbao/live/adapter/LiveRoomTypeAdapter.java +++ b/live/src/main/java/com/yunbao/live/adapter/LiveRoomTypeAdapter.java @@ -15,7 +15,7 @@ import com.yunbao.common.CommonAppConfig; import com.yunbao.common.bean.ConfigBean; import com.yunbao.common.interfaces.OnItemClickListener; import com.yunbao.live.R; -import com.yunbao.live.bean.LiveRoomTypeBean; +import com.yunbao.common.bean.LiveRoomTypeBean; import java.util.ArrayList; import java.util.Arrays; diff --git a/live/src/main/java/com/yunbao/live/dialog/LiveNewRoomClassDialogFragment.java b/live/src/main/java/com/yunbao/live/dialog/LiveNewRoomClassDialogFragment.java index 6bf49ae81..f2ba058b5 100644 --- a/live/src/main/java/com/yunbao/live/dialog/LiveNewRoomClassDialogFragment.java +++ b/live/src/main/java/com/yunbao/live/dialog/LiveNewRoomClassDialogFragment.java @@ -18,7 +18,6 @@ import com.yunbao.common.interfaces.CommonCallback; import com.yunbao.common.interfaces.OnItemClickListener; import com.yunbao.live.R; import com.yunbao.live.adapter.LiveReadyClassAdapter; -import com.yunbao.live.bean.LiveRoomTypeBean; import java.util.ArrayList; import java.util.List; diff --git a/live/src/main/java/com/yunbao/live/dialog/LiveNewRoomTypeDialogFragment.java b/live/src/main/java/com/yunbao/live/dialog/LiveNewRoomTypeDialogFragment.java index 7f853b10e..946af6304 100644 --- a/live/src/main/java/com/yunbao/live/dialog/LiveNewRoomTypeDialogFragment.java +++ b/live/src/main/java/com/yunbao/live/dialog/LiveNewRoomTypeDialogFragment.java @@ -19,7 +19,7 @@ import com.yunbao.common.interfaces.OnItemClickListener; import com.yunbao.common.utils.DpUtil; import com.yunbao.common.utils.WordUtil; import com.yunbao.live.R; -import com.yunbao.live.bean.LiveRoomTypeBean; +import com.yunbao.common.bean.LiveRoomTypeBean; import java.util.ArrayList; import java.util.Arrays; diff --git a/live/src/main/java/com/yunbao/live/dialog/LiveRoomTypeDialogFragment.java b/live/src/main/java/com/yunbao/live/dialog/LiveRoomTypeDialogFragment.java index be42aaecf..933dd3339 100644 --- a/live/src/main/java/com/yunbao/live/dialog/LiveRoomTypeDialogFragment.java +++ b/live/src/main/java/com/yunbao/live/dialog/LiveRoomTypeDialogFragment.java @@ -14,7 +14,7 @@ import com.yunbao.common.interfaces.OnItemClickListener; import com.yunbao.common.utils.DpUtil; import com.yunbao.live.R; import com.yunbao.live.adapter.LiveRoomTypeAdapter; -import com.yunbao.live.bean.LiveRoomTypeBean; +import com.yunbao.common.bean.LiveRoomTypeBean; /** * Created by cxf on 2018/10/8. diff --git a/live/src/main/java/com/yunbao/live/http/LiveHttpUtil.java b/live/src/main/java/com/yunbao/live/http/LiveHttpUtil.java index 864ec1fe6..39b9b26d5 100644 --- a/live/src/main/java/com/yunbao/live/http/LiveHttpUtil.java +++ b/live/src/main/java/com/yunbao/live/http/LiveHttpUtil.java @@ -47,10 +47,11 @@ public class LiveHttpUtil { /** * 获取直播用户日榜/周榜 - * @param liveUid 主播uid + * + * @param liveUid 主播uid * @param callback 回调 */ - public static void getUserRankList(String liveUid,HttpCallback callback){ + public static void getUserRankList(String liveUid, HttpCallback callback) { HttpClient.getInstance().get("Contribute.index", LiveHttpConsts.GET_USER_LIST) .params("uid", liveUid) .execute(callback); @@ -685,7 +686,7 @@ public class LiveHttpUtil { * @param file 封面图片文件 * @param callback */ - public static void newcreateRoom(String title, int liveClassId, int type, int typeVal, File file, HttpCallback callback) { + public static void newcreateRoom(String title, int liveClassId, int type, int typeVal, File file, int clarityType, HttpCallback callback) { PostRequest request = HttpClient.getInstance().post("Live.createRoom2", LiveHttpConsts.CREATE_ROOM) .params("title", title) @@ -693,7 +694,8 @@ public class LiveHttpUtil { .params("type", type) .params("landscape", "2") .params("class_type", "0") - .params("type_val", typeVal); + .params("type_val", typeVal) + .params("clarityType ", clarityType); if (file != null) { request.params("file", file); } @@ -902,16 +904,17 @@ public class LiveHttpUtil { /** * 获取用户贵族喇叭的数量 */ - public static void nobleUseTrumpet(String trumpet_msg,String anchor_id,HttpCallback callback) { + public static void nobleUseTrumpet(String trumpet_msg, String anchor_id, HttpCallback callback) { HttpClient.getInstance().get("Noble.nobleUseTrumpet", "nobleUseTrumpet") .params("", trumpet_msg) .params("", anchor_id) .execute(callback); } + /** * 获取用户贵族喇叭的数量 */ - public static void getStarChallengeStatus(String liveUid,HttpCallback callback) { + public static void getStarChallengeStatus(String liveUid, HttpCallback callback) { HttpClient.getInstance().get("StarChallenge.getStarChallengeStatus", "StarChallengeStatus") .params("liveUid", liveUid) .execute(callback); diff --git a/live/src/main/java/com/yunbao/live/views/LiveNewReadyRyViewHolder.java b/live/src/main/java/com/yunbao/live/views/LiveNewReadyRyViewHolder.java index 019a85805..202f538fe 100644 --- a/live/src/main/java/com/yunbao/live/views/LiveNewReadyRyViewHolder.java +++ b/live/src/main/java/com/yunbao/live/views/LiveNewReadyRyViewHolder.java @@ -1,5 +1,7 @@ package com.yunbao.live.views; +import static com.yunbao.live.event.LiveAudienceEvent.LiveAudienceType.WISH_LIST_UPDATE; + import android.app.Dialog; import android.content.Context; import android.graphics.drawable.Drawable; @@ -23,6 +25,7 @@ import com.lxj.xpopup.interfaces.XPopupCallback; import com.yunbao.common.CommonAppConfig; import com.yunbao.common.Constants; import com.yunbao.common.bean.LiveClassBean; +import com.yunbao.common.bean.LiveRoomTypeBean; import com.yunbao.common.bean.UserBean; import com.yunbao.common.glide.ImgLoader; import com.yunbao.common.http.HttpCallback; @@ -37,21 +40,25 @@ import com.yunbao.common.utils.ToastUtil; import com.yunbao.common.utils.WordUtil; import com.yunbao.common.views.AbsViewHolder; import com.yunbao.common.views.LiveClarityCustomPopup; +import com.yunbao.common.views.LiveOpenCustomPopup; import com.yunbao.common.views.LiveRobotSettingCustomPopup; import com.yunbao.common.views.weight.ViewClicksAntiShake; import com.yunbao.faceunity.FaceManager; import com.yunbao.live.R; import com.yunbao.live.activity.LiveActivity; import com.yunbao.live.activity.LiveRyAnchorActivity; -import com.yunbao.live.bean.LiveRoomTypeBean; import com.yunbao.live.dialog.LiveFaceUnityDialogFragment; import com.yunbao.live.dialog.LiveNewRoomClassDialogFragment; import com.yunbao.live.dialog.LiveNewRoomTypeDialogFragment; import com.yunbao.live.dialog.LiveNewWishListDialogFragment; import com.yunbao.live.dialog.LiveTimeDialogFragment; +import com.yunbao.live.event.LiveAudienceEvent; import com.yunbao.live.http.LiveHttpConsts; import com.yunbao.live.http.LiveHttpUtil; +import org.greenrobot.eventbus.Subscribe; +import org.greenrobot.eventbus.ThreadMode; + import java.io.File; import cn.rongcloud.rtc.api.RCRTCEngine; @@ -78,6 +85,7 @@ public class LiveNewReadyRyViewHolder extends AbsViewHolder implements View.OnCl private TextView faceTextView;//提示人脸未检测到的TextView private ImageView imgClarity; private int selectClarity = 1; + private LiveOpenCustomPopup liveOpenCustomPopup; public LiveNewReadyRyViewHolder(Context context, ViewGroup parentView, int liveSdk) { super(context, parentView, liveSdk); @@ -269,6 +277,9 @@ public class LiveNewReadyRyViewHolder extends AbsViewHolder implements View.OnCl liveClarity.setText(R.string.ultra_hd); break; } + if (liveOpenCustomPopup != null) { + liveOpenCustomPopup.setSelectClarity(selectClarity); + } } public void setManager(FaceManager manager) { @@ -299,8 +310,156 @@ public class LiveNewReadyRyViewHolder extends AbsViewHolder implements View.OnCl } else if (i == R.id.btn_room_type) { chooseLiveType(); } else if (i == R.id.btn_start_live) { - startLive(); +// startLive(); + liveOpenCustomPopup = new LiveOpenCustomPopup(mContext, selectClarity, classBean, liveRoomTypeBean) + .setCallBack(new LiveOpenCustomPopup.LiveOpenCallBack() { + @Override + public void startLive(LiveRoomTypeBean liveRoomTypeModel, LiveClassBean classModel) { + if (classModel != null) { + classBean = classModel; + mLiveClassID = classBean.getId(); + } + liveRoomTypeBean = liveRoomTypeModel; + mLiveType = liveRoomTypeModel.getId(); + startLiveInit(); + liveOpenCustomPopup = null; + } + @Override + public void selectClarity(int selectClarity) { + LiveClarityCustomPopup liveClarityCustomPopup = new LiveClarityCustomPopup(mContext, selectClarity); + new XPopup.Builder(mContext) + .setPopupCallback(new XPopupCallback() { + @Override + public void onCreated(BasePopupView popupView) { + + } + + @Override + public void beforeShow(BasePopupView popupView) { + + } + + @Override + public void onShow(BasePopupView popupView) { + + } + + @Override + public void onDismiss(BasePopupView popupView) { + setSelectClarity(liveClarityCustomPopup.getSelectClarity()); + } + + @Override + public void beforeDismiss(BasePopupView popupView) { + + } + + @Override + public boolean onBackPressed(BasePopupView popupView) { + return false; + } + + @Override + public void onKeyBoardStateChanged(BasePopupView popupView, int height) { + + } + + @Override + public void onDrag(BasePopupView popupView, int value, float percent, boolean upOrLeft) { + + } + + @Override + public void onClickOutside(BasePopupView popupView) { + + } + }) + .asCustom(liveClarityCustomPopup) + .show(); + } + + @Override + public void openRobot() { + LiveRobotSettingCustomPopup liveRobotSettingCustomPopup = new LiveRobotSettingCustomPopup(mContext); + new XPopup.Builder(mContext) + .setPopupCallback(new XPopupCallback() { + @Override + public void onCreated(BasePopupView popupView) { + + } + + @Override + public void beforeShow(BasePopupView popupView) { + + } + + @Override + public void onShow(BasePopupView popupView) { + + } + + @Override + public void onDismiss(BasePopupView popupView) { + if (liveOpenCustomPopup != null) { + liveOpenCustomPopup.initDate(); + } + } + + @Override + public void beforeDismiss(BasePopupView popupView) { + + } + + @Override + public boolean onBackPressed(BasePopupView popupView) { + return false; + } + + @Override + public void onKeyBoardStateChanged(BasePopupView popupView, int height) { + + } + + @Override + public void onDrag(BasePopupView popupView, int value, float percent, boolean upOrLeft) { + + } + + @Override + public void onClickOutside(BasePopupView popupView) { + + } + }) + .asCustom(liveRobotSettingCustomPopup) + .show(); + } + + @Override + public void openLiveRoomType(LiveRoomTypeBean liveRoomTypeModel) { + liveRoomTypeBean = liveRoomTypeModel; + mLiveType = liveRoomTypeModel.getId(); + chooseLiveType(); + } + + @Override + public void openLiveClass(LiveClassBean classModel) { + if (classModel != null) { + classBean = classModel; + mLiveClassID = classBean.getId(); + } + chooseLiveClass(); + } + + @Override + public void openWishlist() { + //点击心愿单 + openWishListWindow(); + } + }); + new XPopup.Builder(mContext) + .asCustom(liveOpenCustomPopup) + .show(); } else if (i == R.id.btn_locaiton) { switchLocation(); } else if (i == R.id.btn_horizontally) { @@ -337,6 +496,16 @@ public class LiveNewReadyRyViewHolder extends AbsViewHolder implements View.OnCl if (mContext instanceof LiveRyAnchorActivity) { fragment.show(((LiveRyAnchorActivity) mContext).getSupportFragmentManager(), "RY"); + + } + } + + @Subscribe(threadMode = ThreadMode.MAIN) + public void updateStart(LiveAudienceEvent event) { + if (event.getType() == WISH_LIST_UPDATE) { + if (liveOpenCustomPopup != null) { + liveOpenCustomPopup.initDate(); + } } } @@ -424,6 +593,9 @@ public class LiveNewReadyRyViewHolder extends AbsViewHolder implements View.OnCl classBean = bean; mLiveClassID = classBean.getId(); mLiveClass.setText(bean.getName()); + if (liveOpenCustomPopup != null) { + liveOpenCustomPopup.setClassBean(classBean); + } } }); fragment.show(((LiveRyAnchorActivity) mContext).getSupportFragmentManager(), "LiveRoomTypeDialogFragment"); @@ -443,6 +615,8 @@ public class LiveNewReadyRyViewHolder extends AbsViewHolder implements View.OnCl /** * 选择直播类型 */ + private LiveRoomTypeBean liveRoomTypeBean = new LiveRoomTypeBean(0, WordUtil.getString(R.string.live_room_public)); + private void chooseLiveType() { Bundle bundle = new Bundle(); bundle.putInt(Constants.CHECKED_ID, mLiveType); @@ -451,6 +625,7 @@ public class LiveNewReadyRyViewHolder extends AbsViewHolder implements View.OnCl fragment.setCallback(new CommonCallback() { @Override public void callback(LiveRoomTypeBean bean) { + liveRoomTypeBean = bean; switch (bean.getId()) { case Constants.LIVE_TYPE_NORMAL: onLiveTypeNormal(bean); @@ -465,6 +640,9 @@ public class LiveNewReadyRyViewHolder extends AbsViewHolder implements View.OnCl onLiveTypeTime(bean); break; } + if (liveOpenCustomPopup != null) { + liveOpenCustomPopup.setLiveRoomTypeBean(liveRoomTypeBean); + } } }); fragment.show(((LiveRyAnchorActivity) mContext).getSupportFragmentManager(), "LiveRoomTypeDialogFragment"); @@ -560,7 +738,7 @@ public class LiveNewReadyRyViewHolder extends AbsViewHolder implements View.OnCl /** * 点击开始直播按钮 */ - private void startLive() { + private void startLiveInit() { boolean startPreview = ((LiveRyAnchorActivity) mContext).isStartPreview(); // if (!startPreview) { // ToastUtil.show(R.string.please_wait); @@ -586,7 +764,7 @@ public class LiveNewReadyRyViewHolder extends AbsViewHolder implements View.OnCl return; } String title = mEditTitle.getText().toString().trim(); - LiveHttpUtil.newcreateRoom(title, mLiveClassID, mLiveType, mLiveTypeVal, mAvatarFile, new HttpCallback() { + LiveHttpUtil.newcreateRoom(title, mLiveClassID, mLiveType, mLiveTypeVal, mAvatarFile, selectClarity + 1, new HttpCallback() { @Override public void onSuccess(int code, String msg, final String[] info) { if (code == 0 && info.length > 0) { diff --git a/live/src/main/java/com/yunbao/live/views/LivePushRyViewHolder.java b/live/src/main/java/com/yunbao/live/views/LivePushRyViewHolder.java index a3c663c54..6d0da307f 100644 --- a/live/src/main/java/com/yunbao/live/views/LivePushRyViewHolder.java +++ b/live/src/main/java/com/yunbao/live/views/LivePushRyViewHolder.java @@ -565,7 +565,7 @@ public class LivePushRyViewHolder extends AbsRyLivePushViewHolder implements ITX //设置分辨率 .setVideoResolution(RCRTCParamsType.RCRTCVideoResolution.RESOLUTION_480_640) //设置帧率 - .setVideoFps(RCRTCParamsType.RCRTCVideoFps.Fps_30) + .setVideoFps(RCRTCParamsType.RCRTCVideoFps.Fps_24) //设置最小码率,480P下推荐200 .setMinRate(250) //设置最大码率,480P下推荐900 @@ -732,7 +732,7 @@ public class LivePushRyViewHolder extends AbsRyLivePushViewHolder implements ITX int height = 1280; normal.setWidth(width); //视频宽 normal.setHeight(height); //视频高 - normal.setFps(fps); //视频帧率 + normal.setFps(25); //视频帧率 //2. 合流画布设置 //(请参照画布和声音配置示例代码) diff --git a/live/src/main/java/com/yunbao/live/views/LiveReadyRyViewHolder.java b/live/src/main/java/com/yunbao/live/views/LiveReadyRyViewHolder.java index 33eb8b29c..6575c81cb 100644 --- a/live/src/main/java/com/yunbao/live/views/LiveReadyRyViewHolder.java +++ b/live/src/main/java/com/yunbao/live/views/LiveReadyRyViewHolder.java @@ -36,7 +36,7 @@ import com.yunbao.live.activity.LiveActivity; import com.yunbao.live.activity.LiveChooseClassActivity; import com.yunbao.live.activity.LiveRyAnchorActivity; import com.yunbao.live.adapter.LiveReadyShareAdapter; -import com.yunbao.live.bean.LiveRoomTypeBean; +import com.yunbao.common.bean.LiveRoomTypeBean; import com.yunbao.live.dialog.LiveRoomTypeDialogFragment; import com.yunbao.live.dialog.LiveTimeDialogFragment; import com.yunbao.live.dialog.LiveWishListDialogFragment; @@ -471,7 +471,7 @@ public class LiveReadyRyViewHolder extends AbsViewHolder implements View.OnClick return; } String title = mEditTitle.getText().toString().trim(); - LiveHttpUtil.newcreateRoom(title, mLiveClassID, mLiveType, mLiveTypeVal, mAvatarFile, new HttpCallback() { + LiveHttpUtil.newcreateRoom(title, mLiveClassID, mLiveType, mLiveTypeVal, mAvatarFile,0, new HttpCallback() { @Override public void onSuccess(int code, String msg, final String[] info) { if (code == 0 && info.length > 0) { diff --git a/live/src/main/java/com/yunbao/live/views/LiveReadyViewHolder.java b/live/src/main/java/com/yunbao/live/views/LiveReadyViewHolder.java index 1918953a4..4da9ea036 100644 --- a/live/src/main/java/com/yunbao/live/views/LiveReadyViewHolder.java +++ b/live/src/main/java/com/yunbao/live/views/LiveReadyViewHolder.java @@ -1,12 +1,13 @@ package com.yunbao.live.views; +import static com.tencent.trtc.TRTCCloudDef.TRTC_VIDEO_MIRROR_TYPE_DISABLE; +import static com.tencent.trtc.TRTCCloudDef.TRTC_VIDEO_MIRROR_TYPE_ENABLE; +import static com.yunbao.live.views.LivePushTxViewHolder.mTRTCCloud; + import android.app.Dialog; import android.content.Context; import android.content.Intent; import android.os.Bundle; -import androidx.core.content.ContextCompat; -import androidx.recyclerview.widget.LinearLayoutManager; -import androidx.recyclerview.widget.RecyclerView; import android.text.TextUtils; import android.util.Log; import android.view.View; @@ -17,12 +18,17 @@ import android.widget.ImageView; import android.widget.RelativeLayout; import android.widget.TextView; +import androidx.core.content.ContextCompat; +import androidx.recyclerview.widget.LinearLayoutManager; +import androidx.recyclerview.widget.RecyclerView; + import com.lzy.okgo.model.Response; import com.tencent.imsdk.v2.V2TIMManager; import com.tencent.imsdk.v2.V2TIMSendCallback; import com.tencent.trtc.TRTCCloudDef; import com.yunbao.common.CommonAppConfig; import com.yunbao.common.Constants; +import com.yunbao.common.bean.LiveRoomTypeBean; import com.yunbao.common.bean.UserBean; import com.yunbao.common.glide.ImgLoader; import com.yunbao.common.http.HttpCallback; @@ -42,7 +48,6 @@ import com.yunbao.live.activity.LiveActivity; import com.yunbao.live.activity.LiveAnchorActivity; import com.yunbao.live.activity.LiveChooseClassActivity; import com.yunbao.live.adapter.LiveReadyShareAdapter; -import com.yunbao.live.bean.LiveRoomTypeBean; import com.yunbao.live.dialog.LiveRoomTypeDialogFragment; import com.yunbao.live.dialog.LiveTimeDialogFragment; import com.yunbao.live.dialog.LiveWishListDialogFragment; @@ -51,10 +56,6 @@ import com.yunbao.live.http.LiveHttpUtil; import java.io.File; -import static com.tencent.trtc.TRTCCloudDef.TRTC_VIDEO_MIRROR_TYPE_DISABLE; -import static com.tencent.trtc.TRTCCloudDef.TRTC_VIDEO_MIRROR_TYPE_ENABLE; -import static com.yunbao.live.views.LivePushTxViewHolder.mTRTCCloud; - /** * Created by cxf on 2018/10/7. * 开播前准备 @@ -491,7 +492,7 @@ public class LiveReadyViewHolder extends AbsViewHolder implements View.OnClickLi return; } String title = mEditTitle.getText().toString().trim(); - LiveHttpUtil.newcreateRoom(title, mLiveClassID, mLiveType, mLiveTypeVal, mAvatarFile, new HttpCallback() { + LiveHttpUtil.newcreateRoom(title, mLiveClassID, mLiveType, mLiveTypeVal, mAvatarFile, 0, new HttpCallback() { @Override public void onSuccess(int code, String msg, final String[] info) { if (code == 0 && info.length > 0) { @@ -535,7 +536,7 @@ public class LiveReadyViewHolder extends AbsViewHolder implements View.OnClickLi @Override public void onError(Response response) { super.onError(response); - System.out.println("tx 开播失败 = "+response); + System.out.println("tx 开播失败 = " + response); } }); }