Merge branch 'master' into dev_6.7.0
This commit is contained in:
commit
1a2db91ceb
@ -2,7 +2,10 @@ package com.yunbao.common.custom;
|
||||
|
||||
import android.view.View;
|
||||
|
||||
import androidx.core.view.ViewCompat;
|
||||
|
||||
import com.stx.xhb.androidx.transformers.BasePageTransformer;
|
||||
import com.yunbao.common.manager.IMLoginManager;
|
||||
|
||||
public class LiveGuardScalePageTransformer extends BasePageTransformer {
|
||||
/**
|
||||
@ -12,23 +15,54 @@ public class LiveGuardScalePageTransformer extends BasePageTransformer {
|
||||
* github:https://github.com/xiaohaibin
|
||||
* describe: 适用于一屏显示多个模式
|
||||
*/
|
||||
private static final float MIN_SCALE = 0.8F;
|
||||
private float mMinScale = 0.85f;
|
||||
private float mMinAlpha = 1f;
|
||||
|
||||
public LiveGuardScalePageTransformer() {
|
||||
}
|
||||
|
||||
public LiveGuardScalePageTransformer(float minAlpha, float minScale) {
|
||||
setMinAlpha(minAlpha);
|
||||
setMinScale(minScale);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handleInvisiblePage(View view, float position) {
|
||||
view.setScaleY(MIN_SCALE);
|
||||
ViewCompat.setAlpha(view, 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handleLeftPage(View view, float position) {
|
||||
float scale = Math.max(MIN_SCALE, 1 - Math.abs(position));
|
||||
float scale = Math.max(mMinScale, 1 + position);
|
||||
float vertMargin = view.getHeight() * (1 - scale) / 2;
|
||||
float horzMargin = view.getWidth() * (1 - scale) / 2;
|
||||
view.setTranslationX(horzMargin - vertMargin / 2);
|
||||
view.setScaleX(scale);
|
||||
view.setScaleY( scale);
|
||||
view.setAlpha( mMinAlpha + (scale - mMinScale) / (1 - mMinScale) * (1 - mMinAlpha));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handleRightPage(View view, float position) {
|
||||
float scale = Math.max(MIN_SCALE, 1 - Math.abs(position));
|
||||
float scale = Math.max(mMinScale, 1 - position);
|
||||
float vertMargin = view.getHeight() * (1 - scale) / 2;
|
||||
float horzMargin = view.getWidth() * (1 - scale) / 2;
|
||||
view.setTranslationX( -horzMargin + vertMargin / 2);
|
||||
view.setScaleX( scale);
|
||||
|
||||
view.setScaleY( scale);
|
||||
view.setAlpha( mMinAlpha + (scale - mMinScale) / (1 - mMinScale) * (1 - mMinAlpha));
|
||||
}
|
||||
|
||||
public void setMinAlpha(float minAlpha) {
|
||||
if (minAlpha >= 0.6f && minAlpha <= 1.0f) {
|
||||
mMinAlpha = minAlpha;
|
||||
}
|
||||
}
|
||||
|
||||
public void setMinScale(float minScale) {
|
||||
if (minScale >= 0.6f && minScale <= 1.0f) {
|
||||
mMinScale = minScale;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Before Width: | Height: | Size: 59 KiB After Width: | Height: | Size: 59 KiB |
@ -1,10 +1,17 @@
|
||||
package io.agora.beautyapi.faceunity.agora;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.ContentResolver;
|
||||
import android.content.Context;
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.drawable.BitmapDrawable;
|
||||
import android.net.Uri;
|
||||
import android.text.TextUtils;
|
||||
import android.view.SurfaceView;
|
||||
import android.widget.FrameLayout;
|
||||
|
||||
import androidx.core.content.res.ResourcesCompat;
|
||||
|
||||
import com.yunbao.common.CommonAppConfig;
|
||||
import com.yunbao.common.CommonAppContext;
|
||||
import com.yunbao.common.bean.SwTokenModel;
|
||||
@ -17,6 +24,9 @@ import com.yunbao.common.utils.StringUtil;
|
||||
import com.yunbao.common.utils.ToastUtil;
|
||||
import com.yunbao.faceunity.utils.FURenderer;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.FileOutputStream;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@ -27,13 +37,16 @@ import io.agora.beautyapi.faceunity.Config;
|
||||
import io.agora.beautyapi.faceunity.FaceUnityBeautyAPI;
|
||||
import io.agora.beautyapi.faceunity.FaceUnityBeautyAPIKt;
|
||||
import io.agora.beautyapi.faceunity.MirrorMode;
|
||||
import io.agora.beautyapi.faceunity.R;
|
||||
import io.agora.rtc2.ChannelMediaOptions;
|
||||
import io.agora.rtc2.Constants;
|
||||
import io.agora.rtc2.IRtcEngineEventHandler;
|
||||
import io.agora.rtc2.RtcConnection;
|
||||
import io.agora.rtc2.RtcEngine;
|
||||
import io.agora.rtc2.RtcEngineConfig;
|
||||
import io.agora.rtc2.RtcEngineEx;
|
||||
import io.agora.rtc2.video.ContentInspectConfig;
|
||||
import io.agora.rtc2.video.ImageTrackOptions;
|
||||
import io.agora.rtc2.video.VideoCanvas;
|
||||
import io.agora.rtc2.video.VideoEncoderConfiguration;
|
||||
|
||||
@ -53,6 +66,7 @@ public class SWManager extends BaseCacheManager {
|
||||
private FrameLayout linkUserContainer;//连麦用户视图
|
||||
private onRtcEngineListener onRtcEngineListener;
|
||||
private List<String> drPkUserInfo = new ArrayList<>();
|
||||
private ImageTrackOptions imageTrackOptions = null;
|
||||
|
||||
private onDrPkJoinSuccessListener onDrPkJoinSuccessListener;
|
||||
|
||||
@ -66,6 +80,17 @@ public class SWManager extends BaseCacheManager {
|
||||
|
||||
public SWManager(Context context) {
|
||||
super(context);
|
||||
|
||||
String filePath = context.getCacheDir() + File.separator + "zslk.png";
|
||||
if (!new File(filePath).exists()) {
|
||||
Bitmap bitmap = ((BitmapDrawable) ResourcesCompat.getDrawable(context.getResources(), com.yunbao.common.R.mipmap.zslk, null)).getBitmap();
|
||||
try {
|
||||
bitmap.compress(Bitmap.CompressFormat.PNG, 100, new FileOutputStream(filePath));
|
||||
} catch (FileNotFoundException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
imageTrackOptions = new ImageTrackOptions(filePath, 1);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -80,6 +105,12 @@ public class SWManager extends BaseCacheManager {
|
||||
return manager;
|
||||
}
|
||||
|
||||
public void setLeaveFlag(boolean leave) {
|
||||
if (mRtcEngine != null) {
|
||||
mRtcEngine.enableVideoImageSource(leave, imageTrackOptions);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 初始化声网SDK
|
||||
*/
|
||||
@ -126,7 +157,6 @@ public class SWManager extends BaseCacheManager {
|
||||
cfg.orientationMode = VideoEncoderConfiguration.ORIENTATION_MODE.ORIENTATION_MODE_FIXED_PORTRAIT;
|
||||
|
||||
|
||||
|
||||
mRtcEngine.setVideoEncoderConfiguration(cfg);
|
||||
|
||||
// 创建一个 SurfaceView 对象,并将其作为 FrameLayout 的子对象
|
||||
@ -497,6 +527,7 @@ public class SWManager extends BaseCacheManager {
|
||||
|
||||
public interface onRtcEngineListener {
|
||||
void onOpenSuccess(String channel, int uid);
|
||||
|
||||
void onUserOffline(int uid);
|
||||
}
|
||||
|
||||
|
@ -124,6 +124,7 @@ import cn.rongcloud.rtc.api.callback.IRCRTCResultCallback;
|
||||
import cn.rongcloud.rtc.base.RCRTCRect;
|
||||
import cn.rongcloud.rtc.base.RTCErrorCode;
|
||||
import io.agora.beautyapi.faceunity.agora.SWManager;
|
||||
import io.agora.rtc2.RtcEngine;
|
||||
import io.rong.imlib.IRongCallback;
|
||||
import io.rong.imlib.RongIMClient;
|
||||
import io.rong.imlib.model.Conversation;
|
||||
@ -555,12 +556,16 @@ public class LiveSwAnchorActivity extends LiveActivity implements LiveFunctionCl
|
||||
|
||||
}
|
||||
});
|
||||
SWManager.get().setLeaveFlag(true);
|
||||
mLiveAnchorViewHolder.setLeaveFlag(true);
|
||||
} else if (leave == 1) {
|
||||
leave = 0;
|
||||
leave_img.setVisibility(View.GONE);
|
||||
// 清除水印
|
||||
boolean ret = RCRTCEngine.getInstance().getDefaultVideoStream().setWatermark(null, rect);
|
||||
sendSystemMessageSw(mContext.getString(R.string.live_anchor_come_back));
|
||||
SWManager.get().setLeaveFlag(false);
|
||||
mLiveAnchorViewHolder.setLeaveFlag(false);
|
||||
}
|
||||
|
||||
HttpClient.getInstance().get("Live.isLeave", "Live.isLeave")
|
||||
|
@ -30,9 +30,6 @@ import com.lxj.xpopup.XPopup;
|
||||
import com.lxj.xpopup.enums.PopupPosition;
|
||||
import com.makeramen.roundedimageview.RoundedImageView;
|
||||
import com.stx.xhb.androidx.XBanner;
|
||||
import com.stx.xhb.androidx.transformers.ScalePageTransformer;
|
||||
import com.yunbao.common.custom.LiveGuardScalePageTransformer;
|
||||
import com.yunbao.common.utils.MobclickAgent;
|
||||
import com.yunbao.common.CommonAppConfig;
|
||||
import com.yunbao.common.adapter.LiveBuyGuardPrivilegeAdapter;
|
||||
import com.yunbao.common.bean.CheckUpgradesModel;
|
||||
@ -42,6 +39,7 @@ import com.yunbao.common.bean.GuardGetGuardUserInfoModel;
|
||||
import com.yunbao.common.bean.GuardPriceModel;
|
||||
import com.yunbao.common.bean.GuardUserInfoModel;
|
||||
import com.yunbao.common.bean.IMLoginModel;
|
||||
import com.yunbao.common.custom.LiveGuardScalePageTransformer;
|
||||
import com.yunbao.common.dialog.AbsDialogPopupWindow;
|
||||
import com.yunbao.common.dialog.GuardBuyTipsDialog;
|
||||
import com.yunbao.common.dialog.GuardUpgradePopup;
|
||||
@ -52,6 +50,7 @@ import com.yunbao.common.http.live.LiveNetManager;
|
||||
import com.yunbao.common.manager.IMLoginManager;
|
||||
import com.yunbao.common.utils.DeviceUtils;
|
||||
import com.yunbao.common.utils.DialogUitl;
|
||||
import com.yunbao.common.utils.MobclickAgent;
|
||||
import com.yunbao.common.utils.ToastUtil;
|
||||
import com.yunbao.common.utils.WordUtil;
|
||||
import com.yunbao.common.views.weight.ViewClicksAntiShake;
|
||||
@ -160,8 +159,8 @@ public class LiveBuyGuardDialog extends AbsDialogPopupWindow {
|
||||
buyGuardBannerModels.add(guardBannerModel);
|
||||
}
|
||||
buyGuardBanner.setBannerData(R.layout.banner_item_buy_guard, buyGuardBannerModels);
|
||||
buyGuardBanner.setIsClipChildrenMode(true);
|
||||
buyGuardBanner.setCustomPageTransformer(new LiveGuardScalePageTransformer());
|
||||
buyGuardBanner.setIsClipChildrenMode(true);
|
||||
guardPrivilegeStrings = data.getGuardData().get(0).getGuardPrivilege();
|
||||
buyGuardBanner.postDelayed(new Runnable() {
|
||||
@Override
|
||||
|
@ -92,6 +92,8 @@ public class LiveRyAnchorViewHolder extends AbsLiveViewHolder {
|
||||
private TextView menuRed;
|
||||
private static LinearLayout btn_end_pk_dr;
|
||||
private String drpkRoomId; //多人 PK 房主 roomUid
|
||||
private ImageView leaveImg;
|
||||
|
||||
public void setDrpkRoomId(String drpkRoomId) {
|
||||
this.drpkRoomId = drpkRoomId;
|
||||
}
|
||||
@ -132,6 +134,7 @@ public class LiveRyAnchorViewHolder extends AbsLiveViewHolder {
|
||||
mDrawable1 = ContextCompat.getDrawable(mContext, R.mipmap.icon_live_func_1);
|
||||
btn_end_pk_dr = (LinearLayout) findViewById(R.id.btn_end_pk_dr);
|
||||
mBtnFunction = (ImageView) findViewById(R.id.btn_function);
|
||||
leaveImg = (ImageView) findViewById(R.id.leave_img);
|
||||
btn_dr = (TextView) findViewById(R.id.btn_dr);
|
||||
mBanner = (Banner) findViewById(R.id.banner);
|
||||
mBtnFunction.setImageDrawable(mDrawable0);
|
||||
@ -689,6 +692,10 @@ public class LiveRyAnchorViewHolder extends AbsLiveViewHolder {
|
||||
|
||||
private final int WHAT_ANCHOR_LIVE_TIME = 3;//直播间主播计时
|
||||
|
||||
public void setLeaveFlag(boolean leave) {
|
||||
leaveImg.setVisibility(leave ? View.VISIBLE : View.GONE);
|
||||
}
|
||||
|
||||
private class LiveRoomHandler extends Handler {
|
||||
@Override
|
||||
public void handleMessage(Message msg) {
|
||||
|
@ -672,6 +672,9 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe
|
||||
if (LivePlaySwViewHolder.leave != null) {
|
||||
LivePlaySwViewHolder.leave.setVisibility(View.VISIBLE);
|
||||
}
|
||||
if (LivePlayRyViewHolder.leave != null) {
|
||||
LivePlayRyViewHolder.leave.setVisibility(View.VISIBLE);
|
||||
}
|
||||
}
|
||||
//判断是否有连麦,要显示连麦窗口
|
||||
String linkMicUid = data.getEnterRoomInfo().getLinkmicUid();
|
||||
|
@ -1,6 +1,7 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:id="@+id/root"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
@ -54,5 +55,6 @@
|
||||
android:layout_marginBottom="45dp"
|
||||
android:scaleType="fitXY"
|
||||
android:src="@mipmap/zslk"
|
||||
android:visibility="gone" />
|
||||
android:visibility="gone"
|
||||
tools:visibility="visible" />
|
||||
</FrameLayout>
|
@ -39,8 +39,8 @@
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/leave"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="0dp"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:scaleType="centerCrop"
|
||||
android:src="@mipmap/zslk"
|
||||
|
@ -3,6 +3,7 @@
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_gravity="bottom"
|
||||
android:orientation="vertical">
|
||||
|
||||
@ -154,6 +155,14 @@
|
||||
android:layout_height="45dp"
|
||||
android:layout_gravity="bottom">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/leave_img"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:scaleType="matrix"
|
||||
android:src="@mipmap/zslk"
|
||||
android:visibility="gone"
|
||||
tools:visibility="visible" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/btn_close"
|
||||
|
Loading…
Reference in New Issue
Block a user