Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
9c0a1dd19f
@ -159,11 +159,11 @@ public class IMLoginManager extends BaseCacheManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public boolean isMountEffect() {
|
public boolean isMountEffect() {
|
||||||
return getBoolean(MountEffect, false);
|
return getBoolean(MountEffect, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isGiftEffect() {
|
public boolean isGiftEffect() {
|
||||||
return getBoolean(GiftEffect, false);
|
return getBoolean(GiftEffect, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -216,6 +216,7 @@ public class LiveAudienceActivity extends LiveActivity {
|
|||||||
public void onPageSelected(int position) {
|
public void onPageSelected(int position) {
|
||||||
super.onPageSelected(position);
|
super.onPageSelected(position);
|
||||||
mCurrentPage = position;
|
mCurrentPage = position;
|
||||||
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
verticalViewPager.setPageTransformer(false, new ViewPager.PageTransformer() {
|
verticalViewPager.setPageTransformer(false, new ViewPager.PageTransformer() {
|
||||||
@ -234,7 +235,6 @@ public class LiveAudienceActivity extends LiveActivity {
|
|||||||
manager.onRemove();
|
manager.onRemove();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 满足此种条件,表明需要加载直播视频,以及聊天室了
|
// 满足此种条件,表明需要加载直播视频,以及聊天室了
|
||||||
if (viewGroup.getId() == mCurrentItem && (position == 0) && mCurrentItem != mLastPosition) {
|
if (viewGroup.getId() == mCurrentItem && (position == 0) && mCurrentItem != mLastPosition) {
|
||||||
loadData(viewGroup, mCurrentItem);
|
loadData(viewGroup, mCurrentItem);
|
||||||
@ -249,20 +249,9 @@ public class LiveAudienceActivity extends LiveActivity {
|
|||||||
private void loadData(ViewGroup viewGroup, int currentItem) {
|
private void loadData(ViewGroup viewGroup, int currentItem) {
|
||||||
mViewGroup = viewGroup;
|
mViewGroup = viewGroup;
|
||||||
mLastPosition = currentItem;
|
mLastPosition = currentItem;
|
||||||
liveHandler.removeCallbacks(liveRunnable);
|
|
||||||
if (mCurrentPage > 0) {
|
|
||||||
liveHandler.postDelayed(liveRunnable, 800);
|
|
||||||
} else {
|
|
||||||
liveHandler.post(liveRunnable);
|
liveHandler.post(liveRunnable);
|
||||||
}
|
|
||||||
Log.e("收到socket--->", "mLiveUid--------------------------->" + mLiveUid);
|
Log.e("收到socket--->", "mLiveUid--------------------------->" + mLiveUid);
|
||||||
//加载当前页面数据
|
|
||||||
View rootView = manager.getRootView();
|
|
||||||
if (rootView.getParent() != null && rootView.getParent() instanceof ViewGroup) {
|
|
||||||
((ViewGroup) (rootView.getParent())).removeView(rootView);
|
|
||||||
manager.onRemove();
|
|
||||||
}
|
|
||||||
mViewGroup.addView(manager.getRootView());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//获取直播间状态
|
//获取直播间状态
|
||||||
@ -292,6 +281,9 @@ public class LiveAudienceActivity extends LiveActivity {
|
|||||||
if (liveBean1 == null) {
|
if (liveBean1 == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
runOnUiThread(new Runnable() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
mLiveSDK = liveSdk;
|
mLiveSDK = liveSdk;
|
||||||
mLiveType = liveType;
|
mLiveType = liveType;
|
||||||
mLiveTypeVal = liveTypeVal;
|
mLiveTypeVal = liveTypeVal;
|
||||||
@ -300,9 +292,19 @@ public class LiveAudienceActivity extends LiveActivity {
|
|||||||
mStream = liveBean1.getStream();
|
mStream = liveBean1.getStream();
|
||||||
mAncherName = liveBean1.getUserNiceName();
|
mAncherName = liveBean1.getUserNiceName();
|
||||||
mAncherIcon = liveBean1.getAvatar();
|
mAncherIcon = liveBean1.getAvatar();
|
||||||
|
Log.e("收到socket--->", "mLiveUid--------------------------->" + mLiveUid);
|
||||||
|
//加载当前页面数据
|
||||||
|
View rootView = manager.getRootView();
|
||||||
|
if (rootView.getParent() != null && rootView.getParent() instanceof ViewGroup) {
|
||||||
|
((ViewGroup) (rootView.getParent())).removeView(rootView);
|
||||||
|
manager.onRemove();
|
||||||
|
}
|
||||||
|
mViewGroup.addView(manager.getRootView());
|
||||||
|
|
||||||
manager.onAdd(liveBean1, liveType, liveTypeVal, liveSdk);
|
manager.onAdd(liveBean1, liveType, liveTypeVal, liveSdk);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -44,12 +44,13 @@ public class VerticalPagerAdapter extends androidx.viewpager.widget.PagerAdapter
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Object instantiateItem(ViewGroup container, int position) {
|
public Object instantiateItem(ViewGroup container, int position) {
|
||||||
Log.e("LiveAudienceActivity", "VerticalPagerAdapter:" + position);
|
|
||||||
View view = LayoutInflater.from(container.getContext()).inflate(R.layout.layout_portrait_live_item, null);
|
View view = LayoutInflater.from(container.getContext()).inflate(R.layout.layout_portrait_live_item, null);
|
||||||
// 背景
|
// 背景
|
||||||
AnchorRecommendItemModel liveItemBean = liveBeans.get(position);
|
AnchorRecommendItemModel liveItemBean = liveBeans.get(position);
|
||||||
ImageView ivBg = view.findViewById(R.id.iv_bg);
|
ImageView ivBg = view.findViewById(R.id.iv_bg);
|
||||||
ImgLoader.displayBlurLive(mContext, liveItemBean.getAvatar(), ivBg);
|
ImgLoader.displayBlurLive(mContext, liveItemBean.getAvatar(), ivBg);
|
||||||
|
Log.e("LiveAudienceActivity", "加载图片:" + liveItemBean.getAvatar());
|
||||||
// 加载动画
|
// 加载动画
|
||||||
ImageView ivLoading = view.findViewById(R.id.iv_loading);
|
ImageView ivLoading = view.findViewById(R.id.iv_loading);
|
||||||
AnimationDrawable frameAnimation = (AnimationDrawable) ivLoading.getBackground();
|
AnimationDrawable frameAnimation = (AnimationDrawable) ivLoading.getBackground();
|
||||||
|
@ -181,10 +181,7 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe
|
|||||||
private void ininView() {
|
private void ininView() {
|
||||||
// 直播间根布局
|
// 直播间根布局
|
||||||
mRootContainer = (DrawerLayout) LayoutInflater.from(mContext).inflate(R.layout.activity_live_audience, null);
|
mRootContainer = (DrawerLayout) LayoutInflater.from(mContext).inflate(R.layout.activity_live_audience, null);
|
||||||
|
|
||||||
|
|
||||||
playContainer = mRootContainer.findViewById(R.id.play_container);
|
playContainer = mRootContainer.findViewById(R.id.play_container);
|
||||||
|
|
||||||
mViewPager = mRootContainer.findViewById(R.id.viewPager);
|
mViewPager = mRootContainer.findViewById(R.id.viewPager);
|
||||||
btnSmallScreen = mRootContainer.findViewById(R.id.btn_small_screen);
|
btnSmallScreen = mRootContainer.findViewById(R.id.btn_small_screen);
|
||||||
mSecondPage = (ViewGroup) LayoutInflater.from(mContext).inflate(R.layout.view_audience_page, mViewPager, false);
|
mSecondPage = (ViewGroup) LayoutInflater.from(mContext).inflate(R.layout.view_audience_page, mViewPager, false);
|
||||||
@ -200,16 +197,19 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe
|
|||||||
mContainer.removeAllViews();
|
mContainer.removeAllViews();
|
||||||
mViewPager.setAdapter(pagerAdapter);
|
mViewPager.setAdapter(pagerAdapter);
|
||||||
mViewPager.setCurrentItem(1);
|
mViewPager.setCurrentItem(1);
|
||||||
|
|
||||||
//直播页面背景
|
//直播页面背景
|
||||||
liveBack = mRootContainer.findViewById(R.id.live_back);
|
liveBack = mRootContainer.findViewById(R.id.live_back);
|
||||||
mask = mRootContainer.findViewById(R.id.mask);
|
mask = mRootContainer.findViewById(R.id.mask);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onAdd(LiveBean data, int liveType, int liveTypeVal, int liveSdk) {
|
public void onAdd(LiveBean data, int liveType, int liveTypeVal, int liveSdk) {
|
||||||
|
mContext.runOnUiThread(new Runnable() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
Log.e("ImgLoader1", data.getAvatar());
|
||||||
|
|
||||||
|
|
||||||
mLiveBean = data;
|
mLiveBean = data;
|
||||||
mLiveSDK = liveSdk;
|
mLiveSDK = liveSdk;
|
||||||
mLiveType = liveType;
|
mLiveType = liveType;
|
||||||
@ -235,12 +235,9 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe
|
|||||||
mLiveLinkMicAnchorPresenter = new LiveLinkMicAnchorPresenter(mContext, mLivePlayViewHolder, false, mLiveSDK, null);
|
mLiveLinkMicAnchorPresenter = new LiveLinkMicAnchorPresenter(mContext, mLivePlayViewHolder, false, mLiveSDK, null);
|
||||||
|
|
||||||
mLiveRyLinkMicPkPresenter = new LiveRyLinkMicPkPresenter(mContext, mLivePlayViewHolder, false, null);
|
mLiveRyLinkMicPkPresenter = new LiveRyLinkMicPkPresenter(mContext, mLivePlayViewHolder, false, null);
|
||||||
|
|
||||||
|
|
||||||
//直播间背景
|
//直播间背景
|
||||||
ImgLoader.displayBlurLive(mContext, data.getAvatar(), liveBack);
|
ImgLoader.displayBlurLive(mContext, mLiveBean.getAvatar(), liveBack);
|
||||||
mask.setVisibility(View.VISIBLE);
|
mask.setVisibility(View.VISIBLE);
|
||||||
|
|
||||||
mLivePlayViewHolder.setCover(data.getThumb());
|
mLivePlayViewHolder.setCover(data.getThumb());
|
||||||
mLivePlayViewHolder.play(data.getPull());
|
mLivePlayViewHolder.play(data.getPull());
|
||||||
mLiveRoomViewHolder.setAvatar(data.getAvatar());
|
mLiveRoomViewHolder.setAvatar(data.getAvatar());
|
||||||
@ -252,6 +249,11 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe
|
|||||||
mLiveRyLinkMicPkPresenter.setLiveUid(data.getUid(), "");
|
mLiveRyLinkMicPkPresenter.setLiveUid(data.getUid(), "");
|
||||||
|
|
||||||
mLiveRoomViewHolder.setLiveUid(data.getUid());
|
mLiveRoomViewHolder.setLiveUid(data.getUid());
|
||||||
|
|
||||||
|
mSocketRyClient = new SocketRyClient(mLiveBean.getUid(), PortraitLiveManager.this);
|
||||||
|
if (mLiveLinkMicPresenter != null) {
|
||||||
|
mLiveLinkMicPresenter.setSocketClient(mSocketClient);
|
||||||
|
}
|
||||||
//心愿单
|
//心愿单
|
||||||
LiveHttpUtil.getWishList(mLiveBean.getUid(), new HttpCallback() {
|
LiveHttpUtil.getWishList(mLiveBean.getUid(), new HttpCallback() {
|
||||||
@Override
|
@Override
|
||||||
@ -259,30 +261,40 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe
|
|||||||
if (info.length > 0) {
|
if (info.length > 0) {
|
||||||
String json = info[0];
|
String json = info[0];
|
||||||
WishlistModel model = GsonUtils.fromJson(json, WishlistModel.class);
|
WishlistModel model = GsonUtils.fromJson(json, WishlistModel.class);
|
||||||
if (mLiveRoomViewHolder != null && model != null)
|
if (mLiveRoomViewHolder != null && model != null) {
|
||||||
mLiveRoomViewHolder.initWishList(model.getWishlist());
|
mLiveRoomViewHolder.initWishList(model.getWishlist());
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onFinish() {
|
public void onFinish() {
|
||||||
|
|
||||||
enterRoom();
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
enterRoom();
|
||||||
mLiveRoomViewHolder.initHourRankList();
|
mLiveRoomViewHolder.initHourRankList();
|
||||||
}
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onRemove() {
|
public void onRemove() {
|
||||||
//子线程执行退出操作
|
|
||||||
liveHandler.post(() -> exitLiveRoom());
|
|
||||||
|
|
||||||
|
IMLoginManager.get(mContext).setisNewUserOne(false);
|
||||||
|
//子线程执行退出操作
|
||||||
|
endPlay();
|
||||||
|
exitLiveRoom();
|
||||||
|
|
||||||
if (mLiveAudienceViewHolder != null) {
|
if (mLiveAudienceViewHolder != null) {
|
||||||
mLiveAudienceViewHolder.removeFromParent();
|
mLiveAudienceViewHolder.removeFromParent();
|
||||||
mLiveAudienceViewHolder.countDownTimerTrickery = null;
|
mLiveAudienceViewHolder.countDownTimerTrickery = null;
|
||||||
mLiveAudienceViewHolder.removeCallbacks();
|
mLiveAudienceViewHolder.removeCallbacks();
|
||||||
|
mLiveAudienceViewHolder.release();
|
||||||
}
|
}
|
||||||
mLiveAudienceViewHolder = null;
|
mLiveAudienceViewHolder = null;
|
||||||
//断开socket
|
//断开socket
|
||||||
@ -293,6 +305,7 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe
|
|||||||
mSocketRyClient = null;
|
mSocketRyClient = null;
|
||||||
//结束播放
|
//结束播放
|
||||||
if (mLivePlayViewHolder != null) {
|
if (mLivePlayViewHolder != null) {
|
||||||
|
mLivePlayViewHolder.removeFromParent();
|
||||||
mLivePlayViewHolder.stopPlay();
|
mLivePlayViewHolder.stopPlay();
|
||||||
mLivePlayViewHolder.release();
|
mLivePlayViewHolder.release();
|
||||||
}
|
}
|
||||||
@ -312,21 +325,26 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe
|
|||||||
if (mLiveRoomViewHolder != null) {
|
if (mLiveRoomViewHolder != null) {
|
||||||
mLiveRoomViewHolder.removeFromParent();
|
mLiveRoomViewHolder.removeFromParent();
|
||||||
mLiveRoomViewHolder.clearData();
|
mLiveRoomViewHolder.clearData();
|
||||||
|
mLiveRoomViewHolder.release();
|
||||||
mLiveRoomViewHolder = null;
|
mLiveRoomViewHolder = null;
|
||||||
}
|
}
|
||||||
if (mLiveEndViewHolder != null) {
|
if (mLiveEndViewHolder != null) {
|
||||||
|
|
||||||
mLiveEndViewHolder.removeFromParent();
|
mLiveEndViewHolder.removeFromParent();
|
||||||
|
mLiveEndViewHolder.release();
|
||||||
mLiveEndViewHolder = null;
|
mLiveEndViewHolder = null;
|
||||||
}
|
}
|
||||||
if (mLiveLinkMicPresenter != null) {
|
if (mLiveLinkMicPresenter != null) {
|
||||||
mLiveLinkMicPresenter.clearData();
|
mLiveLinkMicPresenter.clearData();
|
||||||
|
mLiveLinkMicPresenter.release();
|
||||||
}
|
}
|
||||||
if (mLiveLinkMicAnchorPresenter != null) {
|
if (mLiveLinkMicAnchorPresenter != null) {
|
||||||
mLiveLinkMicAnchorPresenter.clearData();
|
mLiveLinkMicAnchorPresenter.clearData();
|
||||||
|
mLiveLinkMicAnchorPresenter.release();
|
||||||
}
|
}
|
||||||
if (mLiveRyLinkMicPkPresenter != null) {
|
if (mLiveRyLinkMicPkPresenter != null) {
|
||||||
mLiveRyLinkMicPkPresenter.clearData();
|
mLiveRyLinkMicPkPresenter.clearData();
|
||||||
|
mLiveRyLinkMicPkPresenter.release();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -660,6 +678,7 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onLiveEnd() {
|
public void onLiveEnd() {
|
||||||
|
endPlay();
|
||||||
if (!CommonAppConfig.LIVE_ROOM_SCROLL) {
|
if (!CommonAppConfig.LIVE_ROOM_SCROLL) {
|
||||||
if (mViewPager != null) {
|
if (mViewPager != null) {
|
||||||
if (mViewPager.getCurrentItem() != 1) {
|
if (mViewPager.getCurrentItem() != 1) {
|
||||||
@ -667,7 +686,7 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe
|
|||||||
}
|
}
|
||||||
mViewPager.setCanScroll(false);
|
mViewPager.setCanScroll(false);
|
||||||
}
|
}
|
||||||
endPlay();
|
|
||||||
} else {
|
} else {
|
||||||
if (mLivePlayViewHolder != null) {
|
if (mLivePlayViewHolder != null) {
|
||||||
mLivePlayViewHolder.stopPlay2();
|
mLivePlayViewHolder.stopPlay2();
|
||||||
@ -964,10 +983,6 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe
|
|||||||
private void enterRoom() {
|
private void enterRoom() {
|
||||||
//进入直播间IM
|
//进入直播间IM
|
||||||
|
|
||||||
mSocketRyClient = new SocketRyClient(mLiveBean.getUid(), this);
|
|
||||||
if (mLiveLinkMicPresenter != null) {
|
|
||||||
mLiveLinkMicPresenter.setSocketClient(mSocketClient);
|
|
||||||
}
|
|
||||||
|
|
||||||
timeIndex = 0;
|
timeIndex = 0;
|
||||||
LiveHttpUtil.enterRoom(mLiveBean.getUid(), mLiveBean.getStream(), new HttpCallback() {
|
LiveHttpUtil.enterRoom(mLiveBean.getUid(), mLiveBean.getStream(), new HttpCallback() {
|
||||||
@ -993,7 +1008,6 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe
|
|||||||
mask.setVisibility(View.GONE);
|
mask.setVisibility(View.GONE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//回传参数
|
//回传参数
|
||||||
Bus.get().post(new LiveAudienceEvent()
|
Bus.get().post(new LiveAudienceEvent()
|
||||||
.setType(LiveAudienceEvent.LiveAudienceType.OPEN_PARAMETERS)
|
.setType(LiveAudienceEvent.LiveAudienceType.OPEN_PARAMETERS)
|
||||||
@ -1300,7 +1314,6 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe
|
|||||||
if (mLiveRoomViewHolder != null)
|
if (mLiveRoomViewHolder != null)
|
||||||
mLiveRoomViewHolder.clearList();
|
mLiveRoomViewHolder.clearList();
|
||||||
|
|
||||||
IMLoginManager.get(mContext).setisNewUserOne(false);
|
|
||||||
|
|
||||||
if (countDownTimer != null) {
|
if (countDownTimer != null) {
|
||||||
countDownTimer.cancel();
|
countDownTimer.cancel();
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent">
|
android:layout_height="match_parent">
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user