update
This commit is contained in:
@@ -27,6 +27,7 @@ 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;
|
||||
@@ -186,7 +187,7 @@ public class FaceManager implements SensorEventListener {
|
||||
@Override
|
||||
public void onPrepare() {
|
||||
mFaceUnityDataFactory.bindCurrentRenderer();
|
||||
Log.e(TAG, "mFURendererListener: onPrepare: ");
|
||||
//Log.e(TAG, "mFURendererListener: onPrepare: ");
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -197,7 +198,7 @@ public class FaceManager implements SensorEventListener {
|
||||
@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
|
||||
|
||||
@@ -4,12 +4,11 @@ import android.content.Context;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.yunbao.common.utils.DpUtil;
|
||||
import com.yunbao.faceunity.R;
|
||||
import com.yunbao.faceunity.adapters.vh.AnimViewHolder;
|
||||
import com.yunbao.faceunity.adapters.vh.AnimojiViewHolder;
|
||||
@@ -20,14 +19,21 @@ import com.yunbao.faceunity.adapters.vh.BeautySkinViewHolder;
|
||||
import com.yunbao.faceunity.adapters.vh.BigHeadViewHolder;
|
||||
import com.yunbao.faceunity.adapters.vh.FilterViewHolder;
|
||||
import com.yunbao.faceunity.adapters.vh.FineStickerViewHolder;
|
||||
import com.yunbao.faceunity.adapters.vh.MakeupCustomItemViewHolder;
|
||||
import com.yunbao.faceunity.adapters.vh.MakeupViewHolder;
|
||||
import com.yunbao.faceunity.adapters.vh.StickerViewHolder;
|
||||
import com.yunbao.faceunity.adapters.vh.StyleViewHolder;
|
||||
import com.yunbao.faceunity.data.AnimojiDataFactory;
|
||||
import com.yunbao.faceunity.data.BodyBeautyDataFactory;
|
||||
import com.yunbao.faceunity.data.FaceBeautyDataFactory;
|
||||
import com.yunbao.faceunity.data.FaceParam;
|
||||
import com.yunbao.faceunity.data.FineStickerDataFactory;
|
||||
import com.yunbao.faceunity.data.MakeupDataFactory;
|
||||
import com.yunbao.faceunity.data.PropDataFactory;
|
||||
import com.yunbao.faceunity.entity.BaseBean;
|
||||
import com.yunbao.faceunity.entity.ModelAttributeData;
|
||||
import com.yunbao.faceunity.entity.PropBean;
|
||||
import com.yunbao.faceunity.seekbar.DiscreteSeekBar;
|
||||
import com.yunbao.faceunity.utils.SeekBarUtils;
|
||||
import com.yunbao.faceunity.utils.FaceSPUtils;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
@@ -37,14 +43,66 @@ public class ContainerRecyclerAdapter extends RecyclerView.Adapter<BaseViewHolde
|
||||
private Context mContext;
|
||||
private List<? extends BaseBean> list;
|
||||
public int selectPosition = -1;
|
||||
private FaceBeautyDataFactory faceBeautyDataFactory;//美颜工厂
|
||||
private MakeupDataFactory makeupDataFactory;//美妆工厂
|
||||
private BodyBeautyDataFactory bodyBeautyDataFactory;//美体工厂
|
||||
private PropDataFactory propDataFactory;//道具业务工厂:道具贴图、AR面具、搞笑大头、表情识别、哈哈镜、手势识别
|
||||
private AnimojiDataFactory animojiDataFactory;//Animoji工厂
|
||||
private FineStickerDataFactory fineStickerDataFactory;//精品贴图
|
||||
private DiscreteSeekBar seekBar;
|
||||
private float seekY = 0;
|
||||
|
||||
public ContainerRecyclerAdapter(Context mContext) {
|
||||
this.mContext = mContext;
|
||||
initDataFactory();
|
||||
}
|
||||
|
||||
public void setSeekBar(DiscreteSeekBar seekBar) {
|
||||
this.seekBar = seekBar;
|
||||
}
|
||||
|
||||
public DiscreteSeekBar getSeekBar() {
|
||||
return seekBar;
|
||||
}
|
||||
|
||||
public void showSeekBar() {
|
||||
if (seekBar.getVisibility() == View.VISIBLE) {
|
||||
return;
|
||||
}
|
||||
seekBar.setVisibility(View.VISIBLE);
|
||||
if (seekY == 0) {
|
||||
seekY = seekBar.getY();
|
||||
}
|
||||
seekBar.setY(seekY - DpUtil.dp2px(20));
|
||||
}
|
||||
|
||||
|
||||
private void initDataFactory() {
|
||||
faceBeautyDataFactory = new FaceBeautyDataFactory(new FaceBeautyDataFactory.FaceBeautyListener() {
|
||||
@Override
|
||||
public void onFilterSelected(int res) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFaceBeautyEnable(boolean enable) {
|
||||
|
||||
}
|
||||
});
|
||||
propDataFactory = new PropDataFactory(new PropDataFactory.PropListener() {
|
||||
@Override
|
||||
public void onItemSelected(PropBean bean) {
|
||||
|
||||
}
|
||||
}, 0, 0);
|
||||
animojiDataFactory = new AnimojiDataFactory(0, 0);
|
||||
makeupDataFactory = new MakeupDataFactory(0);
|
||||
bodyBeautyDataFactory = new BodyBeautyDataFactory();
|
||||
}
|
||||
|
||||
public void setList(ArrayList<? extends BaseBean> list) {
|
||||
this.list = list;
|
||||
this.selectPosition = 0;
|
||||
this.selectPosition = -1;
|
||||
}
|
||||
|
||||
public int getSelectPosition() {
|
||||
@@ -56,11 +114,32 @@ public class ContainerRecyclerAdapter extends RecyclerView.Adapter<BaseViewHolde
|
||||
notifyDataSetChanged();
|
||||
}
|
||||
|
||||
public FaceBeautyDataFactory getFaceBeautyDataFactory() {
|
||||
return faceBeautyDataFactory;
|
||||
}
|
||||
|
||||
public MakeupDataFactory getMakeupDataFactory() {
|
||||
return makeupDataFactory;
|
||||
}
|
||||
|
||||
public BodyBeautyDataFactory getBodyBeautyDataFactory() {
|
||||
return bodyBeautyDataFactory;
|
||||
}
|
||||
|
||||
public PropDataFactory getPropDataFactory() {
|
||||
return propDataFactory;
|
||||
}
|
||||
|
||||
public AnimojiDataFactory getAnimojiDataFactory() {
|
||||
return animojiDataFactory;
|
||||
}
|
||||
|
||||
BaseViewHolder vh = null;
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public BaseViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
||||
LayoutInflater from = LayoutInflater.from(mContext);
|
||||
BaseViewHolder vh;
|
||||
switch (viewType) {
|
||||
case FaceParam.FACE_BEAUTY_SKIN:
|
||||
vh = new BeautySkinViewHolder(from.inflate(R.layout.list_item_face_config, parent, false));
|
||||
@@ -98,6 +177,18 @@ public class ContainerRecyclerAdapter extends RecyclerView.Adapter<BaseViewHolde
|
||||
case FaceParam.FACE_FINE_STICKER_GAME:
|
||||
vh = new FineStickerViewHolder(from.inflate(R.layout.list_item_face_config_fine_sticker, parent, false));
|
||||
break;
|
||||
case FaceParam.FACE_MAKEUP_TYPE_FOUNDATION:
|
||||
case FaceParam.FACE_MAKEUP_TYPE_LIP_STICK:
|
||||
case FaceParam.FACE_MAKEUP_TYPE_BLUSHER:
|
||||
case FaceParam.FACE_MAKEUP_TYPE_EYE_BROW:
|
||||
case FaceParam.FACE_MAKEUP_TYPE_EYE_SHADOW:
|
||||
case FaceParam.FACE_MAKEUP_TYPE_EYE_LINER:
|
||||
case FaceParam.FACE_MAKEUP_TYPE_EYE_LASH:
|
||||
case FaceParam.FACE_MAKEUP_TYPE_HIGH_LIGHT:
|
||||
case FaceParam.FACE_MAKEUP_TYPE_SHADOW:
|
||||
case FaceParam.FACE_MAKEUP_TYPE_EYE_PUPIL:
|
||||
vh = new MakeupCustomItemViewHolder(from.inflate(R.layout.list_item_face_config_filter, parent, false));
|
||||
break;
|
||||
default:
|
||||
vh = new BeautySkinViewHolder(LayoutInflater.from(mContext).inflate(R.layout.list_item_face_config, parent, false));
|
||||
}
|
||||
@@ -121,4 +212,10 @@ public class ContainerRecyclerAdapter extends RecyclerView.Adapter<BaseViewHolde
|
||||
|
||||
}
|
||||
|
||||
public void save(String key, String data) {
|
||||
FaceSPUtils.getInstance().saveString(key,data);
|
||||
}
|
||||
public String getString(String key){
|
||||
return FaceSPUtils.getInstance().getString(key);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,23 +6,39 @@ import android.widget.ImageView;
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
import com.yunbao.faceunity.R;
|
||||
import com.yunbao.faceunity.entity.AnimationFilterBean;
|
||||
import com.yunbao.faceunity.entity.BaseBean;
|
||||
|
||||
/**
|
||||
* 动画滤镜
|
||||
* 动画滤镜 *暂无权限
|
||||
*/
|
||||
public class AnimViewHolder extends BaseViewHolder{
|
||||
ImageView imageView;
|
||||
ImageView icon;
|
||||
public AnimViewHolder(@NonNull View itemView) {
|
||||
super(itemView);
|
||||
imageView=itemView.findViewById(R.id.iv_control);
|
||||
imageView.setBackgroundResource(R.drawable.bg_control_square_selector);
|
||||
itemView.setOnClickListener(v -> setSelectPosition(getAdapterPosition()));
|
||||
icon =itemView.findViewById(R.id.iv_control);
|
||||
icon.setBackgroundResource(R.drawable.bg_control_square_selector);
|
||||
itemView.setOnClickListener(v -> {
|
||||
adapter.getAnimojiDataFactory().onFilterSelected((AnimationFilterBean) itemView.getTag());
|
||||
setSelectPosition(getAdapterPosition());
|
||||
saveData();
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setData(BaseBean data) {
|
||||
imageView.setImageResource(data.getImageRes());
|
||||
imageView.setSelected(getAdapterPosition()==getSelectPosition());
|
||||
itemView.setTag(data);
|
||||
icon.setImageResource(data.getImageRes());
|
||||
icon.setSelected(getAdapterPosition()==getSelectPosition());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean loadData() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void saveData() {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,23 +5,52 @@ import android.widget.ImageView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
import com.yunbao.common.utils.ToastUtil;
|
||||
import com.yunbao.faceunity.R;
|
||||
import com.yunbao.faceunity.entity.AnimojiBean;
|
||||
import com.yunbao.faceunity.entity.BaseBean;
|
||||
|
||||
/**
|
||||
* Animoji
|
||||
*/
|
||||
public class AnimojiViewHolder extends BaseViewHolder{
|
||||
ImageView imageView;
|
||||
public class AnimojiViewHolder extends BaseViewHolder {
|
||||
ImageView icon;
|
||||
|
||||
public AnimojiViewHolder(@NonNull View itemView) {
|
||||
super(itemView);
|
||||
imageView=itemView.findViewById(R.id.iv_control);
|
||||
itemView.setOnClickListener(v -> setSelectPosition(getAdapterPosition()));
|
||||
icon = itemView.findViewById(R.id.iv_control);
|
||||
itemView.setOnClickListener(v -> {
|
||||
adapter.getAnimojiDataFactory().onAnimojiSelected((AnimojiBean) itemView.getTag());
|
||||
setSelectPosition(getAdapterPosition());
|
||||
saveData();
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setData(BaseBean data) {
|
||||
imageView.setImageResource(data.getImageRes());
|
||||
imageView.setSelected(getAdapterPosition()==getSelectPosition());
|
||||
itemView.setTag(data);
|
||||
icon.setImageResource(data.getImageRes());
|
||||
int adapterPosition = getAdapterPosition();
|
||||
int selectPosition = getSelectPosition();
|
||||
if(loadData()){
|
||||
return;
|
||||
}
|
||||
icon.setSelected(adapterPosition == selectPosition);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean loadData() {
|
||||
String data = adapter.getString(getClass().getSimpleName());
|
||||
if (data != null) {
|
||||
icon.setSelected(getAdapterPosition() == Integer.parseInt(data));
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void saveData() {
|
||||
adapter.save(getClass().getSimpleName(), String.valueOf(getAdapterPosition()));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -27,7 +27,14 @@ public abstract class BaseViewHolder extends RecyclerView.ViewHolder {
|
||||
super(itemView);
|
||||
}
|
||||
|
||||
public String getName(Object obj){
|
||||
return obj.getClass().getSimpleName()+"_";
|
||||
}
|
||||
|
||||
public abstract void setData(BaseBean data);
|
||||
|
||||
public abstract boolean loadData();
|
||||
public abstract void saveData();
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -8,6 +8,7 @@ import androidx.annotation.NonNull;
|
||||
|
||||
import com.yunbao.faceunity.R;
|
||||
import com.yunbao.faceunity.entity.BaseBean;
|
||||
import com.yunbao.faceunity.entity.BodyBeautyBean;
|
||||
import com.yunbao.faceunity.entity.ModelAttributeData;
|
||||
import com.yunbao.faceunity.seekbar.DiscreteSeekBar;
|
||||
import com.yunbao.faceunity.utils.SeekBarUtils;
|
||||
@@ -27,12 +28,27 @@ public class BeautyBodyViewHolder extends BaseViewHolder{
|
||||
title = itemView.findViewById(R.id.item_title);
|
||||
value = itemView.findViewById(R.id.item_value);
|
||||
seekBar = itemView.findViewById(R.id.item_seekBar);
|
||||
seekBar.setOnProgressChangeListener(new DiscreteSeekBar.OnSimpleProgressChangeListener(){
|
||||
@Override
|
||||
public void onProgressChanged(DiscreteSeekBar seekBar, int value, boolean fromUser) {
|
||||
super.onProgressChanged(seekBar, value, fromUser);
|
||||
BodyBeautyBean bean = (BodyBeautyBean) itemView.getTag();
|
||||
double toValue = SeekBarUtils.Companion.seekToValue(bean.getModelAttributeData().getMaxRange(), value, seekBar.getMin());
|
||||
BeautyBodyViewHolder.this.value.setText(String.format("%.1f",toValue));
|
||||
adapter.getBodyBeautyDataFactory().updateParamIntensity(bean.getKey(),toValue);
|
||||
saveData();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setData(BaseBean data) {
|
||||
itemView.setTag(data);
|
||||
icon.setImageResource(data.getImageRes());
|
||||
title.setText(data.getDesRes());
|
||||
if(loadData()){
|
||||
return;
|
||||
}
|
||||
ModelAttributeData attributeData = data.getModelAttributeData();
|
||||
value.setText(attributeData.getDefault() + "");
|
||||
SeekBarUtils.Companion.seekToSeekBar(seekBar,
|
||||
@@ -40,4 +56,27 @@ public class BeautyBodyViewHolder extends BaseViewHolder{
|
||||
attributeData.getStand(),
|
||||
attributeData.getMaxRange());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean loadData() {
|
||||
BodyBeautyBean bean = (BodyBeautyBean) itemView.getTag();
|
||||
String val = adapter.getString(getName(this) + bean);
|
||||
if(val==null){
|
||||
return false;
|
||||
}
|
||||
ModelAttributeData attributeData = bean.getModelAttributeData();
|
||||
value.setText(val);
|
||||
SeekBarUtils.Companion.seekToSeekBar(seekBar,
|
||||
Double.parseDouble(val),
|
||||
attributeData.getStand(),
|
||||
attributeData.getMaxRange());
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void saveData() {
|
||||
BodyBeautyBean bean = (BodyBeautyBean) itemView.getTag();
|
||||
String key=getName(this)+bean.getKey();
|
||||
adapter.save(key, (String) value.getText());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,7 +7,6 @@ import android.widget.TextView;
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
import com.yunbao.faceunity.R;
|
||||
import com.yunbao.faceunity.data.FaceBeautyDataFactory;
|
||||
import com.yunbao.faceunity.entity.BaseBean;
|
||||
import com.yunbao.faceunity.entity.FaceBeautyBean;
|
||||
import com.yunbao.faceunity.entity.ModelAttributeData;
|
||||
@@ -17,12 +16,11 @@ import com.yunbao.faceunity.utils.SeekBarUtils;
|
||||
/**
|
||||
* 美型
|
||||
*/
|
||||
public class BeautyShapeViewHolder extends BaseViewHolder{
|
||||
public class BeautyShapeViewHolder extends BaseViewHolder {
|
||||
private ImageView icon;
|
||||
private TextView title;
|
||||
private TextView value;
|
||||
private DiscreteSeekBar seekBar;
|
||||
private FaceBeautyDataFactory dataFactory;
|
||||
|
||||
|
||||
public BeautyShapeViewHolder(@NonNull View itemView) {
|
||||
@@ -31,27 +29,18 @@ public class BeautyShapeViewHolder extends BaseViewHolder{
|
||||
title = itemView.findViewById(R.id.item_title);
|
||||
value = itemView.findViewById(R.id.item_value);
|
||||
seekBar = itemView.findViewById(R.id.item_seekBar);
|
||||
seekBar.setOnProgressChangeListener(new DiscreteSeekBar.OnSimpleProgressChangeListener(){
|
||||
seekBar.setOnProgressChangeListener(new DiscreteSeekBar.OnSimpleProgressChangeListener() {
|
||||
@Override
|
||||
public void onProgressChanged(DiscreteSeekBar seekBar, int value, boolean fromUser) {
|
||||
super.onProgressChanged(seekBar, value, fromUser);
|
||||
FaceBeautyBean bean = (FaceBeautyBean) itemView.getTag();
|
||||
double toValue = SeekBarUtils.Companion.seekToValue(bean.getModelAttributeData().getMaxRange(), value, seekBar.getMin());
|
||||
BeautyShapeViewHolder.this.value.setText(String.format("%.1f",toValue));
|
||||
dataFactory.updateParamIntensity(bean.getKey(),toValue);
|
||||
BeautyShapeViewHolder.this.value.setText(String.format("%.1f", toValue));
|
||||
adapter.getFaceBeautyDataFactory().updateParamIntensity(bean.getKey(), toValue);
|
||||
saveData();
|
||||
}
|
||||
});
|
||||
dataFactory=new FaceBeautyDataFactory(new FaceBeautyDataFactory.FaceBeautyListener() {
|
||||
@Override
|
||||
public void onFilterSelected(int res) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFaceBeautyEnable(boolean enable) {
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -59,6 +48,9 @@ public class BeautyShapeViewHolder extends BaseViewHolder{
|
||||
itemView.setTag(data);
|
||||
icon.setImageResource(data.getImageRes());
|
||||
title.setText(data.getDesRes());
|
||||
if(loadData()){
|
||||
return;
|
||||
}
|
||||
ModelAttributeData attributeData = data.getModelAttributeData();
|
||||
value.setText(attributeData.getDefault() + "");
|
||||
SeekBarUtils.Companion.seekToSeekBar(seekBar,
|
||||
@@ -66,4 +58,26 @@ public class BeautyShapeViewHolder extends BaseViewHolder{
|
||||
attributeData.getStand(),
|
||||
attributeData.getMaxRange());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean loadData() {
|
||||
FaceBeautyBean bean = (FaceBeautyBean) itemView.getTag();
|
||||
String val = adapter.getString(getName(this) + bean.getKey());
|
||||
if(val==null) {
|
||||
return false;
|
||||
}
|
||||
ModelAttributeData attributeData = bean.getModelAttributeData();
|
||||
value.setText(val);
|
||||
SeekBarUtils.Companion.seekToSeekBar(seekBar,
|
||||
Double.parseDouble(val),
|
||||
attributeData.getStand(),
|
||||
attributeData.getMaxRange());
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void saveData() {
|
||||
FaceBeautyBean bean = (FaceBeautyBean) itemView.getTag();
|
||||
adapter.save(getName(this)+bean.getKey(), (String) value.getText());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,7 +7,6 @@ import android.widget.TextView;
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
import com.yunbao.faceunity.R;
|
||||
import com.yunbao.faceunity.data.FaceBeautyDataFactory;
|
||||
import com.yunbao.faceunity.entity.BaseBean;
|
||||
import com.yunbao.faceunity.entity.FaceBeautyBean;
|
||||
import com.yunbao.faceunity.entity.ModelAttributeData;
|
||||
@@ -22,7 +21,6 @@ public class BeautySkinViewHolder extends BaseViewHolder{
|
||||
private TextView title;
|
||||
private TextView value;
|
||||
private DiscreteSeekBar seekBar;
|
||||
private FaceBeautyDataFactory dataFactory;
|
||||
|
||||
public BeautySkinViewHolder(@NonNull View itemView) {
|
||||
super(itemView);
|
||||
@@ -37,18 +35,8 @@ public class BeautySkinViewHolder extends BaseViewHolder{
|
||||
FaceBeautyBean bean = (FaceBeautyBean) itemView.getTag();
|
||||
double toValue = SeekBarUtils.Companion.seekToValue(bean.getModelAttributeData().getMaxRange(), value, seekBar.getMin());
|
||||
BeautySkinViewHolder.this.value.setText(String.format("%.1f",toValue));
|
||||
dataFactory.updateParamIntensity(bean.getKey(),toValue);
|
||||
}
|
||||
});
|
||||
dataFactory=new FaceBeautyDataFactory(new FaceBeautyDataFactory.FaceBeautyListener() {
|
||||
@Override
|
||||
public void onFilterSelected(int res) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFaceBeautyEnable(boolean enable) {
|
||||
|
||||
adapter.getFaceBeautyDataFactory().updateParamIntensity(bean.getKey(),toValue);
|
||||
saveData();
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -58,6 +46,9 @@ public class BeautySkinViewHolder extends BaseViewHolder{
|
||||
itemView.setTag(data);
|
||||
icon.setImageResource(data.getImageRes());
|
||||
title.setText(data.getDesRes());
|
||||
if(loadData()){
|
||||
return;
|
||||
}
|
||||
ModelAttributeData attributeData = data.getModelAttributeData();
|
||||
value.setText(attributeData.getDefault() + "");
|
||||
SeekBarUtils.Companion.seekToSeekBar(seekBar,
|
||||
@@ -65,4 +56,29 @@ public class BeautySkinViewHolder extends BaseViewHolder{
|
||||
attributeData.getStand(),
|
||||
attributeData.getMaxRange());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean loadData() {
|
||||
BaseBean data = (FaceBeautyBean) itemView.getTag();
|
||||
ModelAttributeData attributeData = data.getModelAttributeData();
|
||||
String key = getName(this)+data.getKey();
|
||||
String val=adapter.getString(key);
|
||||
if (val==null){
|
||||
return false;
|
||||
}
|
||||
value.setText(val);
|
||||
SeekBarUtils.Companion.seekToSeekBar(seekBar,
|
||||
Double.parseDouble(val),
|
||||
attributeData.getStand(),
|
||||
attributeData.getMaxRange()
|
||||
);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void saveData() {
|
||||
String key = ((FaceBeautyBean)itemView.getTag()).getKey();
|
||||
String val= (String) value.getText();
|
||||
adapter.save(getName(this)+key,val);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,26 +7,59 @@ import androidx.annotation.NonNull;
|
||||
|
||||
import com.yunbao.faceunity.R;
|
||||
import com.yunbao.faceunity.entity.BaseBean;
|
||||
import com.yunbao.faceunity.entity.FunctionEnum;
|
||||
import com.yunbao.faceunity.entity.PropBean;
|
||||
|
||||
/**
|
||||
* 大头
|
||||
*/
|
||||
public class BigHeadViewHolder extends BaseViewHolder{
|
||||
ImageView imageView;
|
||||
public class BigHeadViewHolder extends BaseViewHolder {
|
||||
ImageView icon;
|
||||
|
||||
public BigHeadViewHolder(@NonNull View itemView) {
|
||||
super(itemView);
|
||||
imageView=itemView.findViewById(R.id.iv_control);
|
||||
itemView.setOnClickListener(v -> setSelectPosition(getAdapterPosition()));
|
||||
icon = itemView.findViewById(R.id.iv_control);
|
||||
itemView.setOnClickListener(v -> {
|
||||
PropBean bean = (PropBean) itemView.getTag();
|
||||
adapter.getPropDataFactory().setPropType(FunctionEnum.BIG_HEAD);
|
||||
adapter.getPropDataFactory().onItemSelected(bean);
|
||||
setSelectPosition(getAdapterPosition());
|
||||
saveData();
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setData(BaseBean data) {
|
||||
imageView.setImageResource(data.getImageRes());
|
||||
if(getAdapterPosition()==0){
|
||||
imageView.setBackgroundResource(R.drawable.bg_control_oval2_selector);
|
||||
}else{
|
||||
//imageView.setBackgroundResource(R.drawable.bg_control_oval_selector);
|
||||
itemView.setTag(data);
|
||||
icon.setImageResource(data.getImageRes());
|
||||
if(loadData()){
|
||||
return;
|
||||
}
|
||||
imageView.setSelected(getSelectPosition() == getAdapterPosition());
|
||||
if (getAdapterPosition() == 0) {
|
||||
icon.setBackgroundResource(R.drawable.bg_control_oval2_selector);
|
||||
}
|
||||
icon.setSelected(getSelectPosition() == getAdapterPosition());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean loadData() {
|
||||
PropBean bean = (PropBean) itemView.getTag();
|
||||
String val = adapter.getString(getName(this));
|
||||
if(val==null){
|
||||
return false;
|
||||
}
|
||||
if(!val.equals(bean.getKey())){
|
||||
return false;
|
||||
}
|
||||
icon.setSelected(true);
|
||||
adapter.getPropDataFactory().setPropType(FunctionEnum.BIG_HEAD);
|
||||
adapter.getPropDataFactory().onItemSelected(bean);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void saveData() {
|
||||
PropBean bean = (PropBean) itemView.getTag();
|
||||
adapter.save(getName(this),bean.getKey());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,8 +7,8 @@ import android.widget.TextView;
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
import com.yunbao.faceunity.R;
|
||||
import com.yunbao.faceunity.adapters.vh.BaseViewHolder;
|
||||
import com.yunbao.faceunity.entity.BaseBean;
|
||||
import com.yunbao.faceunity.entity.FaceBeautyFilterBean;
|
||||
|
||||
/**
|
||||
* 滤镜
|
||||
@@ -21,15 +21,46 @@ public class FilterViewHolder extends BaseViewHolder {
|
||||
super(itemView);
|
||||
icon = itemView.findViewById(R.id.iv_control);
|
||||
title = itemView.findViewById(R.id.tv_control);
|
||||
itemView.setOnClickListener(view -> setSelectPosition(getAdapterPosition()));
|
||||
itemView.setOnClickListener(view -> {
|
||||
FaceBeautyFilterBean bean= (FaceBeautyFilterBean) itemView.getTag();
|
||||
adapter.getFaceBeautyDataFactory().onFilterSelected(bean.getKey(),bean.getIntensity(),bean.getDesRes());
|
||||
setSelectPosition(getAdapterPosition());
|
||||
saveData();
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setData(BaseBean data) {
|
||||
itemView.setTag(data);
|
||||
icon.setImageResource(data.getImageRes());
|
||||
title.setText(data.getDesRes());
|
||||
if(loadData()){
|
||||
return;
|
||||
}
|
||||
icon.setSelected(getSelectPosition()==getAdapterPosition());
|
||||
title.setSelected(getSelectPosition()==getAdapterPosition());
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean loadData() {
|
||||
FaceBeautyFilterBean bean= (FaceBeautyFilterBean) itemView.getTag();
|
||||
String val = adapter.getString(getName(this));
|
||||
if(val==null){
|
||||
return false;
|
||||
}
|
||||
if(!val.equals(bean.getKey())){
|
||||
return false;
|
||||
}
|
||||
icon.setSelected(true);
|
||||
title.setSelected(true);
|
||||
adapter.getFaceBeautyDataFactory().onFilterSelected(bean.getKey(),bean.getIntensity(),bean.getDesRes());
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void saveData() {
|
||||
FaceBeautyFilterBean bean= (FaceBeautyFilterBean) itemView.getTag();
|
||||
adapter.save(getName(this),bean.getKey());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,28 +6,82 @@ import android.widget.ImageView;
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
import com.yunbao.common.glide.ImgLoader;
|
||||
import com.yunbao.common.utils.ToastUtil;
|
||||
import com.yunbao.faceunity.R;
|
||||
import com.yunbao.faceunity.data.FineStickerDataFactory;
|
||||
import com.yunbao.faceunity.entity.BaseBean;
|
||||
import com.yunbao.faceunity.entity.net.FineStickerEntity;
|
||||
import com.yunbao.faceunity.utils.net.StickerDownloadHelper;
|
||||
|
||||
/**
|
||||
* 精品贴纸
|
||||
*/
|
||||
public class FineStickerViewHolder extends BaseViewHolder {
|
||||
ImageView imageView;
|
||||
public class FineStickerViewHolder extends BaseViewHolder implements StickerDownloadHelper.Callback {
|
||||
ImageView icon;
|
||||
|
||||
public FineStickerViewHolder(@NonNull View itemView) {
|
||||
super(itemView);
|
||||
imageView = itemView.findViewById(R.id.iv_control);
|
||||
itemView.setOnClickListener(view -> setSelectPosition(getAdapterPosition()));
|
||||
icon = itemView.findViewById(R.id.iv_control);
|
||||
itemView.setOnClickListener(view -> {
|
||||
FineStickerDataFactory.getInstance().downloadSticker((FineStickerEntity.DocsBean) itemView.getTag());
|
||||
setSelectPosition(getAdapterPosition());
|
||||
saveData();
|
||||
});
|
||||
FineStickerDataFactory.getInstance().addCallback(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setData(BaseBean data) {
|
||||
itemView.setTag(data);
|
||||
if (data.getImageUrl().isEmpty()) {
|
||||
imageView.setImageResource(R.mipmap.icon_control_none);
|
||||
icon.setImageResource(R.mipmap.icon_control_none);
|
||||
} else {
|
||||
ImgLoader.display(imageView.getContext(), data.getImageUrl(), imageView);
|
||||
ImgLoader.display(icon.getContext(), data.getImageUrl(), icon);
|
||||
}
|
||||
imageView.setSelected(getSelectPosition() == getAdapterPosition());
|
||||
if (loadData()) {
|
||||
return;
|
||||
}
|
||||
icon.setSelected(getSelectPosition() == getAdapterPosition());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean loadData() {
|
||||
FineStickerEntity.DocsBean bean = (FineStickerEntity.DocsBean) itemView.getTag();
|
||||
String val = adapter.getString(getName(this) + bean.getKey());
|
||||
if(val==null){
|
||||
return false;
|
||||
}
|
||||
if(!val.equals(bean.getKey())){
|
||||
return false;
|
||||
}
|
||||
FineStickerDataFactory.getInstance().downloadSticker(bean);
|
||||
icon.setSelected(true);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void saveData() {
|
||||
FineStickerEntity.DocsBean bean = (FineStickerEntity.DocsBean) itemView.getTag();
|
||||
adapter.save(getName(this), bean.getKey());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onGetTags(String[] tags) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onGetList(String tag, FineStickerEntity fineSticker) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDownload(FineStickerEntity.DocsBean entity) {
|
||||
FineStickerDataFactory.getInstance().onItemSelected(entity);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDownloadError(FineStickerEntity.DocsBean entity, String msg) {
|
||||
ToastUtil.show("下载失败 = " + msg);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,147 @@
|
||||
package com.yunbao.faceunity.adapters.vh;
|
||||
|
||||
import android.view.View;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
import com.yunbao.faceunity.R;
|
||||
import com.yunbao.faceunity.data.FaceParam;
|
||||
import com.yunbao.faceunity.entity.BaseBean;
|
||||
import com.yunbao.faceunity.entity.MakeupCustomBean;
|
||||
import com.yunbao.faceunity.repo.MakeupSource;
|
||||
import com.yunbao.faceunity.seekbar.DiscreteSeekBar;
|
||||
|
||||
public class MakeupCustomItemViewHolder extends BaseViewHolder {
|
||||
private ImageView icon;
|
||||
private TextView title;
|
||||
|
||||
|
||||
public MakeupCustomItemViewHolder(@NonNull View itemView) {
|
||||
super(itemView);
|
||||
icon = itemView.findViewById(R.id.iv_control);
|
||||
title = itemView.findViewById(R.id.tv_control);
|
||||
title.setVisibility(View.INVISIBLE);
|
||||
itemView.setOnClickListener(new View.OnClickListener() {
|
||||
private String key = null;
|
||||
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
adapter.showSeekBar();
|
||||
MakeupCustomBean bean = (MakeupCustomBean) itemView.getTag();
|
||||
key = getMakeupKey(bean.getBeanType());
|
||||
|
||||
if (key == null) {
|
||||
return;
|
||||
}
|
||||
adapter.getMakeupDataFactory().enterCustomMakeup();
|
||||
adapter.getMakeupDataFactory().onCustomBeanSelected(key, getAdapterPosition());
|
||||
adapter.getMakeupDataFactory().bindCurrentRenderer();
|
||||
setSelectPosition(getAdapterPosition());
|
||||
double intensity = adapter.getMakeupDataFactory().getCurrentCustomIntensity(key, adapter.getMakeupDataFactory().getCurrentCustomItemIndex(key));
|
||||
adapter.getSeekBar().setProgress((int) (intensity * 100));
|
||||
adapter.getSeekBar().setOnProgressChangeListener(new DiscreteSeekBar.OnSimpleProgressChangeListener() {
|
||||
@Override
|
||||
public void onProgressChanged(DiscreteSeekBar seekBar, int value, boolean fromUser) {
|
||||
super.onProgressChanged(seekBar, value, fromUser);
|
||||
float valueF = (float) (1.0 * (value - seekBar.getMin()) / 100);
|
||||
int current = adapter.getMakeupDataFactory().getCurrentCustomItemIndex(key);
|
||||
adapter.getMakeupDataFactory().updateCustomItemIntensity(key, current, valueF);
|
||||
saveData();
|
||||
}
|
||||
});
|
||||
saveData();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setData(BaseBean data) {
|
||||
itemView.setTag(data);
|
||||
icon.setImageDrawable(data.getImageDrawable());
|
||||
if (loadData()) {
|
||||
return;
|
||||
}
|
||||
if (getSelectPosition() == getAdapterPosition()) {
|
||||
icon.setSelected(true);
|
||||
return;
|
||||
}
|
||||
icon.setSelected(false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean loadData() {
|
||||
MakeupCustomBean bean = (MakeupCustomBean) itemView.getTag();
|
||||
String model = adapter.getString(getName(this) + "_model");
|
||||
String val = adapter.getString(getName(this) + bean.getKey() + "_val");
|
||||
if (model == null || val == null) {
|
||||
return false;
|
||||
}
|
||||
if(!model.equals(bean.getKey())){
|
||||
return false;
|
||||
}
|
||||
icon.setSelected(true);
|
||||
String key = getMakeupKey(bean.getBeanType());
|
||||
if (key == null) {
|
||||
return false;
|
||||
}
|
||||
adapter.getMakeupDataFactory().enterCustomMakeup();
|
||||
adapter.getMakeupDataFactory().onCustomBeanSelected(key, getAdapterPosition());
|
||||
adapter.getMakeupDataFactory().bindCurrentRenderer();
|
||||
adapter.getSeekBar().setProgress(Integer.parseInt(val));
|
||||
|
||||
float valueF = (float) (1.0 * (Integer.parseInt(val) - adapter.getSeekBar().getMin()) / 100);
|
||||
int current = adapter.getMakeupDataFactory().getCurrentCustomItemIndex(key);
|
||||
adapter.getMakeupDataFactory().updateCustomItemIntensity(key, current, valueF);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void saveData() {
|
||||
MakeupCustomBean bean = (MakeupCustomBean) itemView.getTag();
|
||||
String key=getMakeupKey(bean.getBeanType());
|
||||
if(key==null){
|
||||
return;
|
||||
}
|
||||
adapter.save(getName(this) + "_model", key);
|
||||
adapter.save(getName(this) + bean.getKey() + "_val", adapter.getSeekBar().getProgress() + "");
|
||||
}
|
||||
|
||||
public String getMakeupKey(int beanType) {
|
||||
String key = null;
|
||||
switch (beanType) {
|
||||
case FaceParam.FACE_MAKEUP_TYPE_FOUNDATION:
|
||||
key = MakeupSource.FACE_MAKEUP_TYPE_FOUNDATION;
|
||||
break;
|
||||
case FaceParam.FACE_MAKEUP_TYPE_LIP_STICK:
|
||||
key = MakeupSource.FACE_MAKEUP_TYPE_LIP_STICK;
|
||||
break;
|
||||
case FaceParam.FACE_MAKEUP_TYPE_BLUSHER:
|
||||
key = MakeupSource.FACE_MAKEUP_TYPE_BLUSHER;
|
||||
break;
|
||||
case FaceParam.FACE_MAKEUP_TYPE_EYE_BROW:
|
||||
key = MakeupSource.FACE_MAKEUP_TYPE_EYE_BROW;
|
||||
break;
|
||||
case FaceParam.FACE_MAKEUP_TYPE_EYE_SHADOW:
|
||||
key = MakeupSource.FACE_MAKEUP_TYPE_EYE_SHADOW;
|
||||
break;
|
||||
case FaceParam.FACE_MAKEUP_TYPE_EYE_LINER:
|
||||
key = MakeupSource.FACE_MAKEUP_TYPE_EYE_LINER;
|
||||
break;
|
||||
case FaceParam.FACE_MAKEUP_TYPE_EYE_LASH:
|
||||
key = MakeupSource.FACE_MAKEUP_TYPE_EYE_LASH;
|
||||
break;
|
||||
case FaceParam.FACE_MAKEUP_TYPE_HIGH_LIGHT:
|
||||
key = MakeupSource.FACE_MAKEUP_TYPE_HIGH_LIGHT;
|
||||
break;
|
||||
case FaceParam.FACE_MAKEUP_TYPE_SHADOW:
|
||||
key = MakeupSource.FACE_MAKEUP_TYPE_SHADOW;
|
||||
break;
|
||||
case FaceParam.FACE_MAKEUP_TYPE_EYE_PUPIL:
|
||||
key = MakeupSource.FACE_MAKEUP_TYPE_EYE_PUPIL;
|
||||
break;
|
||||
}
|
||||
return key;
|
||||
}
|
||||
}
|
||||
@@ -8,6 +8,7 @@ import androidx.annotation.NonNull;
|
||||
|
||||
import com.yunbao.faceunity.R;
|
||||
import com.yunbao.faceunity.entity.BaseBean;
|
||||
import com.yunbao.faceunity.entity.MakeupCombinationBean;
|
||||
|
||||
/**
|
||||
* 美妆
|
||||
@@ -15,14 +16,15 @@ import com.yunbao.faceunity.entity.BaseBean;
|
||||
public class MakeupViewHolder extends BaseViewHolder {
|
||||
private ImageView icon;
|
||||
private TextView title;
|
||||
private int index = -1;
|
||||
|
||||
public MakeupViewHolder(@NonNull View itemView) {
|
||||
super(itemView);
|
||||
icon = itemView.findViewById(R.id.iv_control);
|
||||
title = itemView.findViewById(R.id.tv_control);
|
||||
itemView.setOnClickListener(v -> {
|
||||
adapter.getMakeupDataFactory().onMakeupCombinationSelected((MakeupCombinationBean) itemView.getTag());
|
||||
setSelectPosition(getAdapterPosition());
|
||||
saveData();
|
||||
});
|
||||
}
|
||||
|
||||
@@ -31,6 +33,9 @@ public class MakeupViewHolder extends BaseViewHolder {
|
||||
itemView.setTag(data);
|
||||
icon.setImageResource(data.getImageRes());
|
||||
title.setText(data.getDesRes());
|
||||
if(loadData()){
|
||||
return;
|
||||
}
|
||||
if (getSelectPosition() == getAdapterPosition()) {
|
||||
icon.setSelected(true);
|
||||
title.setSelected(true);
|
||||
@@ -39,4 +44,16 @@ public class MakeupViewHolder extends BaseViewHolder {
|
||||
icon.setSelected(false);
|
||||
title.setSelected(false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean loadData() {
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void saveData() {
|
||||
MakeupCombinationBean bean = (MakeupCombinationBean) itemView.getTag();
|
||||
adapter.save(getName(this),bean.getKey());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,19 +7,43 @@ import androidx.annotation.NonNull;
|
||||
|
||||
import com.yunbao.faceunity.R;
|
||||
import com.yunbao.faceunity.entity.BaseBean;
|
||||
import com.yunbao.faceunity.entity.FunctionEnum;
|
||||
import com.yunbao.faceunity.entity.PropBean;
|
||||
|
||||
/**
|
||||
* 普通贴纸
|
||||
*/
|
||||
public class StickerViewHolder extends BaseViewHolder{
|
||||
ImageView imageView;
|
||||
ImageView icon;
|
||||
public StickerViewHolder(@NonNull View itemView) {
|
||||
super(itemView);
|
||||
imageView=itemView.findViewById(R.id.iv_control);
|
||||
icon =itemView.findViewById(R.id.iv_control);
|
||||
itemView.setOnClickListener(v -> {
|
||||
PropBean bean= (PropBean) itemView.getTag();
|
||||
adapter.getPropDataFactory().setPropType(FunctionEnum.STICKER);
|
||||
adapter.getPropDataFactory().onItemSelected(bean);
|
||||
setSelectPosition(getAdapterPosition());
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setData(BaseBean data) {
|
||||
imageView.setImageResource(data.getImageRes());
|
||||
itemView.setTag(data);
|
||||
icon.setImageResource(data.getImageRes());
|
||||
if(getAdapterPosition()==0){
|
||||
icon.setBackgroundResource(R.drawable.bg_control_oval2_selector);
|
||||
}
|
||||
icon.setSelected(getSelectPosition() == getAdapterPosition());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean loadData() {
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void saveData() {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,6 +9,9 @@ import androidx.annotation.NonNull;
|
||||
import com.yunbao.faceunity.R;
|
||||
import com.yunbao.faceunity.entity.BaseBean;
|
||||
|
||||
/**
|
||||
* 风格推荐
|
||||
*/
|
||||
public class StyleViewHolder extends BaseViewHolder{
|
||||
private ImageView icon;
|
||||
private TextView title;
|
||||
@@ -16,14 +19,30 @@ public class StyleViewHolder extends BaseViewHolder{
|
||||
super(itemView);
|
||||
icon=itemView.findViewById(R.id.iv_control);
|
||||
title=itemView.findViewById(R.id.tv_control);
|
||||
itemView.setOnClickListener(v -> setSelectPosition(getAdapterPosition()));
|
||||
itemView.setOnClickListener(v -> {
|
||||
BaseBean bean= (BaseBean) itemView.getTag();
|
||||
adapter.getFaceBeautyDataFactory().onStyleSelected(bean.getKey());
|
||||
setSelectPosition(getAdapterPosition());
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setData(BaseBean data) {
|
||||
itemView.setTag(data);
|
||||
icon.setImageResource(data.getImageRes());
|
||||
title.setText(data.getDesRes());
|
||||
icon.setSelected(getSelectPosition()==getAdapterPosition());
|
||||
title.setSelected(getSelectPosition()==getAdapterPosition());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean loadData() {
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void saveData() {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,150 +0,0 @@
|
||||
package com.yunbao.faceunity.control;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.content.Context;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.faceunity.core.utils.DecimalUtils;
|
||||
|
||||
import com.yunbao.faceunity.R;
|
||||
import com.yunbao.faceunity.base.BaseDelegate;
|
||||
import com.yunbao.faceunity.base.BaseListAdapter;
|
||||
import com.yunbao.faceunity.base.BaseViewHolder;
|
||||
import com.yunbao.faceunity.entity.MakeupCombinationBean;
|
||||
import com.yunbao.faceunity.infe.AbstractMakeupDataFactory;
|
||||
import com.yunbao.faceunity.seekbar.DiscreteSeekBar;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
/**
|
||||
* DESC:美妆
|
||||
* Created on 2021/4/26
|
||||
*/
|
||||
public class MakeupControlView extends BaseControlView {
|
||||
|
||||
private RecyclerView recyclerView;
|
||||
private DiscreteSeekBar discreteSeekBar;
|
||||
|
||||
private AbstractMakeupDataFactory mDataFactory;
|
||||
|
||||
/* 组合妆容 */
|
||||
private BaseListAdapter<MakeupCombinationBean> mCombinationAdapter;
|
||||
|
||||
public MakeupControlView(@NonNull Context context) {
|
||||
super(context);
|
||||
init();
|
||||
}
|
||||
|
||||
public MakeupControlView(@NonNull Context context, @Nullable AttributeSet attrs) {
|
||||
super(context, attrs);
|
||||
init();
|
||||
}
|
||||
|
||||
public MakeupControlView(@NonNull Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
|
||||
super(context, attrs, defStyleAttr);
|
||||
init();
|
||||
}
|
||||
|
||||
private void init() {
|
||||
LayoutInflater.from(mContext).inflate(R.layout.layout_make_up_control, this);
|
||||
initView();
|
||||
initAdapter();
|
||||
bindListener();
|
||||
}
|
||||
|
||||
private void initView() {
|
||||
recyclerView = findViewById(R.id.recycler_view);
|
||||
discreteSeekBar = findViewById(R.id.seek_bar);
|
||||
initHorizontalRecycleView(recyclerView);
|
||||
}
|
||||
|
||||
/**
|
||||
* 给控制绑定FaceBeautyController,MakeupController 数据工厂
|
||||
*
|
||||
* @param dataFactory IFaceBeautyDataFactory
|
||||
*/
|
||||
public void bindDataFactory(AbstractMakeupDataFactory dataFactory) {
|
||||
mDataFactory = dataFactory;
|
||||
mCombinationAdapter.setData(dataFactory.getMakeupCombinations());
|
||||
showCombinationSeekBar(mCombinationAdapter.getData(dataFactory.getCurrentCombinationIndex()));
|
||||
}
|
||||
|
||||
/**
|
||||
* 组合妆容Adapter
|
||||
*/
|
||||
private void initAdapter() {
|
||||
mCombinationAdapter = new BaseListAdapter<>(new ArrayList<>(), new BaseDelegate<MakeupCombinationBean>() {
|
||||
@Override
|
||||
public void convert(int viewType, BaseViewHolder helper, MakeupCombinationBean data, int position) {
|
||||
helper.setText(R.id.tv_control, data.getDesRes());
|
||||
helper.setImageResource(R.id.iv_control, data.getImageRes());
|
||||
helper.itemView.setSelected(position == mDataFactory.getCurrentCombinationIndex());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onItemClickListener(View view, MakeupCombinationBean data, int position) {
|
||||
if (position != mDataFactory.getCurrentCombinationIndex()) {
|
||||
changeAdapterSelected(mCombinationAdapter, mDataFactory.getCurrentCombinationIndex(), position);
|
||||
mDataFactory.setCurrentCombinationIndex(position);
|
||||
mDataFactory.onMakeupCombinationSelected(data);
|
||||
showCombinationSeekBar(data);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
}, R.layout.list_item_control_title_image_square);
|
||||
recyclerView.setAdapter(mCombinationAdapter);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 绑定监听事件
|
||||
*/
|
||||
@SuppressLint("ClickableViewAccessibility")
|
||||
private void bindListener() {
|
||||
/*组合妆容强度变更回调*/
|
||||
discreteSeekBar.setOnProgressChangeListener(new DiscreteSeekBar.OnSimpleProgressChangeListener() {
|
||||
@Override
|
||||
public void onProgressChanged(DiscreteSeekBar seekBar, int value, boolean fromUser) {
|
||||
if (!fromUser) {
|
||||
return;
|
||||
}
|
||||
double valueF = 1.0f * (value - seekBar.getMin()) / 100;
|
||||
MakeupCombinationBean combination = mCombinationAdapter.getData(mDataFactory.getCurrentCombinationIndex());
|
||||
if (!DecimalUtils.doubleEquals(valueF, combination.getIntensity())) {
|
||||
combination.setIntensity(valueF);
|
||||
mDataFactory.updateCombinationIntensity(valueF);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
//endregion init
|
||||
|
||||
|
||||
// region Adapter
|
||||
|
||||
|
||||
// region 视图控制
|
||||
|
||||
/**
|
||||
* 选中组合妆容,控制强度调节器以及自定义按钮状态变更
|
||||
*/
|
||||
private void showCombinationSeekBar(MakeupCombinationBean data) {
|
||||
if (data.getBundlePath() == null) {
|
||||
discreteSeekBar.setVisibility(View.INVISIBLE);
|
||||
} else {
|
||||
discreteSeekBar.setVisibility(View.VISIBLE);
|
||||
discreteSeekBar.setProgress((int) (data.getIntensity() * 100));
|
||||
}
|
||||
}
|
||||
|
||||
// endregion
|
||||
}
|
||||
@@ -54,6 +54,7 @@ public class AnimojiDataFactory extends AbstractAnimojiDataFactory {
|
||||
currentFilterIndex = filterIndex;
|
||||
animojiBeans = AnimojiSource.buildAnimojis();
|
||||
animationFilterBeans = AnimojiSource.buildFilters();
|
||||
bindCurrentRenderer();
|
||||
}
|
||||
|
||||
|
||||
@@ -141,6 +142,7 @@ public class AnimojiDataFactory extends AbstractAnimojiDataFactory {
|
||||
*/
|
||||
@Override
|
||||
public void onFilterSelected(AnimationFilterBean data) {
|
||||
|
||||
animationFilter.setStyle(data.getStyle());
|
||||
}
|
||||
|
||||
|
||||
@@ -339,7 +339,7 @@ public class FaceBeautyDataFactory extends AbstractFaceBeautyDataFactory {
|
||||
/**
|
||||
* 设置推荐风格
|
||||
*
|
||||
* @param name
|
||||
* @param name 风格key
|
||||
*/
|
||||
@Override
|
||||
public void onStyleSelected(String name) {
|
||||
|
||||
@@ -1,19 +1,34 @@
|
||||
package com.yunbao.faceunity.data;
|
||||
|
||||
public class FaceParam {
|
||||
public static final int FACE_BEAUTY=100;
|
||||
public static final int FACE_BEAUTY_SKIN=101;
|
||||
public static final int FACE_BEAUTY_SHAPE=102;
|
||||
public static final int FACE_BEAUTY_FILTER=103;
|
||||
public static final int FACE_BEAUTY_STYLE=104;
|
||||
public static final int FACE_MAKEUP=200;
|
||||
public static final int FACE_BEAUTY_BODY=300;
|
||||
public static final int FACE_BIG_HEAD=400;
|
||||
public static final int FACE_ANIMOJI=500;
|
||||
public static final int FACE_STICKER=600;
|
||||
public static final int FACE_FINE_STICKER=700;
|
||||
public static final int FACE_FINE_STICKER_MIDDLE=701;
|
||||
public static final int FACE_FINE_STICKER_HIGH=702;
|
||||
public static final int FACE_FINE_STICKER_GAME=703;
|
||||
public static final int FACE_ANIM=800;
|
||||
public static final int FACE_BEAUTY=100;//美颜
|
||||
public static final int FACE_BEAUTY_SKIN=101;//美肤
|
||||
public static final int FACE_BEAUTY_SHAPE=102;//美型
|
||||
public static final int FACE_BEAUTY_FILTER=103;//滤镜
|
||||
public static final int FACE_BEAUTY_STYLE=104;//风格推荐
|
||||
public static final int FACE_MAKEUP=200;//美妆
|
||||
public static final int FACE_MAKEUP_TYPE_FOUNDATION=201;//粉底
|
||||
public static final int FACE_MAKEUP_TYPE_LIP_STICK=202;//口红
|
||||
public static final int FACE_MAKEUP_TYPE_BLUSHER=203;//腮红
|
||||
public static final int FACE_MAKEUP_TYPE_EYE_BROW=204;//眉毛
|
||||
public static final int FACE_MAKEUP_TYPE_EYE_SHADOW=205;//眼影
|
||||
public static final int FACE_MAKEUP_TYPE_EYE_LINER=206;//眼线
|
||||
public static final int FACE_MAKEUP_TYPE_EYE_LASH=207;//睫毛
|
||||
public static final int FACE_MAKEUP_TYPE_HIGH_LIGHT=208;//高光
|
||||
public static final int FACE_MAKEUP_TYPE_SHADOW=209;//阴影
|
||||
public static final int FACE_MAKEUP_TYPE_EYE_PUPIL=210;//美瞳
|
||||
public static final int FACE_BEAUTY_BODY=300;//美体
|
||||
public static final int FACE_BIG_HEAD=400;//大头
|
||||
public static final int FACE_ANIMOJI=500;//Animoji
|
||||
public static final int FACE_STICKER=600;//贴纸
|
||||
public static final int FACE_FINE_STICKER=700;//精品贴纸
|
||||
public static final int FACE_FINE_STICKER_MIDDLE=701;//中级道具
|
||||
public static final int FACE_FINE_STICKER_HIGH=702;//高级道具
|
||||
public static final int FACE_FINE_STICKER_GAME=703;//游戏道具
|
||||
public static final int FACE_ANIM=800;//动漫滤镜
|
||||
// 占位符,以下均未使用
|
||||
public static final int FACE_ANIM_AR_MASK=900;
|
||||
public static final int FACE_EXPRESSION_RECOGNITION=1000;
|
||||
public static final int FACE_FACE_WARP=1000;
|
||||
public static final int FACE_GESTURE_RECOGNITION=1100;
|
||||
}
|
||||
|
||||
@@ -68,6 +68,9 @@ public class FineStickerDataFactory extends AbstractFineStickerDataFactory {
|
||||
/*3D抗锯齿*/
|
||||
public Antialiasing antialiasing;
|
||||
|
||||
//回调
|
||||
private List<StickerDownloadHelper.Callback> callbacks;
|
||||
|
||||
//avatar用于区分bundle类型的关键字
|
||||
private final String COMPONENTS_STR = "components";
|
||||
private final String ANIM_STR = "anim";
|
||||
@@ -75,8 +78,9 @@ public class FineStickerDataFactory extends AbstractFineStickerDataFactory {
|
||||
private final String ZIP = ".zip";
|
||||
private final String AVATAR = "avatar";
|
||||
|
||||
public FineStickerDataFactory() {
|
||||
// StickerDownloadHelper.getInstance().setCallback(downloadHelper);
|
||||
private FineStickerDataFactory() {
|
||||
callbacks=new ArrayList<>();
|
||||
StickerDownloadHelper.getInstance().setCallback(downloadHelper);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -87,9 +91,14 @@ public class FineStickerDataFactory extends AbstractFineStickerDataFactory {
|
||||
|
||||
}
|
||||
|
||||
public void setCallback(StickerDownloadHelper.Callback downloadHelper) {
|
||||
StickerDownloadHelper.getInstance().setCallback(downloadHelper);
|
||||
|
||||
public void addCallback(StickerDownloadHelper.Callback downloadHelper) {
|
||||
callbacks.add(downloadHelper);
|
||||
}
|
||||
public void removeCallback(StickerDownloadHelper.Callback downloadHelper){
|
||||
callbacks.remove(downloadHelper);
|
||||
}
|
||||
private void removeAllCallback(){
|
||||
callbacks.clear();
|
||||
}
|
||||
|
||||
public void refuseEvent() {
|
||||
@@ -260,20 +269,31 @@ public class FineStickerDataFactory extends AbstractFineStickerDataFactory {
|
||||
private StickerDownloadHelper.Callback downloadHelper = new StickerDownloadHelper.Callback() {
|
||||
@Override
|
||||
public void onGetTags(String[] tags) {
|
||||
formatTag(tags);
|
||||
for (StickerDownloadHelper.Callback callback : callbacks) {
|
||||
callback.onGetTags(tags);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onGetList(String tag, FineStickerEntity fineSticker) {
|
||||
new FineStickerTagEntity(tag);
|
||||
for (StickerDownloadHelper.Callback callback : callbacks) {
|
||||
callback.onGetList(tag, fineSticker);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDownload(FineStickerEntity.DocsBean entity) {
|
||||
for (StickerDownloadHelper.Callback callback : callbacks) {
|
||||
callback.onDownload(entity);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDownloadError(FineStickerEntity.DocsBean entity, String msg) {
|
||||
for (StickerDownloadHelper.Callback callback : callbacks) {
|
||||
callback.onDownloadError(entity, msg);
|
||||
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -1,18 +1,31 @@
|
||||
package com.yunbao.faceunity.data;
|
||||
|
||||
|
||||
import static com.yunbao.faceunity.repo.MakeupSource.*;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
import com.faceunity.core.entity.FUBundleData;
|
||||
import com.faceunity.core.entity.FUColorRGBData;
|
||||
import com.faceunity.core.enumeration.FUAITypeEnum;
|
||||
import com.faceunity.core.faceunity.FUAIKit;
|
||||
import com.faceunity.core.faceunity.FURenderKit;
|
||||
import com.faceunity.core.model.makeup.SimpleMakeup;
|
||||
import com.faceunity.core.model.makeup.Makeup;
|
||||
import com.faceunity.core.model.makeup.MakeupLipEnum;
|
||||
|
||||
import com.faceunity.core.model.prop.expression.ExpressionRecognition;
|
||||
import com.faceunity.core.utils.DecimalUtils;
|
||||
import com.yunbao.faceunity.entity.MakeupCombinationBean;
|
||||
import com.yunbao.faceunity.entity.MakeupCustomBean;
|
||||
import com.yunbao.faceunity.entity.MakeupCustomClassBean;
|
||||
import com.yunbao.faceunity.infe.AbstractMakeupDataFactory;
|
||||
import com.yunbao.faceunity.repo.FaceBeautySource;
|
||||
import com.yunbao.faceunity.repo.MakeupSource;
|
||||
import com.yunbao.faceunity.utils.FaceUnityConfig;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.LinkedHashMap;
|
||||
|
||||
/**
|
||||
* DESC:美妆业务工厂
|
||||
@@ -29,15 +42,27 @@ public class MakeupDataFactory extends AbstractMakeupDataFactory {
|
||||
/*组合妆容当前下标*/
|
||||
private int currentCombinationIndex;//-1:自定义
|
||||
/*美妆数据模型*/
|
||||
private SimpleMakeup currentMakeup;
|
||||
/*美妆数据模型缓存*/
|
||||
private HashMap<String, SimpleMakeup> makeupMap = new HashMap<>();
|
||||
private Makeup currentMakeup;
|
||||
/*当前滤镜*/
|
||||
private String currentFilterName;
|
||||
/*当前滤镜*/
|
||||
private Double currentFilterIntensity;
|
||||
|
||||
|
||||
private LinkedHashMap<String, ArrayList<double[]>> mMakeUpColorMap;//美妆颜色表
|
||||
|
||||
private HashMap<String, Integer> mCustomIndexMap = new HashMap<>();//key:美妆类别 value:当前美妆子项选中下标 默认0
|
||||
private HashMap<String, Double> mCustomIntensityMap = new HashMap<>();//key:美妆类别_子项下标 value:当前美妆选中子项的妆容强度 默认1.0
|
||||
private HashMap<String, Integer> mCustomColorIndexMap = new HashMap<>();//key:美妆类别_子项下标 value:当前美妆选中子项的颜色下标 默认3
|
||||
|
||||
|
||||
public MakeupDataFactory(int index) {
|
||||
makeupCombinations = MakeupSource.buildCombinations();
|
||||
mMakeUpColorMap = MakeupSource.buildMakeUpColorMap();
|
||||
currentCombinationIndex = index;
|
||||
currentMakeup = getMakeupModel(makeupCombinations.get(currentCombinationIndex)); // 当前生效模型
|
||||
currentFilterName = makeupCombinations.get(index).getFilterName();
|
||||
currentFilterIntensity = makeupCombinations.get(index).getFilterIntensity();
|
||||
currentMakeup = MakeupSource.getMakeupModel(makeupCombinations.get(currentCombinationIndex)); // 当前生效模型
|
||||
}
|
||||
|
||||
//region 组合妆
|
||||
@@ -80,8 +105,16 @@ public class MakeupDataFactory extends AbstractMakeupDataFactory {
|
||||
*/
|
||||
@Override
|
||||
public void onMakeupCombinationSelected(MakeupCombinationBean bean) {
|
||||
currentMakeup = getMakeupModel(bean);
|
||||
currentFilterName = bean.getFilterName();
|
||||
currentFilterIntensity = bean.getFilterIntensity();
|
||||
if (mFURenderKit.getFaceBeauty() != null) {
|
||||
mFURenderKit.getFaceBeauty().setFilterName(currentFilterName);
|
||||
mFURenderKit.getFaceBeauty().setFilterIntensity(currentFilterIntensity);
|
||||
}
|
||||
currentMakeup = MakeupSource.getMakeupModel(bean);
|
||||
mFURenderKit.setMakeup(currentMakeup);
|
||||
if (!currentMakeup.getControlBundle().getPath().equals(FaceUnityConfig.BUNDLE_FACE_MAKEUP))
|
||||
currentMakeup.setFilterIntensity(currentFilterIntensity);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -92,36 +125,725 @@ public class MakeupDataFactory extends AbstractMakeupDataFactory {
|
||||
@Override
|
||||
public void updateCombinationIntensity(double intensity) {
|
||||
currentMakeup.setMakeupIntensity(intensity);
|
||||
}
|
||||
|
||||
/**
|
||||
* 构造美妆模型
|
||||
*
|
||||
* @param bean
|
||||
* @return
|
||||
*/
|
||||
private SimpleMakeup getMakeupModel(MakeupCombinationBean bean) {
|
||||
if (bean.getBundlePath() == null) {
|
||||
return null;
|
||||
} else {
|
||||
if (makeupMap.containsKey(bean.getKey())) {
|
||||
return makeupMap.get(bean.getKey());
|
||||
}
|
||||
SimpleMakeup makeup = new SimpleMakeup(new FUBundleData(MakeupSource.BUNDLE_FACE_MAKEUP));
|
||||
makeup.setCombinedConfig(new FUBundleData(bean.getBundlePath()));
|
||||
makeup.setMakeupIntensity(bean.getIntensity());
|
||||
makeupMap.put(bean.getKey(), makeup);
|
||||
return makeup;
|
||||
currentFilterIntensity = intensity;
|
||||
if (mFURenderKit.getFaceBeauty() != null) {
|
||||
mFURenderKit.getFaceBeauty().setFilterIntensity(currentFilterIntensity);
|
||||
}
|
||||
|
||||
if (!currentMakeup.getControlBundle().getPath().equals(FaceUnityConfig.BUNDLE_FACE_MAKEUP))
|
||||
currentMakeup.setFilterIntensity(currentFilterIntensity);
|
||||
}
|
||||
|
||||
|
||||
//endregion 组合妆
|
||||
|
||||
//region 子美妆
|
||||
|
||||
|
||||
/**
|
||||
* 获取子妆类别列表
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public ArrayList<MakeupCustomClassBean> getMakeupCustomClass() {
|
||||
return MakeupSource.buildCustomClasses();
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取子妆列表参数
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public LinkedHashMap<String, ArrayList<MakeupCustomBean>> getMakeupCustomItemParams() {
|
||||
return MakeupSource.buildCustomItemParams(mMakeUpColorMap);
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置子妆强度
|
||||
*
|
||||
* @param key
|
||||
* @param current
|
||||
* @param intensity
|
||||
*/
|
||||
@Override
|
||||
public void updateCustomItemIntensity(String key, int current, double intensity) {
|
||||
if (key.equals(FACE_MAKEUP_TYPE_FOUNDATION)) {
|
||||
currentMakeup.setFoundationIntensity(intensity);
|
||||
} else if (key.equals(FACE_MAKEUP_TYPE_LIP_STICK)) {
|
||||
currentMakeup.setLipIntensity(intensity);
|
||||
} else if (key.equals(FACE_MAKEUP_TYPE_BLUSHER)) {
|
||||
currentMakeup.setBlusherIntensity(intensity);
|
||||
} else if (key.equals(FACE_MAKEUP_TYPE_EYE_BROW)) {
|
||||
currentMakeup.setEyeBrowIntensity(intensity);
|
||||
} else if (key.equals(FACE_MAKEUP_TYPE_EYE_SHADOW)) {
|
||||
currentMakeup.setEyeShadowIntensity(intensity);
|
||||
} else if (key.equals(FACE_MAKEUP_TYPE_EYE_LINER)) {
|
||||
currentMakeup.setEyeLineIntensity(intensity);
|
||||
} else if (key.equals(FACE_MAKEUP_TYPE_EYE_LASH)) {
|
||||
currentMakeup.setEyeLashIntensity(intensity);
|
||||
} else if (key.equals(FACE_MAKEUP_TYPE_HIGH_LIGHT)) {
|
||||
currentMakeup.setHeightLightIntensity(intensity);
|
||||
} else if (key.equals(FACE_MAKEUP_TYPE_SHADOW)) {
|
||||
currentMakeup.setShadowIntensity(intensity);
|
||||
} else if (key.equals(FACE_MAKEUP_TYPE_EYE_PUPIL)) {
|
||||
currentMakeup.setPupilIntensity(intensity);
|
||||
}
|
||||
mCustomIntensityMap.put(key + "_" + current, intensity);
|
||||
}
|
||||
|
||||
/**
|
||||
* 切换子妆单项
|
||||
*
|
||||
* @param key 子妆类别
|
||||
* @param index 选中下标
|
||||
*/
|
||||
@Override
|
||||
public void onCustomBeanSelected(String key, int index) {
|
||||
String itemDir = FaceUnityConfig.MAKEUP_RESOURCE_ITEM_BUNDLE_DIR;
|
||||
mCustomIndexMap.put(key, index);
|
||||
if (key.equals(FACE_MAKEUP_TYPE_FOUNDATION)) {
|
||||
if (index == 0) {
|
||||
currentMakeup.setFoundationIntensity(0.0);
|
||||
} else {
|
||||
currentMakeup.setFoundationBundle(new FUBundleData(itemDir + "mu_style_foundation_01.bundle"));
|
||||
double intensity = 1.0;
|
||||
if (mCustomIntensityMap.containsKey(FACE_MAKEUP_TYPE_FOUNDATION + "_" + index)) {
|
||||
intensity = mCustomIntensityMap.get(FACE_MAKEUP_TYPE_FOUNDATION + "_" + index);
|
||||
}
|
||||
currentMakeup.setFoundationIntensity((intensity));
|
||||
updateCustomColor(key, index + 2);
|
||||
double[] color = mMakeUpColorMap.get("color_mu_style_foundation_01").get(index + 2);
|
||||
currentMakeup.setFoundationColor(buildFUColorRGBData(color));
|
||||
}
|
||||
} else if (key.equals(FACE_MAKEUP_TYPE_LIP_STICK)) {
|
||||
if (index == 0) {
|
||||
currentMakeup.setLipIntensity(0.0);
|
||||
} else {
|
||||
currentMakeup.setLipBundle(new FUBundleData(itemDir + "mu_style_lip_0" + index + ".bundle"));
|
||||
switch (index) {
|
||||
case 1:
|
||||
currentMakeup.setLipType(MakeupLipEnum.FOG);
|
||||
currentMakeup.setEnableTwoLipColor(false);
|
||||
currentMakeup.setLipHighLightEnable(false);
|
||||
currentMakeup.setLipHighLightStrength(0.0);
|
||||
break;
|
||||
case 2:
|
||||
currentMakeup.setLipType(MakeupLipEnum.MOIST);
|
||||
currentMakeup.setEnableTwoLipColor(false);
|
||||
currentMakeup.setLipHighLightEnable(false);
|
||||
currentMakeup.setLipHighLightStrength(0.0);
|
||||
break;
|
||||
case 3:
|
||||
currentMakeup.setLipType(MakeupLipEnum.WATER);
|
||||
currentMakeup.setEnableTwoLipColor(false);
|
||||
currentMakeup.setLipHighLightEnable(true);
|
||||
currentMakeup.setLipHighLightStrength(0.8);
|
||||
break;
|
||||
case 4:
|
||||
currentMakeup.setLipType(MakeupLipEnum.PEARL);
|
||||
currentMakeup.setEnableTwoLipColor(false);
|
||||
currentMakeup.setLipHighLightEnable(false);
|
||||
currentMakeup.setLipHighLightStrength(0.0);
|
||||
break;
|
||||
case 5:
|
||||
currentMakeup.setLipType(MakeupLipEnum.FOG);
|
||||
currentMakeup.setEnableTwoLipColor(true);
|
||||
currentMakeup.setLipHighLightEnable(false);
|
||||
currentMakeup.setLipHighLightStrength(0.0);
|
||||
currentMakeup.setLipColor2(new FUColorRGBData(0.0, 0.0, 0.0, 0.0));
|
||||
break;
|
||||
}
|
||||
|
||||
double intensity = 1.0;
|
||||
if (mCustomIntensityMap.containsKey(FACE_MAKEUP_TYPE_LIP_STICK + "_" + index)) {
|
||||
intensity = mCustomIntensityMap.get(FACE_MAKEUP_TYPE_LIP_STICK + "_" + index);
|
||||
}
|
||||
currentMakeup.setLipIntensity((intensity));
|
||||
int colorIndex = 3;
|
||||
if (mCustomColorIndexMap.containsKey(FACE_MAKEUP_TYPE_LIP_STICK + "_" + index)) {
|
||||
colorIndex = mCustomColorIndexMap.get(FACE_MAKEUP_TYPE_LIP_STICK + "_" + index);
|
||||
}
|
||||
updateCustomColor(key, colorIndex);
|
||||
}
|
||||
} else if (key.equals(FACE_MAKEUP_TYPE_BLUSHER)) {
|
||||
if (index == 0) {
|
||||
currentMakeup.setBlusherIntensity(0.0);
|
||||
} else {
|
||||
currentMakeup.setBlusherBundle(new FUBundleData(itemDir + "mu_style_blush_0" + index + ".bundle"));
|
||||
double intensity = 1.0;
|
||||
if (mCustomIntensityMap.containsKey(FACE_MAKEUP_TYPE_BLUSHER + "_" + index)) {
|
||||
intensity = mCustomIntensityMap.get(FACE_MAKEUP_TYPE_BLUSHER + "_" + index);
|
||||
}
|
||||
currentMakeup.setBlusherIntensity((intensity));
|
||||
int colorIndex = 3;
|
||||
if (mCustomColorIndexMap.containsKey(FACE_MAKEUP_TYPE_BLUSHER + "_" + index)) {
|
||||
colorIndex = mCustomColorIndexMap.get(FACE_MAKEUP_TYPE_BLUSHER + "_" + index);
|
||||
}
|
||||
updateCustomColor(key, colorIndex);
|
||||
}
|
||||
} else if (key.equals(FACE_MAKEUP_TYPE_EYE_BROW)) {
|
||||
if (index == 0) {
|
||||
currentMakeup.setEyeBrowIntensity(0.0);
|
||||
currentMakeup.setEnableBrowWarp(false);
|
||||
} else {
|
||||
currentMakeup.setEnableBrowWarp(false);
|
||||
currentMakeup.setEyeBrowBundle(new FUBundleData(itemDir + "mu_style_eyebrow_0" + index + ".bundle"));
|
||||
double intensity = 1.0;
|
||||
if (mCustomIntensityMap.containsKey(FACE_MAKEUP_TYPE_EYE_BROW + "_" + index)) {
|
||||
intensity = mCustomIntensityMap.get(FACE_MAKEUP_TYPE_EYE_BROW + "_" + index);
|
||||
}
|
||||
currentMakeup.setEyeBrowIntensity((intensity));
|
||||
int colorIndex = 3;
|
||||
if (mCustomColorIndexMap.containsKey(FACE_MAKEUP_TYPE_EYE_BROW + "_" + index)) {
|
||||
colorIndex = mCustomColorIndexMap.get(FACE_MAKEUP_TYPE_EYE_BROW + "_" + index);
|
||||
}
|
||||
updateCustomColor(key, colorIndex);
|
||||
}
|
||||
} else if (key.equals(FACE_MAKEUP_TYPE_EYE_SHADOW)) {
|
||||
if (index == 0) {
|
||||
currentMakeup.setEyeShadowIntensity(0.0);
|
||||
} else {
|
||||
currentMakeup.setEyeShadowBundle(new FUBundleData(itemDir + "mu_style_eyeshadow_0" + index + ".bundle"));
|
||||
double intensity = 1.0;
|
||||
if (mCustomIntensityMap.containsKey(FACE_MAKEUP_TYPE_EYE_SHADOW + "_" + index)) {
|
||||
intensity = mCustomIntensityMap.get(FACE_MAKEUP_TYPE_EYE_SHADOW + "_" + index);
|
||||
}
|
||||
currentMakeup.setEyeShadowIntensity((intensity));
|
||||
int colorIndex = 3;
|
||||
if (mCustomColorIndexMap.containsKey(FACE_MAKEUP_TYPE_EYE_SHADOW + "_" + index)) {
|
||||
colorIndex = mCustomColorIndexMap.get(FACE_MAKEUP_TYPE_EYE_SHADOW + "_" + index);
|
||||
}
|
||||
updateCustomColor(key, colorIndex);
|
||||
}
|
||||
} else if (key.equals(FACE_MAKEUP_TYPE_EYE_LINER)) {
|
||||
if (index == 0) {
|
||||
currentMakeup.setEyeLineIntensity(0.0);
|
||||
} else {
|
||||
currentMakeup.setEyeLinerBundle(new FUBundleData(itemDir + "mu_style_eyeliner_0" + index + ".bundle"));
|
||||
double intensity = 1.0;
|
||||
if (mCustomIntensityMap.containsKey(FACE_MAKEUP_TYPE_EYE_LINER + "_" + index)) {
|
||||
intensity = mCustomIntensityMap.get(FACE_MAKEUP_TYPE_EYE_LINER + "_" + index);
|
||||
}
|
||||
currentMakeup.setEyeLineIntensity((intensity));
|
||||
int colorIndex = 3;
|
||||
if (mCustomColorIndexMap.containsKey(FACE_MAKEUP_TYPE_EYE_LINER + "_" + index)) {
|
||||
colorIndex = mCustomColorIndexMap.get(FACE_MAKEUP_TYPE_EYE_LINER + "_" + index);
|
||||
}
|
||||
updateCustomColor(key, colorIndex);
|
||||
}
|
||||
} else if (key.equals(FACE_MAKEUP_TYPE_EYE_LASH)) {
|
||||
if (index == 0) {
|
||||
currentMakeup.setEyeLashIntensity(0.0);
|
||||
} else {
|
||||
currentMakeup.setEyeLashBundle(new FUBundleData(itemDir + "mu_style_eyelash_0" + index + ".bundle"));
|
||||
double intensity = 1.0;
|
||||
if (mCustomIntensityMap.containsKey(FACE_MAKEUP_TYPE_EYE_LASH + "_" + index)) {
|
||||
intensity = mCustomIntensityMap.get(FACE_MAKEUP_TYPE_EYE_LASH + "_" + index);
|
||||
}
|
||||
currentMakeup.setEyeLashIntensity((intensity));
|
||||
int colorIndex = 3;
|
||||
if (mCustomColorIndexMap.containsKey(FACE_MAKEUP_TYPE_EYE_LASH + "_" + index)) {
|
||||
colorIndex = mCustomColorIndexMap.get(FACE_MAKEUP_TYPE_EYE_LASH + "_" + index);
|
||||
}
|
||||
updateCustomColor(key, colorIndex);
|
||||
}
|
||||
} else if (key.equals(FACE_MAKEUP_TYPE_HIGH_LIGHT)) {
|
||||
if (index == 0) {
|
||||
currentMakeup.setHeightLightIntensity(0.0);
|
||||
} else {
|
||||
currentMakeup.setHighLightBundle(new FUBundleData(itemDir + "mu_style_highlight_0" + index + ".bundle"));
|
||||
double intensity = 1.0;
|
||||
if (mCustomIntensityMap.containsKey(FACE_MAKEUP_TYPE_HIGH_LIGHT + "_" + index)) {
|
||||
intensity = mCustomIntensityMap.get(FACE_MAKEUP_TYPE_HIGH_LIGHT + "_" + index);
|
||||
}
|
||||
currentMakeup.setHeightLightIntensity((intensity));
|
||||
int colorIndex = 3;
|
||||
if (mCustomColorIndexMap.containsKey(FACE_MAKEUP_TYPE_HIGH_LIGHT + "_" + index)) {
|
||||
colorIndex = mCustomColorIndexMap.get(FACE_MAKEUP_TYPE_HIGH_LIGHT + "_" + index);
|
||||
}
|
||||
updateCustomColor(key, colorIndex);
|
||||
}
|
||||
} else if (key.equals(FACE_MAKEUP_TYPE_SHADOW)) {
|
||||
if (index == 0) {
|
||||
currentMakeup.setShadowIntensity(0.0);
|
||||
} else {
|
||||
currentMakeup.setShadowBundle(new FUBundleData(itemDir + "mu_style_contour_01.bundle"));
|
||||
double intensity = 1.0;
|
||||
if (mCustomIntensityMap.containsKey(FACE_MAKEUP_TYPE_SHADOW + "_" + index)) {
|
||||
intensity = mCustomIntensityMap.get(FACE_MAKEUP_TYPE_SHADOW + "_" + index);
|
||||
}
|
||||
currentMakeup.setShadowIntensity((intensity));
|
||||
int colorIndex = 3;
|
||||
if (mCustomColorIndexMap.containsKey(FACE_MAKEUP_TYPE_SHADOW + "_" + index)) {
|
||||
colorIndex = mCustomColorIndexMap.get(FACE_MAKEUP_TYPE_SHADOW + "_" + index);
|
||||
}
|
||||
updateCustomColor(key, colorIndex);
|
||||
}
|
||||
} else if (key.equals(FACE_MAKEUP_TYPE_EYE_PUPIL)) {
|
||||
if (index == 0) {
|
||||
currentMakeup.setPupilIntensity(0.0);
|
||||
} else {
|
||||
if (index == 1) {
|
||||
currentMakeup.setPupilBundle(new FUBundleData(itemDir + "mu_style_eyepupil_01.bundle"));
|
||||
double intensity = 1.0;
|
||||
if (mCustomIntensityMap.containsKey(FACE_MAKEUP_TYPE_EYE_PUPIL + "_" + index)) {
|
||||
intensity = mCustomIntensityMap.get(FACE_MAKEUP_TYPE_EYE_PUPIL + "_" + index);
|
||||
}
|
||||
currentMakeup.setPupilIntensity((intensity));
|
||||
int colorIndex = 3;
|
||||
if (mCustomColorIndexMap.containsKey(FACE_MAKEUP_TYPE_EYE_PUPIL + "_" + index)) {
|
||||
colorIndex = mCustomColorIndexMap.get(FACE_MAKEUP_TYPE_EYE_PUPIL + "_" + index);
|
||||
}
|
||||
updateCustomColor(key, colorIndex);
|
||||
} else {
|
||||
currentMakeup.setPupilBundle(new FUBundleData(itemDir + "mu_style_eyepupil_0" + (index + 1) + ".bundle"));
|
||||
double intensity = 1.0;
|
||||
if (mCustomIntensityMap.containsKey(FACE_MAKEUP_TYPE_EYE_PUPIL + "_" + index)) {
|
||||
intensity = mCustomIntensityMap.get(FACE_MAKEUP_TYPE_EYE_PUPIL + "_" + index);
|
||||
}
|
||||
currentMakeup.setPupilIntensity((intensity));
|
||||
currentMakeup.setPupilColor(buildFUColorRGBData(new double[]{0.0, 0.0, 0.0, 0.0}));
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 设置子妆颜色值
|
||||
*
|
||||
* @param key 类别关键字
|
||||
* @param index 颜色下标
|
||||
*/
|
||||
@Override
|
||||
public void updateCustomColor(String key, int index) {
|
||||
int current = mCustomIndexMap.containsKey(key) ? mCustomIndexMap.get(key) : 0;
|
||||
if (key.equals(FACE_MAKEUP_TYPE_LIP_STICK)) {
|
||||
mCustomColorIndexMap.put(FACE_MAKEUP_TYPE_LIP_STICK + "_" + current, index);
|
||||
double[] color = mMakeUpColorMap.get("color_mu_style_lip_01").get(index);
|
||||
if (current == 3)
|
||||
currentMakeup.setLipColorV2(buildFUColorRGBData(color));
|
||||
else
|
||||
currentMakeup.setLipColor(buildFUColorRGBData(color));
|
||||
} else if (key.equals(FACE_MAKEUP_TYPE_BLUSHER)) {
|
||||
mCustomColorIndexMap.put(FACE_MAKEUP_TYPE_BLUSHER + "_" + current, index);
|
||||
double[] color = mMakeUpColorMap.get("color_mu_style_blush_0" + current).get(index);
|
||||
currentMakeup.setBlusherColor(buildFUColorRGBData(color));
|
||||
} else if (key.equals(FACE_MAKEUP_TYPE_EYE_BROW)) {
|
||||
mCustomColorIndexMap.put(FACE_MAKEUP_TYPE_EYE_BROW + "_" + current, index);
|
||||
double[] color = mMakeUpColorMap.get("color_mu_style_eyebrow_01").get(index);
|
||||
currentMakeup.setEyeBrowColor(buildFUColorRGBData(color));
|
||||
} else if (key.equals(FACE_MAKEUP_TYPE_EYE_SHADOW)) {
|
||||
mCustomColorIndexMap.put(FACE_MAKEUP_TYPE_EYE_SHADOW + "_" + current, index);
|
||||
double[] color = mMakeUpColorMap.get("color_mu_style_eyeshadow_0" + current).get(index);
|
||||
currentMakeup.setEyeShadowColor(new FUColorRGBData(color[0] * 255, color[1] * 255, color[2] * 255, color[3] * 255));
|
||||
currentMakeup.setEyeShadowColor2(new FUColorRGBData(color[4] * 255, color[5] * 255, color[6] * 255, color[7] * 255));
|
||||
currentMakeup.setEyeShadowColor3(new FUColorRGBData(color[8] * 255, color[9] * 255, color[10] * 255, color[11] * 255));
|
||||
} else if (key.equals(FACE_MAKEUP_TYPE_EYE_LINER)) {
|
||||
mCustomColorIndexMap.put(FACE_MAKEUP_TYPE_EYE_LINER + "_" + current, index);
|
||||
double[] color = mMakeUpColorMap.get("color_mu_style_eyeliner_0" + current).get(index);
|
||||
currentMakeup.setEyeLinerColor(buildFUColorRGBData(color));
|
||||
} else if (key.equals(FACE_MAKEUP_TYPE_EYE_LASH)) {
|
||||
mCustomColorIndexMap.put(FACE_MAKEUP_TYPE_EYE_LASH + "_" + current, index);
|
||||
double[] color = mMakeUpColorMap.get("color_mu_style_eyelash_0" + current).get(index);
|
||||
currentMakeup.setEyeLashColor(buildFUColorRGBData(color));
|
||||
} else if (key.equals(FACE_MAKEUP_TYPE_HIGH_LIGHT)) {
|
||||
mCustomColorIndexMap.put(FACE_MAKEUP_TYPE_HIGH_LIGHT + "_" + current, index);
|
||||
double[] color = mMakeUpColorMap.get("color_mu_style_highlight_0" + current).get(index);
|
||||
currentMakeup.setHighLightColor(buildFUColorRGBData(color));
|
||||
} else if (key.equals(FACE_MAKEUP_TYPE_SHADOW)) {
|
||||
mCustomColorIndexMap.put(FACE_MAKEUP_TYPE_SHADOW + "_" + current, index);
|
||||
double[] color = mMakeUpColorMap.get("color_mu_style_contour_01").get(index);
|
||||
currentMakeup.setShadowColor(buildFUColorRGBData(color));
|
||||
} else if (key.equals(FACE_MAKEUP_TYPE_EYE_PUPIL)) {
|
||||
mCustomColorIndexMap.put(FACE_MAKEUP_TYPE_EYE_PUPIL + "_" + current, index);
|
||||
double[] color = mMakeUpColorMap.get("color_mu_style_eyepupil_01").get(index);
|
||||
currentMakeup.setPupilColor(buildFUColorRGBData(color));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//endregion 子美妆
|
||||
|
||||
//region 其他
|
||||
|
||||
/**
|
||||
* 进入自定义美妆,模型分析
|
||||
*/
|
||||
@Override
|
||||
public void enterCustomMakeup() {
|
||||
mCustomIndexMap.clear();
|
||||
mCustomColorIndexMap.clear();
|
||||
mCustomIntensityMap.clear();
|
||||
double makeupIntensity = currentMakeup.getMakeupIntensity();
|
||||
/*粉底*/
|
||||
if (currentMakeup.getFoundationIntensity() != 0.0) {
|
||||
double intensity = currentMakeup.getFoundationIntensity() * makeupIntensity;
|
||||
currentMakeup.setFoundationIntensity(intensity);
|
||||
double[] array = currentMakeup.getFoundationColor().toScaleColorArray();
|
||||
ArrayList<double[]> list = mMakeUpColorMap.get("color_mu_style_foundation_01");
|
||||
for (int i = 0; i < list.size(); i++) {
|
||||
if (DecimalUtils.doubleArrayEquals(array, list.get(i))) {
|
||||
mCustomIndexMap.put(FACE_MAKEUP_TYPE_FOUNDATION, i - 2);
|
||||
mCustomIntensityMap.put(FACE_MAKEUP_TYPE_FOUNDATION + "_" + (i - 2), intensity);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
/*口红*/
|
||||
if (currentMakeup.getLipIntensity() != 0.0) {
|
||||
double intensity = currentMakeup.getLipIntensity() * makeupIntensity;
|
||||
currentMakeup.setLipIntensity(intensity);
|
||||
int current = 0;
|
||||
switch (currentMakeup.getLipType()) {
|
||||
case MakeupLipEnum.FOG:
|
||||
if (currentMakeup.getEnableTwoLipColor()) {
|
||||
current = 5;
|
||||
} else {
|
||||
current = 1;
|
||||
}
|
||||
break;
|
||||
case MakeupLipEnum.MOIST:
|
||||
current = 3;
|
||||
break;
|
||||
case MakeupLipEnum.PEARL:
|
||||
current = 4;
|
||||
break;
|
||||
case MakeupLipEnum.WATER:
|
||||
current = 2;
|
||||
break;
|
||||
}
|
||||
mCustomIndexMap.put(FACE_MAKEUP_TYPE_LIP_STICK, current);
|
||||
if (current != 0) {
|
||||
double[] colorArray;
|
||||
if (currentMakeup.getLipType() == MakeupLipEnum.WATER) {
|
||||
colorArray = currentMakeup.getLipColorV2().toScaleColorArray();
|
||||
} else {
|
||||
colorArray = currentMakeup.getLipColor().toScaleColorArray();
|
||||
}
|
||||
|
||||
ArrayList<double[]> list = mMakeUpColorMap.get("color_mu_style_lip_01");
|
||||
for (int i = 0; i < list.size(); i++) {
|
||||
if (DecimalUtils.doubleArrayEquals(colorArray, list.get(i))) {
|
||||
mCustomColorIndexMap.put(FACE_MAKEUP_TYPE_LIP_STICK + "_" + current, i);
|
||||
break;
|
||||
}
|
||||
}
|
||||
mCustomIntensityMap.put(FACE_MAKEUP_TYPE_LIP_STICK + "_" + current, intensity);
|
||||
}
|
||||
}
|
||||
/*腮红*/
|
||||
if (currentMakeup.getBlusherIntensity() != 0.0 && currentMakeup.getBlusherBundle() != null) {
|
||||
double intensity = currentMakeup.getBlusherIntensity() * makeupIntensity;
|
||||
currentMakeup.setBlusherIntensity(intensity);
|
||||
String path = currentMakeup.getBlusherBundle().getPath();
|
||||
int current = 0;
|
||||
if (path.endsWith("mu_style_blush_01.bundle")) {
|
||||
current = 1;
|
||||
} else if (path.endsWith("mu_style_blush_02.bundle")) {
|
||||
current = 2;
|
||||
} else if (path.endsWith("mu_style_blush_03.bundle")) {
|
||||
current = 3;
|
||||
} else if (path.endsWith("mu_style_blush_04.bundle")) {
|
||||
current = 4;
|
||||
}
|
||||
mCustomIndexMap.put(FACE_MAKEUP_TYPE_BLUSHER, current);
|
||||
if (current != 0) {
|
||||
double[] colorArray = currentMakeup.getBlusherColor().toScaleColorArray();
|
||||
ArrayList<double[]> list = mMakeUpColorMap.get("color_mu_style_blush_0" + current);
|
||||
for (int i = 0; i < list.size(); i++) {
|
||||
if (DecimalUtils.doubleArrayEquals(colorArray, list.get(i))) {
|
||||
mCustomColorIndexMap.put(FACE_MAKEUP_TYPE_BLUSHER + "_" + current, i);
|
||||
break;
|
||||
}
|
||||
}
|
||||
mCustomIntensityMap.put(FACE_MAKEUP_TYPE_BLUSHER + "_" + current, intensity);
|
||||
}
|
||||
}
|
||||
/*眉毛*/
|
||||
if (currentMakeup.getEyeBrowIntensity() != 0.0) {
|
||||
double intensity = currentMakeup.getEyeBrowIntensity() * makeupIntensity;
|
||||
currentMakeup.setEyeBrowIntensity(intensity);
|
||||
int current = 0;
|
||||
if (currentMakeup.getEyeBrowBundle() != null && currentMakeup.getEyeBrowBundle().getPath() != null) {
|
||||
String bundlePath = currentMakeup.getEyeBrowBundle().getPath();
|
||||
int spotIndex = bundlePath.lastIndexOf(".");
|
||||
String index = bundlePath.substring(spotIndex - 1, spotIndex);
|
||||
current = Integer.valueOf(index);
|
||||
}
|
||||
mCustomIndexMap.put(FACE_MAKEUP_TYPE_EYE_BROW, current);
|
||||
if (current != 0) {
|
||||
double[] colorArray = currentMakeup.getEyeBrowColor().toScaleColorArray();
|
||||
ArrayList<double[]> list = mMakeUpColorMap.get("color_mu_style_eyebrow_01");
|
||||
for (int i = 0; i < list.size(); i++) {
|
||||
if (DecimalUtils.doubleArrayEquals(colorArray, list.get(i))) {
|
||||
mCustomColorIndexMap.put(FACE_MAKEUP_TYPE_EYE_BROW + "_" + current, i);
|
||||
break;
|
||||
}
|
||||
}
|
||||
mCustomIntensityMap.put(FACE_MAKEUP_TYPE_EYE_BROW + "_" + current, intensity);
|
||||
}
|
||||
}
|
||||
/*眼影*/
|
||||
if (currentMakeup.getEyeShadowIntensity() != 0.0 && currentMakeup.getEyeShadowBundle() != null) {
|
||||
double intensity = currentMakeup.getEyeShadowIntensity() * makeupIntensity;
|
||||
currentMakeup.setEyeShadowIntensity(intensity);
|
||||
String path = currentMakeup.getEyeShadowBundle().getPath();
|
||||
int current = 0;
|
||||
if (path.endsWith("mu_style_eyeshadow_01.bundle")) {
|
||||
current = 1;
|
||||
} else if (path.endsWith("mu_style_eyeshadow_02.bundle")) {
|
||||
current = 2;
|
||||
} else if (path.endsWith("mu_style_eyeshadow_03.bundle")) {
|
||||
current = 3;
|
||||
} else if (path.endsWith("mu_style_eyeshadow_04.bundle")) {
|
||||
current = 4;
|
||||
} else if (path.endsWith("mu_style_eyeshadow_05.bundle")) {
|
||||
current = 5;
|
||||
} else if (path.endsWith("mu_style_eyeshadow_06.bundle")) {
|
||||
current = 6;
|
||||
}
|
||||
mCustomIndexMap.put(FACE_MAKEUP_TYPE_EYE_SHADOW, current);
|
||||
if (current != 0) {
|
||||
double[] array = new double[12];
|
||||
double[] color1 = currentMakeup.getEyeShadowColor().toScaleColorArray();
|
||||
double[] color2 = currentMakeup.getEyeShadowColor2().toScaleColorArray();
|
||||
double[] color3 = currentMakeup.getEyeShadowColor3().toScaleColorArray();
|
||||
System.arraycopy(color1, 0, array, 0, color1.length);
|
||||
System.arraycopy(color2, 0, array, 4, color2.length);
|
||||
System.arraycopy(color3, 0, array, 8, color3.length);
|
||||
ArrayList<double[]> list = mMakeUpColorMap.get("color_mu_style_eyeshadow_0" + current);
|
||||
for (int i = 0; i < list.size(); i++) {
|
||||
if (DecimalUtils.doubleArrayEquals(array, list.get(i))) {
|
||||
mCustomColorIndexMap.put(FACE_MAKEUP_TYPE_EYE_SHADOW + "_" + current, i);
|
||||
break;
|
||||
}
|
||||
}
|
||||
mCustomIntensityMap.put(FACE_MAKEUP_TYPE_EYE_SHADOW + "_" + current, intensity);
|
||||
}
|
||||
}
|
||||
/*眼线*/
|
||||
if (currentMakeup.getEyeLineIntensity() != 0.0 && currentMakeup.getEyeLinerBundle() != null) {
|
||||
double intensity = currentMakeup.getEyeLineIntensity() * makeupIntensity;
|
||||
currentMakeup.setEyeLineIntensity(intensity);
|
||||
String path = currentMakeup.getEyeLinerBundle().getPath();
|
||||
int current = 0;
|
||||
if (path.endsWith("mu_style_eyeliner_01.bundle")) {
|
||||
current = 1;
|
||||
} else if (path.endsWith("mu_style_eyeliner_02.bundle")) {
|
||||
current = 2;
|
||||
} else if (path.endsWith("mu_style_eyeliner_03.bundle")) {
|
||||
current = 3;
|
||||
} else if (path.endsWith("mu_style_eyeliner_04.bundle")) {
|
||||
current = 4;
|
||||
} else if (path.endsWith("mu_style_eyeliner_05.bundle")) {
|
||||
current = 5;
|
||||
} else if (path.endsWith("mu_style_eyeliner_06.bundle")) {
|
||||
current = 6;
|
||||
}
|
||||
mCustomIndexMap.put(FACE_MAKEUP_TYPE_EYE_LINER, current);
|
||||
if (current != 0) {
|
||||
double[] colorArray = currentMakeup.getEyeLinerColor().toScaleColorArray();
|
||||
ArrayList<double[]> list = mMakeUpColorMap.get("color_mu_style_eyeliner_0" + current);
|
||||
for (int i = 0; i < list.size(); i++) {
|
||||
if (DecimalUtils.doubleArrayEquals(colorArray, list.get(i))) {
|
||||
mCustomColorIndexMap.put(FACE_MAKEUP_TYPE_EYE_LINER + "_" + current, i);
|
||||
break;
|
||||
}
|
||||
}
|
||||
mCustomIntensityMap.put(FACE_MAKEUP_TYPE_EYE_LINER + "_" + current, intensity);
|
||||
}
|
||||
}
|
||||
/* 睫毛*/
|
||||
if (currentMakeup.getEyeLashIntensity() != 0.0 && currentMakeup.getEyeLashBundle() != null) {
|
||||
double intensity = currentMakeup.getEyeLashIntensity() * makeupIntensity;
|
||||
currentMakeup.setEyeLashIntensity(intensity);
|
||||
String path = currentMakeup.getEyeLashBundle().getPath();
|
||||
int current = 0;
|
||||
if (path.endsWith("mu_style_eyelash_01.bundle")) {
|
||||
current = 1;
|
||||
} else if (path.endsWith("mu_style_eyelash_02.bundle")) {
|
||||
current = 2;
|
||||
} else if (path.endsWith("mu_style_eyelash_03.bundle")) {
|
||||
current = 3;
|
||||
} else if (path.endsWith("mu_style_eyelash_04.bundle")) {
|
||||
current = 4;
|
||||
} else if (path.endsWith("mu_style_eyelash_05.bundle")) {
|
||||
current = 5;
|
||||
} else if (path.endsWith("mu_style_eyelash_06.bundle")) {
|
||||
current = 6;
|
||||
}
|
||||
mCustomIndexMap.put(FACE_MAKEUP_TYPE_EYE_LASH, current);
|
||||
if (current != 0) {
|
||||
double[] colorArray = currentMakeup.getEyeLashColor().toScaleColorArray();
|
||||
ArrayList<double[]> list = mMakeUpColorMap.get("color_mu_style_eyelash_0" + current);
|
||||
for (int i = 0; i < list.size(); i++) {
|
||||
if (DecimalUtils.doubleArrayEquals(colorArray, list.get(i))) {
|
||||
mCustomColorIndexMap.put(FACE_MAKEUP_TYPE_EYE_LASH + "_" + current, i);
|
||||
break;
|
||||
}
|
||||
}
|
||||
mCustomIntensityMap.put(FACE_MAKEUP_TYPE_EYE_LASH + "_" + current, intensity);
|
||||
}
|
||||
}
|
||||
/* 高光*/
|
||||
if (currentMakeup.getHeightLightIntensity() != 0.0 && currentMakeup.getHighLightBundle() != null) {
|
||||
double intensity = currentMakeup.getHeightLightIntensity() * makeupIntensity;
|
||||
currentMakeup.setHeightLightIntensity(intensity);
|
||||
String path = currentMakeup.getHighLightBundle().getPath();
|
||||
int current = 0;
|
||||
if (path.endsWith("mu_style_highlight_01.bundle")) {
|
||||
current = 1;
|
||||
} else if (path.endsWith("mu_style_highlight_02.bundle")) {
|
||||
current = 2;
|
||||
}
|
||||
mCustomIndexMap.put(FACE_MAKEUP_TYPE_HIGH_LIGHT, current);
|
||||
if (current != 0) {
|
||||
double[] colorArray = currentMakeup.getHighLightColor().toScaleColorArray();
|
||||
ArrayList<double[]> list = mMakeUpColorMap.get("color_mu_style_highlight_0" + current);
|
||||
for (int i = 0; i < list.size(); i++) {
|
||||
if (DecimalUtils.doubleArrayEquals(colorArray, list.get(i))) {
|
||||
mCustomColorIndexMap.put(FACE_MAKEUP_TYPE_HIGH_LIGHT + "_" + current, i);
|
||||
break;
|
||||
}
|
||||
}
|
||||
mCustomIntensityMap.put(FACE_MAKEUP_TYPE_HIGH_LIGHT + "_" + current, intensity);
|
||||
}
|
||||
}
|
||||
/* 阴影*/
|
||||
if (currentMakeup.getShadowIntensity() != 0.0 && currentMakeup.getShadowBundle() != null) {
|
||||
double intensity = currentMakeup.getShadowIntensity() * makeupIntensity;
|
||||
currentMakeup.setShadowIntensity(intensity);
|
||||
String path = currentMakeup.getShadowBundle().getPath();
|
||||
int current = 0;
|
||||
if (path.endsWith("mu_style_contour_01.bundle")) {
|
||||
current = 1;
|
||||
}
|
||||
mCustomIndexMap.put(FACE_MAKEUP_TYPE_SHADOW, current);
|
||||
if (current != 0) {
|
||||
double[] colorArray = currentMakeup.getShadowColor().toScaleColorArray();
|
||||
ArrayList<double[]> list = mMakeUpColorMap.get("color_mu_style_contour_01");
|
||||
for (int i = 0; i < list.size(); i++) {
|
||||
if (DecimalUtils.doubleArrayEquals(colorArray, list.get(i))) {
|
||||
mCustomColorIndexMap.put(FACE_MAKEUP_TYPE_SHADOW + "_" + current, i);
|
||||
break;
|
||||
}
|
||||
}
|
||||
mCustomIntensityMap.put(FACE_MAKEUP_TYPE_SHADOW + "_" + current, intensity);
|
||||
}
|
||||
}
|
||||
/* 美瞳*/
|
||||
if (currentMakeup.getPupilIntensity() != 0.0 && currentMakeup.getPupilBundle() != null) {
|
||||
double intensity = currentMakeup.getPupilIntensity() * makeupIntensity;
|
||||
currentMakeup.setPupilIntensity(intensity);
|
||||
String path = currentMakeup.getPupilBundle().getPath();
|
||||
int current = 0;
|
||||
if (path.endsWith("mu_style_eyepupil_01.bundle")) {
|
||||
current = 1;
|
||||
} else if (path.endsWith("mu_style_eyepupil_03.bundle")) {
|
||||
current = 2;
|
||||
} else if (path.endsWith("mu_style_eyepupil_04.bundle")) {
|
||||
current = 3;
|
||||
} else if (path.endsWith("mu_style_eyepupil_05.bundle")) {
|
||||
current = 4;
|
||||
} else if (path.endsWith("mu_style_eyepupil_06.bundle")) {
|
||||
current = 5;
|
||||
} else if (path.endsWith("mu_style_eyepupil_07.bundle")) {
|
||||
current = 6;
|
||||
} else if (path.endsWith("mu_style_eyepupil_08.bundle")) {
|
||||
current = 7;
|
||||
} else if (path.endsWith("mu_style_eyepupil_09.bundle")) {
|
||||
current = 8;
|
||||
}
|
||||
mCustomIndexMap.put(FACE_MAKEUP_TYPE_EYE_PUPIL, current);
|
||||
if (current != 0) {
|
||||
double[] colorArray = currentMakeup.getPupilColor().toScaleColorArray();
|
||||
ArrayList<double[]> list = mMakeUpColorMap.get("color_mu_style_eyepupil_01");
|
||||
for (int i = 0; i < list.size(); i++) {
|
||||
if (DecimalUtils.doubleArrayEquals(colorArray, list.get(i))) {
|
||||
mCustomColorIndexMap.put(FACE_MAKEUP_TYPE_EYE_PUPIL + "_" + current, i);
|
||||
break;
|
||||
}
|
||||
}
|
||||
mCustomIntensityMap.put(FACE_MAKEUP_TYPE_EYE_PUPIL + "_" + current, intensity);
|
||||
}
|
||||
}
|
||||
currentMakeup.setMakeupIntensity(1.0);
|
||||
}
|
||||
|
||||
/**
|
||||
* 或当单项列表当前下标
|
||||
*
|
||||
* @param key
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public int getCurrentCustomItemIndex(String key) {
|
||||
if (mCustomIndexMap.containsKey(key)) {
|
||||
return mCustomIndexMap.get(key);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取当前单项颜色下标
|
||||
*
|
||||
* @param key
|
||||
* @param current
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public int getCurrentCustomColorIndex(String key, int current) {
|
||||
if (mCustomColorIndexMap.containsKey(key + "_" + current)) {
|
||||
return mCustomColorIndexMap.get(key + "_" + current);
|
||||
}
|
||||
return 3;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取当前单项强度
|
||||
*
|
||||
* @param key
|
||||
* @param current
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public double getCurrentCustomIntensity(String key, int current) {
|
||||
if (mCustomIntensityMap.containsKey(key + "_" + current)) {
|
||||
return mCustomIntensityMap.get(key + "_" + current);
|
||||
}
|
||||
return 1.0;
|
||||
}
|
||||
|
||||
//endregion
|
||||
|
||||
/**
|
||||
* FURenderKit加载当前特效
|
||||
*/
|
||||
public void bindCurrentRenderer() {
|
||||
mFURenderKit.setFaceBeauty(FaceBeautySource.clone(FaceBeautyDataFactory.faceBeauty));
|
||||
mFURenderKit.getFaceBeauty().setFilterName(currentFilterName);
|
||||
mFURenderKit.getFaceBeauty().setFilterIntensity(currentFilterIntensity);
|
||||
if (!currentMakeup.getControlBundle().getPath().equals(FaceUnityConfig.BUNDLE_FACE_MAKEUP))
|
||||
currentMakeup.setFilterIntensity(currentFilterIntensity);
|
||||
FUAIKit.getInstance().setMaxFaces(4);
|
||||
mFURenderKit.setMakeup(currentMakeup);
|
||||
|
||||
//特殊有一些需要设置图层混合模式的 04双色眼影3(第2层眼影的混合模式 == 1) 06三色眼影2(第3层眼影的混合模式 == 1)
|
||||
if (currentMakeup.getEyeShadowBundle() != null && ("mu_style_eyeshadow_0" + 4).equals(currentMakeup.getEyeShadowBundle().getName()))
|
||||
currentMakeup.setEyeShadowTexBlend2(1);
|
||||
else if (currentMakeup.getEyeShadowBundle() != null && ("mu_style_eyeshadow_0" + 6).equals(currentMakeup.getEyeShadowBundle().getName()))
|
||||
currentMakeup.setEyeShadowTexBlend3(1);
|
||||
|
||||
if (FaceUnityConfig.IS_OPEN_LAND_MARK) {
|
||||
ExpressionRecognition expressionRecognition = new ExpressionRecognition(new FUBundleData(FaceUnityConfig.BUNDLE_LANDMARKS));
|
||||
expressionRecognition.setLandmarksType(FUAITypeEnum.FUAITYPE_FACELANDMARKS239);
|
||||
mFURenderKit.getPropContainer().addProp(expressionRecognition);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -46,9 +46,14 @@ public class PropDataFactory extends AbstractPropDataFactory {
|
||||
/*回调接口*/
|
||||
private final PropListener mPropListener;
|
||||
/*道具类型*/
|
||||
private final int propType;
|
||||
private int propType;
|
||||
|
||||
|
||||
/**
|
||||
* @param listener 回调接口
|
||||
* @param type 道具类型
|
||||
* @param index 默认选中下标
|
||||
*/
|
||||
public PropDataFactory(PropListener listener, int type, int index) {
|
||||
mPropListener = listener;
|
||||
propType = type;
|
||||
@@ -89,12 +94,18 @@ public class PropDataFactory extends AbstractPropDataFactory {
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 设置效果
|
||||
*/
|
||||
@Override
|
||||
public void onItemSelected(PropBean bean) {
|
||||
onPropSelected(bean);
|
||||
mPropListener.onItemSelected(bean);
|
||||
}
|
||||
|
||||
public void setPropType(int propType) {
|
||||
this.propType = propType;
|
||||
}
|
||||
|
||||
/**
|
||||
* 其他道具
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
package com.yunbao.faceunity.entity
|
||||
|
||||
import android.graphics.drawable.Drawable
|
||||
|
||||
abstract class BaseBean {
|
||||
abstract val key: String
|
||||
abstract val desRes: Int
|
||||
@@ -11,5 +13,7 @@ abstract class BaseBean {
|
||||
open fun getImageUrl():String {
|
||||
return "";
|
||||
}
|
||||
|
||||
open fun getImageDrawable(): Drawable{
|
||||
return null!!
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,90 @@
|
||||
package com.yunbao.faceunity.entity;
|
||||
|
||||
import android.graphics.drawable.Drawable;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
import java.util.ArrayList;
|
||||
/**
|
||||
*
|
||||
* @property nameRes Int 名称
|
||||
* @property drawable Drawable 图片资源
|
||||
* @property doubleArray ArrayList<DoubleArray>? 颜色数组
|
||||
* @constructor
|
||||
*/
|
||||
public class MakeupCustomBean extends BaseBean{
|
||||
private int nameRes;
|
||||
private Drawable drawable;
|
||||
private ArrayList<double[]> doubleArray;
|
||||
private int beanType;
|
||||
|
||||
public MakeupCustomBean(int nameRes, Drawable drawable, ArrayList<double[]> doubleArray,int beanType) {
|
||||
this.nameRes = nameRes;
|
||||
this.drawable = drawable;
|
||||
this.doubleArray = doubleArray;
|
||||
this.beanType=beanType;
|
||||
}
|
||||
|
||||
|
||||
public MakeupCustomBean(int nameRes, Drawable drawable,int beanType) {
|
||||
this.nameRes = nameRes;
|
||||
this.drawable = drawable;
|
||||
this.beanType=beanType;
|
||||
}
|
||||
|
||||
public int getNameRes() {
|
||||
return nameRes;
|
||||
}
|
||||
|
||||
public void setNameRes(int nameRes) {
|
||||
this.nameRes = nameRes;
|
||||
}
|
||||
|
||||
public Drawable getDrawable() {
|
||||
return drawable;
|
||||
}
|
||||
|
||||
public void setDrawable(Drawable drawable) {
|
||||
this.drawable = drawable;
|
||||
}
|
||||
|
||||
public ArrayList<double[]> getDoubleArray() {
|
||||
return doubleArray;
|
||||
}
|
||||
|
||||
public void setDoubleArray(ArrayList<double[]> doubleArray) {
|
||||
this.doubleArray = doubleArray;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getKey() {
|
||||
return nameRes+"";
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getDesRes() {
|
||||
return nameRes;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getImageRes() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public Drawable getImageDrawable() {
|
||||
return drawable;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getBeanType() {
|
||||
return beanType;
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public ModelAttributeData getModelAttributeData() {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -1,18 +0,0 @@
|
||||
package com.yunbao.faceunity.entity
|
||||
|
||||
import android.graphics.drawable.Drawable
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @property nameRes Int 名称
|
||||
* @property drawable Drawable 图片资源
|
||||
* @property doubleArray ArrayList<DoubleArray>? 颜色数组
|
||||
* @constructor
|
||||
*/
|
||||
data class MakeupCustomBean @JvmOverloads constructor(
|
||||
val nameRes: Int,
|
||||
val drawable: Drawable,
|
||||
val doubleArray: ArrayList<DoubleArray>? = null
|
||||
)
|
||||
|
||||
@@ -0,0 +1,43 @@
|
||||
package com.yunbao.faceunity.entity;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
import com.yunbao.faceunity.data.FaceParam;
|
||||
|
||||
public class MakeupCustomClassBean extends BaseBean{
|
||||
private int nameRes;
|
||||
private String key;
|
||||
private int beanType;
|
||||
|
||||
public MakeupCustomClassBean(int nameRes, String key, int beanType) {
|
||||
this.nameRes = nameRes;
|
||||
this.key = key;
|
||||
this.beanType = beanType;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getKey() {
|
||||
return key;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getDesRes() {
|
||||
return nameRes;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getImageRes() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getBeanType() {
|
||||
return beanType;
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public ModelAttributeData getModelAttributeData() {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -1,9 +0,0 @@
|
||||
package com.yunbao.faceunity.entity
|
||||
|
||||
/**
|
||||
* 美妆子妆类别
|
||||
* @property nameRes Int 名称
|
||||
* @property key String 标识
|
||||
* @constructor
|
||||
*/
|
||||
data class MakeupCustomClassBean(val nameRes: Int, val key: String)
|
||||
@@ -15,16 +15,19 @@ public class PropBean extends BaseBean {
|
||||
private int iconId;
|
||||
private String path;
|
||||
private int descId;
|
||||
private int beanType;
|
||||
|
||||
public PropBean(int iconId, String path) {
|
||||
public PropBean(int iconId, String path,int beanType) {
|
||||
this.iconId = iconId;
|
||||
this.path = path;
|
||||
this.beanType=beanType;
|
||||
}
|
||||
|
||||
public PropBean(int iconId, String path, int descId) {
|
||||
public PropBean(int iconId, String path, int descId,int beanType) {
|
||||
this.iconId = iconId;
|
||||
this.path = path;
|
||||
this.descId = descId;
|
||||
this.beanType=beanType;
|
||||
}
|
||||
|
||||
public int getIconId() {
|
||||
@@ -69,7 +72,7 @@ public class PropBean extends BaseBean {
|
||||
|
||||
@Override
|
||||
public int getBeanType() {
|
||||
return FaceParam.FACE_BIG_HEAD;
|
||||
return beanType;
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@@ -77,4 +80,6 @@ public class PropBean extends BaseBean {
|
||||
public ModelAttributeData getModelAttributeData() {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -137,7 +137,7 @@ public class FineStickerEntity {
|
||||
@NonNull
|
||||
@Override
|
||||
public String getKey() {
|
||||
return tag;
|
||||
return _id;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1,50 +0,0 @@
|
||||
package com.yunbao.faceunity.infe;
|
||||
|
||||
|
||||
import com.yunbao.faceunity.entity.MakeupCombinationBean;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
/**
|
||||
* DESC:数据构造工厂抽象类
|
||||
* Created on 2021/4/26
|
||||
*/
|
||||
public abstract class AbstractMakeupDataFactory {
|
||||
|
||||
/**
|
||||
* 获取当前组合妆容列表
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public abstract ArrayList<MakeupCombinationBean> getMakeupCombinations();
|
||||
|
||||
/**
|
||||
* 获取当前组合妆容下标
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public abstract int getCurrentCombinationIndex();
|
||||
|
||||
/**
|
||||
* 设置组合妆容下标
|
||||
*
|
||||
* @param currentCombinationIndex
|
||||
*/
|
||||
public abstract void setCurrentCombinationIndex(int currentCombinationIndex);
|
||||
|
||||
|
||||
/**
|
||||
* 组合妆容选中
|
||||
*
|
||||
* @param bean MakeupCombinationBean
|
||||
*/
|
||||
public abstract void onMakeupCombinationSelected(MakeupCombinationBean bean);
|
||||
|
||||
/**
|
||||
* 设置美妆整体强度
|
||||
*
|
||||
* @param intensity Double
|
||||
*/
|
||||
public abstract void updateCombinationIntensity(double intensity);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,93 @@
|
||||
package com.yunbao.faceunity.infe
|
||||
|
||||
|
||||
import com.yunbao.faceunity.entity.MakeupCombinationBean
|
||||
import com.yunbao.faceunity.entity.MakeupCustomBean
|
||||
import com.yunbao.faceunity.entity.MakeupCustomClassBean
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* DESC:
|
||||
* Created on 2020/12/22
|
||||
*
|
||||
*/
|
||||
abstract class AbstractMakeupDataFactory {
|
||||
|
||||
/* 默认组合妆容下标 */
|
||||
abstract var currentCombinationIndex: Int
|
||||
|
||||
/* 美妆组合妆容配置 */
|
||||
abstract val makeupCombinations: ArrayList<MakeupCombinationBean>
|
||||
|
||||
/**
|
||||
* 组合妆容选中
|
||||
* @param bean MakeupCombinationBean
|
||||
*/
|
||||
abstract fun onMakeupCombinationSelected(bean: MakeupCombinationBean)
|
||||
|
||||
/**
|
||||
* 设置美妆整体强度
|
||||
* @param intensity Double
|
||||
*/
|
||||
abstract fun updateCombinationIntensity(intensity: Double)
|
||||
|
||||
/**
|
||||
* 进入自定义美妆
|
||||
*/
|
||||
abstract fun enterCustomMakeup()
|
||||
|
||||
/**
|
||||
* 设置美妆单项强度
|
||||
* @param key String 单项key
|
||||
* @param current Int 单项下标
|
||||
* @param intensity Double
|
||||
*/
|
||||
abstract fun updateCustomItemIntensity(key: String, current: Int, intensity: Double)
|
||||
|
||||
/**
|
||||
* 更换类别单项
|
||||
* @param key String
|
||||
* @param index Int
|
||||
*/
|
||||
abstract fun onCustomBeanSelected(key: String, index: Int)
|
||||
|
||||
/**
|
||||
* 设置单项颜色
|
||||
* @param key String
|
||||
* @param index Int
|
||||
*/
|
||||
abstract fun updateCustomColor(key: String, index: Int)
|
||||
|
||||
|
||||
/* 美妆功能菜单 */
|
||||
abstract val makeupCustomItemParams: LinkedHashMap<String, ArrayList<MakeupCustomBean>>
|
||||
|
||||
/* 美妆子项类别 */
|
||||
|
||||
abstract val makeupCustomClass: ArrayList<MakeupCustomClassBean>
|
||||
|
||||
|
||||
/**
|
||||
* 获取美妆单项当前下标
|
||||
* @param key String
|
||||
* @return Int
|
||||
*/
|
||||
abstract fun getCurrentCustomItemIndex(key: String): Int
|
||||
|
||||
/**
|
||||
* 获取美妆当前选中项颜色下标
|
||||
* @param key String
|
||||
* @param current Int
|
||||
* @return Int
|
||||
*/
|
||||
abstract fun getCurrentCustomColorIndex(key: String, current: Int): Int
|
||||
|
||||
/**
|
||||
* 获取美妆当前选中项强度
|
||||
* @param key String
|
||||
* @param current Int
|
||||
* @return Double
|
||||
*/
|
||||
abstract fun getCurrentCustomIntensity(key: String, current: Int): Double
|
||||
}
|
||||
@@ -288,20 +288,22 @@ public class MakeupSource {
|
||||
*/
|
||||
public static ArrayList<MakeupCustomClassBean> buildCustomClasses() {
|
||||
ArrayList<MakeupCustomClassBean> classes = new ArrayList();
|
||||
classes.add(new MakeupCustomClassBean(R.string.makeup_radio_foundation, FACE_MAKEUP_TYPE_FOUNDATION));
|
||||
classes.add(new MakeupCustomClassBean(R.string.makeup_radio_lipstick, FACE_MAKEUP_TYPE_LIP_STICK));
|
||||
classes.add(new MakeupCustomClassBean(R.string.makeup_radio_blusher, FACE_MAKEUP_TYPE_BLUSHER));
|
||||
classes.add(new MakeupCustomClassBean(R.string.makeup_radio_eyebrow, FACE_MAKEUP_TYPE_EYE_BROW));
|
||||
classes.add(new MakeupCustomClassBean(R.string.makeup_radio_eye_shadow, FACE_MAKEUP_TYPE_EYE_SHADOW));
|
||||
classes.add(new MakeupCustomClassBean(R.string.makeup_radio_eye_liner, FACE_MAKEUP_TYPE_EYE_LINER));
|
||||
classes.add(new MakeupCustomClassBean(R.string.makeup_radio_eyelash, FACE_MAKEUP_TYPE_EYE_LASH));
|
||||
classes.add(new MakeupCustomClassBean(R.string.makeup_radio_highlight, FACE_MAKEUP_TYPE_HIGH_LIGHT));
|
||||
classes.add(new MakeupCustomClassBean(R.string.makeup_radio_shadow, FACE_MAKEUP_TYPE_SHADOW));
|
||||
classes.add(new MakeupCustomClassBean(R.string.makeup_radio_contact_lens, FACE_MAKEUP_TYPE_EYE_PUPIL));
|
||||
classes.add(new MakeupCustomClassBean(R.string.makeup_radio_foundation, FACE_MAKEUP_TYPE_FOUNDATION,FaceParam.FACE_MAKEUP_TYPE_FOUNDATION));
|
||||
classes.add(new MakeupCustomClassBean(R.string.makeup_radio_lipstick, FACE_MAKEUP_TYPE_LIP_STICK,FaceParam.FACE_MAKEUP_TYPE_LIP_STICK));
|
||||
classes.add(new MakeupCustomClassBean(R.string.makeup_radio_blusher, FACE_MAKEUP_TYPE_BLUSHER,FaceParam.FACE_MAKEUP_TYPE_BLUSHER));
|
||||
classes.add(new MakeupCustomClassBean(R.string.makeup_radio_eyebrow, FACE_MAKEUP_TYPE_EYE_BROW,FaceParam.FACE_MAKEUP_TYPE_EYE_BROW));
|
||||
classes.add(new MakeupCustomClassBean(R.string.makeup_radio_eye_shadow, FACE_MAKEUP_TYPE_EYE_SHADOW,FaceParam.FACE_MAKEUP_TYPE_EYE_SHADOW));
|
||||
classes.add(new MakeupCustomClassBean(R.string.makeup_radio_eye_liner, FACE_MAKEUP_TYPE_EYE_LINER,FaceParam.FACE_MAKEUP_TYPE_EYE_LINER));
|
||||
classes.add(new MakeupCustomClassBean(R.string.makeup_radio_eyelash, FACE_MAKEUP_TYPE_EYE_LASH,FaceParam.FACE_MAKEUP_TYPE_EYE_LASH));
|
||||
classes.add(new MakeupCustomClassBean(R.string.makeup_radio_highlight, FACE_MAKEUP_TYPE_HIGH_LIGHT,FaceParam.FACE_MAKEUP_TYPE_HIGH_LIGHT));
|
||||
classes.add(new MakeupCustomClassBean(R.string.makeup_radio_shadow, FACE_MAKEUP_TYPE_SHADOW,FaceParam.FACE_MAKEUP_TYPE_SHADOW));
|
||||
classes.add(new MakeupCustomClassBean(R.string.makeup_radio_contact_lens, FACE_MAKEUP_TYPE_EYE_PUPIL,FaceParam.FACE_MAKEUP_TYPE_EYE_PUPIL));
|
||||
return classes;
|
||||
}
|
||||
|
||||
|
||||
public static LinkedHashMap<String,ArrayList<MakeupCustomBean>> buildCustomItemParams(){
|
||||
return buildCustomItemParams(MakeupSource.buildMakeUpColorMap());
|
||||
}
|
||||
/**
|
||||
* 美妆单项妆容配置参数
|
||||
*
|
||||
@@ -311,12 +313,12 @@ public class MakeupSource {
|
||||
LinkedHashMap<String, ArrayList<MakeupCustomBean>> mCustomItems = new LinkedHashMap<>();
|
||||
/*粉底*/
|
||||
ArrayList<MakeupCustomBean> makeupItems = new ArrayList(6);
|
||||
makeupItems.add(new MakeupCustomBean(R.string.makeup_radio_remove, getDrawable(R.mipmap.icon_control_none)));
|
||||
makeupItems.add(new MakeupCustomBean(R.string.makeup_radio_remove, getDrawable(R.mipmap.icon_control_none),FaceParam.FACE_MAKEUP_TYPE_FOUNDATION));
|
||||
ArrayList<double[]> list = colorMap.get("color_mu_style_foundation_01");
|
||||
for (int i = 3; i < 8; i++) {
|
||||
double[] colors = list.get(i);
|
||||
ColorDrawable drawable = new ColorDrawable(Color.argb((int) (colors[3] * 255), (int) (colors[0] * 255), (int) (colors[1] * 255), (int) (colors[2] * 255)));
|
||||
makeupItems.add(new MakeupCustomBean(0, drawable));
|
||||
makeupItems.add(new MakeupCustomBean(0, drawable,FaceParam.FACE_MAKEUP_TYPE_FOUNDATION));
|
||||
}
|
||||
mCustomItems.put(FACE_MAKEUP_TYPE_FOUNDATION, makeupItems);
|
||||
|
||||
@@ -324,101 +326,101 @@ public class MakeupSource {
|
||||
/*口红*/
|
||||
mCustomItems.put(FACE_MAKEUP_TYPE_LIP_STICK, new ArrayList<MakeupCustomBean>() {
|
||||
{
|
||||
add(new MakeupCustomBean(R.string.makeup_radio_remove, getDrawable(R.mipmap.icon_control_none)));
|
||||
add(new MakeupCustomBean(R.string.makeup_lip_fog, getDrawable(R.mipmap.icon_makeup_lip_fog), colorMap.get("color_mu_style_lip_01")));
|
||||
add(new MakeupCustomBean(R.string.makeup_lip_moist1, getDrawable(R.mipmap.icon_makeup_lip_moist), colorMap.get("color_mu_style_lip_01")));
|
||||
add(new MakeupCustomBean(R.string.makeup_lip_moist2, getDrawable(R.mipmap.icon_makeup_lip_water), colorMap.get("color_mu_style_lip_01")));
|
||||
add(new MakeupCustomBean(R.string.makeup_lip_pearl, getDrawable(R.mipmap.icon_makeup_lip_pearl), colorMap.get("color_mu_style_lip_01")));
|
||||
add(new MakeupCustomBean(R.string.makeup_lip_bitelip, getDrawable(R.mipmap.icon_makeup_lip_beitelip), colorMap.get("color_mu_style_lip_01")));
|
||||
add(new MakeupCustomBean(R.string.makeup_radio_remove, getDrawable(R.mipmap.icon_control_none),FaceParam.FACE_MAKEUP_TYPE_LIP_STICK));
|
||||
add(new MakeupCustomBean(R.string.makeup_lip_fog, getDrawable(R.mipmap.icon_makeup_lip_fog), colorMap.get("color_mu_style_lip_01"),FaceParam.FACE_MAKEUP_TYPE_LIP_STICK));
|
||||
add(new MakeupCustomBean(R.string.makeup_lip_moist1, getDrawable(R.mipmap.icon_makeup_lip_moist), colorMap.get("color_mu_style_lip_01"),FaceParam.FACE_MAKEUP_TYPE_LIP_STICK));
|
||||
add(new MakeupCustomBean(R.string.makeup_lip_moist2, getDrawable(R.mipmap.icon_makeup_lip_water), colorMap.get("color_mu_style_lip_01"),FaceParam.FACE_MAKEUP_TYPE_LIP_STICK));
|
||||
add(new MakeupCustomBean(R.string.makeup_lip_pearl, getDrawable(R.mipmap.icon_makeup_lip_pearl), colorMap.get("color_mu_style_lip_01"),FaceParam.FACE_MAKEUP_TYPE_LIP_STICK));
|
||||
add(new MakeupCustomBean(R.string.makeup_lip_bitelip, getDrawable(R.mipmap.icon_makeup_lip_beitelip), colorMap.get("color_mu_style_lip_01"),FaceParam.FACE_MAKEUP_TYPE_LIP_STICK));
|
||||
}
|
||||
});
|
||||
|
||||
/*腮红*/
|
||||
mCustomItems.put(FACE_MAKEUP_TYPE_BLUSHER, new ArrayList<MakeupCustomBean>() {
|
||||
{
|
||||
add(new MakeupCustomBean(R.string.makeup_radio_remove, getDrawable(R.mipmap.icon_control_none)));
|
||||
add(new MakeupCustomBean(R.string.makeup_blusher_apple, getDrawable(R.mipmap.icon_makeup_blush_01), colorMap.get("color_mu_style_blush_01")));
|
||||
add(new MakeupCustomBean(R.string.makeup_blusher_fan, getDrawable(R.mipmap.icon_makeup_blush_02), colorMap.get("color_mu_style_blush_02")));
|
||||
add(new MakeupCustomBean(R.string.makeup_blusher_eye_corner, getDrawable(R.mipmap.icon_makeup_blush_03), colorMap.get("color_mu_style_blush_03")));
|
||||
add(new MakeupCustomBean(R.string.makeup_blusher_slight_drunk, getDrawable(R.mipmap.icon_makeup_blush_04), colorMap.get("color_mu_style_blush_04")));
|
||||
add(new MakeupCustomBean(R.string.makeup_radio_remove, getDrawable(R.mipmap.icon_control_none),FaceParam.FACE_MAKEUP_TYPE_BLUSHER));
|
||||
add(new MakeupCustomBean(R.string.makeup_blusher_apple, getDrawable(R.mipmap.icon_makeup_blush_01), colorMap.get("color_mu_style_blush_01"),FaceParam.FACE_MAKEUP_TYPE_BLUSHER));
|
||||
add(new MakeupCustomBean(R.string.makeup_blusher_fan, getDrawable(R.mipmap.icon_makeup_blush_02), colorMap.get("color_mu_style_blush_02"),FaceParam.FACE_MAKEUP_TYPE_BLUSHER));
|
||||
add(new MakeupCustomBean(R.string.makeup_blusher_eye_corner, getDrawable(R.mipmap.icon_makeup_blush_03), colorMap.get("color_mu_style_blush_03"),FaceParam.FACE_MAKEUP_TYPE_BLUSHER));
|
||||
add(new MakeupCustomBean(R.string.makeup_blusher_slight_drunk, getDrawable(R.mipmap.icon_makeup_blush_04), colorMap.get("color_mu_style_blush_04"),FaceParam.FACE_MAKEUP_TYPE_BLUSHER));
|
||||
}
|
||||
});
|
||||
/*眉毛*/
|
||||
mCustomItems.put(FACE_MAKEUP_TYPE_EYE_BROW, new ArrayList<MakeupCustomBean>() {
|
||||
{
|
||||
add(new MakeupCustomBean(R.string.makeup_radio_remove, getDrawable(R.mipmap.icon_control_none)));
|
||||
add(new MakeupCustomBean(R.string.makeup_eyebrow_willow, getDrawable(R.mipmap.icon_makeup_eyebrow_01), colorMap.get("color_mu_style_eyebrow_01")));
|
||||
add(new MakeupCustomBean(R.string.makeup_eyebrow_wild, getDrawable(R.mipmap.icon_makeup_eyebrow_02), colorMap.get("color_mu_style_eyebrow_01")));
|
||||
add(new MakeupCustomBean(R.string.makeup_eyebrow_classical, getDrawable(R.mipmap.icon_makeup_eyebrow_03), colorMap.get("color_mu_style_eyebrow_01")));
|
||||
add(new MakeupCustomBean(R.string.makeup_eyebrow_standard, getDrawable(R.mipmap.icon_makeup_eyebrow_04), colorMap.get("color_mu_style_eyebrow_01")));
|
||||
add(new MakeupCustomBean(R.string.makeup_radio_remove, getDrawable(R.mipmap.icon_control_none),FaceParam.FACE_MAKEUP_TYPE_EYE_BROW));
|
||||
add(new MakeupCustomBean(R.string.makeup_eyebrow_willow, getDrawable(R.mipmap.icon_makeup_eyebrow_01), colorMap.get("color_mu_style_eyebrow_01"),FaceParam.FACE_MAKEUP_TYPE_EYE_BROW));
|
||||
add(new MakeupCustomBean(R.string.makeup_eyebrow_wild, getDrawable(R.mipmap.icon_makeup_eyebrow_02), colorMap.get("color_mu_style_eyebrow_01"),FaceParam.FACE_MAKEUP_TYPE_EYE_BROW));
|
||||
add(new MakeupCustomBean(R.string.makeup_eyebrow_classical, getDrawable(R.mipmap.icon_makeup_eyebrow_03), colorMap.get("color_mu_style_eyebrow_01"),FaceParam.FACE_MAKEUP_TYPE_EYE_BROW));
|
||||
add(new MakeupCustomBean(R.string.makeup_eyebrow_standard, getDrawable(R.mipmap.icon_makeup_eyebrow_04), colorMap.get("color_mu_style_eyebrow_01"),FaceParam.FACE_MAKEUP_TYPE_EYE_BROW));
|
||||
}
|
||||
});
|
||||
|
||||
/*眼影*/
|
||||
mCustomItems.put(FACE_MAKEUP_TYPE_EYE_SHADOW, new ArrayList<MakeupCustomBean>() {
|
||||
{
|
||||
add(new MakeupCustomBean(R.string.makeup_radio_remove, getDrawable(R.mipmap.icon_control_none)));
|
||||
add(new MakeupCustomBean(R.string.makeup_eye_shadow_single, getDrawable(R.mipmap.icon_makeup_eyeshadow_01), colorMap.get("color_mu_style_eyeshadow_01")));
|
||||
add(new MakeupCustomBean(R.string.makeup_eye_shadow_double1, getDrawable(R.mipmap.icon_makeup_eyeshadow_02), colorMap.get("color_mu_style_eyeshadow_02")));
|
||||
add(new MakeupCustomBean(R.string.makeup_eye_shadow_double2, getDrawable(R.mipmap.icon_makeup_eyeshadow_03), colorMap.get("color_mu_style_eyeshadow_03")));
|
||||
add(new MakeupCustomBean(R.string.makeup_eye_shadow_double3, getDrawable(R.mipmap.icon_makeup_eyeshadow_04), colorMap.get("color_mu_style_eyeshadow_04")));
|
||||
add(new MakeupCustomBean(R.string.makeup_eye_shadow_triple1, getDrawable(R.mipmap.icon_makeup_eyeshadow_05), colorMap.get("color_mu_style_eyeshadow_05")));
|
||||
add(new MakeupCustomBean(R.string.makeup_eye_shadow_triple2, getDrawable(R.mipmap.icon_makeup_eyeshadow_06), colorMap.get("color_mu_style_eyeshadow_06")));
|
||||
add(new MakeupCustomBean(R.string.makeup_radio_remove, getDrawable(R.mipmap.icon_control_none),FaceParam.FACE_MAKEUP_TYPE_EYE_SHADOW));
|
||||
add(new MakeupCustomBean(R.string.makeup_eye_shadow_single, getDrawable(R.mipmap.icon_makeup_eyeshadow_01), colorMap.get("color_mu_style_eyeshadow_01"),FaceParam.FACE_MAKEUP_TYPE_EYE_SHADOW));
|
||||
add(new MakeupCustomBean(R.string.makeup_eye_shadow_double1, getDrawable(R.mipmap.icon_makeup_eyeshadow_02), colorMap.get("color_mu_style_eyeshadow_02"),FaceParam.FACE_MAKEUP_TYPE_EYE_SHADOW));
|
||||
add(new MakeupCustomBean(R.string.makeup_eye_shadow_double2, getDrawable(R.mipmap.icon_makeup_eyeshadow_03), colorMap.get("color_mu_style_eyeshadow_03"),FaceParam.FACE_MAKEUP_TYPE_EYE_SHADOW));
|
||||
add(new MakeupCustomBean(R.string.makeup_eye_shadow_double3, getDrawable(R.mipmap.icon_makeup_eyeshadow_04), colorMap.get("color_mu_style_eyeshadow_04"),FaceParam.FACE_MAKEUP_TYPE_EYE_SHADOW));
|
||||
add(new MakeupCustomBean(R.string.makeup_eye_shadow_triple1, getDrawable(R.mipmap.icon_makeup_eyeshadow_05), colorMap.get("color_mu_style_eyeshadow_05"),FaceParam.FACE_MAKEUP_TYPE_EYE_SHADOW));
|
||||
add(new MakeupCustomBean(R.string.makeup_eye_shadow_triple2, getDrawable(R.mipmap.icon_makeup_eyeshadow_06), colorMap.get("color_mu_style_eyeshadow_06"),FaceParam.FACE_MAKEUP_TYPE_EYE_SHADOW));
|
||||
}
|
||||
});
|
||||
|
||||
/*眼线*/
|
||||
mCustomItems.put(FACE_MAKEUP_TYPE_EYE_LINER, new ArrayList<MakeupCustomBean>() {
|
||||
{
|
||||
add(new MakeupCustomBean(R.string.makeup_radio_remove, getDrawable(R.mipmap.icon_control_none)));
|
||||
add(new MakeupCustomBean(R.string.makeup_eye_linear_cat, getDrawable(R.mipmap.icon_makeup_eyeliner_01), colorMap.get("color_mu_style_eyeliner_01")));
|
||||
add(new MakeupCustomBean(R.string.makeup_eye_linear_drooping, getDrawable(R.mipmap.icon_makeup_eyeliner_02), colorMap.get("color_mu_style_eyeliner_02")));
|
||||
add(new MakeupCustomBean(R.string.makeup_eye_linear_pull_open, getDrawable(R.mipmap.icon_makeup_eyeliner_03), colorMap.get("color_mu_style_eyeliner_03")));
|
||||
add(new MakeupCustomBean(R.string.makeup_eye_linear_pull_close, getDrawable(R.mipmap.icon_makeup_eyeliner_04), colorMap.get("color_mu_style_eyeliner_04")));
|
||||
add(new MakeupCustomBean(R.string.makeup_eye_linear_long, getDrawable(R.mipmap.icon_makeup_eyeliner_05), colorMap.get("color_mu_style_eyeliner_05")));
|
||||
add(new MakeupCustomBean(R.string.makeup_eye_linear_circular, getDrawable(R.mipmap.icon_makeup_eyeliner_06), colorMap.get("color_mu_style_eyeliner_06")));
|
||||
add(new MakeupCustomBean(R.string.makeup_radio_remove, getDrawable(R.mipmap.icon_control_none),FaceParam.FACE_MAKEUP_TYPE_EYE_LINER));
|
||||
add(new MakeupCustomBean(R.string.makeup_eye_linear_cat, getDrawable(R.mipmap.icon_makeup_eyeliner_01), colorMap.get("color_mu_style_eyeliner_01"),FaceParam.FACE_MAKEUP_TYPE_EYE_LINER));
|
||||
add(new MakeupCustomBean(R.string.makeup_eye_linear_drooping, getDrawable(R.mipmap.icon_makeup_eyeliner_02), colorMap.get("color_mu_style_eyeliner_02"),FaceParam.FACE_MAKEUP_TYPE_EYE_LINER));
|
||||
add(new MakeupCustomBean(R.string.makeup_eye_linear_pull_open, getDrawable(R.mipmap.icon_makeup_eyeliner_03), colorMap.get("color_mu_style_eyeliner_03"),FaceParam.FACE_MAKEUP_TYPE_EYE_LINER));
|
||||
add(new MakeupCustomBean(R.string.makeup_eye_linear_pull_close, getDrawable(R.mipmap.icon_makeup_eyeliner_04), colorMap.get("color_mu_style_eyeliner_04"),FaceParam.FACE_MAKEUP_TYPE_EYE_LINER));
|
||||
add(new MakeupCustomBean(R.string.makeup_eye_linear_long, getDrawable(R.mipmap.icon_makeup_eyeliner_05), colorMap.get("color_mu_style_eyeliner_05"),FaceParam.FACE_MAKEUP_TYPE_EYE_LINER));
|
||||
add(new MakeupCustomBean(R.string.makeup_eye_linear_circular, getDrawable(R.mipmap.icon_makeup_eyeliner_06), colorMap.get("color_mu_style_eyeliner_06"),FaceParam.FACE_MAKEUP_TYPE_EYE_LINER));
|
||||
}
|
||||
});
|
||||
/*睫毛*/
|
||||
mCustomItems.put(FACE_MAKEUP_TYPE_EYE_LASH, new ArrayList<MakeupCustomBean>() {
|
||||
{
|
||||
add(new MakeupCustomBean(R.string.makeup_radio_remove, getDrawable(R.mipmap.icon_control_none)));
|
||||
add(new MakeupCustomBean(R.string.makeup_eyelash_natural1, getDrawable(R.mipmap.icon_makeup_eyelash_01), colorMap.get("color_mu_style_eyelash_01")));
|
||||
add(new MakeupCustomBean(R.string.makeup_eyelash_natural2, getDrawable(R.mipmap.icon_makeup_eyelash_02), colorMap.get("color_mu_style_eyelash_02")));
|
||||
add(new MakeupCustomBean(R.string.makeup_eyelash_thick1, getDrawable(R.mipmap.icon_makeup_eyelash_03), colorMap.get("color_mu_style_eyelash_03")));
|
||||
add(new MakeupCustomBean(R.string.makeup_eyelash_thick2, getDrawable(R.mipmap.icon_makeup_eyelash_04), colorMap.get("color_mu_style_eyelash_04")));
|
||||
add(new MakeupCustomBean(R.string.makeup_eyelash_exaggerate1, getDrawable(R.mipmap.icon_makeup_eyelash_05), colorMap.get("color_mu_style_eyelash_05")));
|
||||
add(new MakeupCustomBean(R.string.makeup_eyelash_exaggerate2, getDrawable(R.mipmap.icon_makeup_eyelash_06), colorMap.get("color_mu_style_eyelash_06")));
|
||||
add(new MakeupCustomBean(R.string.makeup_radio_remove, getDrawable(R.mipmap.icon_control_none),FaceParam.FACE_MAKEUP_TYPE_EYE_LASH));
|
||||
add(new MakeupCustomBean(R.string.makeup_eyelash_natural1, getDrawable(R.mipmap.icon_makeup_eyelash_01), colorMap.get("color_mu_style_eyelash_01"),FaceParam.FACE_MAKEUP_TYPE_EYE_LASH));
|
||||
add(new MakeupCustomBean(R.string.makeup_eyelash_natural2, getDrawable(R.mipmap.icon_makeup_eyelash_02), colorMap.get("color_mu_style_eyelash_02"),FaceParam.FACE_MAKEUP_TYPE_EYE_LASH));
|
||||
add(new MakeupCustomBean(R.string.makeup_eyelash_thick1, getDrawable(R.mipmap.icon_makeup_eyelash_03), colorMap.get("color_mu_style_eyelash_03"),FaceParam.FACE_MAKEUP_TYPE_EYE_LASH));
|
||||
add(new MakeupCustomBean(R.string.makeup_eyelash_thick2, getDrawable(R.mipmap.icon_makeup_eyelash_04), colorMap.get("color_mu_style_eyelash_04"),FaceParam.FACE_MAKEUP_TYPE_EYE_LASH));
|
||||
add(new MakeupCustomBean(R.string.makeup_eyelash_exaggerate1, getDrawable(R.mipmap.icon_makeup_eyelash_05), colorMap.get("color_mu_style_eyelash_05"),FaceParam.FACE_MAKEUP_TYPE_EYE_LASH));
|
||||
add(new MakeupCustomBean(R.string.makeup_eyelash_exaggerate2, getDrawable(R.mipmap.icon_makeup_eyelash_06), colorMap.get("color_mu_style_eyelash_06"),FaceParam.FACE_MAKEUP_TYPE_EYE_LASH));
|
||||
}
|
||||
});
|
||||
|
||||
/*高光*/
|
||||
mCustomItems.put(FACE_MAKEUP_TYPE_HIGH_LIGHT, new ArrayList<MakeupCustomBean>() {
|
||||
{
|
||||
add(new MakeupCustomBean(R.string.makeup_radio_remove, getDrawable(R.mipmap.icon_control_none)));
|
||||
add(new MakeupCustomBean(R.string.makeup_highlight_one, getDrawable(R.mipmap.icon_makeup_highlight_01), colorMap.get("color_mu_style_highlight_01")));
|
||||
add(new MakeupCustomBean(R.string.makeup_highlight_two, getDrawable(R.mipmap.icon_makeup_highlight_02), colorMap.get("color_mu_style_highlight_02")));
|
||||
add(new MakeupCustomBean(R.string.makeup_radio_remove, getDrawable(R.mipmap.icon_control_none),FaceParam.FACE_MAKEUP_TYPE_HIGH_LIGHT));
|
||||
add(new MakeupCustomBean(R.string.makeup_highlight_one, getDrawable(R.mipmap.icon_makeup_highlight_01), colorMap.get("color_mu_style_highlight_01"),FaceParam.FACE_MAKEUP_TYPE_HIGH_LIGHT));
|
||||
add(new MakeupCustomBean(R.string.makeup_highlight_two, getDrawable(R.mipmap.icon_makeup_highlight_02), colorMap.get("color_mu_style_highlight_02"),FaceParam.FACE_MAKEUP_TYPE_HIGH_LIGHT));
|
||||
}
|
||||
});
|
||||
/*阴影*/
|
||||
mCustomItems.put(FACE_MAKEUP_TYPE_SHADOW, new ArrayList<MakeupCustomBean>() {
|
||||
{
|
||||
add(new MakeupCustomBean(R.string.makeup_radio_remove, getDrawable(R.mipmap.icon_control_none)));
|
||||
add(new MakeupCustomBean(R.string.makeup_shadow_one, getDrawable(R.mipmap.icon_makeup_contour_01), colorMap.get("color_mu_style_contour_01")));
|
||||
add(new MakeupCustomBean(R.string.makeup_radio_remove, getDrawable(R.mipmap.icon_control_none),FaceParam.FACE_MAKEUP_TYPE_SHADOW));
|
||||
add(new MakeupCustomBean(R.string.makeup_shadow_one, getDrawable(R.mipmap.icon_makeup_contour_01), colorMap.get("color_mu_style_contour_01"),FaceParam.FACE_MAKEUP_TYPE_SHADOW));
|
||||
}
|
||||
});
|
||||
/*美瞳*/
|
||||
mCustomItems.put(FACE_MAKEUP_TYPE_EYE_PUPIL, new ArrayList<MakeupCustomBean>() {
|
||||
{
|
||||
add(new MakeupCustomBean(R.string.makeup_radio_remove, getDrawable(R.mipmap.icon_control_none)));
|
||||
add(new MakeupCustomBean(R.string.makeup_pupil_1, getDrawable(R.mipmap.icon_makeup_eyepupil_01), colorMap.get("color_mu_style_eyepupil_01")));
|
||||
add(new MakeupCustomBean(R.string.makeup_pupil_2, getDrawable(R.mipmap.icon_makeup_eyepupil_03), null));
|
||||
add(new MakeupCustomBean(R.string.makeup_pupil_3, getDrawable(R.mipmap.icon_makeup_eyepupil_04), null));
|
||||
add(new MakeupCustomBean(R.string.makeup_pupil_4, getDrawable(R.mipmap.icon_makeup_eyepupil_05), null));
|
||||
add(new MakeupCustomBean(R.string.makeup_pupil_5, getDrawable(R.mipmap.icon_makeup_eyepupil_06), null));
|
||||
add(new MakeupCustomBean(R.string.makeup_pupil_6, getDrawable(R.mipmap.icon_makeup_eyepupil_07), null));
|
||||
add(new MakeupCustomBean(R.string.makeup_pupil_7, getDrawable(R.mipmap.icon_makeup_eyepupil_08), null));
|
||||
add(new MakeupCustomBean(R.string.makeup_pupil_8, getDrawable(R.mipmap.icon_makeup_eyepupil_09), null));
|
||||
add(new MakeupCustomBean(R.string.makeup_radio_remove, getDrawable(R.mipmap.icon_control_none),FaceParam.FACE_MAKEUP_TYPE_EYE_PUPIL));
|
||||
add(new MakeupCustomBean(R.string.makeup_pupil_1, getDrawable(R.mipmap.icon_makeup_eyepupil_01), colorMap.get("color_mu_style_eyepupil_01"),FaceParam.FACE_MAKEUP_TYPE_EYE_PUPIL));
|
||||
add(new MakeupCustomBean(R.string.makeup_pupil_2, getDrawable(R.mipmap.icon_makeup_eyepupil_03), null,FaceParam.FACE_MAKEUP_TYPE_EYE_PUPIL));
|
||||
add(new MakeupCustomBean(R.string.makeup_pupil_3, getDrawable(R.mipmap.icon_makeup_eyepupil_04), null,FaceParam.FACE_MAKEUP_TYPE_EYE_PUPIL));
|
||||
add(new MakeupCustomBean(R.string.makeup_pupil_4, getDrawable(R.mipmap.icon_makeup_eyepupil_05), null,FaceParam.FACE_MAKEUP_TYPE_EYE_PUPIL));
|
||||
add(new MakeupCustomBean(R.string.makeup_pupil_5, getDrawable(R.mipmap.icon_makeup_eyepupil_06), null,FaceParam.FACE_MAKEUP_TYPE_EYE_PUPIL));
|
||||
add(new MakeupCustomBean(R.string.makeup_pupil_6, getDrawable(R.mipmap.icon_makeup_eyepupil_07), null,FaceParam.FACE_MAKEUP_TYPE_EYE_PUPIL));
|
||||
add(new MakeupCustomBean(R.string.makeup_pupil_7, getDrawable(R.mipmap.icon_makeup_eyepupil_08), null,FaceParam.FACE_MAKEUP_TYPE_EYE_PUPIL));
|
||||
add(new MakeupCustomBean(R.string.makeup_pupil_8, getDrawable(R.mipmap.icon_makeup_eyepupil_09), null,FaceParam.FACE_MAKEUP_TYPE_EYE_PUPIL));
|
||||
}
|
||||
});
|
||||
return mCustomItems;
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.yunbao.faceunity.repo;
|
||||
|
||||
import com.yunbao.faceunity.R;
|
||||
import com.yunbao.faceunity.data.FaceParam;
|
||||
import com.yunbao.faceunity.entity.FunctionEnum;
|
||||
import com.yunbao.faceunity.entity.PropBean;
|
||||
|
||||
@@ -16,62 +17,62 @@ public class PropSource {
|
||||
ArrayList<PropBean> propBeans = new ArrayList<>();
|
||||
switch (propType) {
|
||||
case FunctionEnum.STICKER:
|
||||
propBeans.add(new PropBean(R.mipmap.icon_control_delete_all, null));
|
||||
propBeans.add(new PropBean(R.mipmap.icon_sticker_cat_sparks, "effect/normal/cat_sparks.bundle"));
|
||||
propBeans.add(new PropBean(R.mipmap.icon_sticker_fu_zh_fenshu, "effect/normal/fu_zh_fenshu.bundle"));
|
||||
propBeans.add(new PropBean(R.mipmap.icon_sticker_sdlr, "effect/normal/sdlr.bundle"));
|
||||
propBeans.add(new PropBean(R.mipmap.icon_sticker_xlong_zh_fu, "effect/normal/xlong_zh_fu.bundle"));
|
||||
propBeans.add(new PropBean(R.mipmap.icon_sticker_newy1, "effect/normal/newy1.bundle"));
|
||||
propBeans.add(new PropBean(R.mipmap.icon_sticker_redribbt, "effect/normal/redribbt.bundle"));
|
||||
propBeans.add(new PropBean(R.mipmap.icon_sticker_daisypig, "effect/normal/daisypig.bundle"));
|
||||
propBeans.add(new PropBean(R.mipmap.icon_sticker_sdlu, "effect/normal/sdlu.bundle"));
|
||||
propBeans.add(new PropBean(R.mipmap.icon_control_delete_all, null, FaceParam.FACE_STICKER));
|
||||
propBeans.add(new PropBean(R.mipmap.icon_sticker_cat_sparks, "effect/normal/cat_sparks.bundle", FaceParam.FACE_STICKER));
|
||||
propBeans.add(new PropBean(R.mipmap.icon_sticker_fu_zh_fenshu, "effect/normal/fu_zh_fenshu.bundle", FaceParam.FACE_STICKER));
|
||||
propBeans.add(new PropBean(R.mipmap.icon_sticker_sdlr, "effect/normal/sdlr.bundle", FaceParam.FACE_STICKER));
|
||||
propBeans.add(new PropBean(R.mipmap.icon_sticker_xlong_zh_fu, "effect/normal/xlong_zh_fu.bundle", FaceParam.FACE_STICKER));
|
||||
propBeans.add(new PropBean(R.mipmap.icon_sticker_newy1, "effect/normal/newy1.bundle", FaceParam.FACE_STICKER));
|
||||
propBeans.add(new PropBean(R.mipmap.icon_sticker_redribbt, "effect/normal/redribbt.bundle", FaceParam.FACE_STICKER));
|
||||
propBeans.add(new PropBean(R.mipmap.icon_sticker_daisypig, "effect/normal/daisypig.bundle", FaceParam.FACE_STICKER));
|
||||
propBeans.add(new PropBean(R.mipmap.icon_sticker_sdlu, "effect/normal/sdlu.bundle", FaceParam.FACE_STICKER));
|
||||
break;
|
||||
case FunctionEnum.AR_MASK:
|
||||
propBeans.add(new PropBean(R.mipmap.icon_control_delete_all, null));
|
||||
propBeans.add(new PropBean(R.mipmap.icon_ar_bluebird, "effect/ar/bluebird.bundle"));
|
||||
propBeans.add(new PropBean(R.mipmap.icon_ar_lanhudie, "effect/ar/lanhudie.bundle"));
|
||||
propBeans.add(new PropBean(R.mipmap.icon_ar_fenhudie, "effect/ar/fenhudie.bundle"));
|
||||
propBeans.add(new PropBean(R.mipmap.icon_ar_tiger_huang, "effect/ar/tiger_huang.bundle"));
|
||||
propBeans.add(new PropBean(R.mipmap.icon_ar_tiger_bai, "effect/ar/tiger_bai.bundle"));
|
||||
propBeans.add(new PropBean(R.mipmap.icon_ar_baozi, "effect/ar/baozi.bundle"));
|
||||
propBeans.add(new PropBean(R.mipmap.icon_ar_tiger, "effect/ar/tiger.bundle"));
|
||||
propBeans.add(new PropBean(R.mipmap.icon_ar_xiongmao, "effect/ar/xiongmao.bundle"));
|
||||
propBeans.add(new PropBean(R.mipmap.icon_control_delete_all, null, FaceParam.FACE_ANIM_AR_MASK));
|
||||
propBeans.add(new PropBean(R.mipmap.icon_ar_bluebird, "effect/ar/bluebird.bundle", FaceParam.FACE_ANIM_AR_MASK));
|
||||
propBeans.add(new PropBean(R.mipmap.icon_ar_lanhudie, "effect/ar/lanhudie.bundle", FaceParam.FACE_ANIM_AR_MASK));
|
||||
propBeans.add(new PropBean(R.mipmap.icon_ar_fenhudie, "effect/ar/fenhudie.bundle", FaceParam.FACE_ANIM_AR_MASK));
|
||||
propBeans.add(new PropBean(R.mipmap.icon_ar_tiger_huang, "effect/ar/tiger_huang.bundle", FaceParam.FACE_ANIM_AR_MASK));
|
||||
propBeans.add(new PropBean(R.mipmap.icon_ar_tiger_bai, "effect/ar/tiger_bai.bundle", FaceParam.FACE_ANIM_AR_MASK));
|
||||
propBeans.add(new PropBean(R.mipmap.icon_ar_baozi, "effect/ar/baozi.bundle", FaceParam.FACE_ANIM_AR_MASK));
|
||||
propBeans.add(new PropBean(R.mipmap.icon_ar_tiger, "effect/ar/tiger.bundle", FaceParam.FACE_ANIM_AR_MASK));
|
||||
propBeans.add(new PropBean(R.mipmap.icon_ar_xiongmao, "effect/ar/xiongmao.bundle", FaceParam.FACE_ANIM_AR_MASK));
|
||||
break;
|
||||
case FunctionEnum.BIG_HEAD:
|
||||
propBeans.add(new PropBean(R.mipmap.icon_control_delete_all, null));
|
||||
propBeans.add(new PropBean(R.mipmap.icon_big_head, "effect/big_head/big_head.bundle"));
|
||||
propBeans.add(new PropBean(R.mipmap.icon_big_head_husky_face, "effect/big_head/big_head_facewarp2.bundle"));
|
||||
propBeans.add(new PropBean(R.mipmap.icon_big_head_sausage_mouth, "effect/big_head/big_head_facewarp4.bundle"));
|
||||
propBeans.add(new PropBean(R.mipmap.icon_big_head_blush, "effect/big_head/big_head_facewarp5.bundle"));
|
||||
propBeans.add(new PropBean(R.mipmap.icon_big_head_dark_circles, "effect/big_head/big_head_facewarp6.bundle"));
|
||||
propBeans.add(new PropBean(R.mipmap.icon_big_head_smiling_head, "effect/big_head/big_head_smile.bundle", R.string.xiaobianzi_zh_fu));
|
||||
propBeans.add(new PropBean(R.mipmap.icon_control_delete_all, null, FaceParam.FACE_BIG_HEAD));
|
||||
propBeans.add(new PropBean(R.mipmap.icon_big_head, "effect/big_head/big_head.bundle", FaceParam.FACE_BIG_HEAD));
|
||||
propBeans.add(new PropBean(R.mipmap.icon_big_head_husky_face, "effect/big_head/big_head_facewarp2.bundle", FaceParam.FACE_BIG_HEAD));
|
||||
propBeans.add(new PropBean(R.mipmap.icon_big_head_sausage_mouth, "effect/big_head/big_head_facewarp4.bundle", FaceParam.FACE_BIG_HEAD));
|
||||
propBeans.add(new PropBean(R.mipmap.icon_big_head_blush, "effect/big_head/big_head_facewarp5.bundle", FaceParam.FACE_BIG_HEAD));
|
||||
propBeans.add(new PropBean(R.mipmap.icon_big_head_dark_circles, "effect/big_head/big_head_facewarp6.bundle", FaceParam.FACE_BIG_HEAD));
|
||||
propBeans.add(new PropBean(R.mipmap.icon_big_head_smiling_head, "effect/big_head/big_head_smile.bundle", R.string.xiaobianzi_zh_fu, FaceParam.FACE_BIG_HEAD));
|
||||
break;
|
||||
case FunctionEnum.EXPRESSION_RECOGNITION:
|
||||
propBeans.add(new PropBean(R.mipmap.icon_control_delete_all, null));
|
||||
propBeans.add(new PropBean(R.mipmap.icon_expression_future_warrior, "effect/expression/future_warrior.bundle", R.string.future_warrior));
|
||||
propBeans.add(new PropBean(R.mipmap.icon_expression_jet_mask, "effect/expression/jet_mask.bundle", R.string.jet_mask));
|
||||
propBeans.add(new PropBean(R.mipmap.icon_expression_sdx2, "effect/expression/sdx2.bundle", R.string.sdx2));
|
||||
propBeans.add(new PropBean(R.mipmap.icon_expression_luhantongkuan_ztt_fu, "effect/expression/luhantongkuan_ztt_fu.bundle", R.string.luhantongkuan_ztt_fu));
|
||||
propBeans.add(new PropBean(R.mipmap.icon_expression_qingqing_ztt_fu, "effect/expression/qingqing_ztt_fu.bundle", R.string.qingqing_ztt_fu));
|
||||
propBeans.add(new PropBean(R.mipmap.icon_expression_xiaobianzi_zh_fu, "effect/expression/xiaobianzi_zh_fu.bundle", R.string.xiaobianzi_zh_fu));
|
||||
propBeans.add(new PropBean(R.mipmap.icon_expression_xiaoxueshen_ztt_fu, "effect/expression/xiaoxueshen_ztt_fu.bundle", R.string.xiaoxueshen_ztt_fu));
|
||||
propBeans.add(new PropBean(R.mipmap.icon_control_delete_all, null,FaceParam.FACE_EXPRESSION_RECOGNITION));
|
||||
propBeans.add(new PropBean(R.mipmap.icon_expression_future_warrior, "effect/expression/future_warrior.bundle", R.string.future_warrior,FaceParam.FACE_EXPRESSION_RECOGNITION));
|
||||
propBeans.add(new PropBean(R.mipmap.icon_expression_jet_mask, "effect/expression/jet_mask.bundle", R.string.jet_mask,FaceParam.FACE_EXPRESSION_RECOGNITION));
|
||||
propBeans.add(new PropBean(R.mipmap.icon_expression_sdx2, "effect/expression/sdx2.bundle", R.string.sdx2,FaceParam.FACE_EXPRESSION_RECOGNITION));
|
||||
propBeans.add(new PropBean(R.mipmap.icon_expression_luhantongkuan_ztt_fu, "effect/expression/luhantongkuan_ztt_fu.bundle", R.string.luhantongkuan_ztt_fu,FaceParam.FACE_EXPRESSION_RECOGNITION));
|
||||
propBeans.add(new PropBean(R.mipmap.icon_expression_qingqing_ztt_fu, "effect/expression/qingqing_ztt_fu.bundle", R.string.qingqing_ztt_fu,FaceParam.FACE_EXPRESSION_RECOGNITION));
|
||||
propBeans.add(new PropBean(R.mipmap.icon_expression_xiaobianzi_zh_fu, "effect/expression/xiaobianzi_zh_fu.bundle", R.string.xiaobianzi_zh_fu,FaceParam.FACE_EXPRESSION_RECOGNITION));
|
||||
propBeans.add(new PropBean(R.mipmap.icon_expression_xiaoxueshen_ztt_fu, "effect/expression/xiaoxueshen_ztt_fu.bundle", R.string.xiaoxueshen_ztt_fu,FaceParam.FACE_EXPRESSION_RECOGNITION));
|
||||
break;
|
||||
case FunctionEnum.FACE_WARP:
|
||||
propBeans.add(new PropBean(R.mipmap.icon_control_delete_all, null));
|
||||
propBeans.add(new PropBean(R.mipmap.icon_face_warp_2, "effect/facewarp/facewarp2.bundle"));
|
||||
propBeans.add(new PropBean(R.mipmap.icon_face_warp_3, "effect/facewarp/facewarp3.bundle"));
|
||||
propBeans.add(new PropBean(R.mipmap.icon_face_warp_4, "effect/facewarp/facewarp4.bundle"));
|
||||
propBeans.add(new PropBean(R.mipmap.icon_face_warp_5, "effect/facewarp/facewarp5.bundle"));
|
||||
propBeans.add(new PropBean(R.mipmap.icon_face_warp_6, "effect/facewarp/facewarp6.bundle"));
|
||||
propBeans.add(new PropBean(R.mipmap.icon_control_delete_all, null,FaceParam.FACE_FACE_WARP));
|
||||
propBeans.add(new PropBean(R.mipmap.icon_face_warp_2, "effect/facewarp/facewarp2.bundle",FaceParam.FACE_FACE_WARP));
|
||||
propBeans.add(new PropBean(R.mipmap.icon_face_warp_3, "effect/facewarp/facewarp3.bundle",FaceParam.FACE_FACE_WARP));
|
||||
propBeans.add(new PropBean(R.mipmap.icon_face_warp_4, "effect/facewarp/facewarp4.bundle",FaceParam.FACE_FACE_WARP));
|
||||
propBeans.add(new PropBean(R.mipmap.icon_face_warp_5, "effect/facewarp/facewarp5.bundle",FaceParam.FACE_FACE_WARP));
|
||||
propBeans.add(new PropBean(R.mipmap.icon_face_warp_6, "effect/facewarp/facewarp6.bundle",FaceParam.FACE_FACE_WARP));
|
||||
break;
|
||||
case FunctionEnum.GESTURE_RECOGNITION:
|
||||
propBeans.add(new PropBean(R.mipmap.icon_control_delete_all, null));
|
||||
propBeans.add(new PropBean(R.mipmap.icon_gesture_rain, "effect/gesture/ctrl_rain.bundle", R.string.push_hand));
|
||||
propBeans.add(new PropBean(R.mipmap.icon_gesture_snow, "effect/gesture/ctrl_snow.bundle", R.string.push_hand));
|
||||
propBeans.add(new PropBean(R.mipmap.icon_gesture_flower, "effect/gesture/ctrl_flower.bundle", R.string.push_hand));
|
||||
propBeans.add(new PropBean(R.mipmap.icon_gesture_koreaheart, "effect/gesture/ssd_thread_korheart.bundle", R.string.fu_lm_koreaheart));
|
||||
propBeans.add(new PropBean(R.mipmap.icon_gesture_six, "effect/gesture/ssd_thread_six.bundle", R.string.ssd_thread_six));
|
||||
propBeans.add(new PropBean(R.mipmap.icon_gesture_cute, "effect/gesture/ssd_thread_cute.bundle", R.string.ssd_thread_cute));
|
||||
propBeans.add(new PropBean(R.mipmap.icon_control_delete_all, null,FaceParam.FACE_GESTURE_RECOGNITION));
|
||||
propBeans.add(new PropBean(R.mipmap.icon_gesture_rain, "effect/gesture/ctrl_rain.bundle", R.string.push_hand,FaceParam.FACE_GESTURE_RECOGNITION));
|
||||
propBeans.add(new PropBean(R.mipmap.icon_gesture_snow, "effect/gesture/ctrl_snow.bundle", R.string.push_hand,FaceParam.FACE_GESTURE_RECOGNITION));
|
||||
propBeans.add(new PropBean(R.mipmap.icon_gesture_flower, "effect/gesture/ctrl_flower.bundle", R.string.push_hand,FaceParam.FACE_GESTURE_RECOGNITION));
|
||||
propBeans.add(new PropBean(R.mipmap.icon_gesture_koreaheart, "effect/gesture/ssd_thread_korheart.bundle", R.string.fu_lm_koreaheart,FaceParam.FACE_GESTURE_RECOGNITION));
|
||||
propBeans.add(new PropBean(R.mipmap.icon_gesture_six, "effect/gesture/ssd_thread_six.bundle", R.string.ssd_thread_six,FaceParam.FACE_GESTURE_RECOGNITION));
|
||||
propBeans.add(new PropBean(R.mipmap.icon_gesture_cute, "effect/gesture/ssd_thread_cute.bundle", R.string.ssd_thread_cute,FaceParam.FACE_GESTURE_RECOGNITION));
|
||||
break;
|
||||
}
|
||||
return propBeans;
|
||||
|
||||
@@ -21,6 +21,7 @@ import com.yunbao.faceunity.data.FaceUnityDataFactory;
|
||||
import com.yunbao.faceunity.entity.BaseBean;
|
||||
import com.yunbao.faceunity.data.FineStickerDataFactory;
|
||||
import com.yunbao.faceunity.entity.FunctionEnum;
|
||||
import com.yunbao.faceunity.entity.MakeupCustomClassBean;
|
||||
import com.yunbao.faceunity.entity.MenuGroupBean;
|
||||
import com.yunbao.faceunity.entity.net.FineStickerEntity;
|
||||
import com.yunbao.faceunity.entity.net.FineStickerTagEntity;
|
||||
@@ -29,6 +30,7 @@ import com.yunbao.faceunity.repo.BodyBeautySource;
|
||||
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.net.StickerDownloadHelper;
|
||||
|
||||
import java.util.ArrayList;
|
||||
@@ -48,8 +50,9 @@ public class FaceUnityView extends LinearLayout implements StickerDownloadHelper
|
||||
private ContainerRecyclerAdapter containerAdapter;
|
||||
private TabLayout tabLayout;
|
||||
private TextView title;
|
||||
private LinearLayout menu2, diy, reset, menu2Reset;
|
||||
private LinearLayout menu2, menuDiy, reset, menu2Reset;
|
||||
private ImageView menu2Back, back, close;
|
||||
private DiscreteSeekBar seekBar;
|
||||
|
||||
public FaceUnityView(Context context) {
|
||||
super(context);
|
||||
@@ -74,7 +77,7 @@ public class FaceUnityView extends LinearLayout implements StickerDownloadHelper
|
||||
LayoutInflater.from(mContext).inflate(R.layout.layout_faceunity, this);
|
||||
initView();
|
||||
bindBottomView();
|
||||
FineStickerDataFactory.getInstance().setCallback(this);
|
||||
FineStickerDataFactory.getInstance().addCallback(this);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -100,15 +103,24 @@ public class FaceUnityView extends LinearLayout implements StickerDownloadHelper
|
||||
close = findViewById(R.id.menu_close);
|
||||
reset = findViewById(R.id.menu_reset);
|
||||
menu2Reset = findViewById(R.id.menu2_reset);
|
||||
menuDiy = findViewById(R.id.menu_diy);
|
||||
seekBar = findViewById(R.id.item_seekBar);
|
||||
initMenuGroup();
|
||||
setContainerRecycler(new ArrayList<>());
|
||||
initViewClick();
|
||||
}
|
||||
private void initViewClick(){
|
||||
|
||||
private void initViewClick() {
|
||||
menu2Back.setOnClickListener(v -> goBackMainMenu());
|
||||
menuDiy.setOnClickListener(v -> {
|
||||
changeRecyclerItemCount(5);
|
||||
ArrayList<MakeupCustomClassBean> list = MakeupSource.buildCustomClasses();
|
||||
setTab(createTabs(list));
|
||||
});
|
||||
|
||||
}
|
||||
private void goBackMainMenu(){
|
||||
|
||||
private void goBackMainMenu() {
|
||||
setContainerRecycler(new ArrayList<>());
|
||||
title.setText("美顏特效選擇");
|
||||
title.setVisibility(VISIBLE);
|
||||
@@ -159,6 +171,7 @@ public class FaceUnityView extends LinearLayout implements StickerDownloadHelper
|
||||
case 1:
|
||||
title.setText(R.string.home_function_name_makeup);
|
||||
title.setVisibility(VISIBLE);
|
||||
menuDiy.setVisibility(VISIBLE);
|
||||
changeRecyclerItemCount(5);
|
||||
setContainerRecycler(MakeupSource.buildCombinations());
|
||||
break;
|
||||
@@ -221,6 +234,17 @@ public class FaceUnityView extends LinearLayout implements StickerDownloadHelper
|
||||
return list;
|
||||
}
|
||||
|
||||
private List<TabLayout.Tab> createTabs(ArrayList<MakeupCustomClassBean> tags) {
|
||||
List<TabLayout.Tab> list = new ArrayList<>();
|
||||
for (MakeupCustomClassBean tag : tags) {
|
||||
TabLayout.Tab tab;
|
||||
tab = tabLayout.newTab().setText(tag.getDesRes());
|
||||
tab.setTag(tag.getBeanType());
|
||||
list.add(tab);
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
private void setTab(List<TabLayout.Tab> tabs) {
|
||||
tabLayout.removeAllTabs();
|
||||
for (TabLayout.Tab tab : tabs) {
|
||||
@@ -256,6 +280,46 @@ public class FaceUnityView extends LinearLayout implements StickerDownloadHelper
|
||||
changeRecyclerItemCount(5);
|
||||
setContainerRecycler(AnimojiSource.buildFilters());
|
||||
break;
|
||||
case FaceParam.FACE_MAKEUP_TYPE_FOUNDATION:
|
||||
changeRecyclerItemCount(5);
|
||||
setContainerRecycler(MakeupSource.buildCustomItemParams().get(MakeupSource.FACE_MAKEUP_TYPE_FOUNDATION));
|
||||
break;
|
||||
case FaceParam.FACE_MAKEUP_TYPE_LIP_STICK:
|
||||
changeRecyclerItemCount(5);
|
||||
setContainerRecycler(MakeupSource.buildCustomItemParams().get(MakeupSource.FACE_MAKEUP_TYPE_LIP_STICK));
|
||||
break;
|
||||
case FaceParam.FACE_MAKEUP_TYPE_BLUSHER:
|
||||
changeRecyclerItemCount(5);
|
||||
setContainerRecycler(MakeupSource.buildCustomItemParams().get(MakeupSource.FACE_MAKEUP_TYPE_BLUSHER));
|
||||
break;
|
||||
case FaceParam.FACE_MAKEUP_TYPE_EYE_BROW:
|
||||
changeRecyclerItemCount(5);
|
||||
setContainerRecycler(MakeupSource.buildCustomItemParams().get(MakeupSource.FACE_MAKEUP_TYPE_EYE_BROW));
|
||||
break;
|
||||
case FaceParam.FACE_MAKEUP_TYPE_EYE_SHADOW:
|
||||
changeRecyclerItemCount(5);
|
||||
setContainerRecycler(MakeupSource.buildCustomItemParams().get(MakeupSource.FACE_MAKEUP_TYPE_EYE_SHADOW));
|
||||
break;
|
||||
case FaceParam.FACE_MAKEUP_TYPE_EYE_LINER:
|
||||
changeRecyclerItemCount(5);
|
||||
setContainerRecycler(MakeupSource.buildCustomItemParams().get(MakeupSource.FACE_MAKEUP_TYPE_EYE_LINER));
|
||||
break;
|
||||
case FaceParam.FACE_MAKEUP_TYPE_EYE_LASH:
|
||||
changeRecyclerItemCount(5);
|
||||
setContainerRecycler(MakeupSource.buildCustomItemParams().get(MakeupSource.FACE_MAKEUP_TYPE_EYE_LASH));
|
||||
break;
|
||||
case FaceParam.FACE_MAKEUP_TYPE_HIGH_LIGHT:
|
||||
changeRecyclerItemCount(5);
|
||||
setContainerRecycler(MakeupSource.buildCustomItemParams().get(MakeupSource.FACE_MAKEUP_TYPE_HIGH_LIGHT));
|
||||
break;
|
||||
case FaceParam.FACE_MAKEUP_TYPE_SHADOW:
|
||||
changeRecyclerItemCount(5);
|
||||
setContainerRecycler(MakeupSource.buildCustomItemParams().get(MakeupSource.FACE_MAKEUP_TYPE_SHADOW));
|
||||
break;
|
||||
case FaceParam.FACE_MAKEUP_TYPE_EYE_PUPIL:
|
||||
changeRecyclerItemCount(5);
|
||||
setContainerRecycler(MakeupSource.buildCustomItemParams().get(MakeupSource.FACE_MAKEUP_TYPE_EYE_PUPIL));
|
||||
break;
|
||||
default:
|
||||
setContainerRecycler(new ArrayList<>());
|
||||
}
|
||||
@@ -291,6 +355,7 @@ public class FaceUnityView extends LinearLayout implements StickerDownloadHelper
|
||||
private void setContainerRecycler(ArrayList<? extends BaseBean> list) {
|
||||
if (containerAdapter == null) {
|
||||
containerAdapter = new ContainerRecyclerAdapter(mContext);
|
||||
containerAdapter.setSeekBar(seekBar);
|
||||
containerRecycler.setLayoutManager(new GridLayoutManager(mContext, 2));
|
||||
containerRecycler.setAdapter(containerAdapter);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
package com.yunbao.faceunity.utils;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.SharedPreferences;
|
||||
|
||||
import com.yunbao.common.CommonAppContext;
|
||||
|
||||
public class FaceSPUtils {
|
||||
private static FaceSPUtils utils;
|
||||
private SharedPreferences mSharedPreferences;
|
||||
private FaceSPUtils(){
|
||||
mSharedPreferences = CommonAppContext.sInstance.getSharedPreferences("FaceUnityConfig", Context.MODE_PRIVATE);
|
||||
}
|
||||
public static FaceSPUtils getInstance(){
|
||||
if(utils==null){
|
||||
utils=new FaceSPUtils();
|
||||
}
|
||||
return utils;
|
||||
}
|
||||
public void saveString(String key,String value){
|
||||
mSharedPreferences.edit().putString(key,value).apply();
|
||||
}
|
||||
public String getString(String key){
|
||||
return mSharedPreferences.getString(key,null);
|
||||
}
|
||||
public boolean saveBool(String key,boolean value){
|
||||
return mSharedPreferences.getBoolean(key,false);
|
||||
}
|
||||
}
|
||||
@@ -86,10 +86,7 @@ public class FileUtils {
|
||||
* @return
|
||||
*/
|
||||
public static File getExternalFileDir(Context context) {
|
||||
File fileDir = context.getExternalFilesDir(null);
|
||||
if (fileDir == null) {
|
||||
fileDir = context.getFilesDir();
|
||||
}
|
||||
File fileDir = context.getFilesDir();
|
||||
return fileDir;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user