悬浮窗视频调整,主播离开下滑直播间离开画面不消失问题修复
This commit is contained in:
parent
744de267dd
commit
cf4948a3e2
@ -73,8 +73,8 @@ public class LiveFloatView implements Function1<FloatCallbacks.Builder, Unit> {
|
|||||||
CardView layout = magnetView.findViewById(R.id.layout);
|
CardView layout = magnetView.findViewById(R.id.layout);
|
||||||
RelativeLayout.LayoutParams cardParams = (RelativeLayout.LayoutParams) layout.getLayoutParams();
|
RelativeLayout.LayoutParams cardParams = (RelativeLayout.LayoutParams) layout.getLayoutParams();
|
||||||
if (mLiveBean.getLandscape() == 1) {
|
if (mLiveBean.getLandscape() == 1) {
|
||||||
cardParams.height = DpUtil.dp2px(130);
|
cardParams.height = DpUtil.dp2px(190);
|
||||||
cardParams.width = DpUtil.dp2px(230);
|
cardParams.width = DpUtil.dp2px(255);
|
||||||
} else {
|
} else {
|
||||||
cardParams.height = DpUtil.dp2px(224);
|
cardParams.height = DpUtil.dp2px(224);
|
||||||
cardParams.width = DpUtil.dp2px(126);
|
cardParams.width = DpUtil.dp2px(126);
|
||||||
@ -91,8 +91,8 @@ public class LiveFloatView implements Function1<FloatCallbacks.Builder, Unit> {
|
|||||||
Log.e("视频流有", "videoWidth:" + videoWidth + " videoHeight:" + videoHeight);
|
Log.e("视频流有", "videoWidth:" + videoWidth + " videoHeight:" + videoHeight);
|
||||||
if (mLiveBean.getLandscape() != 1){
|
if (mLiveBean.getLandscape() != 1){
|
||||||
if (videoWidth > 720) {
|
if (videoWidth > 720) {
|
||||||
cardParams.height = DpUtil.dp2px(130);
|
cardParams.height = DpUtil.dp2px(190);
|
||||||
cardParams.width = DpUtil.dp2px(230);
|
cardParams.width = DpUtil.dp2px(255);
|
||||||
} else {
|
} else {
|
||||||
cardParams.height = DpUtil.dp2px(224);
|
cardParams.height = DpUtil.dp2px(224);
|
||||||
cardParams.width = DpUtil.dp2px(126);
|
cardParams.width = DpUtil.dp2px(126);
|
||||||
@ -206,8 +206,8 @@ public class LiveFloatView implements Function1<FloatCallbacks.Builder, Unit> {
|
|||||||
CardView layout = view.findViewById(R.id.layout);
|
CardView layout = view.findViewById(R.id.layout);
|
||||||
RelativeLayout.LayoutParams cardParams = (RelativeLayout.LayoutParams) layout.getLayoutParams();
|
RelativeLayout.LayoutParams cardParams = (RelativeLayout.LayoutParams) layout.getLayoutParams();
|
||||||
if (mLiveBean.getLandscape() == 1) {
|
if (mLiveBean.getLandscape() == 1) {
|
||||||
cardParams.height = DpUtil.dp2px(130);
|
cardParams.height = DpUtil.dp2px(190);
|
||||||
cardParams.width = DpUtil.dp2px(230);
|
cardParams.width = DpUtil.dp2px(255);
|
||||||
} else {
|
} else {
|
||||||
cardParams.height = DpUtil.dp2px(224);
|
cardParams.height = DpUtil.dp2px(224);
|
||||||
cardParams.width = DpUtil.dp2px(126);
|
cardParams.width = DpUtil.dp2px(126);
|
||||||
@ -224,8 +224,8 @@ public class LiveFloatView implements Function1<FloatCallbacks.Builder, Unit> {
|
|||||||
Log.e("视频流有", "videoWidth:" + videoWidth + " videoHeight:" + videoHeight);
|
Log.e("视频流有", "videoWidth:" + videoWidth + " videoHeight:" + videoHeight);
|
||||||
if (mLiveBean.getLandscape() != 1){
|
if (mLiveBean.getLandscape() != 1){
|
||||||
if (videoWidth > 720) {
|
if (videoWidth > 720) {
|
||||||
cardParams.height = DpUtil.dp2px(130);
|
cardParams.height = DpUtil.dp2px(190);
|
||||||
cardParams.width = DpUtil.dp2px(230);
|
cardParams.width = DpUtil.dp2px(255);
|
||||||
} else {
|
} else {
|
||||||
cardParams.height = DpUtil.dp2px(224);
|
cardParams.height = DpUtil.dp2px(224);
|
||||||
cardParams.width = DpUtil.dp2px(126);
|
cardParams.width = DpUtil.dp2px(126);
|
||||||
|
@ -0,0 +1,68 @@
|
|||||||
|
package com.yunbao.common.views.weight;
|
||||||
|
|
||||||
|
import android.app.Activity;
|
||||||
|
import android.graphics.drawable.AnimationDrawable;
|
||||||
|
import android.view.Gravity;
|
||||||
|
import android.view.View;
|
||||||
|
import android.widget.FrameLayout;
|
||||||
|
import android.widget.ImageView;
|
||||||
|
import android.widget.RelativeLayout;
|
||||||
|
|
||||||
|
import com.lzf.easyfloat.EasyFloat;
|
||||||
|
import com.lzf.easyfloat.enums.ShowPattern;
|
||||||
|
import com.lzf.easyfloat.interfaces.FloatCallbacks;
|
||||||
|
import com.lzf.easyfloat.interfaces.OnInvokeView;
|
||||||
|
import com.yunbao.common.R;
|
||||||
|
import com.yunbao.common.glide.ImgLoader;
|
||||||
|
import com.yunbao.common.utils.DeviceUtils;
|
||||||
|
|
||||||
|
import kotlin.Unit;
|
||||||
|
import kotlin.jvm.functions.Function1;
|
||||||
|
|
||||||
|
public class LiveLoadingViewHolder implements Function1<FloatCallbacks.Builder, Unit> {
|
||||||
|
private String TAG = "LiveLoadingViewHolder";
|
||||||
|
private Activity mContext;
|
||||||
|
private String url;
|
||||||
|
|
||||||
|
public void builderSystemFloat(Activity mContext, String url) {
|
||||||
|
this.mContext = mContext;
|
||||||
|
this.url = url;
|
||||||
|
EasyFloat.with(mContext)
|
||||||
|
.setTag(TAG)
|
||||||
|
.setLayout(R.layout.layout_portrait_live_item, new LiveOnInvokeView())
|
||||||
|
.setShowPattern(ShowPattern.CURRENT_ACTIVITY)
|
||||||
|
.setFilter()
|
||||||
|
.setGravity(Gravity.CENTER)
|
||||||
|
.setAnimator(null)
|
||||||
|
.setMatchParent(true,true)
|
||||||
|
.registerCallback(this)
|
||||||
|
.show();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* loading
|
||||||
|
*/
|
||||||
|
private class LiveOnInvokeView implements OnInvokeView {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void invoke(View view) {
|
||||||
|
|
||||||
|
RelativeLayout layout = view.findViewById(R.id.layout);
|
||||||
|
FrameLayout.LayoutParams cardParams = (FrameLayout.LayoutParams) layout.getLayoutParams();
|
||||||
|
cardParams.width = DeviceUtils.getScreenWidth(mContext);
|
||||||
|
cardParams.height = DeviceUtils.getScreenHeight(mContext);
|
||||||
|
layout.setLayoutParams(cardParams);
|
||||||
|
ImageView ivBg = view.findViewById(R.id.iv_bg);
|
||||||
|
ImgLoader.displayBlurLive(mContext, url, ivBg);
|
||||||
|
// 加载动画
|
||||||
|
ImageView ivLoading = view.findViewById(R.id.iv_loading);
|
||||||
|
AnimationDrawable frameAnimation = (AnimationDrawable) ivLoading.getBackground();
|
||||||
|
frameAnimation.start();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Unit invoke(FloatCallbacks.Builder builder) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
@ -1,6 +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:id="@+id/layout"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent">
|
android:layout_height="match_parent">
|
||||||
|
|
@ -144,6 +144,7 @@ public class LiveAudienceActivity extends LiveActivity {
|
|||||||
private Handler liveHandler = new Handler();
|
private Handler liveHandler = new Handler();
|
||||||
private ImageView voicePress;
|
private ImageView voicePress;
|
||||||
private View titleLine;
|
private View titleLine;
|
||||||
|
private boolean liveIndex = true;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public <T extends View> T findViewById(@IdRes int id) {
|
public <T extends View> T findViewById(@IdRes int id) {
|
||||||
@ -301,7 +302,7 @@ public class LiveAudienceActivity extends LiveActivity {
|
|||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
AnchorRecommendItemModel data = itemModelList.get(mCurrentPage);
|
AnchorRecommendItemModel data = itemModelList.get(mCurrentPage);
|
||||||
if (mCurrentPage==0){
|
if (mCurrentPage == 0&&liveIndex) {
|
||||||
View rootView = manager.getRootView();
|
View rootView = manager.getRootView();
|
||||||
if (rootView.getParent() != null && rootView.getParent() instanceof ViewGroup) {
|
if (rootView.getParent() != null && rootView.getParent() instanceof ViewGroup) {
|
||||||
((ViewGroup) (rootView.getParent())).removeView(rootView);
|
((ViewGroup) (rootView.getParent())).removeView(rootView);
|
||||||
@ -313,11 +314,12 @@ public class LiveAudienceActivity extends LiveActivity {
|
|||||||
//加载完页面后再后台静默下载礼物svga
|
//加载完页面后再后台静默下载礼物svga
|
||||||
downloadAllGift();
|
downloadAllGift();
|
||||||
over();
|
over();
|
||||||
}else {
|
|
||||||
|
} else {
|
||||||
new LiveRoomCheckLivePresenter(mContext, data.getUid(), data.getStream(), new LiveRoomCheckLivePresenter.NewActionListener() {
|
new LiveRoomCheckLivePresenter(mContext, data.getUid(), data.getStream(), new LiveRoomCheckLivePresenter.NewActionListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onLiveRoomChanged(String liveUid, String stream, int liveType, String liveTypeVal, String liveSdk) {
|
public void onLiveRoomChanged(String liveUid, String stream, int liveType, String liveTypeVal, String liveSdk) {
|
||||||
|
liveIndex =false;
|
||||||
try {
|
try {
|
||||||
mLiveSDK = Integer.parseInt(liveSdk);
|
mLiveSDK = Integer.parseInt(liveSdk);
|
||||||
mLiveTypeVal = Integer.parseInt(liveTypeVal);
|
mLiveTypeVal = Integer.parseInt(liveTypeVal);
|
||||||
@ -754,7 +756,7 @@ public class LiveAudienceActivity extends LiveActivity {
|
|||||||
if (liveBean == null) {
|
if (liveBean == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if(MicStatusManager.getInstance().isMic(liveUid)){
|
if (MicStatusManager.getInstance().isMic(liveUid)) {
|
||||||
MicStatusManager.getInstance().showDownMicDialog(mContext);
|
MicStatusManager.getInstance().showDownMicDialog(mContext);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -1053,7 +1055,7 @@ public class LiveAudienceActivity extends LiveActivity {
|
|||||||
break;
|
break;
|
||||||
case LIVE_ROOM_EXCEPTION:
|
case LIVE_ROOM_EXCEPTION:
|
||||||
//主播未直播时自动下滑至下一个直播间
|
//主播未直播时自动下滑至下一个直播间
|
||||||
mCurrentPage = mCurrentPage+1;
|
mCurrentPage = mCurrentPage + 1;
|
||||||
liveHandler.post(liveRunnable);
|
liveHandler.post(liveRunnable);
|
||||||
break;
|
break;
|
||||||
case REFRESH_THE_LIVEl_PAGE:
|
case REFRESH_THE_LIVEl_PAGE:
|
||||||
|
@ -2988,6 +2988,19 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取是否有热度卡加成
|
||||||
|
*/
|
||||||
|
public static void getIsHot(String isUseHotCard) {
|
||||||
|
|
||||||
|
if ("1".equals(isUseHotCard)) {
|
||||||
|
ft_hot_add.setVisibility(View.VISIBLE);
|
||||||
|
} else {
|
||||||
|
ft_hot_add.setVisibility(View.GONE);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
public void resetUserListWidth(int width) {
|
public void resetUserListWidth(int width) {
|
||||||
ViewGroup.LayoutParams params = mUserRecyclerView.getLayoutParams();
|
ViewGroup.LayoutParams params = mUserRecyclerView.getLayoutParams();
|
||||||
params.width = width;
|
params.width = width;
|
||||||
@ -3169,7 +3182,7 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
|
|||||||
|
|
||||||
if (taskModel != null) {
|
if (taskModel != null) {
|
||||||
GiftModel giftModel = newPeopleTask.getGift();
|
GiftModel giftModel = newPeopleTask.getGift();
|
||||||
if (giftModel!=null){
|
if (giftModel != null) {
|
||||||
RewardAllModel rewardOne = newPeopleTask.getRewardOne();
|
RewardAllModel rewardOne = newPeopleTask.getRewardOne();
|
||||||
String gold = rewardOne.getGold();
|
String gold = rewardOne.getGold();
|
||||||
String experience = rewardOne.getExperience();
|
String experience = rewardOne.getExperience();
|
||||||
@ -3580,7 +3593,7 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
|
|||||||
.setMicIng(2)
|
.setMicIng(2)
|
||||||
.setBean(liveBean).setLiveType(liveType).setLiveTypeVal(Integer.parseInt(liveTypeVal)));
|
.setBean(liveBean).setLiveType(liveType).setLiveTypeVal(Integer.parseInt(liveTypeVal)));
|
||||||
} else {
|
} else {
|
||||||
if(MicStatusManager.getInstance().isMic(liveUid)){
|
if (MicStatusManager.getInstance().isMic(liveUid)) {
|
||||||
MicStatusManager.getInstance().showDownMicDialog(mContext);
|
MicStatusManager.getInstance().showDownMicDialog(mContext);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -59,6 +59,7 @@ import com.yunbao.common.utils.ToastUtil;
|
|||||||
import com.yunbao.common.utils.WordUtil;
|
import com.yunbao.common.utils.WordUtil;
|
||||||
import com.yunbao.common.utils.formatBigNum;
|
import com.yunbao.common.utils.formatBigNum;
|
||||||
import com.yunbao.common.views.weight.LiveFloatView;
|
import com.yunbao.common.views.weight.LiveFloatView;
|
||||||
|
import com.yunbao.common.views.weight.LiveLoadingViewHolder;
|
||||||
import com.yunbao.live.R;
|
import com.yunbao.live.R;
|
||||||
import com.yunbao.live.activity.LiveActivity;
|
import com.yunbao.live.activity.LiveActivity;
|
||||||
import com.yunbao.live.activity.LiveAudienceActivity;
|
import com.yunbao.live.activity.LiveAudienceActivity;
|
||||||
@ -257,7 +258,13 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe
|
|||||||
mLiveLinkMicPresenter.setLiveSdk(mLiveSDK);
|
mLiveLinkMicPresenter.setLiveSdk(mLiveSDK);
|
||||||
mLiveLinkMicAnchorPresenter.setLiveSdk(mLiveSDK);
|
mLiveLinkMicAnchorPresenter.setLiveSdk(mLiveSDK);
|
||||||
}
|
}
|
||||||
|
//去除主播离开画面
|
||||||
|
if (LivePlayKsyViewHolder.leave != null) {
|
||||||
|
LivePlayKsyViewHolder.leave.setVisibility(View.GONE);
|
||||||
|
}
|
||||||
|
if (LivePlayRyViewHolder.leave != null) {
|
||||||
|
LivePlayRyViewHolder.leave.setVisibility(View.GONE);
|
||||||
|
}
|
||||||
//直播间背景
|
//直播间背景
|
||||||
ImgLoader.displayBlurLive(mContext, mLiveBean.getAvatar(), liveBack, 400, 600);
|
ImgLoader.displayBlurLive(mContext, mLiveBean.getAvatar(), liveBack, 400, 600);
|
||||||
//ImageLoadUtils.loadUrlToBlur(mContext,mLiveBean.getAvatar(),400,600,liveBack);
|
//ImageLoadUtils.loadUrlToBlur(mContext,mLiveBean.getAvatar(),400,600,liveBack);
|
||||||
@ -304,6 +311,8 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe
|
|||||||
@Override
|
@Override
|
||||||
public void onSuccess(EnterRoomNewModel data) {
|
public void onSuccess(EnterRoomNewModel data) {
|
||||||
mLivePlayViewHolder.setLiveBeanLandscape(data.getLiveInfo().getLandscape());
|
mLivePlayViewHolder.setLiveBeanLandscape(data.getLiveInfo().getLandscape());
|
||||||
|
//是否热度卡加成
|
||||||
|
mLiveRoomViewHolder.getIsHot(data.getIsUseHotCard());
|
||||||
isEnterRoom = true;
|
isEnterRoom = true;
|
||||||
//延时1秒发送
|
//延时1秒发送
|
||||||
liveHandler.postDelayed(sendFIm, 700);
|
liveHandler.postDelayed(sendFIm, 700);
|
||||||
@ -334,7 +343,10 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe
|
|||||||
bannerModel.setStart(false);
|
bannerModel.setStart(false);
|
||||||
bannerModel.setLink(model.getLink());
|
bannerModel.setLink(model.getLink());
|
||||||
bannerModel.setImageUrl(model.getImg());
|
bannerModel.setImageUrl(model.getImg());
|
||||||
bannerBeans.add(bannerModel);
|
if (TextUtils.equals(model.getIsHidden(),"0")){
|
||||||
|
bannerBeans.add(bannerModel);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -503,6 +515,7 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe
|
|||||||
mLiveRoomViewHolder.showPrizePoolLevel(String.valueOf(giftPrizePoolLevel));
|
mLiveRoomViewHolder.showPrizePoolLevel(String.valueOf(giftPrizePoolLevel));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
Loading…
Reference in New Issue
Block a user