Skip to content

Commit e72ea03

Browse files
committed
更新版本1.2.2
1 parent eb63a24 commit e72ea03

8 files changed

Lines changed: 41 additions & 10 deletions

File tree

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,13 @@ polyv-android-livescenes-sdk-demo
22
===
33

44
[![build passing](https://img.shields.io/badge/build-passing-brightgreen.svg)](#)
5-
[![GitHub release](https://img.shields.io/badge/release-v1.2.0-blue.svg)](https://github.com/polyv/polyv-android-livescenes-sdk-demo/releases/tag/v1.2.0)
5+
[![GitHub release](https://img.shields.io/badge/release-v1.2.2-blue.svg)](https://github.com/polyv/polyv-android-livescenes-sdk-demo/releases/tag/v1.2.2)
66

77
### !!!集成请务必参考[wiki](https://github.com/polyv/polyv-android-livescenes-sdk-demo/wiki)文档
88

99
## API 文档
1010

11+
1.2.2版API文档请看[v1.2.2 API](http://repo.polyv.net/android/livescenes/javadoc/1.2.2/index.html)</br>
1112
1.1.0版API文档请看[v1.1.0 API](http://repo.polyv.net/android/livescenes/javadoc/1.1.0/index.html)</br>
1213
1.0.1版API文档请看[v1.0.1 API](http://repo.polyv.net/android/livescenes/javadoc/1.0.1/index.html)
1314

build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ ext {
3333
minSdkVersion = 21
3434
targetSdkVersion = 27
3535
versionCode = 121
36-
versionName = "1.2.1"
36+
versionName = "1.2.2"
3737
}
3838

3939
task clean(type: Delete) {

polyvLiveCloudClassScene/src/main/java/com/easefun/polyv/livecloudclass/modules/chatroom/PLVLCChatFragment.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,9 @@ public void setIsLiveType(boolean isLiveType) {
182182

183183
// <editor-fold defaultstate="collapsed" desc="初始化view">
184184
private void initView() {
185+
if (chatCommonMessageList == null || chatroomPresenter == null) {
186+
return;
187+
}
185188
//未读信息view
186189
unreadMsgTv = findViewById(R.id.unread_msg_tv);
187190
chatCommonMessageList.addUnreadView(unreadMsgTv);
@@ -210,6 +213,9 @@ public void onChange(int currentUnreadCount) {
210213
swipeLoadView.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() {
211214
@Override
212215
public void onRefresh() {
216+
if (chatroomPresenter == null) {
217+
return;
218+
}
213219
chatroomPresenter.requestChatHistory(chatroomPresenter.getViewIndex(chatroomView));
214220
}
215221
});

polyvLiveCloudClassScene/src/main/java/com/easefun/polyv/livecloudclass/modules/chatroom/chatlandscape/PLVLCChatLandscapeLayout.java

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,9 @@ public PLVLCChatLandscapeLayout(@NonNull Context context, @Nullable AttributeSet
8484
// <editor-fold defaultstate="collapsed" desc="初始化数据">
8585
public void init(PLVLCChatCommonMessageList chatCommonMessageList) {
8686
this.chatCommonMessageList = chatCommonMessageList;
87+
if (chatCommonMessageList == null) {
88+
return;
89+
}
8790
chatCommonMessageList.addUnreadView(unreadMsgTv);
8891
chatCommonMessageList.addOnUnreadCountChangeListener(new PLVMessageRecyclerView.OnUnreadCountChangeListener() {
8992
@Override
@@ -142,7 +145,7 @@ public void run() {
142145
public void setPresenter(@NonNull IPLVChatroomContract.IChatroomPresenter presenter) {
143146
super.setPresenter(presenter);
144147
chatroomPresenter = presenter;
145-
if (chatroomPresenter.getChatHistoryTime() == 0 && chatCommonMessageList.isLandscapeLayout()) {
148+
if (chatroomPresenter.getChatHistoryTime() == 0 && chatCommonMessageList != null && chatCommonMessageList.isLandscapeLayout()) {
146149
chatroomPresenter.requestChatHistory(chatroomPresenter.getViewIndex(chatroomView));
147150
}
148151
}
@@ -185,7 +188,7 @@ public void onRemoveBulletinEvent() {
185188
@Override
186189
public void onCloseRoomEvent(@NonNull final PLVCloseRoomEvent closeRoomEvent) {
187190
super.onCloseRoomEvent(closeRoomEvent);
188-
if (!chatCommonMessageList.isLandscapeLayout()) {
191+
if (chatCommonMessageList == null || !chatCommonMessageList.isLandscapeLayout()) {
189192
return;
190193
}
191194
handler.post(new Runnable() {
@@ -270,19 +273,26 @@ private void addChatMessageToList(final List<PLVBaseViewData> chatMessageDataLis
270273
handler.post(new Runnable() {
271274
@Override
272275
public void run() {
273-
chatCommonMessageList.addChatMessageToList(chatMessageDataList, isScrollEnd, true);
276+
if (chatCommonMessageList != null) {
277+
chatCommonMessageList.addChatMessageToList(chatMessageDataList, isScrollEnd, true);
278+
}
274279
}
275280
});
276281
}
277282

278283
private void addChatHistoryToList(final List<PLVBaseViewData<PLVBaseEvent>> chatMessageDataList, final boolean isScrollEnd) {
279-
chatCommonMessageList.addChatHistoryToList(chatMessageDataList, isScrollEnd, true);
284+
if (chatCommonMessageList != null) {
285+
chatCommonMessageList.addChatHistoryToList(chatMessageDataList, isScrollEnd, true);
286+
}
280287
}
281288

282289
private void removeChatMessageToList(final String id, final boolean isRemoveAll) {
283290
handler.post(new Runnable() {
284291
@Override
285292
public void run() {
293+
if (chatCommonMessageList == null) {
294+
return;
295+
}
286296
if (isRemoveAll) {
287297
chatCommonMessageList.removeAllChatMessage(true);
288298
} else {

polyvLiveCloudClassScene/src/main/java/com/easefun/polyv/livecloudclass/modules/linkmic/adapter/PLVLinkMicListAdapter.java

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
import android.support.annotation.Nullable;
55
import android.support.v7.widget.RecyclerView;
66
import android.text.TextUtils;
7+
import android.view.Gravity;
78
import android.view.LayoutInflater;
89
import android.view.SurfaceView;
910
import android.view.View;
@@ -256,7 +257,7 @@ public LinkMicItemViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int v
256257

257258
LinkMicItemViewHolder viewHolder = new LinkMicItemViewHolder(itemView);
258259
viewHolder.renderView = renderView;
259-
viewHolder.flRenderViewContainer.addView(renderView, ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT);
260+
viewHolder.flRenderViewContainer.addView(renderView, getRenderViewLayoutParam());
260261
return viewHolder;
261262
}
262263

@@ -275,7 +276,7 @@ public void onBindViewHolder(@NonNull final LinkMicItemViewHolder holder, final
275276
if (holder.isViewRecycled) {
276277
holder.isViewRecycled = false;
277278
holder.renderView = adapterCallback.createLinkMicRenderView();
278-
holder.flRenderViewContainer.addView(holder.renderView, ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT);
279+
holder.flRenderViewContainer.addView(holder.renderView,getRenderViewLayoutParam());
279280
holder.isRenderViewSetup = false;
280281
}
281282
PLVLinkMicItemDataBean itemDataBean = dataList.get(position);
@@ -496,7 +497,7 @@ private void bindVideoMute(@NonNull LinkMicItemViewHolder holder, boolean isMute
496497
}
497498
//将渲染器从View 添加到view tree中
498499
if (holder.renderView != null && holder.renderView.getParent() == null) {
499-
holder.flRenderViewContainer.addView(holder.renderView, ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT);
500+
holder.flRenderViewContainer.addView(holder.renderView, getRenderViewLayoutParam());
500501
}
501502
}
502503
}
@@ -561,6 +562,11 @@ private boolean resolveListShowMode(LinkMicItemViewHolder holder, int position)
561562
private boolean intBetween(int value, int left, int right) {
562563
return value > left && value <= right;
563564
}
565+
566+
//获取渲染器的布局参数
567+
private FrameLayout.LayoutParams getRenderViewLayoutParam() {
568+
return new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT, Gravity.CENTER);
569+
}
564570
// </editor-fold>
565571

566572
// <editor-fold defaultstate="collapsed" desc="内部类 - LinkMicItemViewHolder定义">

polyvLiveCommonModul/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ android {
2525

2626
dependencies {
2727
implementation 'com.android.support:design:27.1.1'
28-
api 'com.easefun.polyv:polyvSDKLiveScenes:1.2.0'
28+
api 'com.easefun.polyv:polyvSDKLiveScenes:1.2.2'
2929

3030
//glide
3131
api ("com.github.bumptech.glide:okhttp3-integration:4.7.1"){

polyvLiveCommonModul/src/main/java/com/easefun/polyv/livecommon/module/modules/linkmic/presenter/PLVLinkMicPresenter.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -287,6 +287,7 @@ public void run() {
287287
// <editor-fold defaultstate="collapsed" desc="API-presenter接口实现">
288288
@Override
289289
public void destroy() {
290+
leaveChannel();
290291
dispose(getLinkMicListDelay);
291292
dispose(getLinkMicListTimer);
292293
linkMicList.clear();

polyvLiveCommonModul/src/main/java/com/easefun/polyv/livecommon/module/modules/linkmic/presenter/PLVRTCWatchEnabledStrategy.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
package com.easefun.polyv.livecommon.module.modules.linkmic.presenter;
22

3+
import android.app.Activity;
4+
import android.media.AudioManager;
35
import android.text.TextUtils;
46

57
import com.easefun.polyv.livecommon.module.data.IPLVLiveRoomDataManager;
@@ -9,6 +11,7 @@
911
import com.easefun.polyv.livescenes.linkmic.listener.PolyvLinkMicEventListener;
1012
import com.easefun.polyv.livescenes.linkmic.manager.PolyvLinkMicConfig;
1113
import com.plv.linkmic.model.PLVLinkMicJoinSuccess;
14+
import com.plv.thirdpart.blankj.utilcode.util.ActivityUtils;
1215

1316
/**
1417
* date: 2020/12/23
@@ -106,6 +109,10 @@ public void setLiveEnd() {
106109
*/
107110
@Override
108111
public void setLiveStart() {
112+
Activity topActivity= ActivityUtils.getTopActivity();
113+
if (topActivity!=null){
114+
topActivity.setVolumeControlStream(AudioManager.STREAM_VOICE_CALL);
115+
}
109116
if (!isJoinChannel) {
110117
onBeforeJoinChannelListener.onBeforeJoinChannel(PLVLinkMicListShowModeGetter.getLeavedMicShowMode());
111118
linkMicManager.joinChannel();

0 commit comments

Comments
 (0)