update
This commit is contained in:
parent
80c5609bb7
commit
d2bb4e4375
@ -2,35 +2,24 @@ package com.yunbao.faceunity;
|
||||
|
||||
import static android.content.Context.SENSOR_SERVICE;
|
||||
|
||||
import static com.lzy.okgo.utils.HttpUtils.runOnUiThread;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.BitmapFactory;
|
||||
import android.hardware.Camera;
|
||||
import android.hardware.Sensor;
|
||||
import android.hardware.SensorEvent;
|
||||
import android.hardware.SensorEventListener;
|
||||
import android.hardware.SensorManager;
|
||||
import android.opengl.GLSurfaceView;
|
||||
import android.os.Environment;
|
||||
import android.util.Log;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import com.faceunity.core.callback.OperateCallback;
|
||||
import com.faceunity.core.entity.FURenderFrameData;
|
||||
import com.faceunity.core.entity.FURenderInputData;
|
||||
import com.faceunity.core.entity.FURenderOutputData;
|
||||
import com.faceunity.core.enumeration.CameraFacingEnum;
|
||||
import com.faceunity.core.enumeration.FUAIProcessorEnum;
|
||||
import com.faceunity.core.enumeration.FUInputTextureEnum;
|
||||
import com.faceunity.core.enumeration.FUTransformMatrixEnum;
|
||||
import com.faceunity.core.faceunity.FURenderKit;
|
||||
import com.faceunity.core.faceunity.FURenderManager;
|
||||
import com.faceunity.core.listener.OnGlRendererListener;
|
||||
import com.faceunity.core.renderer.CameraRenderer;
|
||||
import com.faceunity.core.utils.CameraUtils;
|
||||
import com.faceunity.core.utils.FULogger;
|
||||
import com.yunbao.faceunity.data.FaceUnityDataFactory;
|
||||
@ -39,23 +28,17 @@ 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.FaceCameraConfig;
|
||||
import com.yunbao.faceunity.utils.FaceUnityData;
|
||||
import com.yunbao.faceunity.utils.net.OkHttpUtils;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileOutputStream;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Arrays;
|
||||
import java.util.Date;
|
||||
import java.util.Locale;
|
||||
|
||||
import cn.rongcloud.rtc.api.RCRTCEngine;
|
||||
import cn.rongcloud.rtc.api.callback.IRCRTCVideoOutputFrameListener;
|
||||
import cn.rongcloud.rtc.api.stream.RCRTCVideoView;
|
||||
import cn.rongcloud.rtc.base.RCRTCVideoFrame;
|
||||
import cn.rongcloud.rtc.core.EglRenderer;
|
||||
import io.rong.callkit.SingleCallActivity;
|
||||
|
||||
/**
|
||||
* 美颜模块管理类,接入测试中
|
||||
@ -64,6 +47,7 @@ public class FaceManager implements SensorEventListener {
|
||||
private static boolean isInit = false;
|
||||
private static final String TAG = FaceManager.class.getSimpleName();
|
||||
private FaceUnityDataFactory mFaceUnityDataFactory;
|
||||
private FaceManager.FaceStatusChanged faceStatusChanged;
|
||||
|
||||
/**
|
||||
* 初始化美颜模块,在AppContext中调用
|
||||
@ -72,7 +56,7 @@ public class FaceManager implements SensorEventListener {
|
||||
if (isInit) {
|
||||
return;
|
||||
}
|
||||
FaceUnityData.mApplication=context;
|
||||
FaceUnityData.mApplication = context;
|
||||
OkHttpUtils.getInstance().init(context, false);
|
||||
FURenderManager.setCoreDebug(FULogger.LogLevel.OFF);
|
||||
FURenderManager.setKitDebug(FULogger.LogLevel.OFF);
|
||||
@ -91,6 +75,7 @@ public class FaceManager implements SensorEventListener {
|
||||
}
|
||||
|
||||
private FURenderer mFURenderer;
|
||||
private FaceUnityView faceUnityView;
|
||||
|
||||
/**
|
||||
* 配置美颜SDK
|
||||
@ -115,8 +100,13 @@ public class FaceManager implements SensorEventListener {
|
||||
/**
|
||||
* 绑定控制view
|
||||
*/
|
||||
public void bindControlView(FaceUnityView view){
|
||||
view.bindDataFactory(mFaceUnityDataFactory);
|
||||
public void bindControlView(FaceUnityView view) {
|
||||
this.faceUnityView = view;
|
||||
faceUnityView.bindDataFactory(mFaceUnityDataFactory);
|
||||
}
|
||||
|
||||
public void setFaceStatusChanged(FaceStatusChanged faceStatusChanged) {
|
||||
this.faceStatusChanged = faceStatusChanged;
|
||||
}
|
||||
|
||||
private boolean mIsFirstFrame = true;
|
||||
@ -193,12 +183,16 @@ public class FaceManager implements SensorEventListener {
|
||||
@Override
|
||||
public void onTrackStatusChanged(FUAIProcessorEnum type, int status) {
|
||||
Log.e(TAG, "onTrackStatusChanged: 人脸数: " + status);
|
||||
if (faceStatusChanged != null) {
|
||||
faceStatusChanged.onFaceChanged(status);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFpsChanged(double fps, double callTime) {
|
||||
final String FPS = String.format(Locale.getDefault(), "%.2f", fps);
|
||||
// Log.d(TAG, "onFpsChanged FPS: " + FPS + ", callTime: " + String.format("%.2f", callTime));
|
||||
// Log.d(TAG, "onFpsChanged FPS: " + FPS + ", callTime: " + String.format("%.2f", callTime));
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -218,10 +212,15 @@ public class FaceManager implements SensorEventListener {
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 离开渲染界面时注销融云监听器,不然会绿屏
|
||||
*/
|
||||
public void onClose() {
|
||||
RCRTCEngine.getInstance().getDefaultVideoStream().setVideoFrameListener(null);
|
||||
}
|
||||
|
||||
public interface FaceStatusChanged {
|
||||
void onFaceChanged(int num);
|
||||
}
|
||||
}
|
||||
|
@ -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;
|
||||
@ -71,16 +72,17 @@ public class ContainerRecyclerAdapter extends RecyclerView.Adapter<BaseViewHolde
|
||||
}
|
||||
seekBar.setVisibility(View.VISIBLE);
|
||||
if (seekY == 0) {
|
||||
seekY = seekBar.getY();
|
||||
seekBar.setY(seekY - DpUtil.dp2px(20));
|
||||
seekY = seekBar.getY() - DpUtil.dp2px(20);
|
||||
}
|
||||
seekBar.setY(seekY);
|
||||
}
|
||||
public void hideSeekBar(){
|
||||
if(seekBar.getVisibility()==View.INVISIBLE){
|
||||
|
||||
public void hideSeekBar() {
|
||||
if (seekBar.getVisibility() == View.GONE) {
|
||||
return;
|
||||
}
|
||||
seekBar.setOnProgressChangeListener(null);
|
||||
seekBar.setVisibility(View.INVISIBLE);
|
||||
seekBar.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
|
||||
@ -105,6 +107,7 @@ public class ContainerRecyclerAdapter extends RecyclerView.Adapter<BaseViewHolde
|
||||
animojiDataFactory = new AnimojiDataFactory(0, 0);
|
||||
makeupDataFactory = new MakeupDataFactory(0);
|
||||
bodyBeautyDataFactory = new BodyBeautyDataFactory();
|
||||
bodyBeautyDataFactory.bindCurrentRenderer();
|
||||
}
|
||||
|
||||
public void setList(ArrayList<? extends BaseBean> list) {
|
||||
@ -221,17 +224,21 @@ public class ContainerRecyclerAdapter extends RecyclerView.Adapter<BaseViewHolde
|
||||
}
|
||||
|
||||
public void save(String key, String data) {
|
||||
FaceSPUtils.getInstance().saveString(key,data);
|
||||
FaceSPUtils.getInstance().saveString(key, data);
|
||||
}
|
||||
public String getString(String key){
|
||||
|
||||
public String getString(String key) {
|
||||
return FaceSPUtils.getInstance().getString(key);
|
||||
}
|
||||
public void del(String key){
|
||||
|
||||
public void del(String key) {
|
||||
FaceSPUtils.getInstance().del(key);
|
||||
}
|
||||
public void reset(){
|
||||
if(vh!=null){
|
||||
vh.reset(list);
|
||||
}
|
||||
|
||||
public void reset() {
|
||||
if (vh != null) {
|
||||
vh.reset(list);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -23,7 +23,7 @@ public class AnimojiViewHolder extends BaseViewHolder {
|
||||
icon = itemView.findViewById(R.id.iv_control);
|
||||
itemView.setOnClickListener(v -> {
|
||||
adapter.getAnimojiDataFactory().onAnimojiSelected((AnimojiBean) itemView.getTag());
|
||||
setSelectPosition(getAdapterPosition());
|
||||
setSelectPosition(getLayoutPosition());
|
||||
saveData();
|
||||
});
|
||||
}
|
||||
@ -44,21 +44,26 @@ public class AnimojiViewHolder extends BaseViewHolder {
|
||||
@Override
|
||||
public boolean loadData() {
|
||||
String data = adapter.getString(getName(this));
|
||||
if (data != null) {
|
||||
icon.setSelected(getAdapterPosition() == Integer.parseInt(data));
|
||||
return true;
|
||||
if (data == null) {
|
||||
return false;
|
||||
}
|
||||
if (!data.equals(String.valueOf(getLayoutPosition()))) {
|
||||
return false;
|
||||
}
|
||||
icon.setSelected(true);
|
||||
adapter.getAnimojiDataFactory().onAnimojiSelected((AnimojiBean) itemView.getTag());
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void saveData() {
|
||||
adapter.save(getName(this), String.valueOf(getAdapterPosition()));
|
||||
adapter.save(getName(this), String.valueOf(getLayoutPosition()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void reset(List<? extends BaseBean> list) {
|
||||
adapter.del(getName(this));
|
||||
adapter.getAnimojiDataFactory().onAnimojiSelected((AnimojiBean) list.get(0));
|
||||
adapter.setSelectPosition(0);
|
||||
}
|
||||
|
||||
|
@ -69,7 +69,8 @@ public class BigHeadViewHolder extends BaseViewHolder {
|
||||
@Override
|
||||
public void reset(List<? extends BaseBean> list) {
|
||||
adapter.del(getName(this));
|
||||
itemView.callOnClick();
|
||||
adapter.getPropDataFactory().setPropType(FunctionEnum.BIG_HEAD);
|
||||
adapter.getPropDataFactory().onItemSelected((PropBean) list.get(0));
|
||||
adapter.setSelectPosition(0);
|
||||
}
|
||||
}
|
||||
|
@ -15,6 +15,9 @@ import com.yunbao.faceunity.seekbar.DiscreteSeekBar;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 美妆 - 自定义
|
||||
*/
|
||||
public class MakeupCustomItemViewHolder extends BaseViewHolder {
|
||||
private ImageView icon;
|
||||
private TextView title;
|
||||
|
@ -9,6 +9,7 @@ import androidx.annotation.NonNull;
|
||||
import com.yunbao.faceunity.R;
|
||||
import com.yunbao.faceunity.entity.BaseBean;
|
||||
import com.yunbao.faceunity.entity.MakeupCombinationBean;
|
||||
import com.yunbao.faceunity.utils.FaceSPUtils;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@ -72,6 +73,10 @@ public class MakeupViewHolder extends BaseViewHolder {
|
||||
|
||||
@Override
|
||||
public void reset(List<? extends BaseBean>list) {
|
||||
|
||||
adapter.del(getName(this));
|
||||
FaceSPUtils.getInstance().delStart("MakeupCustomItemViewHolder");
|
||||
adapter.getMakeupDataFactory().onMakeupCombinationSelected((MakeupCombinationBean) list.get(0));
|
||||
adapter.getMakeupDataFactory().clearAll();
|
||||
adapter.setSelectPosition(0);
|
||||
}
|
||||
}
|
||||
|
@ -68,7 +68,8 @@ public class StickerViewHolder extends BaseViewHolder{
|
||||
@Override
|
||||
public void reset(List<? extends BaseBean> list) {
|
||||
adapter.del(getName(this));
|
||||
itemView.callOnClick();
|
||||
adapter.getPropDataFactory().setPropType(FunctionEnum.STICKER);
|
||||
adapter.getPropDataFactory().onItemSelected((PropBean) list.get(0));
|
||||
adapter.setSelectPosition(0);
|
||||
}
|
||||
}
|
||||
|
@ -2,6 +2,8 @@ package com.yunbao.faceunity.data;
|
||||
|
||||
import com.faceunity.core.controller.bodyBeauty.BodyBeautyParam;
|
||||
import com.faceunity.core.entity.FUBundleData;
|
||||
import com.faceunity.core.enumeration.FUAITypeEnum;
|
||||
import com.faceunity.core.faceunity.FUAIKit;
|
||||
import com.faceunity.core.faceunity.FURenderKit;
|
||||
import com.faceunity.core.model.bodyBeauty.BodyBeauty;
|
||||
|
||||
@ -9,6 +11,7 @@ import com.yunbao.faceunity.entity.BodyBeautyBean;
|
||||
import com.yunbao.faceunity.entity.ModelAttributeData;
|
||||
import com.yunbao.faceunity.infe.AbstractBodyBeautyDataFactory;
|
||||
import com.yunbao.faceunity.repo.BodyBeautySource;
|
||||
import com.yunbao.faceunity.utils.FaceUnityConfig;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
@ -31,13 +34,14 @@ public class BodyBeautyDataFactory extends AbstractBodyBeautyDataFactory {
|
||||
|
||||
|
||||
/*渲染控制器*/
|
||||
private final FURenderKit mFURenderKit = FURenderKit.getInstance();
|
||||
private FURenderKit mFURenderKit = FURenderKit.getInstance();
|
||||
private FUAIKit mFUAIKit = FUAIKit.getInstance();
|
||||
|
||||
/*美体数据模型*/
|
||||
public final BodyBeauty bodyBeauty;
|
||||
|
||||
public BodyBeautyDataFactory() {
|
||||
bodyBeauty = new BodyBeauty(new FUBundleData(BodyBeautySource.BUNDLE_BODY_BEAUTY));
|
||||
bodyBeauty = new BodyBeauty(new FUBundleData(FaceUnityConfig.BUNDLE_BODY_BEAUTY));
|
||||
|
||||
}
|
||||
|
||||
@ -90,6 +94,13 @@ public class BodyBeautyDataFactory extends AbstractBodyBeautyDataFactory {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void enableBodyBeauty(boolean enable) {
|
||||
if (mFURenderKit.getBodyBeauty() != null) {
|
||||
mFURenderKit.getBodyBeauty().setEnable(enable);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取当前模型
|
||||
*
|
||||
@ -99,22 +110,11 @@ public class BodyBeautyDataFactory extends AbstractBodyBeautyDataFactory {
|
||||
return bodyBeauty;
|
||||
}
|
||||
|
||||
/**
|
||||
* 美体开关设置
|
||||
*
|
||||
* @param enable
|
||||
*/
|
||||
@Override
|
||||
public void enableBodyBeauty(boolean enable) {
|
||||
if (mFURenderKit.getBodyBeauty() != null) {
|
||||
mFURenderKit.getBodyBeauty().setEnable(enable);
|
||||
}
|
||||
}
|
||||
|
||||
/*模型映射设置模型值*/
|
||||
private final HashMap<String, BodyBeautySetParamInterface> bodyBeautySetMapping = new HashMap<String, BodyBeautySetParamInterface>() {
|
||||
{
|
||||
put(BodyBeautyParam.BODY_SLIM_INTENSITY, value -> getCurrentBodyBeautyModel().setBodySlimIntensity(value));
|
||||
put(BodyBeautyParam.BODY_SLIM_INTENSITY, value -> getCurrentBodyBeautyModel().setBodySlimIntensity(value));
|
||||
put(BodyBeautyParam.LEG_STRETCH_INTENSITY, value -> getCurrentBodyBeautyModel().setLegStretchIntensity(value));
|
||||
put(BodyBeautyParam.WAIST_SLIM_INTENSITY, value -> getCurrentBodyBeautyModel().setWaistSlimIntensity(value));
|
||||
put(BodyBeautyParam.SHOULDER_SLIM_INTENSITY, value -> getCurrentBodyBeautyModel().setShoulderSlimIntensity(value));
|
||||
@ -127,13 +127,13 @@ public class BodyBeautyDataFactory extends AbstractBodyBeautyDataFactory {
|
||||
/*模型映射获取模型值*/
|
||||
HashMap<String, BodyBeautyGetParamInterface> bodyBeautyGetMapping = new HashMap<String, BodyBeautyGetParamInterface>() {
|
||||
{
|
||||
put(BodyBeautyParam.BODY_SLIM_INTENSITY, () -> getCurrentBodyBeautyModel().getBodySlimIntensity());
|
||||
put(BodyBeautyParam.LEG_STRETCH_INTENSITY, () -> getCurrentBodyBeautyModel().getLegStretchIntensity());
|
||||
put(BodyBeautyParam.WAIST_SLIM_INTENSITY, () -> getCurrentBodyBeautyModel().getWaistSlimIntensity());
|
||||
put(BodyBeautyParam.SHOULDER_SLIM_INTENSITY, () -> getCurrentBodyBeautyModel().getShoulderSlimIntensity());
|
||||
put(BodyBeautyParam.HIP_SLIM_INTENSITY, () -> getCurrentBodyBeautyModel().getHipSlimIntensity());
|
||||
put(BodyBeautyParam.HEAD_SLIM_INTENSITY, () -> getCurrentBodyBeautyModel().getHeadSlimIntensity());
|
||||
put(BodyBeautyParam.LEG_SLIM_INTENSITY, () -> getCurrentBodyBeautyModel().getLegSlimIntensity());
|
||||
put(BodyBeautyParam.BODY_SLIM_INTENSITY, ()->getCurrentBodyBeautyModel().getBodySlimIntensity());
|
||||
put(BodyBeautyParam.LEG_STRETCH_INTENSITY, ()->getCurrentBodyBeautyModel().getLegStretchIntensity());
|
||||
put(BodyBeautyParam.WAIST_SLIM_INTENSITY, ()->getCurrentBodyBeautyModel().getWaistSlimIntensity());
|
||||
put(BodyBeautyParam.SHOULDER_SLIM_INTENSITY, ()->getCurrentBodyBeautyModel().getShoulderSlimIntensity());
|
||||
put(BodyBeautyParam.HIP_SLIM_INTENSITY, ()->getCurrentBodyBeautyModel().getHipSlimIntensity());
|
||||
put(BodyBeautyParam.HEAD_SLIM_INTENSITY, ()->getCurrentBodyBeautyModel().getHeadSlimIntensity());
|
||||
put(BodyBeautyParam.LEG_SLIM_INTENSITY, ()->getCurrentBodyBeautyModel().getLegSlimIntensity());
|
||||
|
||||
}
|
||||
};
|
||||
@ -143,8 +143,18 @@ public class BodyBeautyDataFactory extends AbstractBodyBeautyDataFactory {
|
||||
* FURenderKit加载当前特效
|
||||
*/
|
||||
public void bindCurrentRenderer() {
|
||||
mFUAIKit.loadAIProcessor(FaceUnityConfig.getAIHumanBundle(), FUAITypeEnum.FUAITYPE_HUMAN_PROCESSOR);
|
||||
mFUAIKit.setMaxFaces(1);
|
||||
mFURenderKit.setFaceBeauty(FaceBeautyDataFactory.faceBeauty);
|
||||
mFURenderKit.setBodyBeauty(bodyBeauty);
|
||||
}
|
||||
|
||||
/**
|
||||
* 结束需要释放AI驱动
|
||||
*/
|
||||
public void releaseAIProcessor() {
|
||||
mFUAIKit.releaseAIProcessor(FUAITypeEnum.FUAITYPE_HUMAN_PROCESSOR);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@ -846,4 +846,8 @@ public class MakeupDataFactory extends AbstractMakeupDataFactory {
|
||||
mFURenderKit.getPropContainer().addProp(expressionRecognition);
|
||||
}
|
||||
}
|
||||
public void clearAll(){
|
||||
currentMakeup = new Makeup(new FUBundleData(FaceUnityConfig.BUNDLE_FACE_MAKEUP));
|
||||
mFURenderKit.setMakeup(currentMakeup);
|
||||
}
|
||||
}
|
@ -3,6 +3,7 @@ package com.yunbao.faceunity.ui;
|
||||
import android.content.Context;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.TextView;
|
||||
@ -111,9 +112,24 @@ public class FaceUnityView extends LinearLayout implements StickerDownloadHelper
|
||||
}
|
||||
|
||||
private void initViewClick() {
|
||||
menu2Back.setOnClickListener(v -> goBackMainMenu());
|
||||
menu2Back.setOnClickListener(v -> {
|
||||
Object tag = menu2Back.getTag();
|
||||
if(tag==null) {
|
||||
goBackMainMenu();
|
||||
}else if(tag.equals("makeup")){
|
||||
title.setText(R.string.home_function_name_makeup);
|
||||
title.setVisibility(VISIBLE);
|
||||
menuDiy.setVisibility(VISIBLE);
|
||||
tabLayout.removeAllTabs();
|
||||
changeRecyclerItemCount(5);
|
||||
setContainerRecycler(MakeupSource.buildCombinations());
|
||||
menu2Back.setTag(null);
|
||||
}
|
||||
});
|
||||
menuDiy.setOnClickListener(v -> {
|
||||
menu2Back.setTag("makeup");
|
||||
changeRecyclerItemCount(5);
|
||||
menuDiy.setVisibility(GONE);
|
||||
ArrayList<MakeupCustomClassBean> list = MakeupSource.buildCustomClasses();
|
||||
setTab(createTabs(list));
|
||||
});
|
||||
@ -128,6 +144,7 @@ public class FaceUnityView extends LinearLayout implements StickerDownloadHelper
|
||||
title.setVisibility(VISIBLE);
|
||||
menu2.setVisibility(GONE);
|
||||
menuGroup.setVisibility(VISIBLE);
|
||||
menuDiy.setVisibility(GONE);
|
||||
}
|
||||
|
||||
|
||||
|
@ -30,4 +30,12 @@ public class FaceSPUtils {
|
||||
public void del(String key) {
|
||||
mSharedPreferences.edit().remove(key).apply();
|
||||
}
|
||||
|
||||
public void delStart(String key){
|
||||
for (String _key : mSharedPreferences.getAll().keySet()) {
|
||||
if(_key.startsWith(key)){
|
||||
mSharedPreferences.edit().remove(key).apply();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -13,8 +13,8 @@
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:layout_marginTop="@dimen/x24"
|
||||
android:layout_marginBottom="@dimen/x15"
|
||||
android:paddingTop="20dp"
|
||||
android:visibility="gone"
|
||||
android:paddingTop="10dp"
|
||||
app:dsb_indicatorColor="#CDCDCD"
|
||||
app:dsb_indicatorElevation="0dp"
|
||||
app:dsb_indicatorPopupEnabled="true"
|
||||
@ -171,6 +171,8 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="10dp"
|
||||
android:layout_weight="0"
|
||||
android:paddingStart="10dp"
|
||||
android:paddingEnd="10dp"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
@ -186,8 +188,10 @@
|
||||
|
||||
<com.google.android.material.tabs.TabLayout
|
||||
android:id="@+id/menu2_tab"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
app:tabMaxWidth="100dp"
|
||||
app:tabMode="scrollable"
|
||||
app:tabSelectedTextColor="#F6F7FB"
|
||||
app:tabTextColor="#9A9A9A" />
|
||||
</HorizontalScrollView>
|
||||
|
Binary file not shown.
Before Width: | Height: | Size: 6.8 KiB After Width: | Height: | Size: 4.8 KiB |
Binary file not shown.
After Width: | Height: | Size: 4.8 KiB |
@ -148,13 +148,6 @@ public class LauncherActivity extends AppCompatActivity implements View.OnClickL
|
||||
}
|
||||
};
|
||||
mHandler.sendEmptyMessageDelayed(WHAT_GET_CONFIG, 1000);
|
||||
mCover.setOnClickListener(v -> {
|
||||
FaceManager manager = new FaceManager();
|
||||
manager.initFURender(mContext);
|
||||
LiveFaceUnityDialogFragment fragment = new LiveFaceUnityDialogFragment(mContext);
|
||||
fragment.setManager(manager);
|
||||
fragment.show(((LauncherActivity) mContext).getSupportFragmentManager(), "FaceUnity");
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
@ -47,6 +47,7 @@ import com.yunbao.live.bean.LiveKsyConfigBean;
|
||||
import com.yunbao.live.bean.LiveReceiveGiftBean;
|
||||
import com.yunbao.live.bean.WishlistModel;
|
||||
import com.yunbao.live.dialog.LiveBeautyDialogFragment;
|
||||
import com.yunbao.live.dialog.LiveFaceUnityDialogFragment;
|
||||
import com.yunbao.live.dialog.LiveFunctionDialogFragment;
|
||||
import com.yunbao.live.dialog.LiveLinkMicListDialogFragment;
|
||||
import com.yunbao.live.dialog.LiveMicUserDialogFragment;
|
||||
|
@ -6,6 +6,8 @@ import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import android.os.Looper;
|
||||
import android.text.TextUtils;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
@ -71,6 +73,7 @@ public class LiveNewReadyRyViewHolder extends AbsViewHolder implements View.OnCl
|
||||
private int mLiveSdk;
|
||||
private LiveClassBean classBean;
|
||||
private FaceManager manager;
|
||||
private TextView faceTextView;//提示人脸未检测到的TextView
|
||||
|
||||
public LiveNewReadyRyViewHolder(Context context, ViewGroup parentView, int liveSdk) {
|
||||
super(context, parentView, liveSdk);
|
||||
@ -120,6 +123,8 @@ public class LiveNewReadyRyViewHolder extends AbsViewHolder implements View.OnCl
|
||||
mLiveClass = (TextView) findViewById(R.id.live_class);
|
||||
mLiveTypeTextView = (TextView) findViewById(R.id.text_room_type);
|
||||
mLiveWishListTextView = (TextView) findViewById(R.id.text_wishlist);
|
||||
faceTextView=(TextView)findViewById(R.id.faceTextView);
|
||||
|
||||
mImageUtil = ((LiveActivity) mContext).getProcessImageUtil();
|
||||
mImageUtil.setImageResultCallback(new ImageResultCallback() {
|
||||
|
||||
@ -188,6 +193,20 @@ public class LiveNewReadyRyViewHolder extends AbsViewHolder implements View.OnCl
|
||||
}
|
||||
};
|
||||
manager = new FaceManager();
|
||||
manager.setFaceStatusChanged(new FaceManager.FaceStatusChanged() {
|
||||
final Handler handler = new Handler(Looper.getMainLooper());
|
||||
|
||||
@Override
|
||||
public void onFaceChanged(int num) {
|
||||
handler.post(() -> {
|
||||
if (num == 0) {
|
||||
faceTextView.setVisibility(View.VISIBLE);
|
||||
} else {
|
||||
faceTextView.setVisibility(View.GONE);
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
manager.initFURender(mContext);
|
||||
manager.drawRongFrame(mContext);
|
||||
}
|
||||
@ -229,6 +248,7 @@ public class LiveNewReadyRyViewHolder extends AbsViewHolder implements View.OnCl
|
||||
public void setFaceUnity() {
|
||||
LiveFaceUnityDialogFragment fragment = new LiveFaceUnityDialogFragment(mContext);
|
||||
fragment.setManager(manager);
|
||||
|
||||
if (mContext instanceof LiveRyAnchorActivity) {
|
||||
fragment.show(((LiveRyAnchorActivity) mContext).getSupportFragmentManager(), "FaceUnity");
|
||||
}
|
||||
|
@ -108,6 +108,7 @@ import com.yunbao.live.bean.WishlistItemModel;
|
||||
import com.yunbao.live.custom.LiveLightView;
|
||||
import com.yunbao.live.custom.RightGradual;
|
||||
import com.yunbao.live.custom.TopGradual;
|
||||
import com.yunbao.live.dialog.LiveFaceUnityDialogFragment;
|
||||
import com.yunbao.live.dialog.LiveFansMedalDialogFragment;
|
||||
import com.yunbao.live.dialog.LiveHDDialogFragment;
|
||||
import com.yunbao.live.dialog.LiveUserDialogFragment;
|
||||
@ -963,7 +964,7 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
|
||||
reloadIM();
|
||||
}
|
||||
public void hideFloatMsg(){
|
||||
msg.setVisibility(View.GONE);
|
||||
msgLayout.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
private void showBanner2() {
|
||||
@ -2541,6 +2542,12 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
|
||||
*/
|
||||
public void startFace() {
|
||||
manager=new FaceManager();
|
||||
manager.setFaceStatusChanged(new FaceManager.FaceStatusChanged() {
|
||||
@Override
|
||||
public void onFaceChanged(int num) {
|
||||
|
||||
}
|
||||
});
|
||||
manager.initFURender(mContext);
|
||||
manager.drawRongFrame(mContext);
|
||||
}
|
||||
@ -2549,7 +2556,10 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
|
||||
* 切换美颜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.show(((LiveActivity)mContext).getSupportFragmentManager(),"faceUi");
|
||||
}
|
||||
|
||||
private static class LiveRoomHandler extends Handler {
|
||||
|
@ -249,5 +249,18 @@
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent" />
|
||||
|
||||
|
||||
<TextView
|
||||
android:id="@+id/faceTextView"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textColor="#FFFFFF"
|
||||
android:visibility="gone"
|
||||
android:textSize="16sp"
|
||||
android:text="@string/fu_base_is_tracking_text"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
Loading…
Reference in New Issue
Block a user