美颜补充对比键功能
This commit is contained in:
parent
7033f5e707
commit
04f0953cfa
@ -11,9 +11,6 @@ import android.hardware.SensorManager;
|
||||
import android.os.Environment;
|
||||
import android.util.Log;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
import com.faceunity.core.callback.OperateCallback;
|
||||
import com.faceunity.core.entity.FURenderOutputData;
|
||||
import com.faceunity.core.enumeration.CameraFacingEnum;
|
||||
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.FUTransformMatrixEnum;
|
||||
import com.faceunity.core.faceunity.FUAIKit;
|
||||
import com.faceunity.core.faceunity.FURenderManager;
|
||||
import com.faceunity.core.utils.CameraUtils;
|
||||
import com.faceunity.core.utils.FULogger;
|
||||
import com.yunbao.faceunity.data.FaceUnityDataFactory;
|
||||
import com.yunbao.faceunity.listener.FURendererListener;
|
||||
import com.yunbao.faceunity.ui.FaceUnityView;
|
||||
import com.yunbao.faceunity.utils.Authpack;
|
||||
import com.yunbao.faceunity.utils.CSVUtils;
|
||||
import com.yunbao.faceunity.utils.FURenderer;
|
||||
import com.yunbao.faceunity.utils.FaceUnityData;
|
||||
@ -50,6 +44,7 @@ public class FaceManager implements SensorEventListener {
|
||||
private static final String TAG = FaceManager.class.getSimpleName();
|
||||
private FaceUnityDataFactory mFaceUnityDataFactory;
|
||||
private FaceManager.FaceStatusChanged faceStatusChanged;
|
||||
private boolean pauseFace = false;
|
||||
|
||||
/**
|
||||
* 初始化美颜模块,在AppContext中调用
|
||||
@ -61,7 +56,7 @@ public class FaceManager implements SensorEventListener {
|
||||
FaceUnityData.mApplication = context;
|
||||
OkHttpUtils.getInstance().init(context, false);
|
||||
FURenderer.getInstance().setup(context);
|
||||
isInit=true;
|
||||
isInit = true;
|
||||
}
|
||||
|
||||
private FURenderer mFURenderer;
|
||||
@ -86,6 +81,24 @@ public class FaceManager implements SensorEventListener {
|
||||
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
|
||||
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();
|
||||
|
||||
|
@ -2,8 +2,8 @@ package com.yunbao.faceunity.ui;
|
||||
|
||||
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;
|
||||
@ -18,9 +18,8 @@ import com.yunbao.faceunity.R;
|
||||
import com.yunbao.faceunity.adapters.ContainerRecyclerAdapter;
|
||||
import com.yunbao.faceunity.adapters.MenuGroupRecyclerAdapter;
|
||||
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.entity.BaseBean;
|
||||
import com.yunbao.faceunity.entity.FunctionEnum;
|
||||
import com.yunbao.faceunity.entity.MakeupCustomClassBean;
|
||||
import com.yunbao.faceunity.entity.MenuGroupBean;
|
||||
@ -52,8 +51,9 @@ public class FaceUnityView extends LinearLayout implements StickerDownloadHelper
|
||||
private TabLayout tabLayout;
|
||||
private TextView title;
|
||||
private LinearLayout menu2, menuDiy, reset, menu2Reset;
|
||||
private ImageView menu2Back, back, close;
|
||||
private ImageView menu2Back, back, close, contrast;
|
||||
private DiscreteSeekBar seekBar;
|
||||
private IFaceUnityInter iFaceUnityInter;
|
||||
|
||||
public FaceUnityView(Context context) {
|
||||
super(context);
|
||||
@ -96,6 +96,7 @@ public class FaceUnityView extends LinearLayout implements StickerDownloadHelper
|
||||
menu2Reset = findViewById(R.id.menu2_reset);
|
||||
menuDiy = findViewById(R.id.menu_diy);
|
||||
seekBar = findViewById(R.id.item_seekBar);
|
||||
contrast = findViewById(R.id.item_contrast);
|
||||
initMenuGroup();
|
||||
setContainerRecycler(new ArrayList<>());
|
||||
initViewClick();
|
||||
@ -107,9 +108,9 @@ public class FaceUnityView extends LinearLayout implements StickerDownloadHelper
|
||||
private void initViewClick() {
|
||||
menu2Back.setOnClickListener(v -> {
|
||||
Object tag = menu2Back.getTag();
|
||||
if(tag==null) {
|
||||
if (tag == null) {
|
||||
goBackMainMenu();
|
||||
}else if(tag.equals("makeup")){
|
||||
} else if (tag.equals("makeup")) {
|
||||
title.setText(R.string.home_function_name_makeup);
|
||||
title.setVisibility(VISIBLE);
|
||||
menuDiy.setVisibility(VISIBLE);
|
||||
@ -129,6 +130,25 @@ public class FaceUnityView extends LinearLayout implements StickerDownloadHelper
|
||||
menu2Reset.setOnClickListener(view -> {
|
||||
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个
|
||||
*
|
||||
* @param count
|
||||
*/
|
||||
private void changeRecyclerItemCount(int count) {
|
||||
@ -371,6 +392,7 @@ public class FaceUnityView extends LinearLayout implements StickerDownloadHelper
|
||||
|
||||
/**
|
||||
* 设置美颜Recycler内容
|
||||
*
|
||||
* @param 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 interface IFaceUnityInter {
|
||||
void onPause();
|
||||
|
||||
void onStart();
|
||||
}
|
||||
}
|
||||
|
@ -6,13 +6,18 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical">
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_gravity="center"
|
||||
android:layout_height="wrap_content"
|
||||
>
|
||||
|
||||
|
||||
<com.yunbao.faceunity.seekbar.DiscreteSeekBar
|
||||
android:id="@+id/item_seekBar"
|
||||
android:layout_width="300dp"
|
||||
android:layout_height="@dimen/x48"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:layout_marginTop="@dimen/x24"
|
||||
android:layout_marginBottom="@dimen/x15"
|
||||
android:paddingTop="20dp"
|
||||
android:visibility="gone"
|
||||
app:dsb_indicatorColor="#CDCDCD"
|
||||
@ -27,7 +32,22 @@
|
||||
app:dsb_trackBaseHeight="@dimen/x16"
|
||||
app:dsb_trackColor="#4D4D4D"
|
||||
app:dsb_trackHeight="@dimen/x16"
|
||||
app:dsb_value="0" />
|
||||
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
|
||||
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() {
|
||||
super.onCreate();
|
||||
//注册全局异常捕获
|
||||
registerError();
|
||||
// registerError();
|
||||
sInstance = this;
|
||||
L.setDeBug(BuildConfig.DEBUG);
|
||||
AppEventsLogger.activateApp(this);
|
||||
|
@ -81,7 +81,7 @@ public class VersionUtil {
|
||||
|
||||
//谷歌更新
|
||||
} 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);
|
||||
builder.setTitle(WordUtil.getString(R.string.version_update))
|
||||
.setContent(configBean.getUpdateDes())
|
||||
@ -159,7 +159,7 @@ public class VersionUtil {
|
||||
ToastUtil.show(R.string.version_download_url_error);
|
||||
}
|
||||
} 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");
|
||||
DialogUitl.Builder builder = new DialogUitl.Builder(context);
|
||||
builder.setTitle(WordUtil.getString(R.string.version_update))
|
||||
|
@ -60,6 +60,7 @@ public class LiveFaceUnityDialogFragment extends AbsDialogFragment {
|
||||
@Override
|
||||
public void onActivityCreated(@Nullable Bundle savedInstanceState) {
|
||||
super.onActivityCreated(savedInstanceState);
|
||||
manager.setFaceUnityView(faceView);
|
||||
}
|
||||
|
||||
public void setManager(FaceManager manager) {
|
||||
|
Loading…
Reference in New Issue
Block a user