美颜补充对比键功能
This commit is contained in:
parent
7033f5e707
commit
04f0953cfa
@ -11,9 +11,6 @@ import android.hardware.SensorManager;
|
|||||||
import android.os.Environment;
|
import android.os.Environment;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
|
|
||||||
import androidx.annotation.NonNull;
|
|
||||||
|
|
||||||
import com.faceunity.core.callback.OperateCallback;
|
|
||||||
import com.faceunity.core.entity.FURenderOutputData;
|
import com.faceunity.core.entity.FURenderOutputData;
|
||||||
import com.faceunity.core.enumeration.CameraFacingEnum;
|
import com.faceunity.core.enumeration.CameraFacingEnum;
|
||||||
import com.faceunity.core.enumeration.FUAIProcessorEnum;
|
import com.faceunity.core.enumeration.FUAIProcessorEnum;
|
||||||
@ -21,13 +18,10 @@ import com.faceunity.core.enumeration.FUAITypeEnum;
|
|||||||
import com.faceunity.core.enumeration.FUInputTextureEnum;
|
import com.faceunity.core.enumeration.FUInputTextureEnum;
|
||||||
import com.faceunity.core.enumeration.FUTransformMatrixEnum;
|
import com.faceunity.core.enumeration.FUTransformMatrixEnum;
|
||||||
import com.faceunity.core.faceunity.FUAIKit;
|
import com.faceunity.core.faceunity.FUAIKit;
|
||||||
import com.faceunity.core.faceunity.FURenderManager;
|
|
||||||
import com.faceunity.core.utils.CameraUtils;
|
import com.faceunity.core.utils.CameraUtils;
|
||||||
import com.faceunity.core.utils.FULogger;
|
|
||||||
import com.yunbao.faceunity.data.FaceUnityDataFactory;
|
import com.yunbao.faceunity.data.FaceUnityDataFactory;
|
||||||
import com.yunbao.faceunity.listener.FURendererListener;
|
import com.yunbao.faceunity.listener.FURendererListener;
|
||||||
import com.yunbao.faceunity.ui.FaceUnityView;
|
import com.yunbao.faceunity.ui.FaceUnityView;
|
||||||
import com.yunbao.faceunity.utils.Authpack;
|
|
||||||
import com.yunbao.faceunity.utils.CSVUtils;
|
import com.yunbao.faceunity.utils.CSVUtils;
|
||||||
import com.yunbao.faceunity.utils.FURenderer;
|
import com.yunbao.faceunity.utils.FURenderer;
|
||||||
import com.yunbao.faceunity.utils.FaceUnityData;
|
import com.yunbao.faceunity.utils.FaceUnityData;
|
||||||
@ -50,6 +44,7 @@ public class FaceManager implements SensorEventListener {
|
|||||||
private static final String TAG = FaceManager.class.getSimpleName();
|
private static final String TAG = FaceManager.class.getSimpleName();
|
||||||
private FaceUnityDataFactory mFaceUnityDataFactory;
|
private FaceUnityDataFactory mFaceUnityDataFactory;
|
||||||
private FaceManager.FaceStatusChanged faceStatusChanged;
|
private FaceManager.FaceStatusChanged faceStatusChanged;
|
||||||
|
private boolean pauseFace = false;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 初始化美颜模块,在AppContext中调用
|
* 初始化美颜模块,在AppContext中调用
|
||||||
@ -61,7 +56,7 @@ public class FaceManager implements SensorEventListener {
|
|||||||
FaceUnityData.mApplication = context;
|
FaceUnityData.mApplication = context;
|
||||||
OkHttpUtils.getInstance().init(context, false);
|
OkHttpUtils.getInstance().init(context, false);
|
||||||
FURenderer.getInstance().setup(context);
|
FURenderer.getInstance().setup(context);
|
||||||
isInit=true;
|
isInit = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
private FURenderer mFURenderer;
|
private FURenderer mFURenderer;
|
||||||
@ -86,6 +81,24 @@ public class FaceManager implements SensorEventListener {
|
|||||||
mSensorManager.registerListener(this, sensor, SensorManager.SENSOR_DELAY_NORMAL);
|
mSensorManager.registerListener(this, sensor, SensorManager.SENSOR_DELAY_NORMAL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 注册长按对比键事件
|
||||||
|
* @param faceUnityView
|
||||||
|
*/
|
||||||
|
public void setFaceUnityView(FaceUnityView faceUnityView) {
|
||||||
|
faceUnityView.setIFaceUnityInter(new FaceUnityView.IFaceUnityInter() {
|
||||||
|
@Override
|
||||||
|
public void onPause() {
|
||||||
|
pauseFace = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onStart() {
|
||||||
|
pauseFace = false;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 监听人脸识别个数
|
* 监听人脸识别个数
|
||||||
*/
|
*/
|
||||||
@ -108,6 +121,9 @@ public class FaceManager implements SensorEventListener {
|
|||||||
@Override
|
@Override
|
||||||
public RCRTCVideoFrame processVideoFrame(RCRTCVideoFrame callVideoFrame) {
|
public RCRTCVideoFrame processVideoFrame(RCRTCVideoFrame callVideoFrame) {
|
||||||
//Log.i(TAG, "processVideoFrame: egl context " + EGL14.eglGetCurrentContext());
|
//Log.i(TAG, "processVideoFrame: egl context " + EGL14.eglGetCurrentContext());
|
||||||
|
if (pauseFace) {
|
||||||
|
return callVideoFrame;
|
||||||
|
}
|
||||||
int width = callVideoFrame.getWidth();
|
int width = callVideoFrame.getWidth();
|
||||||
int height = callVideoFrame.getHeight();
|
int height = callVideoFrame.getHeight();
|
||||||
|
|
||||||
|
@ -2,8 +2,8 @@ package com.yunbao.faceunity.ui;
|
|||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.util.AttributeSet;
|
import android.util.AttributeSet;
|
||||||
|
import android.view.KeyEvent;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.View;
|
|
||||||
import android.widget.ImageView;
|
import android.widget.ImageView;
|
||||||
import android.widget.LinearLayout;
|
import android.widget.LinearLayout;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
@ -18,9 +18,8 @@ import com.yunbao.faceunity.R;
|
|||||||
import com.yunbao.faceunity.adapters.ContainerRecyclerAdapter;
|
import com.yunbao.faceunity.adapters.ContainerRecyclerAdapter;
|
||||||
import com.yunbao.faceunity.adapters.MenuGroupRecyclerAdapter;
|
import com.yunbao.faceunity.adapters.MenuGroupRecyclerAdapter;
|
||||||
import com.yunbao.faceunity.data.FaceParam;
|
import com.yunbao.faceunity.data.FaceParam;
|
||||||
import com.yunbao.faceunity.data.FaceUnityDataFactory;
|
|
||||||
import com.yunbao.faceunity.entity.BaseBean;
|
|
||||||
import com.yunbao.faceunity.data.FineStickerDataFactory;
|
import com.yunbao.faceunity.data.FineStickerDataFactory;
|
||||||
|
import com.yunbao.faceunity.entity.BaseBean;
|
||||||
import com.yunbao.faceunity.entity.FunctionEnum;
|
import com.yunbao.faceunity.entity.FunctionEnum;
|
||||||
import com.yunbao.faceunity.entity.MakeupCustomClassBean;
|
import com.yunbao.faceunity.entity.MakeupCustomClassBean;
|
||||||
import com.yunbao.faceunity.entity.MenuGroupBean;
|
import com.yunbao.faceunity.entity.MenuGroupBean;
|
||||||
@ -52,8 +51,9 @@ public class FaceUnityView extends LinearLayout implements StickerDownloadHelper
|
|||||||
private TabLayout tabLayout;
|
private TabLayout tabLayout;
|
||||||
private TextView title;
|
private TextView title;
|
||||||
private LinearLayout menu2, menuDiy, reset, menu2Reset;
|
private LinearLayout menu2, menuDiy, reset, menu2Reset;
|
||||||
private ImageView menu2Back, back, close;
|
private ImageView menu2Back, back, close, contrast;
|
||||||
private DiscreteSeekBar seekBar;
|
private DiscreteSeekBar seekBar;
|
||||||
|
private IFaceUnityInter iFaceUnityInter;
|
||||||
|
|
||||||
public FaceUnityView(Context context) {
|
public FaceUnityView(Context context) {
|
||||||
super(context);
|
super(context);
|
||||||
@ -96,6 +96,7 @@ public class FaceUnityView extends LinearLayout implements StickerDownloadHelper
|
|||||||
menu2Reset = findViewById(R.id.menu2_reset);
|
menu2Reset = findViewById(R.id.menu2_reset);
|
||||||
menuDiy = findViewById(R.id.menu_diy);
|
menuDiy = findViewById(R.id.menu_diy);
|
||||||
seekBar = findViewById(R.id.item_seekBar);
|
seekBar = findViewById(R.id.item_seekBar);
|
||||||
|
contrast = findViewById(R.id.item_contrast);
|
||||||
initMenuGroup();
|
initMenuGroup();
|
||||||
setContainerRecycler(new ArrayList<>());
|
setContainerRecycler(new ArrayList<>());
|
||||||
initViewClick();
|
initViewClick();
|
||||||
@ -107,9 +108,9 @@ public class FaceUnityView extends LinearLayout implements StickerDownloadHelper
|
|||||||
private void initViewClick() {
|
private void initViewClick() {
|
||||||
menu2Back.setOnClickListener(v -> {
|
menu2Back.setOnClickListener(v -> {
|
||||||
Object tag = menu2Back.getTag();
|
Object tag = menu2Back.getTag();
|
||||||
if(tag==null) {
|
if (tag == null) {
|
||||||
goBackMainMenu();
|
goBackMainMenu();
|
||||||
}else if(tag.equals("makeup")){
|
} else if (tag.equals("makeup")) {
|
||||||
title.setText(R.string.home_function_name_makeup);
|
title.setText(R.string.home_function_name_makeup);
|
||||||
title.setVisibility(VISIBLE);
|
title.setVisibility(VISIBLE);
|
||||||
menuDiy.setVisibility(VISIBLE);
|
menuDiy.setVisibility(VISIBLE);
|
||||||
@ -129,6 +130,25 @@ public class FaceUnityView extends LinearLayout implements StickerDownloadHelper
|
|||||||
menu2Reset.setOnClickListener(view -> {
|
menu2Reset.setOnClickListener(view -> {
|
||||||
containerAdapter.reset();
|
containerAdapter.reset();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
contrast.setOnTouchListener((v, event) -> {
|
||||||
|
if (iFaceUnityInter == null) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (event.getAction() == KeyEvent.ACTION_DOWN) {
|
||||||
|
iFaceUnityInter.onPause();
|
||||||
|
} else if (event.getAction() == KeyEvent.ACTION_UP) {
|
||||||
|
iFaceUnityInter.onStart();
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 对比接口
|
||||||
|
*/
|
||||||
|
public void setIFaceUnityInter(IFaceUnityInter iFaceUnityInter) {
|
||||||
|
this.iFaceUnityInter = iFaceUnityInter;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -363,6 +383,7 @@ public class FaceUnityView extends LinearLayout implements StickerDownloadHelper
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 设置美颜选项配置行数,图标为5个,拖动条为2个
|
* 设置美颜选项配置行数,图标为5个,拖动条为2个
|
||||||
|
*
|
||||||
* @param count
|
* @param count
|
||||||
*/
|
*/
|
||||||
private void changeRecyclerItemCount(int count) {
|
private void changeRecyclerItemCount(int count) {
|
||||||
@ -371,6 +392,7 @@ public class FaceUnityView extends LinearLayout implements StickerDownloadHelper
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 设置美颜Recycler内容
|
* 设置美颜Recycler内容
|
||||||
|
*
|
||||||
* @param list
|
* @param list
|
||||||
*/
|
*/
|
||||||
private void setContainerRecycler(ArrayList<? extends BaseBean> list) {
|
private void setContainerRecycler(ArrayList<? extends BaseBean> list) {
|
||||||
@ -404,4 +426,10 @@ public class FaceUnityView extends LinearLayout implements StickerDownloadHelper
|
|||||||
public void onDownloadError(FineStickerEntity.DocsBean entity, String msg) {
|
public void onDownloadError(FineStickerEntity.DocsBean entity, String msg) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public interface IFaceUnityInter {
|
||||||
|
void onPause();
|
||||||
|
|
||||||
|
void onStart();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -6,28 +6,48 @@
|
|||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:orientation="vertical">
|
android:orientation="vertical">
|
||||||
|
|
||||||
<com.yunbao.faceunity.seekbar.DiscreteSeekBar
|
<androidx.constraintlayout.widget.ConstraintLayout
|
||||||
android:id="@+id/item_seekBar"
|
android:layout_width="match_parent"
|
||||||
android:layout_width="300dp"
|
android:layout_gravity="center"
|
||||||
android:layout_height="@dimen/x48"
|
android:layout_height="wrap_content"
|
||||||
android:layout_gravity="center_horizontal"
|
>
|
||||||
android:layout_marginTop="@dimen/x24"
|
|
||||||
android:layout_marginBottom="@dimen/x15"
|
|
||||||
android:paddingTop="20dp"
|
<com.yunbao.faceunity.seekbar.DiscreteSeekBar
|
||||||
android:visibility="gone"
|
android:id="@+id/item_seekBar"
|
||||||
app:dsb_indicatorColor="#CDCDCD"
|
android:layout_width="300dp"
|
||||||
app:dsb_indicatorElevation="0dp"
|
android:layout_height="@dimen/x48"
|
||||||
app:dsb_indicatorPopupEnabled="true"
|
android:layout_gravity="center_horizontal"
|
||||||
app:dsb_max="100"
|
android:paddingTop="20dp"
|
||||||
app:dsb_min="0"
|
android:visibility="gone"
|
||||||
app:dsb_progressColor="#FFFFFF"
|
app:dsb_indicatorColor="#CDCDCD"
|
||||||
app:dsb_rippleColor="#FFFFFF"
|
app:dsb_indicatorElevation="0dp"
|
||||||
app:dsb_scrubberHeight="@dimen/x16"
|
app:dsb_indicatorPopupEnabled="true"
|
||||||
app:dsb_thumbSize="@dimen/x32"
|
app:dsb_max="100"
|
||||||
app:dsb_trackBaseHeight="@dimen/x16"
|
app:dsb_min="0"
|
||||||
app:dsb_trackColor="#4D4D4D"
|
app:dsb_progressColor="#FFFFFF"
|
||||||
app:dsb_trackHeight="@dimen/x16"
|
app:dsb_rippleColor="#FFFFFF"
|
||||||
app:dsb_value="0" />
|
app:dsb_scrubberHeight="@dimen/x16"
|
||||||
|
app:dsb_thumbSize="@dimen/x32"
|
||||||
|
app:dsb_trackBaseHeight="@dimen/x16"
|
||||||
|
app:dsb_trackColor="#4D4D4D"
|
||||||
|
app:dsb_trackHeight="@dimen/x16"
|
||||||
|
app:dsb_value="0"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/item_contrast"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginEnd="16dp"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent"
|
||||||
|
app:srcCompat="@mipmap/icon_contrast" />
|
||||||
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
|
BIN
FaceUnity/src/main/res/mipmap-xxhdpi/icon_contrast.png
Normal file
BIN
FaceUnity/src/main/res/mipmap-xxhdpi/icon_contrast.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.1 KiB |
@ -115,7 +115,7 @@ public class AppContext extends CommonAppContext {
|
|||||||
public void onCreate() {
|
public void onCreate() {
|
||||||
super.onCreate();
|
super.onCreate();
|
||||||
//注册全局异常捕获
|
//注册全局异常捕获
|
||||||
registerError();
|
// registerError();
|
||||||
sInstance = this;
|
sInstance = this;
|
||||||
L.setDeBug(BuildConfig.DEBUG);
|
L.setDeBug(BuildConfig.DEBUG);
|
||||||
AppEventsLogger.activateApp(this);
|
AppEventsLogger.activateApp(this);
|
||||||
|
@ -81,7 +81,7 @@ public class VersionUtil {
|
|||||||
|
|
||||||
//谷歌更新
|
//谷歌更新
|
||||||
} else if (CommonAppConfig.IS_GOOGLE_PLAY == true) {
|
} else if (CommonAppConfig.IS_GOOGLE_PLAY == true) {
|
||||||
if (configBean.getGoogle_isup().equals("0")) {
|
if ("0".equals(configBean.getGoogle_isup())) {
|
||||||
DialogUitl.Builder builder = new DialogUitl.Builder(context);
|
DialogUitl.Builder builder = new DialogUitl.Builder(context);
|
||||||
builder.setTitle(WordUtil.getString(R.string.version_update))
|
builder.setTitle(WordUtil.getString(R.string.version_update))
|
||||||
.setContent(configBean.getUpdateDes())
|
.setContent(configBean.getUpdateDes())
|
||||||
@ -159,7 +159,7 @@ public class VersionUtil {
|
|||||||
ToastUtil.show(R.string.version_download_url_error);
|
ToastUtil.show(R.string.version_download_url_error);
|
||||||
}
|
}
|
||||||
} else if (CommonAppConfig.IS_GOOGLE_PLAY) {
|
} else if (CommonAppConfig.IS_GOOGLE_PLAY) {
|
||||||
if (configBean.getGoogle_isup() != null && configBean.getGoogle_isup().equals("0")) {
|
if ( "0".equals(configBean.getGoogle_isup())) {
|
||||||
Log.e("tagg", "111111");
|
Log.e("tagg", "111111");
|
||||||
DialogUitl.Builder builder = new DialogUitl.Builder(context);
|
DialogUitl.Builder builder = new DialogUitl.Builder(context);
|
||||||
builder.setTitle(WordUtil.getString(R.string.version_update))
|
builder.setTitle(WordUtil.getString(R.string.version_update))
|
||||||
|
@ -51,7 +51,7 @@ public class LiveFaceUnityDialogFragment extends AbsDialogFragment {
|
|||||||
|
|
||||||
WindowManager.LayoutParams params = window.getAttributes();
|
WindowManager.LayoutParams params = window.getAttributes();
|
||||||
params.width = ActionBar.LayoutParams.MATCH_PARENT;
|
params.width = ActionBar.LayoutParams.MATCH_PARENT;
|
||||||
params.height = ActionBar.LayoutParams.WRAP_CONTENT;
|
params.height = ActionBar.LayoutParams.WRAP_CONTENT;
|
||||||
params.gravity = Gravity.BOTTOM;
|
params.gravity = Gravity.BOTTOM;
|
||||||
window.setAttributes(params);
|
window.setAttributes(params);
|
||||||
|
|
||||||
@ -60,6 +60,7 @@ public class LiveFaceUnityDialogFragment extends AbsDialogFragment {
|
|||||||
@Override
|
@Override
|
||||||
public void onActivityCreated(@Nullable Bundle savedInstanceState) {
|
public void onActivityCreated(@Nullable Bundle savedInstanceState) {
|
||||||
super.onActivityCreated(savedInstanceState);
|
super.onActivityCreated(savedInstanceState);
|
||||||
|
manager.setFaceUnityView(faceView);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setManager(FaceManager manager) {
|
public void setManager(FaceManager manager) {
|
||||||
|
Loading…
Reference in New Issue
Block a user