重新启用美颜sdk

调整美颜sdk只使用美颜功能
This commit is contained in:
zlzw 2022-10-19 16:19:50 +08:00
parent 99d32c03b2
commit 00dfd38be5
33 changed files with 1499 additions and 1366 deletions

View File

@ -4,7 +4,6 @@ import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;

View File

@ -66,7 +66,7 @@ public class AnimojiViewHolder extends BaseViewHolder {
@Override
public void reset(List<? extends BaseBean> list) {
adapter.del(getName(this));
adapter.save(getName(this),"0");
adapter.getAnimojiDataFactory().onAnimojiSelected((AnimojiBean) list.get(0));
adapter.setSelectPosition(0);
}

View File

@ -71,7 +71,7 @@ public class BigHeadViewHolder extends BaseViewHolder {
@Override
public void reset(List<? extends BaseBean> list) {
adapter.del(getName(this));
adapter.save(getName(this),list.get(0).getKey());
adapter.getPropDataFactory().setPropType(FunctionEnum.BIG_HEAD);
adapter.getPropDataFactory().onItemSelected((PropBean) list.get(0));
adapter.setSelectPosition(0);

View File

@ -9,6 +9,8 @@ import androidx.annotation.NonNull;
import com.yunbao.faceunity.R;
import com.yunbao.faceunity.entity.BaseBean;
import com.yunbao.faceunity.entity.FaceBeautyFilterBean;
import com.yunbao.faceunity.seekbar.DiscreteSeekBar;
import com.yunbao.faceunity.utils.SeekBarUtils;
import java.util.List;
@ -18,6 +20,7 @@ import java.util.List;
public class FilterViewHolder extends BaseViewHolder {
private ImageView icon;
private TextView title;
private String KEY_VAL;
public FilterViewHolder(@NonNull View itemView) {
super(itemView);
@ -28,6 +31,28 @@ public class FilterViewHolder extends BaseViewHolder {
adapter.getFaceBeautyDataFactory().onFilterSelected(bean.getKey(), bean.getIntensity(), bean.getDesRes());
setSelectPosition(getAdapterPosition());
saveData();
if("origin".equals(bean.getKey())){
adapter.hideSeekBar();
return;
}
adapter.showSeekBar();
adapter.getSeekBar().setMax(100);
adapter.getSeekBar().setTag(bean);
adapter.getSeekBar().setOnProgressChangeListener(new DiscreteSeekBar.OnSimpleProgressChangeListener(){
@Override
public void onProgressChanged(DiscreteSeekBar seekBar, int value, boolean fromUser) {
super.onProgressChanged(seekBar, value, fromUser);
KEY_VAL=getName(FilterViewHolder.this)+((BaseBean)seekBar.getTag()).getKey()+"_val";
double toValue = SeekBarUtils.Companion.seekToValue(1, value, seekBar.getMin());
adapter.getFaceBeautyDataFactory().updateFilterIntensity(toValue);
adapter.save(KEY_VAL,value+"");
}
});
if(adapter.getString(KEY_VAL)==null) {
adapter.getSeekBar().setProgress((int) (bean.getIntensity() * 100));
}else{
adapter.getSeekBar().setProgress(Integer.parseInt(adapter.getString(KEY_VAL)));
}
});
}
@ -47,6 +72,7 @@ public class FilterViewHolder extends BaseViewHolder {
@Override
public boolean loadData() {
FaceBeautyFilterBean bean = (FaceBeautyFilterBean) itemView.getTag();
KEY_VAL=getName(FilterViewHolder.this)+bean.getKey()+"_val";
String val = adapter.getString(getName(this));
if (val == null) {
return false;
@ -56,6 +82,9 @@ public class FilterViewHolder extends BaseViewHolder {
}
icon.setSelected(true);
title.setSelected(true);
if(adapter.getString(KEY_VAL)!=null) {
bean.setIntensity(Double.parseDouble(adapter.getString(KEY_VAL))/100);
}
adapter.getFaceBeautyDataFactory().onFilterSelected(bean.getKey(), bean.getIntensity(), bean.getDesRes());
return true;
}
@ -68,8 +97,14 @@ public class FilterViewHolder extends BaseViewHolder {
@Override
public void reset(List<? extends BaseBean> list) {
adapter.del(getName(this));
itemView.callOnClick();
FaceBeautyFilterBean bean = (FaceBeautyFilterBean) list.get(0);
for (BaseBean baseBean : list) {
String key=getName(this)+baseBean.getKey()+"_val";
adapter.save(key,"40");
}
adapter.hideSeekBar();
adapter.save(getName(this),bean.getKey());
adapter.getFaceBeautyDataFactory().onFilterSelected(bean.getKey(), bean.getIntensity(), bean.getDesRes());
adapter.setSelectPosition(0);
}
}

View File

@ -72,7 +72,7 @@ public class FineStickerViewHolder extends BaseViewHolder implements StickerDown
@Override
public void reset(List<? extends BaseBean> list) {
adapter.del(getName(this));
adapter.save(getName(this),list.get(0).getKey());
itemView.callOnClick();
adapter.setSelectPosition(0);
}

View File

@ -115,11 +115,10 @@ public class MakeupCustomItemViewHolder extends BaseViewHolder {
@Override
public void reset(List<? extends BaseBean> list) {
adapter.del(getName(this));
adapter.save(getName(this),list.get(0).getKey());
for (BaseBean bean : list) {
adapter.del(getName(this) + bean.getKey() + "_val");
}
itemView.callOnClick();
adapter.setSelectPosition(0);
}

View File

@ -73,7 +73,7 @@ public class MakeupViewHolder extends BaseViewHolder {
@Override
public void reset(List<? extends BaseBean>list) {
adapter.del(getName(this));
adapter.save(getName(this),list.get(0).getKey());
FaceSPUtils.getInstance().delStart("MakeupCustomItemViewHolder");
adapter.getMakeupDataFactory().onMakeupCombinationSelected((MakeupCombinationBean) list.get(0));
adapter.getMakeupDataFactory().clearAll();

View File

@ -70,7 +70,7 @@ public class StickerViewHolder extends BaseViewHolder{
@Override
public void reset(List<? extends BaseBean> list) {
adapter.del(getName(this));
adapter.save(getName(this),list.get(0).getKey());
adapter.getPropDataFactory().setPropType(FunctionEnum.STICKER);
adapter.getPropDataFactory().onItemSelected((PropBean) list.get(0));
adapter.setSelectPosition(0);

View File

@ -46,7 +46,9 @@ public class StyleViewHolder extends BaseViewHolder{
BaseBean bean= (BaseBean) itemView.getTag();
String val = adapter.getString(getName(this));
if(val==null){
return false;
icon.setSelected(false);
title.setSelected(false);
return true;
}
if(!val.equals(bean.getKey())){
return false;
@ -66,8 +68,9 @@ public class StyleViewHolder extends BaseViewHolder{
@Override
public void reset(List<? extends BaseBean> list) {
adapter.del(getName(this));
itemView.callOnClick();
// adapter.save(getName(this),list.get(0).getKey());
adapter.setSelectPosition(0);
adapter.del(getName(this));
adapter.getFaceBeautyDataFactory().onStyleSelected(null);
}
}

View File

@ -2,9 +2,9 @@ package com.yunbao.faceunity.ui;
import android.content.Context;
import android.util.AttributeSet;
import android.util.Log;
import android.view.KeyEvent;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
@ -15,10 +15,12 @@ import androidx.recyclerview.widget.GridLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import com.google.android.material.tabs.TabLayout;
import com.yunbao.common.utils.ToastUtil;
import com.yunbao.common.utils.WordUtil;
import com.yunbao.faceunity.R;
import com.yunbao.faceunity.adapters.ContainerRecyclerAdapter;
import com.yunbao.faceunity.adapters.MenuGroupRecyclerAdapter;
import com.yunbao.faceunity.adapters.vh.StyleViewHolder;
import com.yunbao.faceunity.data.FaceParam;
import com.yunbao.faceunity.data.FineStickerDataFactory;
import com.yunbao.faceunity.entity.BaseBean;
@ -33,6 +35,7 @@ import com.yunbao.faceunity.repo.FaceBeautySource;
import com.yunbao.faceunity.repo.MakeupSource;
import com.yunbao.faceunity.repo.PropSource;
import com.yunbao.faceunity.seekbar.DiscreteSeekBar;
import com.yunbao.faceunity.utils.FaceSPUtils;
import com.yunbao.faceunity.utils.net.StickerDownloadHelper;
import java.util.ArrayList;
@ -57,6 +60,7 @@ public class FaceUnityView extends LinearLayout implements StickerDownloadHelper
private DiscreteSeekBar seekBar;
private IFaceUnityInter iFaceUnityInter;
private ConstraintLayout titleLayout;
private static final String TAG = "美颜";
public FaceUnityView(Context context) {
super(context);
@ -104,6 +108,7 @@ public class FaceUnityView extends LinearLayout implements StickerDownloadHelper
initMenuGroup();
setContainerRecycler(new ArrayList<>());
initViewClick();
gotoFaceBeauty();
}
/**
@ -168,6 +173,25 @@ public class FaceUnityView extends LinearLayout implements StickerDownloadHelper
menuDiy.setVisibility(GONE);
}
/**
* 目前只需要美颜功能进入后直奔美颜
*/
private void gotoFaceBeauty() {
LinkedHashMap<Integer, Integer> map = new LinkedHashMap<>();
map.put(R.string.beauty_radio_skin_beauty, FaceParam.FACE_BEAUTY_SKIN);
map.put(R.string.beauty_radio_face_shape, FaceParam.FACE_BEAUTY_SHAPE);
map.put(R.string.beauty_radio_filter, FaceParam.FACE_BEAUTY_FILTER);
map.put(R.string.beauty_radio_style, FaceParam.FACE_BEAUTY_STYLE);
setTab(createTabs(map));
setContainerRecycler(FaceBeautySource.buildSkinParams());
changeRecyclerItemCount(2);
menuGroup.setVisibility(GONE);
titleLayout.setVisibility(GONE);
back.setVisibility(GONE);
menu2Back.setVisibility(GONE);
menu2.setVisibility(VISIBLE);
}
/**
* 配置主菜单
*/
@ -293,6 +317,11 @@ public class FaceUnityView extends LinearLayout implements StickerDownloadHelper
public void onTabSelected(TabLayout.Tab tab) {
Object tabTag = tab.getTag();
if (tabTag instanceof Integer) {
if (FaceSPUtils.getInstance().getString(StyleViewHolder.class.getSimpleName() + "_") != null && (int) tab.getTag() < FaceParam.FACE_BEAUTY_STYLE) {
ToastUtil.show("请先重置风格推荐");
tabLayout.getTabAt(3).select();
return;
}
switch ((int) tab.getTag()) {
case FaceParam.FACE_BEAUTY_SKIN:
changeRecyclerItemCount(2);
@ -407,7 +436,8 @@ public class FaceUnityView extends LinearLayout implements StickerDownloadHelper
containerRecycler.setLayoutManager(new GridLayoutManager(mContext, 2));
containerRecycler.setAdapter(containerAdapter);
}
titleLayout.setVisibility(title.getVisibility()==GONE?INVISIBLE:VISIBLE);
// titleLayout.setVisibility(title.getVisibility()==GONE?INVISIBLE:VISIBLE);
// Log.i(TAG, "setContainerRecycler: " + list.size());
containerAdapter.setList(list);
containerAdapter.notifyDataSetChanged();
}

View File

@ -87,8 +87,8 @@ public class FURenderer extends IFURenderer {
*/
@Override
public void setup(Context context) {
FURenderManager.setKitDebug(FULogger.LogLevel.OFF);
FURenderManager.setCoreDebug(FULogger.LogLevel.OFF);
FURenderManager.setKitDebug(FULogger.LogLevel.INFO);
FURenderManager.setCoreDebug(FULogger.LogLevel.INFO);
FURenderManager.registerFURender(context, Authpack.A(), new OperateCallback() {
@Override
public void onSuccess(int i, @NotNull String s) {

View File

@ -59,6 +59,7 @@
android:id="@+id/titleLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:visibility="gone"
android:layout_marginTop="16dp"
>
@ -178,11 +179,11 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:visibility="gone">
android:visibility="visible">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="25dp"
android:layout_height="35dp"
android:gravity="center"
android:orientation="horizontal">
@ -202,7 +203,7 @@
<HorizontalScrollView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_height="match_parent"
android:layout_marginStart="10dp"
android:layout_marginEnd="10dp"
android:layout_weight="1">
@ -214,6 +215,8 @@
app:tabMaxWidth="100dp"
app:tabMode="scrollable"
app:tabSelectedTextColor="#F6F7FB"
app:tabIndicatorColor="#F6F7FB"
app:tabIndicatorFullWidth="false"
app:tabTextColor="#9A9A9A" />
</HorizontalScrollView>

View File

@ -69,6 +69,27 @@ android {
print "not Exists = "+manifestPath
}
}
variant.mergeAssetsProvider.configure {
doLast {
delete(fileTree(dir: outputDir, includes: [
'model/ai_bgseg_green.bundle',
//'model/ai_face_processor.bundle',
'model/ai_face_processor_lite.bundle',
'model/ai_hairseg.bundle',
'model/ai_hand_processor.bundle',
'model/ai_human_processor.bundle',
'model/ai_human_processor_gpu.bundle',
'model/ai_human_processor_mb_fast.bundle',
'graphics/body_slim.bundle',
'graphics/controller_cpp.bundle',
//'graphics/face_beautification.bundle',
'graphics/face_makeup.bundle',
'graphics/fuzzytoonfilter.bundle',
'graphics/fxaa.bundle',
'graphics/tongue.bundle'
]))
}
}
}
signingConfigs {
release {

View File

@ -40,6 +40,7 @@ import com.yunbao.common.manager.imrongcloud.RecommendLiveRoom;
import com.yunbao.common.manager.imrongcloud.RongcloudIMManager;
import com.yunbao.common.utils.L;
import com.yunbao.common.utils.SpUtil;
import com.yunbao.faceunity.FaceManager;
import com.yunbao.live.socket.SocketRyClient;
import com.yunbao.live.utils.LiveImDeletUtil;
import com.yunbao.live.views.PortraitLiveManager;
@ -256,7 +257,7 @@ public class AppContext extends CommonAppContext {
});
configSPApp();
//初始化美颜SDK
// FaceManager.initFaceUnity(this);
FaceManager.initFaceUnity(this);
}
/**

View File

@ -2,6 +2,8 @@ package com.yunbao.common.utils;
import android.app.Activity;
import android.content.Context;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.util.DisplayMetrics;
/**
@ -55,4 +57,16 @@ public class DeviceUtils {
final float scale = context.getResources().getDisplayMetrics().density;
return (int) (pxValue / scale + 0.5f);
}
public static String getVersionName(Context context) {
try {
PackageManager manager = context.getPackageManager();
PackageInfo info = manager.getPackageInfo(context.getPackageName(),0);
return info.versionName;
} catch (Exception e) {
e.printStackTrace();
}
return "0";
}
}

View File

@ -71,7 +71,7 @@ public class GiftCacheUtil {
@Override
public void onProgress(int progress) {
Log.i(TAG, "onProgress: "+progress);
// Log.i(TAG, "onProgress: "+progress);
}
@Override

View File

@ -12,7 +12,7 @@ import java.util.List;
public class SVGAViewUtils {
private final static List<SVGAImageView> SVGA_CACHE = new ArrayList<>();
public static void playEndClear(SVGAImageView svga, boolean isClear) {
public static void playEndClear(SVGAImageView svga, boolean isClear, SVGACallback callback) {
if (!isClear) {
if (!SVGA_CACHE.contains(svga)) {
SVGA_CACHE.add(svga);
@ -21,7 +21,9 @@ public class SVGAViewUtils {
svga.setCallback(new SVGACallback() {
@Override
public void onPause() {
if (callback != null) {
callback.onPause();
}
}
@Override
@ -30,16 +32,23 @@ public class SVGAViewUtils {
if (isClear) {
svga.clear();
}
if (callback != null) {
callback.onFinished();
}
}
@Override
public void onRepeat() {
if (callback != null) {
callback.onRepeat();
}
}
@Override
public void onStep(int i, double v) {
if (callback != null) {
callback.onStep(i, v);
}
}
});
svga.startAnimation();
@ -58,6 +67,10 @@ public class SVGAViewUtils {
SVGA_CACHE.clear();
}
public static void playEndClear(SVGAImageView svga, boolean isClear) {
playEndClear(svga, isClear, null);
}
public static void playEndClear(SVGAImageView svga) {
playEndClear(svga, true);
}
@ -65,7 +78,7 @@ public class SVGAViewUtils {
/**
* 获取svga动画播放时间
*/
public static long getPlayTimer(SVGAImageView svga){
public static long getPlayTimer(SVGAImageView svga) {
return svga.getPlayDuration();
}
}

View File

@ -1 +1 @@
apply plugin: 'com.android.library' apply plugin: 'img-optimizer' apply plugin: 'kotlin-android' android { compileSdkVersion rootProject.ext.android.compileSdkVersion buildToolsVersion rootProject.ext.android.buildToolsVersion aaptOptions.cruncherEnabled = false aaptOptions.useNewCruncher = false packagingOptions { pickFirst "lib/armeabi/libyuvutils.so" pickFirst "lib/arm64-v8a/libyuvutils.so" pickFirst "lib/armeabi-v7a/libyuvutils.so" pickFirst "lib/armeabi/libyuvtools.so" pickFirst "lib/arm64-v8a/libyuvtools.so" pickFirst "lib/armeabi-v7a/libyuvtools.so" exclude "lib/arm64-v8a/libmmcv_api_handgesture.so" exclude "lib/arm64-v8a/libmmcv_api_express.so" exclude "lib/arm64-v8a/libMediaEncoder.so" exclude "lib/arm64-v8a/libarcore_sdk_c.so" exclude "lib/arm64-v8a/libmediadecoder.so" exclude "lib/arm64-v8a/libMediaMuxer.so" exclude "lib/arm64-v8a/libarcore_sdk_jni.so" exclude "lib/arm64-v8a/libMediaUtils.so" exclude "lib/arm64-v8a/libcosmosffmpeg.so" } defaultConfig { minSdkVersion rootProject.ext.android.minSdkVersion targetSdkVersion rootProject.ext.android.targetSdkVersion versionCode rootProject.ext.android.versionCode versionName rootProject.ext.android.versionName manifestPlaceholders = rootProject.ext.manifestPlaceholders ndk { abiFilters "armeabi-v7a", "arm64-v8a" } javaCompileOptions { annotationProcessorOptions { arguments = [AROUTER_MODULE_NAME: project.getName()] } } } aaptOptions { cruncherEnabled = false useNewCruncher = false } buildTypes { release { minifyEnabled false proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' } } kotlinOptions { allWarningsAsErrors = true } compileOptions { sourceCompatibility JavaVersion.VERSION_1_8 targetCompatibility JavaVersion.VERSION_1_8 } } repositories { flatDir { dirs 'libs', '../libs' } mavenCentral() } dependencies { implementation 'androidx.constraintlayout:constraintlayout:2.0.0' implementation fileTree(dir: 'libs', include: ['*.jar', '*.aar']) implementation (name:'../libs/beautysdk-202202241203',ext:'aar') implementation (name:'../libs/svgaplayer-release-v1.2.1',ext:'aar') //socket.io implementation('io.socket:socket.io-client:1.0.0') { exclude group: 'org.json', module: 'json' } //common api project(path: ':common') // api project(path:':FaceUnity')//新娱美颜 annotationProcessor rootProject.ext.dependencies["arouter-compiler"] //工具 api rootProject.ext.dependencies["blank-utilcode"] implementation 'com.eightbitlab:blurview:1.6.6' implementation 'com.google.code.gson:gson:2.8.6' implementation "com.getkeepsafe.relinker:relinker:1.4.4" }
apply plugin: 'com.android.library' apply plugin: 'img-optimizer' apply plugin: 'kotlin-android' android { compileSdkVersion rootProject.ext.android.compileSdkVersion buildToolsVersion rootProject.ext.android.buildToolsVersion aaptOptions.cruncherEnabled = false aaptOptions.useNewCruncher = false packagingOptions { pickFirst "lib/armeabi/libyuvutils.so" pickFirst "lib/arm64-v8a/libyuvutils.so" pickFirst "lib/armeabi-v7a/libyuvutils.so" pickFirst "lib/armeabi/libyuvtools.so" pickFirst "lib/arm64-v8a/libyuvtools.so" pickFirst "lib/armeabi-v7a/libyuvtools.so" exclude "lib/arm64-v8a/libmmcv_api_handgesture.so" exclude "lib/arm64-v8a/libmmcv_api_express.so" exclude "lib/arm64-v8a/libMediaEncoder.so" exclude "lib/arm64-v8a/libarcore_sdk_c.so" exclude "lib/arm64-v8a/libmediadecoder.so" exclude "lib/arm64-v8a/libMediaMuxer.so" exclude "lib/arm64-v8a/libarcore_sdk_jni.so" exclude "lib/arm64-v8a/libMediaUtils.so" exclude "lib/arm64-v8a/libcosmosffmpeg.so" } defaultConfig { minSdkVersion rootProject.ext.android.minSdkVersion targetSdkVersion rootProject.ext.android.targetSdkVersion versionCode rootProject.ext.android.versionCode versionName rootProject.ext.android.versionName manifestPlaceholders = rootProject.ext.manifestPlaceholders ndk { abiFilters "armeabi-v7a", "arm64-v8a" } javaCompileOptions { annotationProcessorOptions { arguments = [AROUTER_MODULE_NAME: project.getName()] } } } aaptOptions { cruncherEnabled = false useNewCruncher = false } buildTypes { release { minifyEnabled false proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' } } kotlinOptions { allWarningsAsErrors = true } compileOptions { sourceCompatibility JavaVersion.VERSION_1_8 targetCompatibility JavaVersion.VERSION_1_8 } } repositories { flatDir { dirs 'libs', '../libs' } mavenCentral() } dependencies { implementation 'androidx.constraintlayout:constraintlayout:2.0.0' implementation fileTree(dir: 'libs', include: ['*.jar', '*.aar']) implementation (name:'../libs/beautysdk-202202241203',ext:'aar') implementation (name:'../libs/svgaplayer-release-v1.2.1',ext:'aar') //socket.io implementation('io.socket:socket.io-client:1.0.0') { exclude group: 'org.json', module: 'json' } //common api project(path: ':common') api project(path:':FaceUnity')//新娱美颜 annotationProcessor rootProject.ext.dependencies["arouter-compiler"] //工具 api rootProject.ext.dependencies["blank-utilcode"] implementation 'com.eightbitlab:blurview:1.6.6' implementation 'com.google.code.gson:gson:2.8.6' implementation "com.getkeepsafe.relinker:relinker:1.4.4" }

View File

@ -478,12 +478,12 @@ public class LiveRyAnchorActivity extends LiveActivity implements LiveFunctionCl
if (mLiveReadyViewHolder != null) {
mLiveReadyViewHolder.hide();
}
/* if(mLiveRoomViewHolder!=null){
if(mLiveRoomViewHolder!=null){
mLiveRoomViewHolder.changeFaceUnityView();
}*/
LiveBeautyDialogFragment fragment = new LiveBeautyDialogFragment();
}
/* LiveBeautyDialogFragment fragment = new LiveBeautyDialogFragment();
fragment.setiBeautyModule(BeautyManager.iBeautyModule, BeautyManager.iLookupModule, BeautyManager.iBeautyBodyModule);
fragment.show(getSupportFragmentManager(), "LiveBeautyDialogFragment");
fragment.show(getSupportFragmentManager(), "LiveBeautyDialogFragment");*/
}
/**

View File

@ -9,6 +9,9 @@ public class LiveEnterRoomBean {
private LiveUserGiftBean mUserBean;
private LiveChatBean mLiveChatBean;
public LiveEnterRoomBean() {
}
public LiveEnterRoomBean(LiveUserGiftBean userBean, LiveChatBean liveChatBean) {
mUserBean = userBean;
mLiveChatBean = liveChatBean;

View File

@ -12,6 +12,8 @@ import android.view.WindowManager;
import androidx.annotation.Nullable;
import com.yunbao.common.dialog.AbsDialogFragment;
import com.yunbao.faceunity.FaceManager;
import com.yunbao.faceunity.ui.FaceUnityView;
import com.yunbao.live.R;
/**
@ -19,8 +21,8 @@ import com.yunbao.live.R;
*/
public class LiveFaceUnityDialogFragment extends AbsDialogFragment {
private Context mContext;
// private FaceUnityView faceView;
// private FaceManager manager;
private FaceUnityView faceView;
private FaceManager manager;
private View mRootView;
public LiveFaceUnityDialogFragment(Context mContext) {
@ -34,9 +36,8 @@ public class LiveFaceUnityDialogFragment extends AbsDialogFragment {
@Override
protected View getLayoutView() {
// faceView = new FaceUnityView(mContext);
// return faceView;
return null;
faceView = new FaceUnityView(mContext);
return faceView;
}
@Override
@ -63,7 +64,7 @@ public class LiveFaceUnityDialogFragment extends AbsDialogFragment {
@Override
public void onActivityCreated(@Nullable Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
// manager.setFaceUnityView(faceView);
manager.setFaceUnityView(faceView);
}
@Override
@ -74,9 +75,9 @@ public class LiveFaceUnityDialogFragment extends AbsDialogFragment {
}
}
/* public void setManager(FaceManager manager) {
public void setManager(FaceManager manager) {
this.manager = manager;
}*/
}
public void setDismissShowUi(View mRootView) {

View File

@ -311,7 +311,27 @@ public class LiveEnterRoomAnimPresenter {
SVGARect rect = svgaVideoEntity.getVideoSize();
enter_room_svg_small.setVideoItem(svgaVideoEntity);
enter_room_svg_small.setLoops(1);
SVGAViewUtils.playEndClear(enter_room_svg_small);
SVGAViewUtils.playEndClear(enter_room_svg_small, true, new SVGACallback() {
@Override
public void onPause() {
}
@Override
public void onFinished() {
mIsAnimating = false;
}
@Override
public void onRepeat() {
}
@Override
public void onStep(int i, double v) {
}
});
}
} else {
if (mSVGImageView != null) {
@ -319,7 +339,7 @@ public class LiveEnterRoomAnimPresenter {
SVGARect rect = svgaVideoEntity.getVideoSize();
mSVGImageView.setVideoItem(svgaVideoEntity);
mSVGImageView.setLoops(1);
mSVGImageView.setCallback(new SVGACallback() {
SVGAViewUtils.playEndClear(mSVGImageView,true,new SVGACallback() {
@Override
public void onPause() {
@ -343,7 +363,6 @@ public class LiveEnterRoomAnimPresenter {
}
});
mSVGImageView.startAnimation();
}
}
mIsAnimating = false;

View File

@ -33,6 +33,7 @@ import com.yunbao.common.utils.StringUtil;
import com.yunbao.common.utils.ToastUtil;
import com.yunbao.common.utils.WordUtil;
import com.yunbao.common.views.AbsViewHolder;
import com.yunbao.faceunity.FaceManager;
import com.yunbao.live.R;
import com.yunbao.live.activity.Beauty360Activity3;
import com.yunbao.live.activity.LiveActivity;
@ -70,7 +71,7 @@ public class LiveNewReadyRyViewHolder extends AbsViewHolder implements View.OnCl
private boolean mOpenLocation = true;
private int mLiveSdk;
private LiveClassBean classBean;
// private FaceManager manager;
private FaceManager manager;
private TextView faceTextView;//提示人脸未检测到的TextView
public LiveNewReadyRyViewHolder(Context context, ViewGroup parentView, int liveSdk) {
@ -190,7 +191,7 @@ public class LiveNewReadyRyViewHolder extends AbsViewHolder implements View.OnCl
}
}
};
/* manager = new FaceManager();
manager = new FaceManager();
manager.setFaceStatusChanged(new FaceManager.FaceStatusChanged() {
final Handler handler = new Handler(Looper.getMainLooper());
@ -204,10 +205,10 @@ public class LiveNewReadyRyViewHolder extends AbsViewHolder implements View.OnCl
}
});
}
});*/
});
//新美颜
//manager.initFURender(mContext);
//manager.drawRongFrame(mContext);
manager.initFURender(mContext);
manager.drawRongFrame(mContext);
}
@ -227,8 +228,8 @@ public class LiveNewReadyRyViewHolder extends AbsViewHolder implements View.OnCl
} else if (i == R.id.btn_live_class) {
chooseLiveClass();
} else if (i == R.id.btn_beauty) {
beauty();//momo美颜
//setFaceUnity(); //新娱美颜
//beauty();//momo美颜
setFaceUnity(); //新娱美颜
} else if (i == R.id.btn_wishlist) {
//点击心愿单
openWishListWindow();
@ -250,7 +251,7 @@ public class LiveNewReadyRyViewHolder extends AbsViewHolder implements View.OnCl
*/
public void setFaceUnity() {
LiveFaceUnityDialogFragment fragment = new LiveFaceUnityDialogFragment(mContext);
// fragment.setManager(manager);
fragment.setManager(manager);
fragment.setDismissShowUi(mRootView);
if (mContext instanceof LiveRyAnchorActivity) {
fragment.show(((LiveRyAnchorActivity) mContext).getSupportFragmentManager(), "FaceUnity");

View File

@ -197,7 +197,7 @@ public class LivePlayRyViewHolder extends LiveRoomPlayViewHolder {
if (TextUtils.isEmpty(url) || mVideoView == null) {
return;
}
mPlayer.setCacheParams(1.0f, 5.0f);
//mPlayer.setCacheParams(1.0f, 5.0f);
mPlayer.setObserver(new V2TXLivePlayerObserver() {
String TAG = "播放流";
@ -214,8 +214,8 @@ public class LivePlayRyViewHolder extends LiveRoomPlayViewHolder {
if (code == 2105) {
// mPlayer.resumeVideo();
// mPlayer.resumeAudio();
/* mPlayer.stopPlay();
mPlayer.startPlay(purl);*/
mPlayer.stopPlay();
mPlayer.startPlay(purl);
}
}
@ -240,6 +240,36 @@ public class LivePlayRyViewHolder extends LiveRoomPlayViewHolder {
@Override
public void onStatisticsUpdate(V2TXLivePlayer player, V2TXLiveDef.V2TXLivePlayerStatistics statistics) {
super.onStatisticsUpdate(player, statistics);
Map<String, DownloadTask> taskMap = OkDownload.getInstance().getTaskMap();
StringBuilder buffer = new StringBuilder();
buffer.append("|");
for (String key : taskMap.keySet()) {
DownloadTask task = taskMap.get(key);
buffer.append(task.progress.fileName).append(":");
int status = task.progress.status;
switch (status) {
case 0:
buffer.append("无状态");
break;
case 1:
buffer.append("等待");
break;
case 2:
buffer.append("下载中:").append(task.progress.fraction);
break;
case 3:
buffer.append("暂停");
break;
case 4:
buffer.append("错误");
break;
case 5:
buffer.append("完成");
break;
}
buffer.append("|");
}
//Log.i(TAG, "onStatisticsUpdate: " + JSON.toJSONString(statistics) + " |当前下载数 : " + OkDownload.getInstance().getTaskMap().size() + buffer);
if (statistics.fps == 0) {
OkDownload.getInstance().pauseAll();
} else {

View File

@ -538,14 +538,14 @@ public class LivePushRyViewHolder extends AbsRyLivePushViewHolder implements ITX
new Handler(Looper.getMainLooper()).post(new Runnable() {
public void run() {
//旧美颜不需要了
RCRTCEngine.getInstance().getDefaultVideoStream().setVideoFrameListener(new IRCRTCVideoOutputFrameListener() {
/*RCRTCEngine.getInstance().getDefaultVideoStream().setVideoFrameListener(new IRCRTCVideoOutputFrameListener() {
@Override
public RCRTCVideoFrame processVideoFrame(RCRTCVideoFrame rtcVideoFrame) {
// 使用数据进行美颜/录像等处理后需要把数据再返回给 SDK 做发送
rtcVideoFrame.setTextureId(tencentTRTCBeautyManager.renderWithTexture(rtcVideoFrame.getTextureId(), rtcVideoFrame.getWidth(), rtcVideoFrame.getHeight(), false));
return rtcVideoFrame;
}
});
});*/
}
});

View File

@ -94,6 +94,7 @@ import com.yunbao.common.views.AbsViewHolder;
import com.yunbao.common.views.weight.FullServiceNotificationView;
import com.yunbao.common.views.weight.NobleNoticeView;
import com.yunbao.common.views.weight.ViewClicksAntiShake;
import com.yunbao.faceunity.FaceManager;
import com.yunbao.live.R;
import com.yunbao.live.activity.LiveActivity;
import com.yunbao.live.activity.LiveAnchorActivity;
@ -300,7 +301,7 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
private RoundedImageView msgUserIcon; //悬浮窗icon
private FullServiceNotificationView fullScreen;//全副喇叭
private NobleNoticeView noble;//全副喇叭
//private FaceManager manager;
private FaceManager manager;
public LiveRoomViewHolder(boolean isRys, int forActivity, Context context, ViewGroup parentView, GifImageView gifImageView, SVGAImageView svgaImageView, ViewGroup liveGiftPrizePoolContainer, WindowManager windowManager) {
super(context, parentView);
@ -720,6 +721,11 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
if (!IMLoginManager.get(mContext).hintChat()) {
msgLayout.setVisibility(View.VISIBLE);
}
msgLayout.removeAllViews();
msgLayout.setOnClickListener(v -> {
LiveEnterRoomBean bean = JSON.parseObject("{\"liveChatBean\":{\"aiAutomaticSpeechModel\":{\"aiName\":\"null:\"},\"anchor\":false,\"atUserID\":\"\",\"atUserName\":\"\",\"bubble\":\"\",\"content\":\"駕馭着公爵專屬座駕【神化龍魚】霸氣進場了\",\"contentColor\":\"\",\"endColor\":\"\",\"guard_type\":0,\"heart\":0,\"hot_num\":\"75974\",\"id\":\"158329\",\"level\":58,\"manager\":false,\"medal_name\":\"\",\"medal_new\":\"\",\"msgModel\":{\"action\":\"\",\"anchorId\":\"\",\"anchorName\":\"\",\"method\":\"\",\"msgtype\":\"\",\"nobleId\":\"\",\"recommendCardType\":\"\",\"systemBubble\":\"\",\"trumpetMsg\":\"\",\"userId\":\"\",\"userName\":\"\"},\"nobleId\":\"0\",\"startColor\":\"\",\"type\":3,\"user_nicename\":\"爺傲灬奈我何丿\",\"vip_type\":0},\"userBean\":{\"avatar\":\"https://downs.yaoulive.com/20220915105003_c3dd5b27cc1d484dbfdade8ae14cb76e?imageView2/2/w/600/h/600\",\"avatar_thumb\":\"https://downs.yaoulive.com/20220915105003_c3dd5b27cc1d484dbfdade8ae14cb76e?imageView2/2/w/200/h/200\",\"car\":{\"id\":44,\"swf\":\"https://downs.yaoulive.com/%E4%BE%AF%E7%88%B5%C2%B7%E7%A5%9E%E5%8C%96%E9%BE%99%E9%B1%BC.svga\",\"swftime\":7,\"words\":\"駕馭着公爵專屬座駕【神化龍魚】霸氣進場了\"},\"dress\":{},\"fans\":0,\"follows\":0,\"goodName\":\"0\",\"guard_type\":0,\"hide\":false,\"hot_num\":\"75974\",\"id\":\"158329\",\"level\":58,\"level_anchor\":0,\"liang\":{\"name\":\"0\"},\"liangNameTip\":\"ID:158329\",\"lives\":0,\"medal_level'\":0,\"medal_name\":\"\",\"medal_name'\":\"\",\"noble_id\":\"0\",\"nub\":0,\"sex\":0,\"token_rong\":\"\",\"user_nicename\":\"爺傲灬奈我何丿\",\"vip\":{\"type\":0},\"vipType\":0}}", LiveEnterRoomBean.class);
onEnterRoom(bean);
});
mHandler = new Handler() {
@Override
public void handleMessage(Message msg) {
@ -1344,9 +1350,13 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
TextView wishIndex = wish.findViewById(R.id.wish_index);
ImgLoader.display(mContext, wishlist.get(i).getWishlistIcon(), wishPic);
wishIndex.setText(wishlist.get(i).getWishlistNumP());
wishListFlipper.addView(wish);
if(wishListFlipper!=null) {
wishListFlipper.addView(wish);
}
}
if(wishListFlipper!=null) {
wishListFlipper.startFlipping();
}
wishListFlipper.startFlipping();
});
}
@ -1461,7 +1471,9 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
model.setWishlistProgress(String.valueOf(number));
}
}
wishListFlipper.removeAllViews();
if (wishListLayout != null) {
wishListLayout.removeAllViews();
}
initWishList(wishlist);
}
@ -2776,7 +2788,7 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
* 启动美颜SDK
*/
public void startFace() {
/* manager = new FaceManager();
manager = new FaceManager();
manager.setFaceStatusChanged(new FaceManager.FaceStatusChanged() {
@Override
public void onFaceChanged(int num) {
@ -2784,16 +2796,16 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
}
});
manager.initFURender(mContext);
manager.drawRongFrame(mContext);*/
manager.drawRongFrame(mContext);
}
/**
* 切换美颜UI
*/
public void changeFaceUnityView() {
// faceUnityView.setVisibility(faceUnityView.getVisibility() == View.GONE ? View.VISIBLE : View.GONE);
// faceUnityView.setVisibility(faceUnityView.getVisibility() == View.GONE ? View.VISIBLE : View.GONE);
LiveFaceUnityDialogFragment fragment = new LiveFaceUnityDialogFragment(mContext);
// fragment.setManager(manager);
fragment.setManager(manager);
fragment.show(((LiveActivity) mContext).getSupportFragmentManager(), "faceUi");
}

View File

@ -250,18 +250,10 @@
android:layout_marginTop="5dp"
android:background="@drawable/bg_live_chat"
android:orientation="horizontal">
<ImageView
android:layout_width="25dp"
android:layout_height="25dp"
android:layout_gravity="center"
android:layout_marginLeft="5dp"
android:visibility="gone"
android:src="@mipmap/icon_live_msg" />
<TextView
android:id="@+id/et_input"
android:layout_width="match_parent"
android:layout_weight="1"
android:layout_height="30dp"
android:layout_gravity="center"
android:alpha="0.5"
@ -271,6 +263,15 @@
android:textColor="@color/textColor"
android:textColorHint="@color/gray3"
android:textSize="12sp" />
<ImageView
android:layout_width="25dp"
android:layout_height="25dp"
android:layout_gravity="center"
android:layout_marginEnd="15dp"
android:visibility="visible"
android:src="@mipmap/icon_live_msg" />
</LinearLayout>

View File

@ -667,7 +667,7 @@
android:layout_height="48dp"
android:layout_alignParentEnd="true"
android:layout_marginEnd="0dp"
android:visibility="invisible"
android:visibility="visible"
android:background="@drawable/bg_live_room_msg">
<androidx.constraintlayout.widget.ConstraintLayout

View File

@ -72,7 +72,7 @@ dependencies {
//
api project(':video')
api project(':common')
//api project(':FaceUnity')//
api project(':FaceUnity')//
implementation 'androidx.appcompat:appcompat:1.3.0'
implementation 'com.google.android.material:material:1.4.0'
annotationProcessor rootProject.ext.dependencies["arouter-compiler"]

View File

@ -225,7 +225,7 @@ public class MainActivity extends AbsActivity implements MainAppBarLayoutListene
RongIMClient.init(this, RongcloudIMManager.RONG_IM_KEY, true);
// RTCLib 初始化
RCRTCConfig.Builder config = RCRTCConfig.Builder.create();
//config.enableEncoderTexture(false);//新娱美颜 需要关闭这个
config.enableEncoderTexture(false);//新娱美颜 需要关闭这个
RCRTCEngine.getInstance().init(MainActivity.this, config.build());
//推送跳直播间
if (getIntent().getStringExtra("liveid") != null) {

View File

@ -12,6 +12,7 @@ import androidx.recyclerview.widget.RecyclerView;
import com.yunbao.common.Constants;
import com.yunbao.common.interfaces.OnItemClickListener;
import com.yunbao.common.utils.DeviceUtils;
import com.yunbao.common.views.weight.ViewClicksAntiShake;
import com.yunbao.main.BuildConfig;
import com.yunbao.main.R;
@ -140,7 +141,7 @@ public class SettingAdapter extends RecyclerView.Adapter {
if (bean.getId() == Constants.SETTING_CLEAR_CACHE) {
mText.setText(mCacheString);
} else if (bean.getId() == 19) {
mText.setText(BuildConfig.VERSION_NAME);
mText.setText(DeviceUtils.getVersionName(itemView.getContext()));
mText.setTextColor(Color.parseColor("#969696"));
} else {
mText.setText(mVersionString);

View File

@ -1,2 +1,2 @@
include ':app', ':video', ':common', ':main', ':baidu', ':live', ':lib_country_code'
//include ':FaceUnity'
include ':FaceUnity'