Compare commits

..

No commits in common. "master" and "6.4.2" have entirely different histories.

5915 changed files with 67448 additions and 177248 deletions

View File

@ -1,12 +1,12 @@
apply plugin: 'com.android.library'
apply plugin: 'img-optimizer'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-parcelize'
apply from: "../package_config.gradle"
apply plugin: 'kotlin-android-extensions'
android {
namespace "com.yunbao.faceunity"
compileSdk rootProject.ext.android.compileSdkVersion
compileSdkVersion rootProject.ext.android.compileSdkVersion
buildToolsVersion rootProject.ext.android.buildToolsVersion
packagingOptions {
pickFirst "lib/armeabi/libyuvutils.so"
pickFirst "lib/arm64-v8a/libyuvutils.so"
@ -34,7 +34,6 @@ android {
manifestPlaceholders = rootProject.ext.manifestPlaceholders
ndk {
abiFilters "armeabi-v7a", "arm64-v8a"
// abiFilters "armeabi-v7a", "arm64-v8a","x86","x86_64"
}
}
aaptOptions {
@ -49,8 +48,8 @@ android {
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_18
targetCompatibility JavaVersion.VERSION_18
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}
repositories {
@ -59,15 +58,15 @@ repositories {
}
}
dependencies {
api fileTree(dir: 'libs', include: ['*.jar'])
api rootProject.ext.dependencies["appcompat-androidx"]
api rootProject.ext.dependencies["recyclerview-androidx"]
api "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation rootProject.ext.dependencies["appcompat-androidx"]
implementation rootProject.ext.dependencies["recyclerview-androidx"]
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
//common
api project(path: ':common')
implementation project(path: ':common')
api 'com.faceunity:core:8.7.0'
api 'com.faceunity:model:8.7.0'
implementation 'com.faceunity:core:8.3.1'
implementation 'com.faceunity:model:8.3.1'
//implementation 'com.faceunity:nama:8.3.1' //-

View File

@ -2,7 +2,7 @@ package com.yunbao.faceunity;
import android.content.Context;
import androidx.test.platform.app.Instrimport com.yunbao.common.utils.MobclickAgent;ntationRegistry;
import androidx.test.platform.app.InstrumentationRegistry;
import androidx.test.ext.junit.runners.AndroidJUnit4;
import org.junit.Test;

View File

@ -1,5 +1,7 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools">
xmlns:tools="http://schemas.android.com/tools"
package="com.yunbao.faceunity"
>
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.CAMERA" />

View File

@ -19,15 +19,11 @@ import com.faceunity.core.enumeration.FUInputTextureEnum;
import com.faceunity.core.enumeration.FUTransformMatrixEnum;
import com.faceunity.core.faceunity.FUAIKit;
import com.faceunity.core.utils.CameraUtils;
import com.yunbao.faceunity.data.FaceBeautyDataFactory;
import com.yunbao.faceunity.data.FaceUnityDataFactory;
import com.yunbao.faceunity.entity.FaceBeautyBean;
import com.yunbao.faceunity.entity.FaceBeautyFilterBean;
import com.yunbao.faceunity.listener.FURendererListener;
import com.yunbao.faceunity.ui.FaceUnityView;
import com.yunbao.faceunity.utils.CSVUtils;
import com.yunbao.faceunity.utils.FURenderer;
import com.yunbao.faceunity.utils.FaceSPUtils;
import com.yunbao.faceunity.utils.FaceUnityData;
import com.yunbao.faceunity.utils.net.OkHttpUtils;
@ -35,9 +31,10 @@ import java.io.File;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Locale;
import java.util.Map;
import java.util.Objects;
import cn.rongcloud.rtc.api.RCRTCEngine;
import cn.rongcloud.rtc.api.callback.IRCRTCVideoOutputFrameListener;
import cn.rongcloud.rtc.base.RCRTCVideoFrame;
/**
* 美颜模块管理类
@ -68,7 +65,7 @@ public class FaceManager implements SensorEventListener {
* 配置美颜SDK
*/
public void initFURender(Context context) {
initFaceUnity(context);
mFURenderer = FURenderer.getInstance();
mFURenderer.setInputTextureType(FUInputTextureEnum.FU_ADM_FLAG_COMMON_TEXTURE);
mFURenderer.setCameraFacing(CameraFacingEnum.CAMERA_FRONT);
@ -86,81 +83,22 @@ public class FaceManager implements SensorEventListener {
/**
* 注册长按对比键事件
*
* @param faceUnityView
*/
public void setFaceUnityView(FaceUnityView faceUnityView) {
faceUnityView.setIFaceUnityInter(new FaceUnityView.IFaceUnityInter() {
@Override
public void onPause() {
if(onMirrorChanged!=null){
onMirrorChanged.onChange(false);
}
pauseFace = true;
}
@Override
public void onStart() {
if(onMirrorChanged!=null){
onMirrorChanged.onChange(true);
}
pauseFace = false;
}
});
}
public void loadConfig() {
initFaceBeauty();
}
public void initFaceBeauty() {
FaceBeautyDataFactory faceBeautyDataFactory;
faceBeautyDataFactory = new FaceBeautyDataFactory();
Map<String, ?> configMap = FaceSPUtils.getInstance().getAll();
for (String key : configMap.keySet()) {
if ("FilterViewHolder_".equals(key)) {
for (FaceBeautyFilterBean filter : faceBeautyDataFactory.getBeautyFilters()) {
if (filter.getKey().equals(configMap.get(key)) && !"origin".equals(configMap.get(key))) {
try {
faceBeautyDataFactory.onFilterSelected(filter.getKey(), Double.parseDouble((String) Objects.requireNonNull(configMap.get("FilterViewHolder_" + configMap.get(key) + "_val"))) / 100, filter.getDesRes());
Log.i(TAG, "test: 设置滤镜 =" + filter.getKey() + " val = " + configMap.get("FilterViewHolder_" + configMap.get(key) + "_val"));
} catch (Exception e) {
e.printStackTrace();
}
break;
}
}
} else if (key.startsWith("BeautySkinViewHolder_")) {
String name = key.replace("BeautySkinViewHolder_", "");
for (FaceBeautyBean bean : faceBeautyDataFactory.getShapeBeauty()) {
if (bean.getKey().equals(name)) {
try {
faceBeautyDataFactory.updateParamIntensity(bean.getKey(), Double.parseDouble((String) Objects.requireNonNull(configMap.get(key))));
Log.i(TAG, "test: 设置美颜 = " + bean.getKey() + " val = " + configMap.get(key));
} catch (Exception e) {
e.printStackTrace();
}
break;
}
}
} else if (key.startsWith("BeautyShapeViewHolder")) {
String name = key.replace("BeautyShapeViewHolder_", "");
for (FaceBeautyBean bean : faceBeautyDataFactory.getShapeBeauty()) {
if (bean.getKey().equals(name)) {
try {
faceBeautyDataFactory.updateParamIntensity(bean.getKey(), Double.parseDouble((String) Objects.requireNonNull(configMap.get(key))));
Log.i(TAG, "test: 设置美肤 = " + bean.getKey() + " val = " + configMap.get(key));
} catch (Exception e) {
e.printStackTrace();
}
break;
}
}
}
}
}
/**
* 监听人脸识别个数
*/
@ -175,6 +113,44 @@ public class FaceManager implements SensorEventListener {
private static final int CAMERA_SWITCH_SKIP_FRAME = 0;
private volatile boolean mSkip;
/**
* 渲染融云视频帧
*/
public void drawRongFrame(Context context) {
RCRTCEngine.getInstance().getDefaultVideoStream().setVideoFrameListener(new IRCRTCVideoOutputFrameListener() {
@Override
public RCRTCVideoFrame processVideoFrame(RCRTCVideoFrame callVideoFrame) {
//Log.i(TAG, "processVideoFrame: egl context " + EGL14.eglGetCurrentContext());
if (pauseFace) {
return callVideoFrame;
}
int width = callVideoFrame.getWidth();
int height = callVideoFrame.getHeight();
if (mIsFirstFrame) {
mIsFirstFrame = false;
//initCsvUtil(context);
mFURenderer.prepareRenderer(mFURendererListener);
}
//long start = System.nanoTime();
mFURenderer.setInputOrientation(callVideoFrame.getRotation());
FURenderOutputData data = mFURenderer.onDrawFrameInputWithReturn(callVideoFrame.getData(), width, height);
/* long time = System.nanoTime() - start;
if (mCSVUtils != null) {
mCSVUtils.writeCsv(null, time);
}*/
if (mSkippedFrames > 0 || mSkip) {
--mSkippedFrames;
return callVideoFrame;
}
if (data != null && data.getImage() != null && data.getImage().getBuffer() != null) {
callVideoFrame.setData(data.getImage().getBuffer());
}
return callVideoFrame;
}
});
}
/**
* 记录渲染工具调试用在processVideoFrame里使用
@ -237,6 +213,12 @@ public class FaceManager implements SensorEventListener {
}
/**
* 离开渲染界面时注销融云监听器不然会绿屏
*/
public void onClose() {
RCRTCEngine.getInstance().getDefaultVideoStream().setVideoFrameListener(null);
}
/**
* 释放资源
@ -250,22 +232,10 @@ public class FaceManager implements SensorEventListener {
} catch (Exception e) {
e.printStackTrace();
}
isInit = false;
}
OnMirrorChanged onMirrorChanged;
public void setOnMirrorChanged(OnMirrorChanged onMirrorChanged) {
this.onMirrorChanged = onMirrorChanged;
}
public interface FaceStatusChanged {
void onFaceChanged(int num);
}
public interface OnMirrorChanged{
void onChange(boolean falg);
}
}

View File

@ -4,6 +4,7 @@ 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;
@ -80,11 +81,11 @@ public class ContainerRecyclerAdapter extends RecyclerView.Adapter<BaseViewHolde
}
public void hideSeekBar() {
if (seekBar.getVisibility() == View.INVISIBLE) {
if (seekBar.getVisibility() == View.GONE) {
return;
}
seekBar.setOnProgressChangeListener(null);
seekBar.setVisibility(View.INVISIBLE);
seekBar.setVisibility(View.GONE);
}

View File

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

View File

@ -37,8 +37,7 @@ public class BeautyShapeViewHolder extends BaseViewHolder {
super.onProgressChanged(seekBar, value, fromUser);
FaceBeautyBean bean = (FaceBeautyBean) itemView.getTag();
double toValue = SeekBarUtils.Companion.seekToValue(bean.getModelAttributeData().getMaxRange(), value, seekBar.getMin());
BeautyShapeViewHolder.this.value.setTag(String.format("%.1f", toValue));
BeautyShapeViewHolder.this.value.setText(value+"");
BeautyShapeViewHolder.this.value.setText(String.format("%.1f", toValue));
adapter.getFaceBeautyDataFactory().updateParamIntensity(bean.getKey(), toValue);
saveData();
}
@ -81,7 +80,7 @@ public class BeautyShapeViewHolder extends BaseViewHolder {
@Override
public void saveData() {
FaceBeautyBean bean = (FaceBeautyBean) itemView.getTag();
adapter.save(getName(this)+bean.getKey(), (String) value.getTag());
adapter.save(getName(this)+bean.getKey(), (String) value.getText());
}
@Override

View File

@ -36,8 +36,7 @@ public class BeautySkinViewHolder extends BaseViewHolder{
super.onProgressChanged(seekBar, value, fromUser);
FaceBeautyBean bean = (FaceBeautyBean) itemView.getTag();
double toValue = SeekBarUtils.Companion.seekToValue(bean.getModelAttributeData().getMaxRange(), value, seekBar.getMin());
BeautySkinViewHolder.this.value.setTag(String.format("%.1f",toValue));
BeautySkinViewHolder.this.value.setText(value+"");
BeautySkinViewHolder.this.value.setText(String.format("%.1f",toValue));
adapter.getFaceBeautyDataFactory().updateParamIntensity(bean.getKey(),toValue);
saveData();
}
@ -81,7 +80,7 @@ public class BeautySkinViewHolder extends BaseViewHolder{
@Override
public void saveData() {
String key = ((FaceBeautyBean)itemView.getTag()).getKey();
String val= (String) value.getTag();
String val= (String) value.getText();
adapter.save(getName(this)+key,val);
}

View File

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

View File

@ -9,8 +9,6 @@ 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;
@ -20,7 +18,6 @@ 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);
@ -31,28 +28,6 @@ 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)));
}
});
}
@ -72,7 +47,6 @@ 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;
@ -80,14 +54,8 @@ public class FilterViewHolder extends BaseViewHolder {
if (!val.equals(bean.getKey())) {
return false;
}
if(!"origin".equals(bean.getKey())){
adapter.showSeekBar();
}
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;
}
@ -100,14 +68,8 @@ public class FilterViewHolder extends BaseViewHolder {
@Override
public void reset(List<? extends BaseBean> list) {
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.del(getName(this));
itemView.callOnClick();
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.save(getName(this),list.get(0).getKey());
adapter.del(getName(this));
itemView.callOnClick();
adapter.setSelectPosition(0);
}

View File

@ -115,10 +115,11 @@ public class MakeupCustomItemViewHolder extends BaseViewHolder {
@Override
public void reset(List<? extends BaseBean> list) {
adapter.save(getName(this),list.get(0).getKey());
adapter.del(getName(this));
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.save(getName(this),list.get(0).getKey());
adapter.del(getName(this));
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.save(getName(this),list.get(0).getKey());
adapter.del(getName(this));
adapter.getPropDataFactory().setPropType(FunctionEnum.STICKER);
adapter.getPropDataFactory().onItemSelected((PropBean) list.get(0));
adapter.setSelectPosition(0);

View File

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

View File

@ -85,19 +85,6 @@ public class FaceBeautyDataFactory extends AbstractFaceBeautyDataFactory {
public FaceBeautyDataFactory(FaceBeautyListener listener) {
mFaceBeautyListener = listener;
}
public FaceBeautyDataFactory(){
mFaceBeautyListener=new FaceBeautyListener() {
@Override
public void onFilterSelected(int res) {
}
@Override
public void onFaceBeautyEnable(boolean enable) {
}
};
}
/**

View File

@ -4,6 +4,7 @@ import android.content.Context;
import android.util.AttributeSet;
import android.view.KeyEvent;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
@ -14,12 +15,10 @@ 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;
@ -34,7 +33,6 @@ 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;
@ -59,7 +57,6 @@ 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);
@ -107,7 +104,6 @@ public class FaceUnityView extends LinearLayout implements StickerDownloadHelper
initMenuGroup();
setContainerRecycler(new ArrayList<>());
initViewClick();
gotoFaceBeauty();
}
/**
@ -172,25 +168,6 @@ 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);
setContainerRecycler(FaceBeautySource.buildSkinParams());
changeRecyclerItemCount(2);
setTab(createTabs(map));
menuGroup.setVisibility(GONE);
titleLayout.setVisibility(GONE);
back.setVisibility(GONE);
menu2Back.setVisibility(GONE);
menu2.setVisibility(VISIBLE);
}
/**
* 配置主菜单
*/
@ -310,26 +287,12 @@ public class FaceUnityView extends LinearLayout implements StickerDownloadHelper
tabLayout.removeAllTabs();
for (TabLayout.Tab tab : tabs) {
tabLayout.addTab(tab);
if (tab.getTag() instanceof Integer) {
if (FaceSPUtils.getInstance().getString(StyleViewHolder.class.getSimpleName() + "_") != null && (int) tab.getTag() == FaceParam.FACE_BEAUTY_STYLE) {
ToastUtil.show("请先重置风格推荐");
tab.select();
changeRecyclerItemCount(5);
setContainerRecycler(FaceBeautySource.buildStylesParams());
}
}
}
tabLayout.addOnTabSelectedListener(new TabLayout.OnTabSelectedListener() {
@Override
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);
@ -444,8 +407,7 @@ public class FaceUnityView extends LinearLayout implements StickerDownloadHelper
containerRecycler.setLayoutManager(new GridLayoutManager(mContext, 2));
containerRecycler.setAdapter(containerAdapter);
}
// titleLayout.setVisibility(title.getVisibility()==GONE?INVISIBLE:VISIBLE);
// Log.i(TAG, "setContainerRecycler: " + list.size());
titleLayout.setVisibility(title.getVisibility()==GONE?INVISIBLE:VISIBLE);
containerAdapter.setList(list);
containerAdapter.notifyDataSetChanged();
}

View File

@ -52,11 +52,11 @@ public class FURenderer extends IFURenderer {
/* 特效FURenderKit*/
public FURenderKit mFURenderKit;
private FURenderKit mFURenderKit;
/* AI道具*/
public static String BUNDLE_AI_FACE = "model" + File.separator + "ai_face_processor.bundle";
public static String BUNDLE_AI_HUMAN = "model" + File.separator + "ai_human_processor.bundle";
private String BUNDLE_AI_FACE = "model" + File.separator + "ai_face_processor.bundle";
private String BUNDLE_AI_HUMAN = "model" + File.separator + "ai_human_processor.bundle";
/* GL 线程 ID */
private Long mGlThreadId = 0L;
@ -87,8 +87,8 @@ public class FURenderer extends IFURenderer {
*/
@Override
public void setup(Context context) {
FURenderManager.setKitDebug(FULogger.LogLevel.INFO);
FURenderManager.setCoreDebug(FULogger.LogLevel.INFO);
FURenderManager.setKitDebug(FULogger.LogLevel.OFF);
FURenderManager.setCoreDebug(FULogger.LogLevel.OFF);
FURenderManager.registerFURender(context, Authpack.A(), new OperateCallback() {
@Override
public void onSuccess(int i, @NotNull String s) {

View File

@ -5,8 +5,6 @@ import android.content.SharedPreferences;
import com.yunbao.common.CommonAppContext;
import java.util.Map;
public class FaceSPUtils {
private static FaceSPUtils utils;
private SharedPreferences mSharedPreferences;
@ -40,7 +38,4 @@ public class FaceSPUtils {
}
}
}
public Map<String, ?> getAll(){
return mSharedPreferences.getAll();
}
}

View File

@ -314,35 +314,6 @@ public class FileUtils {
return null;
}
public static String copyAssetsFile(Context context, String assetsPath, String fileName, String saveFileDir) {
File fileDir = new File(saveFileDir);
if (!fileDir.exists()) {
fileDir.mkdirs();
}
File file = new File(fileDir, fileName);
if (file.exists()) {
return file.getAbsolutePath();
}
try {
InputStream inputStream = context.getAssets().open(assetsPath);
FileOutputStream fos = new FileOutputStream(file);
BufferedInputStream bis = new BufferedInputStream(inputStream);
BufferedOutputStream bos = new BufferedOutputStream(fos);
byte[] byteArray = new byte[1024];
int bytes = bis.read(byteArray);
while (bytes > 0) {
bos.write(byteArray, 0, bytes);
bos.flush();
bytes = bis.read(byteArray);
}
bos.close();
fos.close();
return file.getAbsolutePath();
} catch (IOException e) {
e.printStackTrace();
}
return null;
}
/**
* 获取Uri文件绝对路径
@ -551,7 +522,6 @@ public class FileUtils {
/**
* 遍历一个文件夹获取改文件夹下所有文件名
*
* @param path
* @return
*/
@ -593,7 +563,7 @@ public class FileUtils {
* @param path String
* @return Boolean
*/
public static Boolean checkIsVideo(Context context, String path) {
public static Boolean checkIsVideo(Context context,String path) {
MediaMetadataRetriever retriever = new MediaMetadataRetriever();
try {
retriever.setDataSource(context, Uri.fromFile(new File(path)));

View File

@ -1,11 +1,10 @@
package com.yunbao.common.utils;
package com.yunbao.faceunity.utils;
import android.util.Log;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.List;
@ -152,36 +151,16 @@ public class ZipUtils {
* @param zipFileString 解压完成的Zip路径
* @throws Exception
*/
public static void zipFolder(List<String> srcFileString, String zipFileString, List<String> filters, Runnable runnable) throws Exception {
if (filters == null) {
filters = new ArrayList<>();
}
filters.add(new File(zipFileString).getAbsolutePath());
final List<String> tmp = new ArrayList<>(filters);
public static void zipFolder(String srcFileString, String zipFileString) throws Exception {
//创建ZIP
ZipOutputStream outZip = new ZipOutputStream(new FileOutputStream(zipFileString));
new Thread(new Runnable() {
@Override
public void run() {
try {
for (String src : srcFileString) {
File file = new File(src);
//压缩
zipFiles(file.getParent() + File.separator, file.getName(), outZip, tmp);
}
//创建文件
//完成和关闭
outZip.finish();
outZip.close();
runnable.run();
} catch (Exception e) {
e.printStackTrace();
}
}
}).start();
//创建文件
File file = new File(srcFileString);
//压缩
zipFiles(file.getParent() + File.separator, file.getName(), outZip);
//完成和关闭
outZip.finish();
outZip.close();
}
/**
@ -192,15 +171,9 @@ public class ZipUtils {
* @param zipOutputSteam
* @throws Exception
*/
private static void zipFiles(String folderString, String fileString, ZipOutputStream zipOutputSteam, List<String> filters) throws Exception {
private static void zipFiles(String folderString, String fileString, ZipOutputStream zipOutputSteam) throws Exception {
if (zipOutputSteam == null)
return;
for (String filter : filters) {
if (fileString.startsWith(filter)) {
return;
}
}
System.out.println("压缩文件:" + folderString + "|" + fileString);
File file = new File(folderString + fileString);
if (file.isFile()) {
ZipEntry zipEntry = new ZipEntry(fileString);
@ -223,7 +196,7 @@ public class ZipUtils {
}
//子文件和递归
for (int i = 0; i < fileList.length; i++) {
zipFiles(folderString, fileString + File.separator + fileList[i], zipOutputSteam, filters);
zipFiles(folderString, fileString + File.separator + fileList[i], zipOutputSteam);
}
}
}

View File

@ -13,7 +13,7 @@ import com.google.gson.JsonObject;
import com.yunbao.faceunity.entity.net.FineStickerEntity;
import com.yunbao.faceunity.utils.FaceUnityData;
import com.yunbao.faceunity.utils.FileUtils;
import com.yunbao.common.utils.ZipUtils;
import com.yunbao.faceunity.utils.ZipUtils;
import java.io.File;
import java.util.ArrayList;

View File

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

Binary file not shown.

Before

Width:  |  Height:  |  Size: 390 B

After

Width:  |  Height:  |  Size: 422 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 276 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 58 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 31 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 163 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 131 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 29 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 26 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 36 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 28 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 35 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 46 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 25 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 78 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 128 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 107 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 54 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 58 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 59 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 55 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 54 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 37 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 32 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.1 KiB

Some files were not shown because too many files have changed in this diff Show More