diff --git a/CHANGELOG.md b/CHANGELOG.md index 88ae2fe6..54cd658a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,34 @@ +## 【v1.22.1] - 2025-01-09 + +### 【手机开播(纯视频)场景】 + +新增: +1. 【推流】断流后页面增加常驻提示【Demo、Common】 +2. 【打赏】支持屏蔽打赏特效【Demo】 +3. 【打赏】支持开启/关闭礼物打赏【Demo、Common、SDK】 +4. 【回放】支持开播前设置回放开关【Demo、SDK】 + +优化: +1. 【UI】在线列表入口优化【Demo】 +2. 【UI】观众申请连麦提示优化【Demo】 +3. 【UI】开播前设置页优化【Demo】 +4. 【UI】根据参数隐藏"混流布局"、"横竖屏"【Demo、SDK】 + +### 【手机开播(三分屏)场景】 + +新增: +1. 【推流】断流后页面增加常驻提示【Demo、Common】 + +### 【观看端(云课堂)场景】 + +修复: +1. 【打赏】修复横屏礼物打赏响应开关失败问题【Demo】 + +### 【SDK】 + +优化: +1. 【RTC】RTC兼容低版本【SDK】 + ## 【v1.22.0] - 2024-12-10 ### 【手机开播(纯视频)场景】 diff --git a/README.md b/README.md index 5cfdd91c..7e6295fe 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ polyv-android-livescenes-sdk-demo === [![build passing](https://img.shields.io/badge/build-passing-brightgreen.svg)](#) -[![GitHub release](https://img.shields.io/badge/release-v1.22.0-blue.svg)](https://github.com/polyv/polyv-android-livescenes-sdk-demo/releases/tag/v1.22.0) +[![GitHub release](https://img.shields.io/badge/release-v1.22.1-blue.svg)](https://github.com/polyv/polyv-android-livescenes-sdk-demo/releases/tag/v1.22.1) @@ -66,7 +66,8 @@ Demo [下载链接](https://www.pgyer.com/Mb6m) (密码:polyv) | Github仓库Tag | 依赖SDK版本 | API文档 | Common层 | 观看端-云课堂场景 | 观看端-直播带货场景 | 开播端-手机开播三分屏场景 | 开播端-手机开播纯视频场景 | 互动学堂场景 | |-------------|------------|-------------------------------------------------------------------------------------------|---------|---------|----------|---------------|---------------|--------| -| 1.22.0 | 1.22.0 | [v1.22.0 API](http://repo.polyv.net/android/livescenes/javadoc/1.22.0/index.html) | ✅ | ✅ | ✅ | ✅ | ✅ | | +| 1.22.1 | 1.22.1 | [v1.22.1 API](http://repo.polyv.net/android/livescenes/javadoc/1.22.1/index.html) | ✅ | ✅ | | ✅ | ✅ | | +| 1.22.0 | 1.22.0 | [v1.22.0 API](http://repo.polyv.net/android/livescenes/javadoc/1.22.0/index.html) | ✅ | ✅ | ✅ | ✅ | ✅ | | | 1.21.0 | 1.21.0 | [v1.21.0 API](http://repo.polyv.net/android/livescenes/javadoc/1.21.0/index.html) | ✅ | | | ✅ | ✅ | | | 1.20.0 | 1.20.0 | [v1.20.0 API](http://repo.polyv.net/android/livescenes/javadoc/1.20.0/index.html) | ✅ | ✅ | ✅ | ✅ | ✅ | | | 1.19.1 | 1.19.1 | [v1.19.1 API](http://repo.polyv.net/android/livescenes/javadoc/1.19.1/index.html) | ✅ | ✅ | ✅ | | | | diff --git a/build.gradle b/build.gradle index 44c4f6a2..79027eaa 100644 --- a/build.gradle +++ b/build.gradle @@ -52,8 +52,8 @@ ext { compileSdkVersion = 31 minSdkVersion = 21 targetSdkVersion = 30 - versionCode = 1220 - versionName = "1.22.0" + versionCode = 1221 + versionName = "1.22.1" } task clean(type: Delete) { diff --git a/demo/src/main/java/com/easefun/polyv/livedemo/PLVLoginWatcherActivity.java b/demo/src/main/java/com/easefun/polyv/livedemo/PLVLoginWatcherActivity.java index e4778ceb..99fc80f7 100644 --- a/demo/src/main/java/com/easefun/polyv/livedemo/PLVLoginWatcherActivity.java +++ b/demo/src/main/java/com/easefun/polyv/livedemo/PLVLoginWatcherActivity.java @@ -1,6 +1,5 @@ package com.easefun.polyv.livedemo; -import static com.plv.foundationsdk.utils.PLVSugarUtil.format; import static com.plv.foundationsdk.utils.PLVSugarUtil.nullable; import android.app.ProgressDialog; @@ -50,6 +49,7 @@ import com.plv.thirdpart.blankj.utilcode.util.ToastUtils; import java.io.File; +import java.util.Calendar; /** * date: 2020-04-29 @@ -185,6 +185,7 @@ private void initView() { //默认选择直播 rlLiveGroupLayout.performClick(); + initCopyright(); initPlaybackCacheConfig(); initPlaybackCacheViewModel(); initMultiVenueViewModel(); @@ -312,6 +313,11 @@ public void onDismiss(DialogInterface dialog) { }); } + private void initCopyright() { + final int year = Calendar.getInstance().get(Calendar.YEAR); + tvCopyright.setText(""); + } + private void initPlaybackCacheConfig() { PLVDependManager.getInstance().get(PLVPlaybackCacheConfig.class) .setApplicationContext(getApplicationContext()) diff --git a/demo/src/main/res/layout/plv_login_watcher_activity.xml b/demo/src/main/res/layout/plv_login_watcher_activity.xml index 620346a7..61612f0a 100644 --- a/demo/src/main/res/layout/plv_login_watcher_activity.xml +++ b/demo/src/main/res/layout/plv_login_watcher_activity.xml @@ -2,6 +2,7 @@ + tools:text="Copyright" /> diff --git a/demo/src/main/res/values-b+zh+Hant/strings.xml b/demo/src/main/res/values-b+zh+Hant/strings.xml index 61d1d047..cd098c17 100644 --- a/demo/src/main/res/values-b+zh+Hant/strings.xml +++ b/demo/src/main/res/values-b+zh+Hant/strings.xml @@ -10,7 +10,6 @@ APP ID APP Secret 正在登录中,请稍等… - 2013 – 2023 易方信息科技股份有限公司 版权所有 手機開播 diff --git a/demo/src/main/res/values-ja/strings.xml b/demo/src/main/res/values-ja/strings.xml index 70007db2..914fb687 100644 --- a/demo/src/main/res/values-ja/strings.xml +++ b/demo/src/main/res/values-ja/strings.xml @@ -10,7 +10,6 @@ APP ID APP Secret 正在登录中,请稍等… - 2013 – 2023 易方信息科技股份有限公司 版权所有 携帯電話でスタート diff --git a/demo/src/main/res/values-ko/strings.xml b/demo/src/main/res/values-ko/strings.xml index 5a79fbd9..84046e3b 100644 --- a/demo/src/main/res/values-ko/strings.xml +++ b/demo/src/main/res/values-ko/strings.xml @@ -10,7 +10,6 @@ APP ID APP Secret 正在登录中,请稍等… - 2013 – 2023 易方信息科技股份有限公司 版权所有 휴대폰 방송 시작 diff --git a/demo/src/main/res/values-zh/strings.xml b/demo/src/main/res/values-zh/strings.xml index d0ed4d8c..28d3b6fc 100644 --- a/demo/src/main/res/values-zh/strings.xml +++ b/demo/src/main/res/values-zh/strings.xml @@ -10,7 +10,6 @@ APP ID APP Secret 正在登录中,请稍等… - 2013 – 2023 易方信息科技股份有限公司 版权所有 手机开播 diff --git a/demo/src/main/res/values/strings.xml b/demo/src/main/res/values/strings.xml index ca898be6..833a1afe 100644 --- a/demo/src/main/res/values/strings.xml +++ b/demo/src/main/res/values/strings.xml @@ -10,7 +10,6 @@ APP ID APP Secret 正在登录中,请稍等… - 2013 – 2023 易方信息科技股份有限公司 版权所有 Mobile Live Broadcast diff --git a/polyvLiveCloudClassScene/src/main/java/com/easefun/polyv/livecloudclass/modules/media/controller/PLVLCLiveMediaController.java b/polyvLiveCloudClassScene/src/main/java/com/easefun/polyv/livecloudclass/modules/media/controller/PLVLCLiveMediaController.java index 13a4516e..8e70c1af 100644 --- a/polyvLiveCloudClassScene/src/main/java/com/easefun/polyv/livecloudclass/modules/media/controller/PLVLCLiveMediaController.java +++ b/polyvLiveCloudClassScene/src/main/java/com/easefun/polyv/livecloudclass/modules/media/controller/PLVLCLiveMediaController.java @@ -157,7 +157,7 @@ public class PLVLCLiveMediaController extends FrameLayout implements IPLVLCLiveM // 服务端的点赞开关 private boolean isLikesSwitchEnabled = true; // 服务端的打赏开关 - private boolean isRewardSwitchEnabled = true; + private boolean isRewardSwitchEnabled = false; // 聊天室tab是否可见 private boolean isChatDisplayEnabled = true; // 主播放器是否正在播放 diff --git a/polyvLiveCommonModul/build.gradle b/polyvLiveCommonModul/build.gradle index 1cef20cb..69b27d99 100644 --- a/polyvLiveCommonModul/build.gradle +++ b/polyvLiveCommonModul/build.gradle @@ -31,7 +31,7 @@ android { dependencies { implementation 'com.android.support:design:27.1.1' implementation 'com.android.support:gridlayout-v7:27.1.1' - api 'net.polyv.android:polyvSDKLiveScenes:1.22.0' + api 'net.polyv.android:polyvSDKLiveScenes:1.22.1' //glide api("com.github.bumptech.glide:okhttp3-integration:4.7.1") { diff --git a/polyvLiveCommonModul/src/main/java/com/easefun/polyv/livecommon/module/data/IPLVLiveRoomDataManager.java b/polyvLiveCommonModul/src/main/java/com/easefun/polyv/livecommon/module/data/IPLVLiveRoomDataManager.java index b9500f4d..c899425c 100644 --- a/polyvLiveCommonModul/src/main/java/com/easefun/polyv/livecommon/module/data/IPLVLiveRoomDataManager.java +++ b/polyvLiveCommonModul/src/main/java/com/easefun/polyv/livecommon/module/data/IPLVLiveRoomDataManager.java @@ -11,6 +11,7 @@ import com.plv.livescenes.model.PLVPlaybackChannelDetailVO; import com.plv.livescenes.model.commodity.saas.PLVCommodityVO2; import com.plv.livescenes.model.interact.PLVWebviewUpdateAppStatusVO; +import com.plv.livescenes.model.pointreward.PLVRewardSettingVO; import com.plv.socket.event.chat.PLVRewardEvent; import com.plv.socket.event.interact.PLVCallAppEvent; @@ -113,6 +114,12 @@ public interface IPLVLiveRoomDataManager { */ LiveData> getPlaybackChannelData(); + /** + * 获取打赏设置LiveData + * @return + */ + LiveData> getRewardSettingData(); + /** * 获取请求商品接口的rank */ @@ -223,6 +230,11 @@ public interface IPLVLiveRoomDataManager { * 请求回放频道的详细信息 */ void requestPlaybackChannelStatus(); + + /** + * 请求打赏设置 + */ + void requestRewardSetting(); // // diff --git a/polyvLiveCommonModul/src/main/java/com/easefun/polyv/livecommon/module/data/PLVLiveRoomDataManager.java b/polyvLiveCommonModul/src/main/java/com/easefun/polyv/livecommon/module/data/PLVLiveRoomDataManager.java index f29b888d..7fdc8d33 100644 --- a/polyvLiveCommonModul/src/main/java/com/easefun/polyv/livecommon/module/data/PLVLiveRoomDataManager.java +++ b/polyvLiveCommonModul/src/main/java/com/easefun/polyv/livecommon/module/data/PLVLiveRoomDataManager.java @@ -12,6 +12,7 @@ import com.plv.livescenes.model.PLVPlaybackChannelDetailVO; import com.plv.livescenes.model.commodity.saas.PLVCommodityVO2; import com.plv.livescenes.model.interact.PLVWebviewUpdateAppStatusVO; +import com.plv.livescenes.model.pointreward.PLVRewardSettingVO; import com.plv.livescenes.streamer.transfer.PLVStreamerInnerDataTransfer; import com.plv.socket.event.chat.PLVRewardEvent; import com.plv.socket.event.interact.PLVCallAppEvent; @@ -62,6 +63,8 @@ public class PLVLiveRoomDataManager implements IPLVLiveRoomDataManager { private MutableLiveData isOnlyAudio = new MutableLiveData<>(); //回放频道的详细信息 private MutableLiveData> playbackChannelDetailVO = new MutableLiveData<>(); + //打赏配置 + private MutableLiveData> rewardSettingVO = new MutableLiveData<>(); //直播场次Id private MutableLiveData sessionIdLiveData = new MutableLiveData<>(); //聊天室token @@ -146,6 +149,11 @@ public LiveData> getPlaybackChannelD return playbackChannelDetailVO; } + @Override + public MutableLiveData> getRewardSettingData() { + return rewardSettingVO; + } + @Override public MutableLiveData getSessionIdLiveData() { return sessionIdLiveData; @@ -381,6 +389,21 @@ public void onFailed(String msg, Throwable throwable) { } }); } + + @Override + public void requestRewardSetting() { + liveRoomDataRequester.requestRewardSetting(new PLVLiveRoomDataRequester.IPLVNetRequestListener() { + @Override + public void onSuccess(PLVRewardSettingVO plvRewardSettingVO) { + rewardSettingVO.postValue(PLVStatefulData.success(plvRewardSettingVO)); + } + + @Override + public void onFailed(String msg, Throwable throwable) { + rewardSettingVO.postValue(PLVStatefulData.error(msg, throwable)); + } + }); + } // // diff --git a/polyvLiveCommonModul/src/main/java/com/easefun/polyv/livecommon/module/data/PLVLiveRoomDataRequester.java b/polyvLiveCommonModul/src/main/java/com/easefun/polyv/livecommon/module/data/PLVLiveRoomDataRequester.java index 3972741a..30cb8b88 100644 --- a/polyvLiveCommonModul/src/main/java/com/easefun/polyv/livecommon/module/data/PLVLiveRoomDataRequester.java +++ b/polyvLiveCommonModul/src/main/java/com/easefun/polyv/livecommon/module/data/PLVLiveRoomDataRequester.java @@ -13,6 +13,8 @@ import com.plv.foundationsdk.rx.PLVRxBaseRetryFunction; import com.plv.foundationsdk.rx.PLVRxBaseTransformer; import com.plv.foundationsdk.utils.PLVFormatUtils; +import com.plv.livescenes.feature.pointreward.IPLVPointRewardDataSource; +import com.plv.livescenes.feature.pointreward.PLVRewardDataSource; import com.plv.livescenes.hiclass.PLVHiClassDataBean; import com.plv.livescenes.hiclass.api.PLVHCApiManager; import com.plv.livescenes.hiclass.vo.PLVHCLessonDetailVO; @@ -20,6 +22,7 @@ import com.plv.livescenes.model.PLVLiveStatusVO2; import com.plv.livescenes.model.PLVPlaybackChannelDetailVO; import com.plv.livescenes.model.commodity.saas.PLVCommodityVO2; +import com.plv.livescenes.model.pointreward.PLVRewardSettingVO; import com.plv.livescenes.net.PLVApiManager; import com.plv.socket.user.PLVSocketUserConstant; @@ -43,6 +46,7 @@ public class PLVLiveRoomDataRequester { //请求商品的rank private int commodityRank = -1; + private PLVRewardDataSource rewardDataSource = new PLVRewardDataSource(); //直播频道配置参数 private PLVLiveChannelConfig liveChannelConfig; @@ -420,6 +424,32 @@ void disposePlayBackChannelDetail(){ } // + // + void requestRewardSetting(final IPLVNetRequestListener listener) { + rewardDataSource.getRewardSetting(getConfig().getChannelId(), new IPLVPointRewardDataSource.IPointRewardListener() { + @Override + public void onSuccess(PLVRewardSettingVO plvRewardSettingVO) { + if (listener != null) { + listener.onSuccess(plvRewardSettingVO); + } + } + + @Override + public void onFailed(Throwable throwable) { + if (listener != null) { + listener.onFailed(getErrorMessage(throwable), throwable); + } + } + }); + } + + void disposeRewardSetting() { + if (rewardDataSource != null) { + rewardDataSource.destroy(); + } + } + // + // void destroy() { disposablePageViewer(); @@ -430,6 +460,7 @@ void destroy() { disposeUpdateChannelName(); disposeLessonDetail(); disposePlayBackChannelDetail(); + disposeRewardSetting(); } // diff --git a/polyvLiveCommonModul/src/main/java/com/easefun/polyv/livecommon/ui/widget/PLVClipOutMaskView.java b/polyvLiveCommonModul/src/main/java/com/easefun/polyv/livecommon/ui/widget/PLVClipOutMaskView.java new file mode 100644 index 00000000..0b021143 --- /dev/null +++ b/polyvLiveCommonModul/src/main/java/com/easefun/polyv/livecommon/ui/widget/PLVClipOutMaskView.java @@ -0,0 +1,173 @@ +package com.easefun.polyv.livecommon.ui.widget; + +import android.content.Context; +import android.content.res.TypedArray; +import android.graphics.Canvas; +import android.graphics.Color; +import android.graphics.Path; +import android.graphics.RectF; +import android.graphics.Region; +import android.support.annotation.Nullable; +import android.support.annotation.Px; +import android.util.AttributeSet; +import android.view.MotionEvent; +import android.view.View; + +import com.easefun.polyv.livecommon.R; + +import java.util.ArrayList; +import java.util.List; + +/** + * @author Hoshiiro + */ +public class PLVClipOutMaskView extends View { + + private final List clipOutParams = new ArrayList<>(); + private final List clipOutPaths = new ArrayList<>(); + private int maskColor = Color.TRANSPARENT; + + public PLVClipOutMaskView(Context context) { + this(context, null); + } + + public PLVClipOutMaskView(Context context, @Nullable AttributeSet attrs) { + this(context, attrs, 0); + } + + public PLVClipOutMaskView(Context context, @Nullable AttributeSet attrs, int defStyleAttr) { + super(context, attrs, defStyleAttr); + init(attrs, defStyleAttr); + } + + private void init(@Nullable AttributeSet attrs, int defStyleAttr) { + TypedArray typedArray = getContext().obtainStyledAttributes(attrs, R.styleable.PLVClipOutMaskView, defStyleAttr, 0); + int maskColor = typedArray.getColor(R.styleable.PLVClipOutMaskView_plv_mask_color, Color.TRANSPARENT); + boolean consumeClick = typedArray.getBoolean(R.styleable.PLVClipOutMaskView_plv_mask_consume_click, true); + typedArray.recycle(); + + this.setMaskColor(maskColor); + if (consumeClick) { + setOnClickListener(new OnClickListener() { + @Override + public void onClick(View v) { + + } + }); + } + } + + public void setMaskColor(int maskColor) { + this.maskColor = maskColor; + } + + public void clipOut(View anchor) { + final ClipOutParam param = new ClipOutParam(); + param.anchor = anchor; + clipOutParams.add(param); + clipOutPaths.clear(); + } + + public void clipOutRoundRect(View anchor, @Px float radius) { + final ClipOutParam param = new ClipOutParam(); + param.anchor = anchor; + param.radiusTopLeft = radius; + param.radiusTopRight = radius; + param.radiusBottomLeft = radius; + param.radiusBottomRight = radius; + clipOutParams.add(param); + clipOutPaths.clear(); + } + + public void clipOutRoundRect(View anchor, @Px float radiusTopLeft, float radiusTopRight, float radiusBottomLeft, float radiusBottomRight) { + final ClipOutParam param = new ClipOutParam(); + param.anchor = anchor; + param.radiusTopLeft = radiusTopLeft; + param.radiusTopRight = radiusTopRight; + param.radiusBottomLeft = radiusBottomLeft; + param.radiusBottomRight = radiusBottomRight; + clipOutParams.add(param); + clipOutPaths.clear(); + } + + public void clearClipOutParams() { + clipOutParams.clear(); + clipOutPaths.clear(); + } + + @Override + public boolean onTouchEvent(MotionEvent event) { + int[] location = new int[2]; + for (ClipOutParam clipOutParam : clipOutParams) { + clipOutParam.anchor.getLocationOnScreen(location); + final int anchorX = location[0]; + final int anchorY = location[1]; + final int anchorWidth = clipOutParam.anchor.getWidth(); + final int anchorHeight = clipOutParam.anchor.getHeight(); + final RectF anchorRect = new RectF(anchorX, anchorY, anchorX + anchorWidth, anchorY + anchorHeight); + if (anchorRect.contains(event.getRawX(), event.getRawY())) { + return false; + } + } + return super.onTouchEvent(event); + } + + @Override + public void invalidate() { + this.clipOutPaths.clear(); + super.invalidate(); + } + + @Override + protected void onDraw(Canvas canvas) { + prepareClipOutPath(); + for (Path path : clipOutPaths) { + canvas.clipPath(path, Region.Op.DIFFERENCE); + } + canvas.drawColor(this.maskColor); + } + + private void prepareClipOutPath() { + if (!clipOutPaths.isEmpty() || clipOutParams.isEmpty()) { + return; + } + int[] location = new int[2]; + for (ClipOutParam clipOutParam : clipOutParams) { + clipOutParam.anchor.getLocationOnScreen(location); + final int anchorX = location[0]; + final int anchorY = location[1]; + final int anchorWidth = clipOutParam.anchor.getWidth(); + final int anchorHeight = clipOutParam.anchor.getHeight(); + this.getLocationOnScreen(location); + final int maskX = location[0]; + final int maskY = location[1]; + final int offsetX = anchorX - maskX; + final int offsetY = anchorY - maskY; + final float radiusTopLeft = clipOutParam.radiusTopLeft; + final float radiusTopRight = clipOutParam.radiusTopRight; + final float radiusBottomLeft = clipOutParam.radiusBottomLeft; + final float radiusBottomRight = clipOutParam.radiusBottomRight; + + final Path path = new Path(); + path.addRoundRect( + new RectF(offsetX, offsetY, offsetX + anchorWidth, offsetY + anchorHeight), + new float[]{radiusTopLeft, radiusTopLeft, radiusTopRight, radiusTopRight, radiusBottomRight, radiusBottomRight, radiusBottomLeft, radiusBottomLeft}, + Path.Direction.CCW + ); + clipOutPaths.add(path); + } + } + + public static class ClipOutParam { + View anchor; + @Px + float radiusTopLeft = 0F; + @Px + float radiusTopRight = 0F; + @Px + float radiusBottomLeft = 0F; + @Px + float radiusBottomRight = 0F; + } + +} diff --git a/polyvLiveCommonModul/src/main/res/values-b+zh+Hant/strings.xml b/polyvLiveCommonModul/src/main/res/values-b+zh+Hant/strings.xml index 11fcceb9..88890b96 100644 --- a/polyvLiveCommonModul/src/main/res/values-b+zh+Hant/strings.xml +++ b/polyvLiveCommonModul/src/main/res/values-b+zh+Hant/strings.xml @@ -321,6 +321,7 @@ 點擊下課將結束直播,確認下課嗎? 網路斷開,已停止直播,請更換網路後重試 + 網絡斷開,直播已暫停 上課前無法發起連麥 請先點選上課 弱網處理 @@ -501,6 +502,7 @@ 確認退出回放 + 直播重播 沒有資料 載入失敗,請點選重試 @@ -539,6 +541,9 @@ 請選擇打賞數 請選擇打賞道具 打賞 + 禮物打賞 + 禮物特效 + 開啟/關閉打賞設定後,觀眾需刷新頁面或重進直播間 %s 發了一個%s, 點選領取 diff --git a/polyvLiveCommonModul/src/main/res/values-ja/strings.xml b/polyvLiveCommonModul/src/main/res/values-ja/strings.xml index b4a3254e..217de534 100644 --- a/polyvLiveCommonModul/src/main/res/values-ja/strings.xml +++ b/polyvLiveCommonModul/src/main/res/values-ja/strings.xml @@ -321,6 +321,7 @@ 退室を終了するためにクリックすると、ライブ ブロードキャストが終了します。本当に退室を終了しますか? ネットワークが切断されたため、ライブ ブロードキャストが停止しました。ネットワークを変更してもう一度お試しください。 + ネットオフ、生中継一時停止 授業の前に linkmic を開始できません 最初にクリックして授業を行ってください 弱いネットワーク処理 @@ -500,6 +501,7 @@ 再生の終了を確認する + ライブ再生 データがありません 読み込みに失敗しました。クリックして再試行してください。 @@ -538,6 +540,9 @@ 報酬額を選択してください 特典アイテムを選択してください 報酬 + プレゼント + プレゼント効果 + 打賞設定をオン/オフにすると、視聴者はページを更新するか、ライブルームに再入力する必要があります %s が %s にメッセージを送信しました。 クリックして受け取る diff --git a/polyvLiveCommonModul/src/main/res/values-ko/strings.xml b/polyvLiveCommonModul/src/main/res/values-ko/strings.xml index b4e079f9..fbc6b49d 100644 --- a/polyvLiveCommonModul/src/main/res/values-ko/strings.xml +++ b/polyvLiveCommonModul/src/main/res/values-ko/strings.xml @@ -321,6 +321,7 @@ 퇴실을 종료하려면 라이브 방송이 종료됩니다. 수업을 종료하시겠습니까? 네트워크 연결이 끊어져 라이브 방송이 중단되었습니다. 네트워크를 변경하고 다시 시도해 주세요. + 네트워크 끊김, 실시간 중단 수업 전에 링크마이크를 시작할 수 없습니다 먼저 수업을 클릭해 주세요 약한 네트워크 처리 @@ -501,6 +502,7 @@ 재생 종료 확인 + 생방송 재생 데이터 없음 로드에 실패했습니다. 다시 시도하려면 클릭하세요 @@ -539,6 +541,9 @@ 보상 금액을 선택해주세요 보상 아이템을 선택해주세요 보상 + 선물 타상 + 선물 효과 + 포상 설정을 켜거나 끈 후, 시청자는 페이지를 새로 고치거나 생방송으로 다시 들어가야 한다 %s님이 %s님에게 메시지를 보냈습니다, 수신하려면 클릭하세요 diff --git a/polyvLiveCommonModul/src/main/res/values-zh/strings.xml b/polyvLiveCommonModul/src/main/res/values-zh/strings.xml index 24139bda..25b4d21f 100644 --- a/polyvLiveCommonModul/src/main/res/values-zh/strings.xml +++ b/polyvLiveCommonModul/src/main/res/values-zh/strings.xml @@ -321,6 +321,7 @@ 点击下课将结束直播,确认下课吗? 网络断开,已停止直播,请更换网络后重试 + 网络断开,直播已暂停 上课前无法发起连麦 请先点击上课 弱网处理 @@ -501,6 +502,7 @@ 确认退出回放 + 直播回放 没有数据 加载失败,请点击重试 @@ -539,6 +541,9 @@ 请选择打赏数量 请选择打赏道具 打赏 + 礼物打赏 + 礼物特效 + 开启/关闭打赏设置后,观众需刷新页面或重进直播间 %s 发了一个%s, 点击领取 diff --git a/polyvLiveCommonModul/src/main/res/values/attrs.xml b/polyvLiveCommonModul/src/main/res/values/attrs.xml index 0a24eae9..07f830b6 100644 --- a/polyvLiveCommonModul/src/main/res/values/attrs.xml +++ b/polyvLiveCommonModul/src/main/res/values/attrs.xml @@ -480,4 +480,9 @@ + + + + + \ No newline at end of file diff --git a/polyvLiveCommonModul/src/main/res/values/strings.xml b/polyvLiveCommonModul/src/main/res/values/strings.xml index 1579f85c..7d3b97f0 100644 --- a/polyvLiveCommonModul/src/main/res/values/strings.xml +++ b/polyvLiveCommonModul/src/main/res/values/strings.xml @@ -321,6 +321,7 @@ Selecting "End class" will disconnect the live lesson. End class now\? Lost connection. Live class ended. Please restore network and retry streaming + Network down, live stream paused Unable to start call before class begins Please start the class first Weak net @@ -501,6 +502,7 @@ Confirm to exit playback + Live Replay No more data Loading failed, please tap retry @@ -539,6 +541,9 @@ Please select the reward amount Please select a reward gift Reward + Gifts Reward + Gifts Effects + After toggling the switch, viewers need to refresh or reload the page for the changes to take effect %s sent a %s,  Click to receive diff --git a/polyvLiveStreamerScene/src/main/java/com/easefun/polyv/livestreamer/modules/liveroom/PLVLSNetworkDisconnectMaskLayout.java b/polyvLiveStreamerScene/src/main/java/com/easefun/polyv/livestreamer/modules/liveroom/PLVLSNetworkDisconnectMaskLayout.java new file mode 100644 index 00000000..0d1611ab --- /dev/null +++ b/polyvLiveStreamerScene/src/main/java/com/easefun/polyv/livestreamer/modules/liveroom/PLVLSNetworkDisconnectMaskLayout.java @@ -0,0 +1,99 @@ +package com.easefun.polyv.livestreamer.modules.liveroom; + +import android.app.Activity; +import android.arch.lifecycle.LifecycleOwner; +import android.arch.lifecycle.Observer; +import android.content.Context; +import android.support.annotation.NonNull; +import android.support.annotation.Nullable; +import android.util.AttributeSet; +import android.view.LayoutInflater; +import android.view.View; +import android.widget.FrameLayout; + +import com.easefun.polyv.livecommon.module.modules.streamer.contract.IPLVStreamerContract; +import com.easefun.polyv.livecommon.module.modules.streamer.view.PLVAbsStreamerView; +import com.easefun.polyv.livecommon.ui.widget.PLVClipOutMaskView; +import com.easefun.polyv.livestreamer.R; +import com.plv.foundationsdk.utils.PLVNetworkUtils; +import com.plv.linkmic.PLVLinkMicConstant; +import com.plv.thirdpart.blankj.utilcode.util.ConvertUtils; + +/** + * @author Hoshiiro + */ +public class PLVLSNetworkDisconnectMaskLayout extends FrameLayout { + + private PLVClipOutMaskView clipOutMaskView; + + private boolean isLive = false; + private boolean isNetworkDisconnect = false; + + public PLVLSNetworkDisconnectMaskLayout(@NonNull Context context) { + super(context); + init(); + } + + public PLVLSNetworkDisconnectMaskLayout(@NonNull Context context, @Nullable AttributeSet attrs) { + super(context, attrs); + init(); + } + + public PLVLSNetworkDisconnectMaskLayout(@NonNull Context context, @Nullable AttributeSet attrs, int defStyleAttr) { + super(context, attrs, defStyleAttr); + init(); + } + + private void init() { + LayoutInflater.from(getContext()).inflate(R.layout.plvls_network_disconnect_mask_layout, this); + clipOutMaskView = findViewById(R.id.plvls_clip_out_mask_view); + } + + public final IPLVStreamerContract.IStreamerView streamerView = new PLVAbsStreamerView() { + @Override + public void setPresenter(@NonNull IPLVStreamerContract.IStreamerPresenter presenter) { + presenter.getData().getStreamerStatus().observe((LifecycleOwner) getContext(), new Observer() { + @Override + public void onChanged(@Nullable Boolean isLive) { + PLVLSNetworkDisconnectMaskLayout.this.isLive = isLive != null && isLive; + update(); + } + }); + } + + @Override + public void onNetworkQuality(PLVLinkMicConstant.NetworkQuality quality) { + isNetworkDisconnect = quality == PLVLinkMicConstant.NetworkQuality.DISCONNECT || !PLVNetworkUtils.isConnected(getContext()); + update(); + } + + }; + + private void update() { + final boolean currentVisible = getVisibility() == VISIBLE; + final boolean needVisible = isLive && isNetworkDisconnect; + if (currentVisible == needVisible) { + return; + } + if (!needVisible) { + setVisibility(GONE); + return; + } + setupClipOutMaskView(); + setVisibility(VISIBLE); + } + + private void setupClipOutMaskView() { + clipOutMaskView.clearClipOutParams(); + final Activity activity = (Activity) getContext(); + final View closeIcon = activity.findViewById(R.id.plvls_status_bar_class_control_tv); + if (closeIcon != null && closeIcon.isShown()) { + clipOutMaskView.clipOutRoundRect(closeIcon, ConvertUtils.dp2px(30)); + } + final View networkStatusBar = activity.findViewById(R.id.plvls_status_bar_net_quality_view); + if (networkStatusBar != null && networkStatusBar.isShown()) { + clipOutMaskView.clipOutRoundRect(networkStatusBar, ConvertUtils.dp2px(10)); + } + } + +} diff --git a/polyvLiveStreamerScene/src/main/java/com/easefun/polyv/livestreamer/scenes/PLVLSLiveStreamerActivity.java b/polyvLiveStreamerScene/src/main/java/com/easefun/polyv/livestreamer/scenes/PLVLSLiveStreamerActivity.java index 273e58eb..6026827c 100644 --- a/polyvLiveStreamerScene/src/main/java/com/easefun/polyv/livestreamer/scenes/PLVLSLiveStreamerActivity.java +++ b/polyvLiveStreamerScene/src/main/java/com/easefun/polyv/livestreamer/scenes/PLVLSLiveStreamerActivity.java @@ -37,6 +37,7 @@ import com.easefun.polyv.livestreamer.modules.document.IPLVLSDocumentLayout; import com.easefun.polyv.livestreamer.modules.document.PLVLSDocumentLayout; import com.easefun.polyv.livestreamer.modules.document.widget.PLVLSDocumentControllerExpandMenu; +import com.easefun.polyv.livestreamer.modules.liveroom.PLVLSNetworkDisconnectMaskLayout; import com.easefun.polyv.livestreamer.modules.liveroom.PLVLSPushDowngradeAlertToastLayout; import com.easefun.polyv.livestreamer.modules.statusbar.IPLVLSStatusBarLayout; import com.easefun.polyv.livestreamer.modules.streamer.IPLVLSStreamerLayout; @@ -100,6 +101,7 @@ public class PLVLSLiveStreamerActivity extends PLVBaseActivity { private PLVLSPushDowngradeAlertToastLayout pushDowngradeAlertToastLy; // 互动布局 private IPLVStreamerInteractLayout interactLayout; + private PLVLSNetworkDisconnectMaskLayout networkDisconnectMaskLayout; // // @@ -196,6 +198,7 @@ protected void onCreate(@Nullable Bundle savedInstanceState) { observeStreamerLayout(); observeChatroomLayout(); observeDocumentLayout(); + observeNetworkDisconnectLayout(); } @Override @@ -318,6 +321,8 @@ private void initView() { toTopView = findViewById(R.id.plvls_chatroom_to_top_view); pushDowngradeAlertToastLy = findViewById(R.id.plvls_push_downgrade_alert_toast_ly); interactLayout = findViewById(R.id.plvsa_interact_layout); + networkDisconnectMaskLayout = findViewById(R.id.plvls_network_disconnect_mask_layout); + interactLayout.init(liveRoomDataManager); // 初始化推流和连麦布局 @@ -686,6 +691,14 @@ public void onSwitchFullScreen(boolean toFullScreen) { } // + // + + private void observeNetworkDisconnectLayout() { + plvlsStreamerLy.getStreamerPresenter().registerView(networkDisconnectMaskLayout.streamerView); + } + + // + // private void checkStreamRecover() { diff --git a/polyvLiveStreamerScene/src/main/res/drawable-xhdpi/plvls_network_disconnect_icon.png b/polyvLiveStreamerScene/src/main/res/drawable-xhdpi/plvls_network_disconnect_icon.png new file mode 100644 index 00000000..a57ef8a0 Binary files /dev/null and b/polyvLiveStreamerScene/src/main/res/drawable-xhdpi/plvls_network_disconnect_icon.png differ diff --git a/polyvLiveStreamerScene/src/main/res/layout/plvls_live_streamer_activity.xml b/polyvLiveStreamerScene/src/main/res/layout/plvls_live_streamer_activity.xml index eb2402f2..7b3299c5 100644 --- a/polyvLiveStreamerScene/src/main/res/layout/plvls_live_streamer_activity.xml +++ b/polyvLiveStreamerScene/src/main/res/layout/plvls_live_streamer_activity.xml @@ -63,6 +63,13 @@ app:layout_constraintRight_toRightOf="@+id/plvls_document_ly" app:layout_constraintTop_toTopOf="@+id/plvls_document_ly" /> + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/polyvStreamerAloneScene/src/main/java/com/easefun/polyv/streameralone/modules/chatroom/IPLVSAChatroomLayout.java b/polyvStreamerAloneScene/src/main/java/com/easefun/polyv/streameralone/modules/chatroom/IPLVSAChatroomLayout.java index 4e9c03bf..9209544b 100644 --- a/polyvStreamerAloneScene/src/main/java/com/easefun/polyv/streameralone/modules/chatroom/IPLVSAChatroomLayout.java +++ b/polyvStreamerAloneScene/src/main/java/com/easefun/polyv/streameralone/modules/chatroom/IPLVSAChatroomLayout.java @@ -46,6 +46,11 @@ public interface IPLVSAChatroomLayout { */ void callInputWindow(); + /** + * 改变聊天列表显示类型 + */ + void changeDisplayType(int displayDataType); + /** * 添加信息到聊天列表中 * diff --git a/polyvStreamerAloneScene/src/main/java/com/easefun/polyv/streameralone/modules/chatroom/PLVSAChatroomLayout.java b/polyvStreamerAloneScene/src/main/java/com/easefun/polyv/streameralone/modules/chatroom/PLVSAChatroomLayout.java index a9575686..d02c6784 100644 --- a/polyvStreamerAloneScene/src/main/java/com/easefun/polyv/streameralone/modules/chatroom/PLVSAChatroomLayout.java +++ b/polyvStreamerAloneScene/src/main/java/com/easefun/polyv/streameralone/modules/chatroom/PLVSAChatroomLayout.java @@ -293,6 +293,13 @@ public boolean onSendMsg(String message) { }); } + @Override + public void changeDisplayType(int displayDataType) { + if (chatMessageAdapter != null) { + chatMessageAdapter.changeDisplayType(displayDataType); + } + } + @Override public void addChatMessageToChatList(final List chatMessageDataList, final boolean isScrollEnd) { addChatMessageToList(chatMessageDataList, isScrollEnd); diff --git a/polyvStreamerAloneScene/src/main/java/com/easefun/polyv/streameralone/modules/chatroom/adapter/PLVSAMessageAdapter.java b/polyvStreamerAloneScene/src/main/java/com/easefun/polyv/streameralone/modules/chatroom/adapter/PLVSAMessageAdapter.java index 5384b58a..5a5691ba 100644 --- a/polyvStreamerAloneScene/src/main/java/com/easefun/polyv/streameralone/modules/chatroom/adapter/PLVSAMessageAdapter.java +++ b/polyvStreamerAloneScene/src/main/java/com/easefun/polyv/streameralone/modules/chatroom/adapter/PLVSAMessageAdapter.java @@ -6,6 +6,7 @@ import android.view.View; import android.view.ViewGroup; +import com.easefun.polyv.livecommon.module.modules.chatroom.PLVCustomGiftEvent; import com.easefun.polyv.livecommon.module.modules.chatroom.PLVSpecialTypeTag; import com.easefun.polyv.livecommon.module.modules.chatroom.holder.PLVChatMessageBaseViewHolder; import com.easefun.polyv.livecommon.module.modules.chatroom.holder.PLVChatMessageItemType; @@ -24,6 +25,7 @@ import com.plv.socket.event.chat.IPLVMessageIdEvent; import com.plv.socket.event.chat.PLVChatQuoteVO; import com.plv.socket.event.chat.PLVProhibitedWordVO; +import com.plv.socket.event.chat.PLVRewardEvent; import java.util.ArrayList; import java.util.List; @@ -34,11 +36,15 @@ public class PLVSAMessageAdapter extends PLVBaseAdapter> { // public static final String PAYLOAD_PROHIBITED_CHANGED = "prohibitedChanged"; + public static final int DISPLAY_DATA_TYPE_FULL = 1; + public static final int DISPLAY_DATA_TYPE_SPECIAL = 2; + public static final int DISPLAY_DATA_TYPE_REMOVE_REWARD = 3;//仅适配全部消息的数据列表 private List dataList;//adapter使用的数据列表 private List fullDataList;//全部信息的数据列表 private List specialDataList;//只看讲师信息的数据列表(包括我、讲师类型、嘉宾类型、助教类型、管理员类型的信息) + private List excludeRewardDataList;//移除了打赏信息的数据列表 - private boolean isDisplaySpecialType;//是否只看讲师 + private int displayDataType = DISPLAY_DATA_TYPE_FULL;//显示数据类型 private int msgIndex; // @@ -51,7 +57,14 @@ public class PLVSAMessageAdapter extends PLVBaseAdapter(); specialDataList = new ArrayList<>(); - dataList = isDisplaySpecialType ? specialDataList : fullDataList; + excludeRewardDataList = new ArrayList<>(); + if (displayDataType == DISPLAY_DATA_TYPE_FULL) { + dataList = fullDataList; + } else if (displayDataType == DISPLAY_DATA_TYPE_SPECIAL) { + dataList = specialDataList; + } else { + dataList = excludeRewardDataList; + } } // @@ -127,18 +140,19 @@ public void setMsgIndex(int msgIndex) { } // - public void changeDisplayType(boolean isDisplaySpecialType) { - if (this.isDisplaySpecialType == isDisplaySpecialType) { + public void changeDisplayType(int displayDataType) { + if (this.displayDataType == displayDataType) { return; } - this.isDisplaySpecialType = isDisplaySpecialType; - if (isDisplaySpecialType) { - dataList = specialDataList; - notifyDataSetChanged(); - } else { + this.displayDataType = displayDataType; + if (displayDataType == DISPLAY_DATA_TYPE_FULL) { dataList = fullDataList; - notifyDataSetChanged(); + } else if (displayDataType == DISPLAY_DATA_TYPE_SPECIAL) { + dataList = specialDataList; + } else if (displayDataType == DISPLAY_DATA_TYPE_REMOVE_REWARD) { + dataList = excludeRewardDataList; } + notifyDataSetChanged(); } // @@ -148,6 +162,10 @@ public boolean addDataChangedAtLast(PLVBaseViewData baseViewData) { if (baseViewData.getTag() instanceof PLVSpecialTypeTag) { specialDataList.add(baseViewData); } + if (!(baseViewData.getData() instanceof PLVCustomGiftEvent) + && !(baseViewData.getData() instanceof PLVRewardEvent)) { + excludeRewardDataList.add(baseViewData); + } if (dataList.size() != oldSize) { notifyItemInserted(dataList.size() - 1); return true; @@ -163,6 +181,12 @@ public boolean addDataListChangedAtLast(List list) { specialDataList.add(baseViewData); } } + for (PLVBaseViewData baseViewData : list) { + if (!(baseViewData.getData() instanceof PLVCustomGiftEvent) + && !(baseViewData.getData() instanceof PLVRewardEvent)) { + excludeRewardDataList.add(baseViewData); + } + } if (dataList.size() != oldSize) { notifyItemRangeInserted(oldSize, dataList.size() - oldSize); return true; @@ -179,6 +203,13 @@ public boolean addDataListChangedAtFirst(List> lis specialDataList.add(0, baseViewData); } } + for (int i = list.size() - 1; i >= 0; i--) { + PLVBaseViewData baseViewData = list.get(i); + if (!(baseViewData.getData() instanceof PLVCustomGiftEvent) + && !(baseViewData.getData() instanceof PLVRewardEvent)) { + excludeRewardDataList.add(0, baseViewData); + } + } if (dataList.size() != oldSize) { notifyItemRangeInserted(0, dataList.size() - oldSize); return true; @@ -213,7 +244,30 @@ public void notifyProhibitedChanged(String prohibitedMessage, String hintMsg, St } } } - notifyItemChanged(isDisplaySpecialType ? changedSpecialDataPosition : changedFullDataPosition, PAYLOAD_PROHIBITED_CHANGED); + int changedExcludeRewardDataPosition = -1; + for (int i = excludeRewardDataList.size() - 1; i >= 0; i--) { + PLVBaseViewData baseViewData = excludeRewardDataList.get(i); + if (baseViewData.getData() instanceof PolyvLocalMessage) { + String speakMsg = ((PolyvLocalMessage) baseViewData.getData()).getSpeakMessage(); + if (prohibitedMessage != null && speakMsg != null && speakMsg.contains(prohibitedMessage)) { + PLVProhibitedWordVO prohibitedWordVO = new PLVProhibitedWordVO(prohibitedMessage, hintMsg, status); + ((PolyvLocalMessage) baseViewData.getData()).setProhibitedWord(prohibitedWordVO); + changedExcludeRewardDataPosition = i; + break; + } + } + } + int changedPosition = -1; + if (displayDataType == DISPLAY_DATA_TYPE_FULL) { + changedPosition = changedFullDataPosition; + } else if (displayDataType == DISPLAY_DATA_TYPE_SPECIAL) { + changedPosition = changedSpecialDataPosition; + } else if (displayDataType == DISPLAY_DATA_TYPE_REMOVE_REWARD) { + changedPosition = changedExcludeRewardDataPosition; + } + if (changedPosition != -1) { + notifyItemChanged(changedPosition); + } } public boolean removeDataChanged(String id) { @@ -243,9 +297,30 @@ public boolean removeDataChanged(String id) { break; } } + int removeExcludeRewardDataPosition = -1; + for (PLVBaseViewData baseViewData : excludeRewardDataList) { + removeExcludeRewardDataPosition++; + if (baseViewData.getData() instanceof IPLVIdEvent + && id.equals(((IPLVIdEvent) baseViewData.getData()).getId()) + || (baseViewData.getData() instanceof IPLVMessageIdEvent + && id.equals(((IPLVMessageIdEvent) baseViewData.getData()).getMessageId()))) { + excludeRewardDataList.remove(baseViewData); + break; + } + } if (dataList.size() != oldSize) { - notifyItemRemoved(isDisplaySpecialType ? removeSpecialDataPosition : removeFullDataPosition); - return true; + int changedPosition = -1; + if (displayDataType == DISPLAY_DATA_TYPE_FULL) { + changedPosition = removeFullDataPosition; + } else if (displayDataType == DISPLAY_DATA_TYPE_SPECIAL) { + changedPosition = removeSpecialDataPosition; + } else if (displayDataType == DISPLAY_DATA_TYPE_REMOVE_REWARD) { + changedPosition = removeExcludeRewardDataPosition; + } + if (changedPosition != -1) { + notifyItemChanged(changedPosition); + return true; + } } return false; } @@ -265,6 +340,12 @@ public boolean removeDataChanged(int maxLength) { specialDataList.clear(); specialDataList.addAll(retainList); } + if (excludeRewardDataList.size() > maxLength) { +// excludeRewardDataList.removeAll(excludeRewardDataList.subList(0, excludeRewardDataList.size() - maxLength)); + List retainList = new ArrayList<>(excludeRewardDataList.subList(excludeRewardDataList.size() - maxLength, excludeRewardDataList.size())); + excludeRewardDataList.clear(); + excludeRewardDataList.addAll(retainList); + } if (dataList.size() != oldSize) { notifyDataSetChanged(); return true; @@ -276,6 +357,7 @@ public boolean removeAllDataChanged() { int oldSize = dataList.size(); fullDataList.clear(); specialDataList.clear(); + excludeRewardDataList.clear(); if (dataList.size() != oldSize) {//if dataList=fullDataList or dataList=specialDataList notifyDataSetChanged(); return true; diff --git a/polyvStreamerAloneScene/src/main/java/com/easefun/polyv/streameralone/modules/liveroom/PLVSALinkMicRequestTipsLayout.java b/polyvStreamerAloneScene/src/main/java/com/easefun/polyv/streameralone/modules/liveroom/PLVSALinkMicRequestTipsLayout.java index ed813f5f..f2b60845 100644 --- a/polyvStreamerAloneScene/src/main/java/com/easefun/polyv/streameralone/modules/liveroom/PLVSALinkMicRequestTipsLayout.java +++ b/polyvStreamerAloneScene/src/main/java/com/easefun/polyv/streameralone/modules/liveroom/PLVSALinkMicRequestTipsLayout.java @@ -1,14 +1,8 @@ package com.easefun.polyv.streameralone.modules.liveroom; -import android.animation.Animator; -import android.animation.AnimatorListenerAdapter; -import android.animation.ObjectAnimator; -import android.arch.lifecycle.LifecycleOwner; -import android.arch.lifecycle.Observer; +import static com.plv.foundationsdk.utils.PLVTimeUnit.seconds; + import android.content.Context; -import android.os.Handler; -import android.os.Looper; -import android.os.Message; import android.support.annotation.NonNull; import android.support.annotation.Nullable; import android.util.AttributeSet; @@ -20,12 +14,9 @@ import android.widget.LinearLayout; import android.widget.TextView; -import com.easefun.polyv.livecommon.module.modules.beauty.viewmodel.PLVBeautyViewModel; -import com.easefun.polyv.livecommon.module.modules.beauty.viewmodel.vo.PLVBeautyUiState; -import com.easefun.polyv.livecommon.ui.widget.roundview.PLVRoundRectLayout; +import com.easefun.polyv.livecommon.ui.util.PLVViewUtil; +import com.easefun.polyv.livecommon.ui.widget.PLVTriangleIndicateLayout; import com.easefun.polyv.streameralone.R; -import com.plv.foundationsdk.component.di.PLVDependManager; -import com.plv.thirdpart.blankj.utilcode.util.ConvertUtils; /** @@ -37,56 +28,12 @@ public class PLVSALinkMicRequestTipsLayout extends FrameLayout { // - private PLVRoundRectLayout plvsaEmptyLinkmicTipsGroupLayout; + private PLVTriangleIndicateLayout plvsaEmptyLinkmicTipsGroupLayout; private LinearLayout plvsaEmptyLinkmicTipsLl; private ImageView plvsaEmptyLinkmicTipsIconIv; private TextView plvsaEmptyLinkmicTipsTv; private Button plvsaEmptyLinkmicNavBtn; - // 有人申请连麦提示条的宽度+右边距 - private int linkmicTipsGroupWidthWithMargin; - - // 连麦提示条动画 - private ObjectAnimator linkmicTipsMoveInAnimator = new ObjectAnimator(); - private ObjectAnimator linkmicTipsMoveOutAnimator = new ObjectAnimator(); - private boolean isLinkmicTipsAnimating = false; - private boolean isLinkmicTipsShowing = false; - - // 连麦提示条动画 消息处理Handler - private static final int MSG_CANCEL = 0; - private static final int MSG_MOVE_IN = 1; - private static final int MSG_MOVE_OUT = 2; - private final Handler animatorHandler = new Handler(Looper.getMainLooper()) { - @Override - public void handleMessage(Message msg) { - switch (msg.what) { - case MSG_CANCEL: - animatorHandler.removeMessages(MSG_MOVE_IN); - animatorHandler.removeMessages(MSG_MOVE_OUT); - linkmicTipsMoveInAnimator.cancel(); - linkmicTipsMoveOutAnimator.cancel(); - plvsaEmptyLinkmicTipsGroupLayout.setAlpha(1); - plvsaEmptyLinkmicTipsGroupLayout.setTranslationX(linkmicTipsGroupWidthWithMargin); - isLinkmicTipsShowing = false; - isLinkmicTipsAnimating = false; - break; - case MSG_MOVE_IN: - if (!isLinkmicTipsShowing && !isLinkmicTipsAnimating) { - linkmicTipsMoveInAnimator.start(); - } - break; - case MSG_MOVE_OUT: - if (isLinkmicTipsShowing && !isLinkmicTipsAnimating) { - linkmicTipsMoveOutAnimator.start(); - } - break; - default: - } - } - }; - - private boolean isBeautyLayoutShowing = false; - private OnTipsClickListener onTipsClickListener; // @@ -114,68 +61,15 @@ private void initView() { LayoutInflater.from(getContext()).inflate(R.layout.plvsa_live_room_linkmic_request_tips_layout, this); findView(); - initLinkmicTipsAnimator(); initLinkmicTipsOnClickListener(); - - observeBeautyLayoutStatus(); } private void findView() { - plvsaEmptyLinkmicTipsGroupLayout = (PLVRoundRectLayout) findViewById(R.id.plvsa_empty_linkmic_tips_group_layout); - plvsaEmptyLinkmicTipsLl = (LinearLayout) findViewById(R.id.plvsa_empty_linkmic_tips_ll); - plvsaEmptyLinkmicTipsIconIv = (ImageView) findViewById(R.id.plvsa_empty_linkmic_tips_icon_iv); - plvsaEmptyLinkmicTipsTv = (TextView) findViewById(R.id.plvsa_empty_linkmic_tips_tv); - plvsaEmptyLinkmicNavBtn = (Button) findViewById(R.id.plvsa_empty_linkmic_nav_btn); - } - - private void initLinkmicTipsAnimator() { - plvsaEmptyLinkmicTipsGroupLayout.post(new Runnable() { - @Override - public void run() { - final int tipsWidth = plvsaEmptyLinkmicTipsGroupLayout.getWidth(); - final int tipsWidthWithMargin = tipsWidth + ConvertUtils.dp2px(8); - linkmicTipsGroupWidthWithMargin = tipsWidthWithMargin; - - plvsaEmptyLinkmicTipsGroupLayout.setTranslationX(tipsWidthWithMargin); - - // 移入:从屏幕右侧移入 - linkmicTipsMoveInAnimator = ObjectAnimator.ofFloat(plvsaEmptyLinkmicTipsGroupLayout, "translationX", tipsWidthWithMargin, 0); - linkmicTipsMoveInAnimator.setDuration(500); - - // 移出:渐隐 - linkmicTipsMoveOutAnimator = ObjectAnimator.ofFloat(plvsaEmptyLinkmicTipsGroupLayout, "alpha", 1, 0); - linkmicTipsMoveOutAnimator.setDuration(1000); - - linkmicTipsMoveInAnimator.addListener(new AnimatorListenerAdapter() { - @Override - public void onAnimationStart(Animator animation, boolean isReverse) { - isLinkmicTipsShowing = true; - isLinkmicTipsAnimating = true; - } - - @Override - public void onAnimationEnd(Animator animation) { - isLinkmicTipsAnimating = false; - animatorHandler.sendMessageDelayed(Message.obtain(animatorHandler, MSG_MOVE_OUT), 10 * 1000); - } - }); - - linkmicTipsMoveOutAnimator.addListener(new AnimatorListenerAdapter() { - @Override - public void onAnimationStart(Animator animation) { - isLinkmicTipsAnimating = true; - } - - @Override - public void onAnimationEnd(Animator animation, boolean isReverse) { - isLinkmicTipsShowing = false; - isLinkmicTipsAnimating = false; - plvsaEmptyLinkmicTipsGroupLayout.setAlpha(1); - plvsaEmptyLinkmicTipsGroupLayout.setTranslationX(tipsWidthWithMargin); - } - }); - } - }); + plvsaEmptyLinkmicTipsGroupLayout = findViewById(R.id.plvsa_empty_linkmic_tips_group_layout); + plvsaEmptyLinkmicTipsLl = findViewById(R.id.plvsa_empty_linkmic_tips_ll); + plvsaEmptyLinkmicTipsIconIv = findViewById(R.id.plvsa_empty_linkmic_tips_icon_iv); + plvsaEmptyLinkmicTipsTv = findViewById(R.id.plvsa_empty_linkmic_tips_tv); + plvsaEmptyLinkmicNavBtn = findViewById(R.id.plvsa_empty_linkmic_nav_btn); } private void initLinkmicTipsOnClickListener() { @@ -197,32 +91,16 @@ public void onClick(View v) { }); } - private void observeBeautyLayoutStatus() { - PLVDependManager.getInstance().get(PLVBeautyViewModel.class) - .getUiState() - .observe((LifecycleOwner) getContext(), new Observer() { - @Override - public void onChanged(@Nullable PLVBeautyUiState beautyUiState) { - PLVSALinkMicRequestTipsLayout.this.isBeautyLayoutShowing = beautyUiState != null && beautyUiState.isBeautyMenuShowing; - updateVisibility(); - } - }); - } - // // public void show() { - animatorHandler.sendMessage(Message.obtain(animatorHandler, MSG_MOVE_IN)); + PLVViewUtil.showViewForDuration(this, seconds(10).toMillis()); } public void hide() { - animatorHandler.sendMessage(Message.obtain(animatorHandler, MSG_MOVE_OUT)); - } - - public void cancel() { - animatorHandler.sendMessage(Message.obtain(animatorHandler, MSG_CANCEL)); + setVisibility(View.GONE); } public void setOnTipsClickListener(OnTipsClickListener onTipsClickListener) { @@ -231,19 +109,6 @@ public void setOnTipsClickListener(OnTipsClickListener onTipsClickListener) { // - // - - private void updateVisibility() { - // 美颜布局显示时,不显示连麦提示条 - if (isBeautyLayoutShowing) { - setVisibility(View.GONE); - return; - } - setVisibility(View.VISIBLE); - } - - // - // public interface OnTipsClickListener { diff --git a/polyvStreamerAloneScene/src/main/java/com/easefun/polyv/streameralone/modules/liveroom/PLVSAMoreLayout.java b/polyvStreamerAloneScene/src/main/java/com/easefun/polyv/streameralone/modules/liveroom/PLVSAMoreLayout.java index a037097e..74965366 100644 --- a/polyvStreamerAloneScene/src/main/java/com/easefun/polyv/streameralone/modules/liveroom/PLVSAMoreLayout.java +++ b/polyvStreamerAloneScene/src/main/java/com/easefun/polyv/streameralone/modules/liveroom/PLVSAMoreLayout.java @@ -1,5 +1,7 @@ package com.easefun.polyv.streameralone.modules.liveroom; +import static com.plv.foundationsdk.utils.PLVAppUtils.postToMainThread; + import android.app.Activity; import android.arch.lifecycle.LifecycleOwner; import android.arch.lifecycle.Observer; @@ -7,7 +9,6 @@ import android.content.DialogInterface; import android.graphics.Color; import android.graphics.PorterDuff; -import android.os.Build; import android.support.annotation.NonNull; import android.support.annotation.Nullable; import android.support.constraint.ConstraintLayout; @@ -55,15 +56,18 @@ import com.plv.livescenes.access.PLVUserAbility; import com.plv.livescenes.access.PLVUserAbilityManager; import com.plv.livescenes.chatroom.IPLVChatroomManager; +import com.plv.livescenes.feature.pointreward.IPLVPointRewardDataSource; +import com.plv.livescenes.feature.pointreward.PLVRewardDataSource; import com.plv.livescenes.linkmic.manager.PLVLinkMicConfig; +import com.plv.livescenes.model.pointreward.PLVRewardSettingVO; import com.plv.livescenes.streamer.config.PLVStreamerConfig; import com.plv.thirdpart.blankj.utilcode.util.ConvertUtils; -import static com.plv.foundationsdk.utils.PLVAppUtils.postToMainThread; import java.util.HashMap; import java.util.Map; import io.socket.client.Ack; +import okhttp3.ResponseBody; /** * 更多布局 @@ -93,7 +97,6 @@ public class PLVSAMoreLayout extends FrameLayout implements View.OnClickListener //view private ConstraintLayout plvsaMoreLayout; - private TextView plvsaMoreTextTv; private ViewGroup plvsaMoreSettingsSv; private FlexboxLayout plvsaMoreSettingsLayout; private ImageView plvsaMoreCameraIv; @@ -130,6 +133,12 @@ public class PLVSAMoreLayout extends FrameLayout implements View.OnClickListener private ImageView moreHangUpViewerLinkmicIv; private TextView moreHangUpViewerLinkmicTv; private LinearLayout moreInteractSigninLl; + private LinearLayout moreGiftRewardLayout; + private ImageView moreGiftRewardIv; + private TextView moreGiftRewardTv; + private LinearLayout moreGiftEffectLayout; + private ImageView moreGiftEffectIv; + private TextView moreGiftEffectTv; //streamerPresenter private IPLVStreamerContract.IStreamerPresenter streamerPresenter; @@ -162,6 +171,7 @@ public class PLVSAMoreLayout extends FrameLayout implements View.OnClickListener private long lastClickCameraSwitchViewTime; private IPLVLiveRoomDataManager liveRoomDataManager; + private PLVRewardDataSource rewardDataSource = new PLVRewardDataSource(); private String channelId; /** @@ -198,7 +208,6 @@ private void initView() { LayoutInflater.from(getContext()).inflate(R.layout.plvsa_live_room_more_layout, this); plvsaMoreLayout = (ConstraintLayout) findViewById(R.id.plvsa_more_layout); - plvsaMoreTextTv = (TextView) findViewById(R.id.plvsa_more_text_tv); plvsaMoreSettingsSv = findViewById(R.id.plvsa_more_settings_sv); plvsaMoreSettingsLayout = (FlexboxLayout) findViewById(R.id.plvsa_more_settings_layout); plvsaMoreCameraIv = (ImageView) findViewById(R.id.plvsa_more_camera_iv); @@ -235,6 +244,12 @@ private void initView() { moreHangUpViewerLinkmicIv = findViewById(R.id.plvsa_more_hang_up_viewer_linkmic_iv); moreHangUpViewerLinkmicTv = findViewById(R.id.plvsa_more_hang_up_viewer_linkmic_tv); moreInteractSigninLl = findViewById(R.id.plvsa_more_interact_signin_layout); + moreGiftRewardLayout = findViewById(R.id.plvsa_more_gift_reward_layout); + moreGiftRewardIv = findViewById(R.id.plvsa_more_gift_reward_iv); + moreGiftRewardTv = findViewById(R.id.plvsa_more_gift_reward_tv); + moreGiftEffectLayout = findViewById(R.id.plvsa_more_gift_effect_layout); + moreGiftEffectIv = findViewById(R.id.plvsa_more_gift_effect_iv); + moreGiftEffectTv = findViewById(R.id.plvsa_more_gift_effect_tv); plvsaMoreCameraIv.setOnClickListener(this); plvsaMoreCameraTv.setOnClickListener(this); @@ -260,15 +275,17 @@ private void initView() { moreLinkmicSettingLayout.setOnClickListener(this); moreHangUpViewerLinkmicLayout.setOnClickListener(this); moreInteractSigninLl.setOnClickListener(this); + moreGiftRewardLayout.setOnClickListener(this); + moreGiftEffectLayout.setOnClickListener(this); plvsaMoreCloseRoomIv.setSelected(PolyvChatroomManager.getInstance().isCloseRoom()); plvsaMoreCloseRoomTv.setText(plvsaMoreCloseRoomIv.isSelected() ? R.string.plv_chat_cancel_close_room : R.string.plv_chat_confirm_close_room); if (!PLVLinkMicConfig.getInstance().isSupportScreenShare()){ - plvsaMoreSettingsLayout.removeView(plvsaMoreShareScreenLl); + plvsaMoreShareScreenLl.setVisibility(View.GONE); } - if (!PLVUserAbilityManager.myAbility().hasAbility(PLVUserAbility.STREAMER_ALLOW_CHANGE_MIX_LAYOUT)) { - plvsaMoreSettingsLayout.removeView(plvsaMoreMixLayout); + if (!PLVUserAbilityManager.myAbility().hasAbility(PLVUserAbility.STREAMER_ALLOW_CHANGE_GIFT_REWARD_OPEN)) { + moreGiftRewardLayout.setVisibility(View.GONE); } //init bitrateLayout @@ -359,6 +376,17 @@ public void onChanged(@Nullable PLVStatefulData polyvLiv } } }); + liveRoomDataManager.getRewardSettingData().observe((LifecycleOwner) getContext(), new Observer>() { + @Override + public void onChanged(@Nullable PLVStatefulData statefulData) { + liveRoomDataManager.getRewardSettingData().removeObserver(this); + if (statefulData == null || !statefulData.isSuccess() || statefulData.getData() == null) { + return; + } + boolean isOpen = statefulData.getData().getDonateGiftEnabled(); + moreGiftRewardLayout.setSelected(isOpen ? false : true); + } + }); } } @@ -428,6 +456,7 @@ public void init(IPLVLiveRoomDataManager liveRoomDataManager) { initBitrateMapIcon(); observeLiveRoomStatus(); updateLinkMicStrategy(liveRoomDataManager); + initMixLayoutButton(); } private void updateLinkMicStrategy(IPLVLiveRoomDataManager liveRoomDataManager) { @@ -435,8 +464,19 @@ private void updateLinkMicStrategy(IPLVLiveRoomDataManager liveRoomDataManager) final boolean isNewLinkMicStrategy = PLVChannelFeatureManager.onChannel(liveRoomDataManager.getConfig().getChannelId()) .isFeatureSupport(PLVChannelFeature.LIVE_NEW_LINKMIC_STRATEGY); if (!canControlLinkMic || !isNewLinkMicStrategy) { - plvsaMoreSettingsLayout.removeView(moreAllowViewerLinkmicLayout); - plvsaMoreSettingsLayout.removeView(moreLinkmicSettingLayout); + moreAllowViewerLinkmicLayout.setVisibility(View.GONE); + moreLinkmicSettingLayout.setVisibility(View.GONE); + moreHangUpViewerLinkmicLayout.setVisibility(View.GONE); + } + } + + private void initMixLayoutButton() { + final boolean showMixLayoutButton = PLVChannelFeatureManager.onChannel(liveRoomDataManager.getConfig().getChannelId()) + .getOrDefault(PLVChannelFeature.STREAMER_SETTING_SHOW_MIX_LAYOUT_BUTTON, true); + if (PLVUserAbilityManager.myAbility().hasAbility(PLVUserAbility.STREAMER_ALLOW_CHANGE_MIX_LAYOUT) && showMixLayoutButton) { + plvsaMoreMixLayout.setVisibility(View.VISIBLE); + } else { + plvsaMoreMixLayout.setVisibility(View.GONE); } } // @@ -794,6 +834,29 @@ public void onFailed(Throwable t) { if (onViewActionListener != null) { onViewActionListener.onShowSignInAction(); } + } else if (id == moreGiftRewardLayout.getId()) { + moreGiftRewardLayout.setSelected(!moreGiftRewardLayout.isSelected()); + moreGiftRewardLayout.setEnabled(false); + PLVToast.Builder.context(getContext()) + .setText(getContext().getString(R.string.plv_reward_gift_reward_switch_tips)) + .show(); + rewardDataSource.updateGiftReward(channelId, !moreGiftRewardLayout.isSelected(), new IPLVPointRewardDataSource.IPointRewardListener() { + @Override + public void onSuccess(ResponseBody responseBody) { + moreGiftRewardLayout.setEnabled(true); + } + + @Override + public void onFailed(Throwable throwable) { + moreGiftRewardLayout.setEnabled(true); + PLVCommonLog.exception(throwable); + } + }); + } else if (id == moreGiftEffectLayout.getId()) { + moreGiftEffectLayout.setSelected(!moreGiftEffectLayout.isSelected()); + if (onViewActionListener != null) { + onViewActionListener.onGiftEffectSwitch(!moreGiftEffectLayout.isSelected()); + } } } @@ -900,7 +963,6 @@ private void updateViewWithOrientation() { moreLayoutParam.height = MORE_LAYOUT_HEIGHT_LAND; moreLayoutParam.gravity = MORE_LAYOUT_GRAVITY_LAND; plvsaMoreLayout.setBackgroundResource(MORE_LAYOUT_BACKGROUND_RES_LAND); - settingLayoutParam.topToBottom = R.id.plvsa_more_text_tv; settingLayoutParam.topMargin = ConvertUtils.dp2px(plvsaMoreSettingsLayout.getChildCount() > 9 ? 48 : 0); } @@ -919,6 +981,11 @@ public interface OnViewActionListener { * 显示签到 */ void onShowSignInAction(); + + /** + * 礼物特效开关切换 + */ + void onGiftEffectSwitch(boolean isOpen); } // } diff --git a/polyvStreamerAloneScene/src/main/java/com/easefun/polyv/streameralone/modules/liveroom/PLVSANetworkDisconnectMaskLayout.java b/polyvStreamerAloneScene/src/main/java/com/easefun/polyv/streameralone/modules/liveroom/PLVSANetworkDisconnectMaskLayout.java new file mode 100644 index 00000000..ea0dfe4b --- /dev/null +++ b/polyvStreamerAloneScene/src/main/java/com/easefun/polyv/streameralone/modules/liveroom/PLVSANetworkDisconnectMaskLayout.java @@ -0,0 +1,85 @@ +package com.easefun.polyv.streameralone.modules.liveroom; + +import android.app.Activity; +import android.content.Context; +import android.support.annotation.NonNull; +import android.support.annotation.Nullable; +import android.util.AttributeSet; +import android.view.LayoutInflater; +import android.view.View; +import android.widget.FrameLayout; + +import com.easefun.polyv.livecommon.module.modules.streamer.contract.IPLVStreamerContract; +import com.easefun.polyv.livecommon.module.modules.streamer.view.PLVAbsStreamerView; +import com.easefun.polyv.livecommon.ui.widget.PLVClipOutMaskView; +import com.easefun.polyv.streameralone.R; +import com.plv.foundationsdk.utils.PLVNetworkUtils; +import com.plv.linkmic.PLVLinkMicConstant; +import com.plv.thirdpart.blankj.utilcode.util.ConvertUtils; + +/** + * @author Hoshiiro + */ +public class PLVSANetworkDisconnectMaskLayout extends FrameLayout { + + private PLVClipOutMaskView clipOutMaskView; + + public PLVSANetworkDisconnectMaskLayout(@NonNull Context context) { + super(context); + init(); + } + + public PLVSANetworkDisconnectMaskLayout(@NonNull Context context, @Nullable AttributeSet attrs) { + super(context, attrs); + init(); + } + + public PLVSANetworkDisconnectMaskLayout(@NonNull Context context, @Nullable AttributeSet attrs, int defStyleAttr) { + super(context, attrs, defStyleAttr); + init(); + } + + private void init() { + LayoutInflater.from(getContext()).inflate(R.layout.plvsa_network_disconnect_mask_layout, this); + clipOutMaskView = findViewById(R.id.plvsa_clip_out_mask_view); + } + + public final IPLVStreamerContract.IStreamerView streamerView = new PLVAbsStreamerView() { + @Override + public void onNetworkQuality(PLVLinkMicConstant.NetworkQuality quality) { + final boolean isNetworkDisconnected = quality == PLVLinkMicConstant.NetworkQuality.DISCONNECT || !PLVNetworkUtils.isConnected(getContext()); + onNetworkChanged(isNetworkDisconnected); + } + }; + + private void onNetworkChanged(boolean isNetworkDisconnected) { + final boolean currentVisible = getVisibility() == VISIBLE; + if (currentVisible == isNetworkDisconnected) { + return; + } + if (!isNetworkDisconnected) { + setVisibility(GONE); + return; + } + setupClipOutMaskView(); + setVisibility(VISIBLE); + } + + private void setupClipOutMaskView() { + clipOutMaskView.clearClipOutParams(); + final Activity activity = (Activity) getContext(); + final View closeIcon = activity.findViewById(R.id.plvsa_status_bar_close_iv); + if (closeIcon != null && closeIcon.isShown()) { + clipOutMaskView.clipOutRoundRect(closeIcon, ConvertUtils.dp2px(32)); + } + final View emptyFragmentCloseIcon = activity.findViewById(R.id.plvsa_empty_close_iv); + if (emptyFragmentCloseIcon != null && emptyFragmentCloseIcon.isShown()) { + clipOutMaskView.clipOutRoundRect(emptyFragmentCloseIcon, ConvertUtils.dp2px(32)); + } + final View networkStatusBar = activity.findViewById(R.id.plvsa_status_bar_network_status_layout); + if (networkStatusBar != null && networkStatusBar.isShown()) { + clipOutMaskView.clipOutRoundRect(networkStatusBar, ConvertUtils.dp2px(10)); + } + } + +} diff --git a/polyvStreamerAloneScene/src/main/java/com/easefun/polyv/streameralone/modules/liveroom/PLVSASettingLayout.java b/polyvStreamerAloneScene/src/main/java/com/easefun/polyv/streameralone/modules/liveroom/PLVSASettingLayout.java index 309253f4..af07b3c4 100644 --- a/polyvStreamerAloneScene/src/main/java/com/easefun/polyv/streameralone/modules/liveroom/PLVSASettingLayout.java +++ b/polyvStreamerAloneScene/src/main/java/com/easefun/polyv/streameralone/modules/liveroom/PLVSASettingLayout.java @@ -1,9 +1,9 @@ package com.easefun.polyv.streameralone.modules.liveroom; import static com.plv.foundationsdk.utils.PLVSugarUtil.getOrDefault; -import static com.plv.foundationsdk.utils.PLVSugarUtil.scaleToRange; import android.Manifest; +import android.annotation.SuppressLint; import android.app.Activity; import android.arch.lifecycle.LifecycleOwner; import android.arch.lifecycle.Observer; @@ -11,7 +11,6 @@ import android.content.DialogInterface; import android.content.res.Configuration; import android.graphics.Color; -import android.os.Build; import android.support.annotation.NonNull; import android.support.annotation.Nullable; import android.support.constraint.ConstraintLayout; @@ -22,12 +21,12 @@ import android.view.ViewGroup; import android.widget.Button; import android.widget.FrameLayout; -import android.widget.HorizontalScrollView; import android.widget.ImageView; import android.widget.LinearLayout; import android.widget.TextView; import com.easefun.polyv.livecommon.module.data.IPLVLiveRoomDataManager; +import com.easefun.polyv.livecommon.module.data.PLVStatefulData; import com.easefun.polyv.livecommon.module.modules.beauty.viewmodel.PLVBeautyViewModel; import com.easefun.polyv.livecommon.module.modules.beauty.viewmodel.vo.PLVBeautyUiState; import com.easefun.polyv.livecommon.module.modules.streamer.contract.IPLVStreamerContract; @@ -35,15 +34,15 @@ import com.easefun.polyv.livecommon.module.utils.PLVDebounceClicker; import com.easefun.polyv.livecommon.module.utils.PLVLiveLocalActionHelper; import com.easefun.polyv.livecommon.module.utils.PLVToast; -import com.easefun.polyv.livecommon.ui.widget.PLVBeadWidget; import com.easefun.polyv.livecommon.ui.widget.PLVConfirmDialog; import com.easefun.polyv.livecommon.ui.widget.PLVOrientationSensibleLinearLayout; import com.easefun.polyv.livecommon.ui.widget.menudrawer.PLVMenuDrawer; -import com.easefun.polyv.livecommon.ui.widget.roundview.PLVRoundRectLayout; +import com.easefun.polyv.livescenes.model.PolyvLiveClassDetailVO; import com.easefun.polyv.streameralone.R; import com.easefun.polyv.streameralone.ui.widget.PLVSAConfirmDialog; import com.plv.foundationsdk.component.di.PLVDependManager; import com.plv.foundationsdk.component.kv.PLVAutoSaveKV; +import com.plv.foundationsdk.log.PLVCommonLog; import com.plv.foundationsdk.permission.PLVFastPermission; import com.plv.foundationsdk.permission.PLVOnPermissionCallback; import com.plv.foundationsdk.utils.PLVAppUtils; @@ -54,32 +53,25 @@ import com.plv.livescenes.access.PLVChannelFeatureManager; import com.plv.livescenes.access.PLVUserAbility; import com.plv.livescenes.access.PLVUserAbilityManager; +import com.plv.livescenes.chatroom.PLVChatApiRequestHelper; import com.plv.livescenes.linkmic.vo.PLVLinkMicDenoiseType; import com.plv.livescenes.streamer.config.PLVStreamerConfig; import com.plv.socket.user.PLVSocketUserConstant; -import com.plv.thirdpart.blankj.utilcode.util.ConvertUtils; import com.plv.thirdpart.blankj.utilcode.util.ScreenUtils; import java.util.ArrayList; import java.util.HashMap; import java.util.Map; +import io.reactivex.functions.Consumer; +import okhttp3.ResponseBody; + /** * 开播设置布局 */ public class PLVSASettingLayout extends FrameLayout implements IPLVSASettingLayout, View.OnClickListener { // - // 设置配置布局左右间距 - private final static int SETTING_CONFIG_LAYOUT_HORIZON_MARGIN_PORT = ConvertUtils.dp2px(24); - private final static int SETTING_CONFIG_LAYOUT_HORIZON_MARGIN_LAND = ConvertUtils.dp2px(132); - // 开始直播按钮左右间距 - private final static int START_LIVE_BUTTON_HORIZON_MARGIN_PORT = ConvertUtils.dp2px(24); - private final static int START_LIVE_BUTTON_HORIZON_MARGIN_LAND = ConvertUtils.dp2px(144); - // 标题框最大显示行数 - private final static int LIVE_TITLE_MAX_LINES_PORT = Integer.MAX_VALUE; - private final static int LIVE_TITLE_MAX_LINES_LAND = 2; - //直播间数据管理器 private IPLVLiveRoomDataManager liveRoomDataManager; private String channelId; @@ -108,27 +100,24 @@ public class PLVSASettingLayout extends FrameLayout implements IPLVSASettingLayo private ConstraintLayout plvsaSettingConfigLy; private TextView plvsaSettingLiveTitleTv; private View plvsaSettingLiveTitleSplitView; - private HorizontalScrollView settingActionScrollContainer; + private View settingActionScrollContainer; private ImageView plvsaSettingCameraOrientIv; private ImageView plvsaSettingMirrorIv; private ImageView plvsaSettingBitrateIv; - private ImageView plvsaSettingMixIv; - private ImageView plvsaSettingScreenOrientationIv; private TextView plvsaSettingCameraOrientTv; private TextView plvsaSettingMirrorTv; private TextView plvsaSettingBitrateTv; - private TextView plvsaSettingMixTv; - private TextView plvsaSettingScreenOrientationTv; + private LinearLayout settingMixLayout; + private LinearLayout settingScreenOrientationLayout; private LinearLayout plvsaSettingBtnLl; - private PLVRoundRectLayout plvsaSettingBeautyLayout; - private ImageView plvsaSettingBeautyIv; + private LinearLayout plvsaSettingBeautyLayout; private Button plvsaSettingStartLiveBtn; private PLVOrientationSensibleLinearLayout settingPushResolutionRatioLl; private ImageView settingPushResolutionRatioIv; private TextView settingPushResolutionRatioTv; private LinearLayout settingDenoiseLayout; private LinearLayout settingExternalAudioInputLayout; - private PLVBeadWidget settingActionScrollIndicator; + private LinearLayout settingLiveReplaySwitchLayout; private String liveTitle; @@ -180,23 +169,20 @@ private void initView() { plvsaSettingCameraOrientIv = findViewById(R.id.plvsa_setting_camera_orient_iv); plvsaSettingMirrorIv = findViewById(R.id.plvsa_setting_mirror_iv); plvsaSettingBitrateIv = findViewById(R.id.plvsa_setting_bitrate_iv); - plvsaSettingMixIv = findViewById(R.id.plvsa_setting_mix_layout_iv); - plvsaSettingScreenOrientationIv = findViewById(R.id.plvsa_setting_screen_orientation_iv); plvsaSettingCameraOrientTv = findViewById(R.id.plvsa_setting_camera_orient_tv); plvsaSettingMirrorTv = findViewById(R.id.plvsa_setting_mirror_tv); plvsaSettingBitrateTv = findViewById(R.id.plvsa_setting_bitrate_tv); - plvsaSettingMixTv = findViewById(R.id.plvsa_setting_mix_layout_tv); - plvsaSettingScreenOrientationTv = findViewById(R.id.plvsa_setting_screen_orientation_tv); + settingMixLayout = findViewById(R.id.plvsa_setting_mix_layout); + settingScreenOrientationLayout = findViewById(R.id.plvsa_setting_screen_orientation_layout); plvsaSettingBtnLl = findViewById(R.id.plvsa_setting_btn_ll); plvsaSettingBeautyLayout = findViewById(R.id.plvsa_setting_beauty_layout); - plvsaSettingBeautyIv = findViewById(R.id.plvsa_setting_beauty_iv); plvsaSettingStartLiveBtn = findViewById(R.id.plvsa_setting_start_live_btn); settingPushResolutionRatioLl = findViewById(R.id.plvsa_setting_push_resolution_ratio_ll); settingPushResolutionRatioIv = findViewById(R.id.plvsa_setting_push_resolution_ratio_iv); settingPushResolutionRatioTv = findViewById(R.id.plvsa_setting_push_resolution_ratio_tv); settingDenoiseLayout = findViewById(R.id.plvsa_setting_denoise_layout); settingExternalAudioInputLayout = findViewById(R.id.plvsa_setting_external_audio_input_layout); - settingActionScrollIndicator = findViewById(R.id.plvsa_setting_action_scroll_indicator); + settingLiveReplaySwitchLayout = findViewById(R.id.plvsa_setting_live_replay_switch_layout); plvsaSettingClosePageIv.setOnClickListener(this); plvsaSettingBeautyLayout.setOnClickListener(this); @@ -207,36 +193,12 @@ private void initView() { plvsaSettingMirrorTv.setOnClickListener(this); plvsaSettingBitrateIv.setOnClickListener(this); plvsaSettingBitrateTv.setOnClickListener(this); - plvsaSettingMixIv.setOnClickListener(this); - plvsaSettingMixTv.setOnClickListener(this); - plvsaSettingScreenOrientationIv.setOnClickListener(this); - plvsaSettingScreenOrientationTv.setOnClickListener(this); + settingMixLayout.setOnClickListener(this); + settingScreenOrientationLayout.setOnClickListener(this); settingPushResolutionRatioLl.setOnClickListener(this); settingDenoiseLayout.setOnClickListener(this); settingExternalAudioInputLayout.setOnClickListener(this); - - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { - settingActionScrollContainer.setOnScrollChangeListener(new OnScrollChangeListener() { - @Override - public void onScrollChange(View v, int scrollX, int scrollY, int oldScrollX, int oldScrollY) { - updateScrollContainerIndicator(); - } - }); - } - post(new Runnable() { - @Override - public void run() { - updateScrollContainerIndicator(); - } - }); - - if (PLVUserAbilityManager.myAbility().hasAbility(PLVUserAbility.STREAMER_ALLOW_CHANGE_MIX_LAYOUT)) { - plvsaSettingMixIv.setVisibility(VISIBLE); - plvsaSettingMixTv.setVisibility(VISIBLE); - } else { - plvsaSettingMixIv.setVisibility(GONE); - plvsaSettingMixTv.setVisibility(GONE); - } + settingLiveReplaySwitchLayout.setOnClickListener(this); initTitleInputLayout(); initBitrateLayout(); @@ -468,16 +430,31 @@ private void initStartLiveBtnText() { plvsaSettingStartLiveBtn.setText(isGuest() ? getContext().getString(R.string.plvsa_setting_enter_live) : getContext().getString(R.string.plv_streamer_start_live)); } - private void initPushResolutionRatioLayout() { + private void initButtonVisibility(IPLVLiveRoomDataManager liveRoomDataManager) { final boolean userAllowChangeRatio = PLVUserAbilityManager.myAbility().hasAbility(PLVUserAbility.STREAMER_ALONE_ALLOW_CHANGE_PUSH_RATIO); final boolean channelAllowChangeRatio = PLVChannelFeatureManager.onChannel(liveRoomDataManager.getConfig().getChannelId()).isFeatureSupport(PLVChannelFeature.STREAMER_ALONE_ALLOW_CHANGE_PUSH_RESOLUTION_RATIO); settingPushResolutionRatioLl.setShowOnLandscape(userAllowChangeRatio && channelAllowChangeRatio); + + final boolean userAllowChangeLiveReplay = PLVUserAbilityManager.myAbility().hasAbility(PLVUserAbility.STREAMER_ALLOW_CHANGE_REPLAY_OPEN); + settingLiveReplaySwitchLayout.setVisibility(userAllowChangeLiveReplay ? View.VISIBLE : View.GONE); + + final boolean showOrientationButton = PLVChannelFeatureManager.onChannel(liveRoomDataManager.getConfig().getChannelId()) + .getOrDefault(PLVChannelFeature.STREAMER_SETTING_SHOW_ORIENTATION_BUTTON, true); + settingScreenOrientationLayout.setVisibility(showOrientationButton ? View.VISIBLE : View.GONE); + + final boolean showMixLayoutButton = PLVChannelFeatureManager.onChannel(liveRoomDataManager.getConfig().getChannelId()) + .getOrDefault(PLVChannelFeature.STREAMER_SETTING_SHOW_MIX_LAYOUT_BUTTON, true); + if (PLVUserAbilityManager.myAbility().hasAbility(PLVUserAbility.STREAMER_ALLOW_CHANGE_MIX_LAYOUT) && showMixLayoutButton) { + settingMixLayout.setVisibility(View.VISIBLE); + } else { + settingMixLayout.setVisibility(View.GONE); + } } - private void setupDefaultPushResolution(IPLVLiveRoomDataManager liveRoomDataManager) { + private void initOrientation(IPLVLiveRoomDataManager liveRoomDataManager) { final boolean isDefaultLandscape = PLVChannelFeatureManager.onChannel(liveRoomDataManager.getConfig().getChannelId()) .getOrDefault(PLVChannelFeature.STREAMER_ALONE_DEFAULT_LANDSCAPE_RESOLUTION, false); - if (PLVScreenUtils.isLandscape(getContext()) ^ isDefaultLandscape) { + if (PLVScreenUtils.isLandscape(getContext()) != isDefaultLandscape) { changeScreenOrientation(); } } @@ -526,12 +503,13 @@ public void init(IPLVLiveRoomDataManager liveRoomDataManager) { titleInputLayout.initTitle(liveTitle); bitrateLayout.init(liveRoomDataManager); mixLayout.init(liveRoomDataManager); + initButtonVisibility(liveRoomDataManager); initBitrateMapIcon(); initStartLiveBtnText(); - initPushResolutionRatioLayout(); - updateOnOrientationChanged(PLVScreenUtils.isLandscape(getContext())); - setupDefaultPushResolution(liveRoomDataManager); + updatePushResolutionRatioOnOrientationChanged(PLVScreenUtils.isLandscape(getContext())); + initOrientation(liveRoomDataManager); + observeLiveRoomData(); } @Override @@ -693,39 +671,7 @@ public void onChanged(@Nullable PLVLinkMicConstant.PushResolutionRatio resolutio protected void onConfigurationChanged(Configuration newConfig) { super.onConfigurationChanged(newConfig); final boolean isLandscape = newConfig.orientation == Configuration.ORIENTATION_LANDSCAPE; - updateOnOrientationChanged(isLandscape); - post(new Runnable() { - @Override - public void run() { - updateScrollContainerIndicator(); - } - }); - } - - private void updateOnOrientationChanged(boolean isLandscape) { updatePushResolutionRatioOnOrientationChanged(isLandscape); - - MarginLayoutParams settingConfigLayoutParam = (MarginLayoutParams) plvsaSettingConfigLy.getLayoutParams(); - MarginLayoutParams settingButtonLayoutParam = (MarginLayoutParams) plvsaSettingBtnLl.getLayoutParams(); - int liveTitleMaxLines; - - if (isLandscape) { - settingConfigLayoutParam.width = ConvertUtils.dp2px(450); - settingButtonLayoutParam.width = ConvertUtils.dp2px(450); - settingConfigLayoutParam.leftMargin = settingConfigLayoutParam.rightMargin = SETTING_CONFIG_LAYOUT_HORIZON_MARGIN_LAND; - settingButtonLayoutParam.leftMargin = settingButtonLayoutParam.rightMargin = START_LIVE_BUTTON_HORIZON_MARGIN_LAND; - liveTitleMaxLines = LIVE_TITLE_MAX_LINES_LAND; - } else { - settingConfigLayoutParam.width = ViewGroup.LayoutParams.MATCH_PARENT; - settingButtonLayoutParam.width = ViewGroup.LayoutParams.MATCH_PARENT; - settingConfigLayoutParam.leftMargin = settingConfigLayoutParam.rightMargin = SETTING_CONFIG_LAYOUT_HORIZON_MARGIN_PORT; - settingButtonLayoutParam.leftMargin = settingButtonLayoutParam.rightMargin = START_LIVE_BUTTON_HORIZON_MARGIN_PORT; - liveTitleMaxLines = LIVE_TITLE_MAX_LINES_PORT; - } - - plvsaSettingConfigLy.setLayoutParams(settingConfigLayoutParam); - plvsaSettingBtnLl.setLayoutParams(settingButtonLayoutParam); - plvsaSettingLiveTitleTv.setMaxLines(liveTitleMaxLines); } private void updatePushResolutionRatioOnOrientationChanged(boolean isLandscape) { @@ -755,6 +701,7 @@ private void updatePushResolutionRatioOnOrientationChanged(boolean isLandscape) // // + @SuppressLint("CheckResult") @Override public void onClick(View v) { if (!PLVDebounceClicker.tryClick(this)) { @@ -783,11 +730,9 @@ public void onClick(View v) { } else if (id == R.id.plvsa_setting_bitrate_iv || id == R.id.plvsa_setting_bitrate_tv) { bitrateLayout.open(); - } else if (id == R.id.plvsa_setting_mix_layout_iv - || id == R.id.plvsa_setting_mix_layout_tv) { + } else if (id == settingMixLayout.getId()) { mixLayout.open(); - } else if (id == plvsaSettingScreenOrientationIv.getId() - || id == plvsaSettingScreenOrientationTv.getId()) { + } else if (id == settingScreenOrientationLayout.getId()) { changeScreenOrientation(); } else if (id == plvsaSettingBeautyLayout.getId()) { PLVDependManager.getInstance().get(PLVBeautyViewModel.class).showBeautyMenu(); @@ -797,10 +742,41 @@ public void onClick(View v) { denoisePreferenceLayout.open(); } else if (id == settingExternalAudioInputLayout.getId()) { externalAudioInputPreferenceLayout.open(); + } else if (id == settingLiveReplaySwitchLayout.getId()) { + settingLiveReplaySwitchLayout.setSelected(!settingLiveReplaySwitchLayout.isSelected()); + settingLiveReplaySwitchLayout.setEnabled(false); + PLVChatApiRequestHelper.getInstance().updatePlaybackSetting(liveRoomDataManager.getConfig().getChannelId(), !settingLiveReplaySwitchLayout.isSelected()) + .subscribe(new Consumer() { + @Override + public void accept(ResponseBody responseBody) throws Exception { + settingLiveReplaySwitchLayout.setEnabled(true); + } + }, new Consumer() { + @Override + public void accept(Throwable throwable) throws Exception { + settingLiveReplaySwitchLayout.setEnabled(true); + PLVCommonLog.exception(throwable); + } + }); } } // + // + private void observeLiveRoomData() { + liveRoomDataManager.getClassDetailVO().observe((LifecycleOwner) getContext(), new Observer>() { + @Override + public void onChanged(@Nullable PLVStatefulData statefulData) { + liveRoomDataManager.getClassDetailVO().removeObserver(this); + if (statefulData != null && statefulData.getData() != null && statefulData.getData().getData() != null){ + boolean playbackEnabled = statefulData.getData().getData().isPlaybackEnabled(); + settingLiveReplaySwitchLayout.setSelected(!playbackEnabled); + } + } + }); + } + // + // /** @@ -875,20 +851,6 @@ private void updateBitrateIcon(int selectedBitrate) { } } - private void updateScrollContainerIndicator() { - int maxSize = settingActionScrollContainer.getChildAt(0).getWidth(); - if (maxSize <= 0) { - maxSize = 1; - } - int pageSize = settingActionScrollContainer.getWidth(); - if (pageSize <= 0) { - pageSize = 1; - } - int currentOffset = settingActionScrollContainer.getScrollX(); - settingActionScrollIndicator.setBeadCount(maxSize / pageSize + 1); - settingActionScrollIndicator.setCurrentSelectedIndex((int) (scaleToRange(currentOffset, 0F, maxSize - pageSize, 0F, maxSize / pageSize) + 0.5)); - } - private void changeScreenOrientation() { if (PLVScreenUtils.isPortrait(getContext())) { PLVScreenUtils.enterLandscape((Activity) getContext()); diff --git a/polyvStreamerAloneScene/src/main/java/com/easefun/polyv/streameralone/modules/statusbar/IPLVSAStatusBarLayout.java b/polyvStreamerAloneScene/src/main/java/com/easefun/polyv/streameralone/modules/statusbar/IPLVSAStatusBarLayout.java index 4b93b196..6b366325 100644 --- a/polyvStreamerAloneScene/src/main/java/com/easefun/polyv/streameralone/modules/statusbar/IPLVSAStatusBarLayout.java +++ b/polyvStreamerAloneScene/src/main/java/com/easefun/polyv/streameralone/modules/statusbar/IPLVSAStatusBarLayout.java @@ -30,12 +30,17 @@ public interface IPLVSAStatusBarLayout { */ void updateChannelName(String channelName); - /** - * 设置停止直播回调监听 - * - * @param onStopLiveListener - */ - void setOnStopLiveListener(PLVSAStatusBarLayout.OnStopLiveListener onStopLiveListener); + void setOnViewActionListener(PLVSAStatusBarLayout.OnViewActionListener onViewActionListener); + + void notifyLinkMicTypeChange(boolean isVideoLinkMic, boolean isOpenLinkMic); + + void openMemberLayoutAndHideUserRequestTips(); + + void closeMemberLayout(); + + void showUserRequestTips(); + + void hideUserRequestTips(); /** * 是否拦截返回事件 diff --git a/polyvStreamerAloneScene/src/main/java/com/easefun/polyv/streameralone/modules/statusbar/PLVSAStatusBarLayout.java b/polyvStreamerAloneScene/src/main/java/com/easefun/polyv/streameralone/modules/statusbar/PLVSAStatusBarLayout.java index 1bc7d678..aefda7cf 100644 --- a/polyvStreamerAloneScene/src/main/java/com/easefun/polyv/streameralone/modules/statusbar/PLVSAStatusBarLayout.java +++ b/polyvStreamerAloneScene/src/main/java/com/easefun/polyv/streameralone/modules/statusbar/PLVSAStatusBarLayout.java @@ -1,5 +1,7 @@ package com.easefun.polyv.streameralone.modules.statusbar; +import static com.plv.foundationsdk.utils.PLVSugarUtil.nullable; + import android.arch.lifecycle.LifecycleOwner; import android.arch.lifecycle.Observer; import android.content.Context; @@ -24,11 +26,14 @@ import com.easefun.polyv.livecommon.ui.widget.roundview.PLVRoundImageView; import com.easefun.polyv.livecommon.ui.widget.roundview.PLVRoundRectLayout; import com.easefun.polyv.streameralone.R; +import com.easefun.polyv.streameralone.modules.liveroom.PLVSALinkMicRequestTipsLayout; +import com.easefun.polyv.streameralone.modules.liveroom.PLVSAMemberLayout; import com.easefun.polyv.streameralone.ui.widget.PLVSAConfirmDialog; import com.plv.foundationsdk.component.proxy.PLVDynamicProxy; import com.plv.foundationsdk.utils.PLVAppUtils; import com.plv.foundationsdk.utils.PLVNetworkUtils; import com.plv.foundationsdk.utils.PLVScreenUtils; +import com.plv.foundationsdk.utils.PLVSugarUtil; import com.plv.linkmic.PLVLinkMicConstant; import com.plv.linkmic.model.PLVNetworkStatusVO; import com.plv.socket.user.PLVSocketUserConstant; @@ -41,13 +46,12 @@ /** * 状态栏布局 */ -public class PLVSAStatusBarLayout extends FrameLayout implements IPLVSAStatusBarLayout { +public class PLVSAStatusBarLayout extends FrameLayout implements IPLVSAStatusBarLayout, View.OnClickListener { // private View rootView; private ImageView plvsaStatusBarCloseIv; - private LinearLayout plvsaStatusBarInfoLl; private PLVRoundRectLayout plvsaStatusBarChannelInfoRl; private ImageView plvsaStatusBarChannelInfoIv; private TextView plvsaStatusBarChannelInfoTv; @@ -55,6 +59,7 @@ public class PLVSAStatusBarLayout extends FrameLayout implements IPLVSAStatusBar private PLVRoundRectLayout plvsaStatusBarMemberCountRl; private ImageView plvsaStatusBarMemberCountIv; private TextView plvsaStatusBarMemberCountTv; + private View plvsaMemberLinkmicRequestTipsView; private PLVRoundRectLayout plvsaStatusBarStreamerTimeRl; private PLVRoundImageView plvsaStatusBarStreamerStatusIv; private TextView plvsaStatusBarStreamerTimeTv; @@ -67,9 +72,11 @@ public class PLVSAStatusBarLayout extends FrameLayout implements IPLVSAStatusBar private PLVRoundRectLayout plvsaStatusBarNotificationLayout; private TextView plvsaStatusBarNotificationLabel; private TextView plvsaStatusBarNotificationTv; - + // 有人申请连麦时 连麦提示条布局 + private PLVSALinkMicRequestTipsLayout linkMicRequestTipsLayout; private PLVSAChannelInfoLayout channelInfoLayout; - + //成员列表布局 + private PLVSAMemberLayout memberLayout; // 停止直播确认对话框 private PLVConfirmDialog stopLiveConfirmDialog; @@ -81,7 +88,7 @@ public class PLVSAStatusBarLayout extends FrameLayout implements IPLVSAStatusBar private boolean isOpenAudio = true; private boolean isOpenVideo = true; - private OnStopLiveListener stopLiveListener; + private OnViewActionListener onViewActionListener; //关闭直播提示的文案 private String closeContentString; @@ -108,13 +115,12 @@ public PLVSAStatusBarLayout(@NonNull Context context, @Nullable AttributeSet att private void initView() { rootView = LayoutInflater.from(getContext()).inflate(R.layout.plvsa_status_bar_layout, this); findView(); - initChannelInfoOnClickListener(); - initCloseIconOnClickListener(); + initOnClickListener(); + observeLinkmicRequestLayout(); } private void findView() { plvsaStatusBarCloseIv = (ImageView) findViewById(R.id.plvsa_status_bar_close_iv); - plvsaStatusBarInfoLl = (LinearLayout) findViewById(R.id.plvsa_status_bar_info_ll); plvsaStatusBarChannelInfoRl = (PLVRoundRectLayout) findViewById(R.id.plvsa_status_bar_channel_info_rl); plvsaStatusBarChannelInfoIv = (ImageView) findViewById(R.id.plvsa_status_bar_channel_info_iv); plvsaStatusBarChannelInfoTv = (TextView) findViewById(R.id.plvsa_status_bar_channel_info_tv); @@ -122,6 +128,7 @@ private void findView() { plvsaStatusBarMemberCountRl = (PLVRoundRectLayout) findViewById(R.id.plvsa_status_bar_member_count_rl); plvsaStatusBarMemberCountIv = (ImageView) findViewById(R.id.plvsa_status_bar_member_count_iv); plvsaStatusBarMemberCountTv = (TextView) findViewById(R.id.plvsa_status_bar_member_count_tv); + plvsaMemberLinkmicRequestTipsView = findViewById(R.id.plvsa_member_linkmic_request_tips_view); plvsaStatusBarStreamerTimeRl = (PLVRoundRectLayout) findViewById(R.id.plvsa_status_bar_streamer_time_rl); plvsaStatusBarStreamerStatusIv = (PLVRoundImageView) findViewById(R.id.plvsa_status_bar_streamer_status_iv); plvsaStatusBarStreamerTimeTv = (TextView) findViewById(R.id.plvsa_status_bar_streamer_time_tv); @@ -134,24 +141,28 @@ private void findView() { plvsaStatusBarNotificationLayout = (PLVRoundRectLayout) findViewById(R.id.plvsa_status_bar_notification_layout); plvsaStatusBarNotificationLabel = (TextView) findViewById(R.id.plvsa_status_bar_notification_label); plvsaStatusBarNotificationTv = (TextView) findViewById(R.id.plvsa_status_bar_notification_tv); + linkMicRequestTipsLayout = findViewById(R.id.plvsa_linkmic_request_layout); + + memberLayout = new PLVSAMemberLayout(getContext()); + } + + private void initOnClickListener() { + plvsaStatusBarChannelInfoRl.setOnClickListener(this); + plvsaStatusBarCloseIv.setOnClickListener(this); + plvsaStatusBarMemberCountRl.setOnClickListener(this); } - private void initChannelInfoOnClickListener() { - plvsaStatusBarChannelInfoRl.setOnClickListener(new OnClickListener() { + private void observeLinkmicRequestLayout() { + linkMicRequestTipsLayout.setOnTipsClickListener(new PLVSALinkMicRequestTipsLayout.OnTipsClickListener() { @Override - public void onClick(View v) { - if (channelInfoLayout != null) { - channelInfoLayout.open(); - } + public void onClickBar() { + linkMicRequestTipsLayout.hide(); } - }); - } - private void initCloseIconOnClickListener() { - plvsaStatusBarCloseIv.setOnClickListener(new OnClickListener() { @Override - public void onClick(View v) { - showStopLiveConfirmLayout(); + public void onClickNavBtn() { + linkMicRequestTipsLayout.hide(); + openMemberLayoutAndHideUserRequestTips(); } }); } @@ -165,8 +176,8 @@ private void showStopLiveConfirmLayout() { .setRightBtnListener(new OnClickListener() { @Override public void onClick(View v) { - if (stopLiveListener != null) { - stopLiveListener.onStopLive(); + if (onViewActionListener != null) { + onViewActionListener.onStopLive(); } stopLiveConfirmDialog.hide(); } @@ -203,6 +214,8 @@ private void initCloseTipContent(IPLVLiveRoomDataManager liveRoomDataManager) { @Override public void init(IPLVLiveRoomDataManager liveRoomDataManager) { this.liveRoomDataManager = liveRoomDataManager; + //初始化成员布局 + memberLayout.init(liveRoomDataManager); initTeacherName(liveRoomDataManager); initChannelInfoLayout(liveRoomDataManager); @@ -212,6 +225,9 @@ public void init(IPLVLiveRoomDataManager liveRoomDataManager) { @Override public void setOnlineCount(int onlineCount) { plvsaStatusBarMemberCountTv.setText(StringUtils.toWString(onlineCount).toUpperCase()); + if (memberLayout != null) { + memberLayout.updateOnlineCount(onlineCount); + } } @Override @@ -222,8 +238,45 @@ public void updateChannelName(String channelName) { } @Override - public void setOnStopLiveListener(OnStopLiveListener stopLiveListener) { - this.stopLiveListener = stopLiveListener; + public void setOnViewActionListener(OnViewActionListener onViewActionListener) { + this.onViewActionListener = onViewActionListener; + } + + @Override + public void notifyLinkMicTypeChange(boolean isVideoLinkMic, boolean isOpenLinkMic) { + if (memberLayout != null) { + memberLayout.notifyLinkMicTypeChange(isVideoLinkMic, isOpenLinkMic); + } + } + + @Override + public void openMemberLayoutAndHideUserRequestTips() { + if (memberLayout != null) { + memberLayout.open(); + } + hideUserRequestTips(); + } + + @Override + public void closeMemberLayout() { + if (memberLayout != null) { + memberLayout.closeAndHideWindow(); + } + } + + @Override + public void showUserRequestTips() { + if (memberLayout != null && memberLayout.isOpen()) { + return; + } + plvsaMemberLinkmicRequestTipsView.setVisibility(View.VISIBLE); + linkMicRequestTipsLayout.show(); + } + + @Override + public void hideUserRequestTips() { + plvsaMemberLinkmicRequestTipsView.setVisibility(View.INVISIBLE); + linkMicRequestTipsLayout.hide(); } @Override @@ -231,6 +284,9 @@ public boolean onBackPressed() { if (channelInfoLayout != null) { return channelInfoLayout.onBackPressed(); } + if (memberLayout != null) { + return memberLayout.onBackPressed(); + } return false; } @@ -245,7 +301,16 @@ public void destroy() { public IPLVStreamerContract.IStreamerView getStreamerView() { return PLVDynamicProxy.forClass(IPLVStreamerContract.IStreamerView.class) - .proxyAll(streamerView, statusBarPushDowngradeAlertLayout.streamerView); + .proxyAll( + streamerView, + statusBarPushDowngradeAlertLayout.streamerView, + nullable(new PLVSugarUtil.Supplier() { + @Override + public IPLVStreamerContract.IStreamerView get() { + return memberLayout.getStreamerView(); + } + }) + ); } private IPLVStreamerContract.IStreamerView streamerView = new PLVAbsStreamerView() { @@ -484,6 +549,25 @@ private void updateViewWithOrientation() { // + // + + @Override + public void onClick(View v) { + final int id = v.getId(); + if (id == plvsaStatusBarChannelInfoRl.getId()) { + if (channelInfoLayout != null) { + channelInfoLayout.open(); + } + } else if (id == plvsaStatusBarCloseIv.getId()) { + showStopLiveConfirmLayout(); + } else if (id == plvsaStatusBarMemberCountRl.getId()) { + openMemberLayoutAndHideUserRequestTips(); + linkMicRequestTipsLayout.hide(); + } + } + + // + // private static String trimStringLength(String oriString, int specLength) { @@ -504,10 +588,7 @@ private boolean isGuest(){ // - /** - * 停止直播回调,由上层停止直播 - */ - public interface OnStopLiveListener { + public interface OnViewActionListener { void onStopLive(); } diff --git a/polyvStreamerAloneScene/src/main/java/com/easefun/polyv/streameralone/scenes/PLVSAStreamerAloneActivity.java b/polyvStreamerAloneScene/src/main/java/com/easefun/polyv/streameralone/scenes/PLVSAStreamerAloneActivity.java index 88543ab5..70a58004 100644 --- a/polyvStreamerAloneScene/src/main/java/com/easefun/polyv/streameralone/scenes/PLVSAStreamerAloneActivity.java +++ b/polyvStreamerAloneScene/src/main/java/com/easefun/polyv/streameralone/scenes/PLVSAStreamerAloneActivity.java @@ -47,8 +47,8 @@ import com.easefun.polyv.streameralone.modules.beauty.PLVSABeautyLayout; import com.easefun.polyv.streameralone.modules.liveroom.IPLVSASettingLayout; import com.easefun.polyv.streameralone.modules.liveroom.PLVSACleanUpLayout; -import com.easefun.polyv.streameralone.modules.liveroom.PLVSALinkMicRequestTipsLayout; import com.easefun.polyv.streameralone.modules.liveroom.PLVSAMoreLayout; +import com.easefun.polyv.streameralone.modules.liveroom.PLVSANetworkDisconnectMaskLayout; import com.easefun.polyv.streameralone.modules.streamer.IPLVSAStreamerLayout; import com.easefun.polyv.streameralone.modules.streamer.PLVSAStreamerFinishLayout; import com.easefun.polyv.streameralone.modules.streamer.PLVSAStreamerFullscreenLayout; @@ -113,8 +113,6 @@ public class PLVSAStreamerAloneActivity extends PLVBaseActivity { private PLVSAStreamerFinishLayout streamerFinishLayout; // 摄像头上层的viewpager布局 private PLVNoInterceptTouchViewPager topLayerViewPager; - // 有人申请连麦时 连麦提示条布局 - private PLVSALinkMicRequestTipsLayout linkMicRequestTipsLayout; // 美颜布局 private IPLVSABeautyLayout beautyLayout; // 主页fragment @@ -126,6 +124,8 @@ public class PLVSAStreamerAloneActivity extends PLVBaseActivity { // 互动布局 private IPLVStreamerInteractLayout interactLayout; + private PLVSANetworkDisconnectMaskLayout networkDisconnectMaskLayout; + // // @@ -222,9 +222,9 @@ protected void onCreate(@Nullable Bundle savedInstanceState) { observeViewPagerLayout(); observeStreamerLayout(); observeCleanUpLayout(); - observeLinkmicRequestLayout(); observeFullscreenLayout(); observeBeautyLayoutStatus(); + observeNetworkDisconnectLayout(); } private void setStatusBarColor() { @@ -360,6 +360,8 @@ private void initLiveRoomManager() { // 进行网络请求,获取直播详情数据 liveRoomDataManager.requestChannelDetail(); + // 进行网络请求,请求打赏配置 + liveRoomDataManager.requestRewardSetting(); } // @@ -371,10 +373,11 @@ private void initView() { cleanUpLayout = findViewById(R.id.plvsa_clean_up_layout); streamerFinishLayout = findViewById(R.id.plvsa_streamer_finish_layout); topLayerViewPager = findViewById(R.id.plvsa_top_layer_view_pager); - linkMicRequestTipsLayout = findViewById(R.id.plvsa_linkmic_request_layout); fullscreenLayout = findViewById(R.id.plvsa_fullscreen_view); maskGroup = findViewById(R.id.plvsa_mask_group); interactLayout = findViewById(R.id.plvsa_interact_layout); + networkDisconnectMaskLayout = findViewById(R.id.plvsa_network_disconnect_mask_layout); + interactLayout.init(liveRoomDataManager); //初始化推流和连麦布局 @@ -421,6 +424,13 @@ public void onShowSignInAction() { interactLayout.showSignIn(); } } + + @Override + public void onGiftEffectSwitch(boolean isOpen) { + if (homeFragment != null) { + homeFragment.changeGiftEffectSwitch(isOpen); + } + } }); } } @@ -645,11 +655,6 @@ public void onStopLive() { updateStopLiveLayout(); } - @Override - public void onClickToOpenMemberLayout() { - linkMicRequestTipsLayout.cancel(); - } - @Override public boolean showCleanUpLayout() { boolean success = false; @@ -699,17 +704,7 @@ public boolean isStreamerStartSuccess() { emptyFragment.setOnViewActionListener(new PLVSAEmptyFragment.OnViewActionListener() { @Override public void onViewCreated() { - streamerLayout.addOnUserRequestListener(new IPLVOnDataChangedListener() { - @Override - public void onChanged(@Nullable String s) { - if (s == null) { - return; - } - if (PLVUserAbilityManager.myAbility().hasRole(PLVUserRole.STREAMER_TEACHER)) { - linkMicRequestTipsLayout.show(); - } - } - }); + } @Override @@ -720,27 +715,6 @@ public void onStopLive() { } // - // - - private void observeLinkmicRequestLayout() { - linkMicRequestTipsLayout.setOnTipsClickListener(new PLVSALinkMicRequestTipsLayout.OnTipsClickListener() { - @Override - public void onClickBar() { - linkMicRequestTipsLayout.cancel(); - } - - @Override - public void onClickNavBtn() { - linkMicRequestTipsLayout.cancel(); - // homeFragment index=1 - topLayerViewPager.setCurrentItem(1); - homeFragment.openMemberLayoutAndHideUserRequestTips(); - } - }); - } - - // - // private void observeFullscreenLayout() { if (streamerLayout != null && fullscreenLayout != null) { @@ -760,6 +734,14 @@ public void onExitFullscreen(PLVLinkMicItemDataBean linkmicItem, PLVViewSwitcher } // + // + + private void observeNetworkDisconnectLayout() { + streamerLayout.getStreamerPresenter().registerView(networkDisconnectMaskLayout.streamerView); + } + + // + // private void checkStreamRecover() { diff --git a/polyvStreamerAloneScene/src/main/java/com/easefun/polyv/streameralone/scenes/fragments/PLVSAStreamerHomeFragment.java b/polyvStreamerAloneScene/src/main/java/com/easefun/polyv/streameralone/scenes/fragments/PLVSAStreamerHomeFragment.java index beaa9c28..86c5edf3 100644 --- a/polyvStreamerAloneScene/src/main/java/com/easefun/polyv/streameralone/scenes/fragments/PLVSAStreamerHomeFragment.java +++ b/polyvStreamerAloneScene/src/main/java/com/easefun/polyv/streameralone/scenes/fragments/PLVSAStreamerHomeFragment.java @@ -35,10 +35,10 @@ import com.easefun.polyv.streameralone.R; import com.easefun.polyv.streameralone.modules.chatroom.IPLVSAChatroomLayout; import com.easefun.polyv.streameralone.modules.chatroom.PLVSAChatroomLayout; +import com.easefun.polyv.streameralone.modules.chatroom.adapter.PLVSAMessageAdapter; import com.easefun.polyv.streameralone.modules.chatroom.widget.PLVSAGreetingView; import com.easefun.polyv.streameralone.modules.chatroom.widget.PLVSARewardGiftAnimView; import com.easefun.polyv.streameralone.modules.liveroom.PLVSACommodityControlLayout; -import com.easefun.polyv.streameralone.modules.liveroom.PLVSAMemberLayout; import com.easefun.polyv.streameralone.modules.liveroom.PLVSAMoreLayout; import com.easefun.polyv.streameralone.modules.statusbar.PLVSAStatusBarLayout; import com.easefun.polyv.streameralone.modules.streamer.widget.PLVSALinkMicControlButton; @@ -80,8 +80,6 @@ public class PLVSAStreamerHomeFragment extends PLVBaseFragment implements View.O private IPLVLiveRoomDataManager liveRoomDataManager; //更多布局 private PLVSAMoreLayout moreLayout; - //成员列表布局 - private PLVSAMemberLayout memberLayout; //状态栏布局 private PLVSAStatusBarLayout plvsaStatusBarLayout; //打赏布局 @@ -96,10 +94,8 @@ public class PLVSAStreamerHomeFragment extends PLVBaseFragment implements View.O private ConstraintLayout homeFragmentLayout; private TextView plvsaToolBarCallInputTv; private ImageView plvsaToolBarMoreIv; - private ImageView plvsaToolBarMemberIv; private PLVSALinkMicControlButton plvsaToolBarLinkmicIv; private ImageView plvsaToolBarLinkmicTypeIv; - private View plvsaToolBarMemberLinkmicRequestTipsView; private TextView plvsaToolBarLinkmicTypeTip; private ImageView toolBarCommodityControlIv; // 评论上墙布局 @@ -114,6 +110,7 @@ public class PLVSAStreamerHomeFragment extends PLVBaseFragment implements View.O private boolean isBeautyLayoutShowing = false; private boolean isVideoLinkMic = false; private boolean isOpenLinkMic = false; + private boolean isOpenGiftEffect = true; // // @@ -143,24 +140,20 @@ private void initView() { plvsaChatroomLayout = (PLVSAChatroomLayout) findViewById(R.id.plvsa_chatroom_layout); plvsaToolBarCallInputTv = (TextView) findViewById(R.id.plvsa_tool_bar_call_input_tv); plvsaToolBarMoreIv = (ImageView) findViewById(R.id.plvsa_tool_bar_more_iv); - plvsaToolBarMemberIv = (ImageView) findViewById(R.id.plvsa_tool_bar_member_iv); plvsaToolBarLinkmicIv = findViewById(R.id.plvsa_tool_bar_linkmic_iv); plvsaToolBarLinkmicTypeIv = (ImageView) findViewById(R.id.plvsa_tool_bar_linkmic_type_iv); - plvsaToolBarMemberLinkmicRequestTipsView = findViewById(R.id.plvsa_tool_bar_member_linkmic_request_tips_view); plvsaToolBarLinkmicTypeTip = findViewById(R.id.plvsa_tool_bar_linkmic_type_tip); toolBarCommodityControlIv = findViewById(R.id.plvsa_tool_bar_commodity_control_iv); toTopView = findViewById(R.id.plvsa_chatroom_to_top_view); plvsaToolBarCallInputTv.setOnClickListener(this); plvsaToolBarMoreIv.setOnClickListener(this); - plvsaToolBarMemberIv.setOnClickListener(this); plvsaToolBarLinkmicTypeIv.setOnClickListener(this); toolBarCommodityControlIv.setOnClickListener(this); initLinkMicControlWindow(); moreLayout = new PLVSAMoreLayout(view.getContext()); - memberLayout = new PLVSAMemberLayout(view.getContext()); commodityControlLayout = new PLVSACommodityControlLayout(view.getContext()); // 初始化评论上墙布局 @@ -181,8 +174,8 @@ private void initLinkMicControlWindow() { public void onLinkMicOpenStateChanged(boolean isVideoLinkMicType, boolean isOpenLinkMic) { PLVSAStreamerHomeFragment.this.isVideoLinkMic = isVideoLinkMicType; PLVSAStreamerHomeFragment.this.isOpenLinkMic = isOpenLinkMic; - if (memberLayout != null) { - memberLayout.notifyLinkMicTypeChange(isVideoLinkMicType, isOpenLinkMic); + if (plvsaStatusBarLayout != null) { + plvsaStatusBarLayout.notifyLinkMicTypeChange(isVideoLinkMicType, isOpenLinkMic); } if (onViewActionListener != null) { onViewActionListener.onLinkMicMediaTypeUpdate(isVideoLinkMicType, isOpenLinkMic); @@ -269,8 +262,6 @@ public void init(IPLVLiveRoomDataManager liveRoomDataManager) { plvsaStatusBarLayout.init(liveRoomDataManager); //初始化聊天室布局 plvsaChatroomLayout.init(liveRoomDataManager); - //初始化成员布局 - memberLayout.init(liveRoomDataManager); //初始化更多布局 moreLayout.init(liveRoomDataManager); commodityControlLayout.init(liveRoomDataManager); @@ -282,6 +273,17 @@ public void init(IPLVLiveRoomDataManager liveRoomDataManager) { updateLinkMicStrategy(liveRoomDataManager); } + public void changeGiftEffectSwitch(boolean isOpen) { + if (plvsaChatroomLayout != null) { + isOpenGiftEffect = isOpen; + if (isOpen) { + plvsaChatroomLayout.changeDisplayType(PLVSAMessageAdapter.DISPLAY_DATA_TYPE_FULL); + } else { + plvsaChatroomLayout.changeDisplayType(PLVSAMessageAdapter.DISPLAY_DATA_TYPE_REMOVE_REWARD); + } + } + } + public void chatroomLogin(){ plvsaChatroomLayout.loginAndLoadHistory(); } @@ -313,7 +315,7 @@ public void registerToTopView() { } public void updateUserRequestStatus() { - showUserRequestTips(); + plvsaStatusBarLayout.showUserRequestTips(); } public void updateLinkMicLayoutTypeVisibility(boolean isShow) { @@ -326,13 +328,10 @@ public void updateLinkMicLayoutTypeVisibility(boolean isShow) { plvsaToolBarLinkmicTypeIv.setVisibility(isShow ? View.VISIBLE : View.INVISIBLE); } - public void openMemberLayoutAndHideUserRequestTips() { - memberLayout.open(); - hideUserRequestTips(); - } - public void closeMemberLayout() { - memberLayout.closeAndHideWindow(); + if (plvsaStatusBarLayout != null) { + plvsaStatusBarLayout.closeMemberLayout(); + } } public IPLVStreamerContract.IStreamerView getStreamerView() { @@ -345,12 +344,6 @@ public IPLVStreamerContract.IStreamerView get() { return moreLayout.getStreamerView(); } }), - nullable(new PLVSugarUtil.Supplier() { - @Override - public IPLVStreamerContract.IStreamerView get() { - return memberLayout.getStreamerView(); - } - }), nullable(new PLVSugarUtil.Supplier() { @Override public IPLVStreamerContract.IStreamerView get() { @@ -368,7 +361,6 @@ public PLVSAMoreLayout getMoreLayout() { public boolean onBackPressed() { return plvsaChatroomLayout.onBackPressed() || moreLayout.onBackPressed() - || memberLayout.onBackPressed() || plvsaStatusBarLayout.onBackPressed(); } @@ -467,7 +459,6 @@ public void onChanged(@Nullable Integer integer) { return; } plvsaStatusBarLayout.setOnlineCount(integer); - memberLayout.updateOnlineCount(integer); } }); //监听聊天室用户的登录事件 @@ -487,7 +478,9 @@ public void onChanged(@Nullable PLVRewardEvent rewardEvent) { if (rewardEvent == null) { return; } - plvsaChatroomRewardLy.acceptRewardGiftMessage(rewardEvent); + if (isOpenGiftEffect) { + plvsaChatroomRewardLy.acceptRewardGiftMessage(rewardEvent); + } addRewardEventToChatList(rewardEvent); } }); @@ -559,8 +552,7 @@ private void addRewardEventToChatList(PLVRewardEvent rewardEvent) { // private void observeStatusBarLayout() { - //监听状态栏回调 - plvsaStatusBarLayout.setOnStopLiveListener(new PLVSAStatusBarLayout.OnStopLiveListener() { + plvsaStatusBarLayout.setOnViewActionListener(new PLVSAStatusBarLayout.OnViewActionListener() { @Override public void onStopLive() { if (onViewActionListener != null) { @@ -572,19 +564,6 @@ public void onStopLive() { // - // - private void showUserRequestTips() { - if (memberLayout != null && memberLayout.isOpen()) { - return; - } - plvsaToolBarMemberLinkmicRequestTipsView.setVisibility(View.VISIBLE); - } - - private void hideUserRequestTips() { - plvsaToolBarMemberLinkmicRequestTipsView.setVisibility(View.GONE); - } - // - // @Override public void onClick(final View v) { @@ -593,11 +572,6 @@ public void onClick(final View v) { plvsaChatroomLayout.callInputWindow(); } else if (id == R.id.plvsa_tool_bar_more_iv) { moreLayout.open(); - } else if (id == R.id.plvsa_tool_bar_member_iv) { - openMemberLayoutAndHideUserRequestTips(); - if (onViewActionListener != null) { - onViewActionListener.onClickToOpenMemberLayout(); - } } else if (id == R.id.plvsa_tool_bar_linkmic_type_iv) { plvsaToolBarLinkmicTypeTip.setVisibility(View.INVISIBLE); if (PLVDebounceClicker.tryClick(this, 800)) { @@ -641,8 +615,6 @@ public interface OnViewActionListener { void onStopLive(); - void onClickToOpenMemberLayout(); - boolean showCleanUpLayout(); /** diff --git a/polyvStreamerAloneScene/src/main/res/drawable-xhdpi/plvsa_gift_effect_close.png b/polyvStreamerAloneScene/src/main/res/drawable-xhdpi/plvsa_gift_effect_close.png new file mode 100644 index 00000000..f55c4546 Binary files /dev/null and b/polyvStreamerAloneScene/src/main/res/drawable-xhdpi/plvsa_gift_effect_close.png differ diff --git a/polyvStreamerAloneScene/src/main/res/drawable-xhdpi/plvsa_gift_effect_open.png b/polyvStreamerAloneScene/src/main/res/drawable-xhdpi/plvsa_gift_effect_open.png new file mode 100644 index 00000000..a621840f Binary files /dev/null and b/polyvStreamerAloneScene/src/main/res/drawable-xhdpi/plvsa_gift_effect_open.png differ diff --git a/polyvStreamerAloneScene/src/main/res/drawable-xhdpi/plvsa_gift_reward_close.png b/polyvStreamerAloneScene/src/main/res/drawable-xhdpi/plvsa_gift_reward_close.png new file mode 100644 index 00000000..9eee36df Binary files /dev/null and b/polyvStreamerAloneScene/src/main/res/drawable-xhdpi/plvsa_gift_reward_close.png differ diff --git a/polyvStreamerAloneScene/src/main/res/drawable-xhdpi/plvsa_gift_reward_open.png b/polyvStreamerAloneScene/src/main/res/drawable-xhdpi/plvsa_gift_reward_open.png new file mode 100644 index 00000000..6c90f9e1 Binary files /dev/null and b/polyvStreamerAloneScene/src/main/res/drawable-xhdpi/plvsa_gift_reward_open.png differ diff --git a/polyvStreamerAloneScene/src/main/res/drawable-xhdpi/plvsa_live_replay_close.png b/polyvStreamerAloneScene/src/main/res/drawable-xhdpi/plvsa_live_replay_close.png new file mode 100644 index 00000000..81b74559 Binary files /dev/null and b/polyvStreamerAloneScene/src/main/res/drawable-xhdpi/plvsa_live_replay_close.png differ diff --git a/polyvStreamerAloneScene/src/main/res/drawable-xhdpi/plvsa_live_replay_open.png b/polyvStreamerAloneScene/src/main/res/drawable-xhdpi/plvsa_live_replay_open.png new file mode 100644 index 00000000..ab9d4cba Binary files /dev/null and b/polyvStreamerAloneScene/src/main/res/drawable-xhdpi/plvsa_live_replay_open.png differ diff --git a/polyvStreamerAloneScene/src/main/res/drawable-xhdpi/plvsa_live_room_setting_beauty_icon.png b/polyvStreamerAloneScene/src/main/res/drawable-xhdpi/plvsa_live_room_setting_beauty_icon.png index b4fa97c5..e182159e 100644 Binary files a/polyvStreamerAloneScene/src/main/res/drawable-xhdpi/plvsa_live_room_setting_beauty_icon.png and b/polyvStreamerAloneScene/src/main/res/drawable-xhdpi/plvsa_live_room_setting_beauty_icon.png differ diff --git a/polyvStreamerAloneScene/src/main/res/drawable-xhdpi/plvsa_network_disconnect_icon.png b/polyvStreamerAloneScene/src/main/res/drawable-xhdpi/plvsa_network_disconnect_icon.png new file mode 100644 index 00000000..a57ef8a0 Binary files /dev/null and b/polyvStreamerAloneScene/src/main/res/drawable-xhdpi/plvsa_network_disconnect_icon.png differ diff --git a/polyvStreamerAloneScene/src/main/res/drawable/plvsa_gift_effect_selector.xml b/polyvStreamerAloneScene/src/main/res/drawable/plvsa_gift_effect_selector.xml new file mode 100644 index 00000000..fb846fcc --- /dev/null +++ b/polyvStreamerAloneScene/src/main/res/drawable/plvsa_gift_effect_selector.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/polyvStreamerAloneScene/src/main/res/drawable/plvsa_gift_reward_selector.xml b/polyvStreamerAloneScene/src/main/res/drawable/plvsa_gift_reward_selector.xml new file mode 100644 index 00000000..479c7f0a --- /dev/null +++ b/polyvStreamerAloneScene/src/main/res/drawable/plvsa_gift_reward_selector.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/polyvStreamerAloneScene/src/main/res/drawable/plvsa_live_replay_selector.xml b/polyvStreamerAloneScene/src/main/res/drawable/plvsa_live_replay_selector.xml new file mode 100644 index 00000000..1254fdf0 --- /dev/null +++ b/polyvStreamerAloneScene/src/main/res/drawable/plvsa_live_replay_selector.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/polyvStreamerAloneScene/src/main/res/layout/plvsa_streamer_alone_activity.xml b/polyvStreamerAloneScene/src/main/res/layout/plvsa_streamer_alone_activity.xml index ebb5c8a8..bf13eee3 100644 --- a/polyvStreamerAloneScene/src/main/res/layout/plvsa_streamer_alone_activity.xml +++ b/polyvStreamerAloneScene/src/main/res/layout/plvsa_streamer_alone_activity.xml @@ -45,12 +45,6 @@ android:overScrollMode="never" android:visibility="invisible" /> - - - + + + + xmlns:app="http://schemas.android.com/apk/res-auto" + android:layout_width="wrap_content" + android:layout_height="wrap_content"> - + app:rectRadius="16dp" + app:triangleHeight="6dp" + app:triangleWidth="11dp" + app:trianglePosition="top" + app:triangleMarginType="center"> + android:orientation="horizontal" + android:paddingVertical="4dp"> + android:textSize="14sp" />