update ui

This commit is contained in:
Yutousama 2022-09-20 22:21:38 +08:00
parent 02206dc289
commit bdaa51dbb6
31 changed files with 166 additions and 26 deletions

View File

@ -96,7 +96,7 @@ public class ContainerRecyclerAdapter extends RecyclerView.Adapter<BaseViewHolde
case FaceParam.FACE_FINE_STICKER_MIDDLE:
case FaceParam.FACE_FINE_STICKER_HIGH:
case FaceParam.FACE_FINE_STICKER_GAME:
vh = new FineStickerViewHolder(from.inflate(R.layout.list_item_face_config_big_head, parent, false));
vh = new FineStickerViewHolder(from.inflate(R.layout.list_item_face_config_fine_sticker, parent, false));
break;
default:
vh = new BeautySkinViewHolder(LayoutInflater.from(mContext).inflate(R.layout.list_item_face_config, parent, false));

View File

@ -8,6 +8,9 @@ import androidx.annotation.NonNull;
import com.yunbao.faceunity.R;
import com.yunbao.faceunity.entity.BaseBean;
/**
* 动画滤镜
*/
public class AnimViewHolder extends BaseViewHolder{
ImageView imageView;
public AnimViewHolder(@NonNull View itemView) {

View File

@ -8,6 +8,9 @@ import androidx.annotation.NonNull;
import com.yunbao.faceunity.R;
import com.yunbao.faceunity.entity.BaseBean;
/**
* Animoji
*/
public class AnimojiViewHolder extends BaseViewHolder{
ImageView imageView;
public AnimojiViewHolder(@NonNull View itemView) {

View File

@ -12,6 +12,9 @@ import com.yunbao.faceunity.entity.ModelAttributeData;
import com.yunbao.faceunity.seekbar.DiscreteSeekBar;
import com.yunbao.faceunity.utils.SeekBarUtils;
/**
* 美体
*/
public class BeautyBodyViewHolder extends BaseViewHolder{
private ImageView icon;
private TextView title;

View File

@ -7,16 +7,23 @@ 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;
import com.yunbao.faceunity.seekbar.DiscreteSeekBar;
import com.yunbao.faceunity.utils.SeekBarUtils;
/**
* 美型
*/
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) {
super(itemView);
@ -24,10 +31,32 @@ 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(){
@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);
}
});
dataFactory=new FaceBeautyDataFactory(new FaceBeautyDataFactory.FaceBeautyListener() {
@Override
public void onFilterSelected(int res) {
}
@Override
public void onFaceBeautyEnable(boolean enable) {
}
});
}
@Override
public void setData(BaseBean data) {
itemView.setTag(data);
icon.setImageResource(data.getImageRes());
title.setText(data.getDesRes());
ModelAttributeData attributeData = data.getModelAttributeData();

View File

@ -7,16 +7,22 @@ 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;
import com.yunbao.faceunity.seekbar.DiscreteSeekBar;
import com.yunbao.faceunity.utils.SeekBarUtils;
/**
* 美肤
*/
public class BeautySkinViewHolder extends BaseViewHolder{
private ImageView icon;
private TextView title;
private TextView value;
private DiscreteSeekBar seekBar;
private FaceBeautyDataFactory dataFactory;
public BeautySkinViewHolder(@NonNull View itemView) {
super(itemView);
@ -24,10 +30,32 @@ public class BeautySkinViewHolder 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);
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) {
}
});
}
@Override
public void setData(BaseBean data) {
itemView.setTag(data);
icon.setImageResource(data.getImageRes());
title.setText(data.getDesRes());
ModelAttributeData attributeData = data.getModelAttributeData();

View File

@ -8,6 +8,9 @@ import androidx.annotation.NonNull;
import com.yunbao.faceunity.R;
import com.yunbao.faceunity.entity.BaseBean;
/**
* 大头
*/
public class BigHeadViewHolder extends BaseViewHolder{
ImageView imageView;
public BigHeadViewHolder(@NonNull View itemView) {

View File

@ -10,6 +10,9 @@ import com.yunbao.faceunity.R;
import com.yunbao.faceunity.adapters.vh.BaseViewHolder;
import com.yunbao.faceunity.entity.BaseBean;
/**
* 滤镜
*/
public class FilterViewHolder extends BaseViewHolder {
private ImageView icon;
private TextView title;
@ -18,11 +21,15 @@ 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()));
}
@Override
public void setData(BaseBean data) {
icon.setImageResource(data.getImageRes());
title.setText(data.getDesRes());
icon.setSelected(getSelectPosition()==getAdapterPosition());
title.setSelected(getSelectPosition()==getAdapterPosition());
}
}

View File

@ -9,12 +9,16 @@ import com.yunbao.common.glide.ImgLoader;
import com.yunbao.faceunity.R;
import com.yunbao.faceunity.entity.BaseBean;
/**
* 精品贴纸
*/
public class FineStickerViewHolder extends BaseViewHolder {
ImageView imageView;
public FineStickerViewHolder(@NonNull View itemView) {
super(itemView);
imageView = itemView.findViewById(R.id.iv_control);
itemView.setOnClickListener(view -> setSelectPosition(getAdapterPosition()));
}
@Override
@ -24,5 +28,6 @@ public class FineStickerViewHolder extends BaseViewHolder {
} else {
ImgLoader.display(imageView.getContext(), data.getImageUrl(), imageView);
}
imageView.setSelected(getSelectPosition() == getAdapterPosition());
}
}

View File

@ -9,6 +9,9 @@ import androidx.annotation.NonNull;
import com.yunbao.faceunity.R;
import com.yunbao.faceunity.entity.BaseBean;
/**
* 美妆
*/
public class MakeupViewHolder extends BaseViewHolder {
private ImageView icon;
private TextView title;

View File

@ -8,6 +8,9 @@ import androidx.annotation.NonNull;
import com.yunbao.faceunity.R;
import com.yunbao.faceunity.entity.BaseBean;
/**
* 普通贴纸
*/
public class StickerViewHolder extends BaseViewHolder{
ImageView imageView;
public StickerViewHolder(@NonNull View itemView) {

View File

@ -24,5 +24,6 @@ public class StyleViewHolder extends BaseViewHolder{
icon.setImageResource(data.getImageRes());
title.setText(data.getDesRes());
icon.setSelected(getSelectPosition()==getAdapterPosition());
title.setSelected(getSelectPosition()==getAdapterPosition());
}
}

View File

@ -1,4 +1,4 @@
package com.yunbao.faceunity.entity;
package com.yunbao.faceunity.data;
import android.util.Log;
import android.view.MotionEvent;
@ -17,7 +17,6 @@ import com.faceunity.core.model.antialiasing.Antialiasing;
import com.faceunity.core.model.prop.sticker.FineSticker;
import com.faceunity.core.utils.FileUtils;
import com.yunbao.faceunity.data.FaceBeautyDataFactory;
import com.yunbao.faceunity.entity.net.FineStickerEntity;
import com.yunbao.faceunity.entity.net.FineStickerTagEntity;
import com.yunbao.faceunity.infe.AbstractFineStickerDataFactory;

View File

@ -1,14 +1,5 @@
package com.yunbao.faceunity.repo;
import com.yunbao.faceunity.entity.FineStickerDataFactory;
import com.yunbao.faceunity.entity.net.FineStickerEntity;
import com.yunbao.faceunity.entity.net.FineStickerTagEntity;
import com.yunbao.faceunity.utils.net.StickerDownloadHelper;
import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.List;
public class FineStickerSource {
}

View File

@ -19,7 +19,7 @@ import com.yunbao.faceunity.adapters.MenuGroupRecyclerAdapter;
import com.yunbao.faceunity.data.FaceParam;
import com.yunbao.faceunity.data.FaceUnityDataFactory;
import com.yunbao.faceunity.entity.BaseBean;
import com.yunbao.faceunity.entity.FineStickerDataFactory;
import com.yunbao.faceunity.data.FineStickerDataFactory;
import com.yunbao.faceunity.entity.FunctionEnum;
import com.yunbao.faceunity.entity.MenuGroupBean;
import com.yunbao.faceunity.entity.net.FineStickerEntity;
@ -110,6 +110,8 @@ public class FaceUnityView extends LinearLayout implements StickerDownloadHelper
}
private void goBackMainMenu(){
setContainerRecycler(new ArrayList<>());
title.setText("美顏特效選擇");
title.setVisibility(VISIBLE);
menu2.setVisibility(GONE);
menuGroup.setVisibility(VISIBLE);
}

View File

@ -23,6 +23,10 @@ class SeekBarUtils {
}
bar.visibility = View.VISIBLE
}
fun seekToValue(range:Double,value:Int,seekBarMin:Int):Double{
val valueF: Double = 1.0 * (value - seekBarMin) / 100
return range*valueF;
}
}

View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@drawable/bg_shape_rect2_theme" android:state_selected="true" />
<item android:drawable="@color/transparent" />
</selector>

View File

@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<corners android:radius="3dp" />
<stroke
android:width="3dp"
android:color="#FFC621" />
<padding
android:bottom="3dp"
android:left="3dp"
android:right="3dp"
android:top="3dp" />
</shape>

View File

@ -1,5 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@mipmap/icon_beauty_box_style_1_checked" android:state_selected="true" />
<item android:drawable="@mipmap/icon_beauty_box_style_1_normal" />
</selector>

View File

@ -1,5 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@mipmap/icon_beauty_box_style_2_checked" android:state_selected="true" />
<item android:drawable="@mipmap/icon_beauty_box_style_2_normal" />
</selector>

View File

@ -1,5 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@mipmap/icon_beauty_box_style_3_checked" android:state_selected="true" />
<item android:drawable="@mipmap/icon_beauty_box_style_3_normal" />
</selector>

View File

@ -1,5 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@mipmap/icon_beauty_box_style_4_checked" android:state_selected="true" />
<item android:drawable="@mipmap/icon_beauty_box_style_4_normal" />
</selector>

View File

@ -1,5 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@mipmap/icon_beauty_box_style_5_checked" android:state_selected="true" />
<item android:drawable="@mipmap/icon_beauty_box_style_5_normal" />
</selector>

View File

@ -1,5 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@mipmap/icon_beauty_box_style_6_checked" android:state_selected="true" />
<item android:drawable="@mipmap/icon_beauty_box_style_6_normal" />
</selector>

View File

@ -1,5 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@mipmap/icon_beauty_box_style_7_checked" android:state_selected="true" />
<item android:drawable="@mipmap/icon_beauty_box_style_7_normal" />
</selector>

View File

@ -4,12 +4,13 @@
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/bg_live_tota"
android:background="@drawable/bg_live_tota2"
android:orientation="vertical">
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="10dp"
android:layout_marginTop="16dp">
<ImageView
@ -139,7 +140,7 @@
android:id="@+id/menu2_back"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="8dp"
android:layout_marginStart="10dp"
android:layout_weight="0"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
@ -150,6 +151,8 @@
<com.google.android.material.tabs.TabLayout
android:id="@+id/menu2_tab"
android:layout_width="0dp"
android:layout_marginStart="10dp"
android:layout_marginEnd="10dp"
android:layout_height="match_parent"
android:layout_weight="1"
app:tabSelectedTextColor="#F6F7FB"
@ -184,10 +187,10 @@
</LinearLayout>
<androidx.recyclerview.widget.RecyclerView
android:layout_marginTop="10dp"
android:id="@+id/menu2_container_view"
android:layout_width="match_parent"
android:layout_height="216dp"
android:layout_marginTop="10dp"
android:layout_weight="1" />
</LinearLayout>

View File

@ -0,0 +1,35 @@
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="@dimen/x132"
android:layout_height="@dimen/x180">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center_horizontal|bottom"
android:orientation="vertical">
<ImageView
android:id="@+id/iv_control"
android:layout_width="@dimen/x88"
android:layout_height="@dimen/x88"
android:layout_marginBottom="@dimen/x18"
android:background="@drawable/bg_control_square2_selector"
android:scaleType="centerInside"
android:src="@mipmap/icon_big_head" />
<TextView
android:id="@+id/tv_control"
android:visibility="invisible"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_marginBottom="@dimen/x30"
android:gravity="center_vertical"
android:text="@string/recover"
android:textColor="@color/tv_main_color_selector"
android:textSize="@dimen/text_size_20" />
</LinearLayout>
</FrameLayout>

View File

@ -12,6 +12,7 @@
<ImageView
android:id="@+id/iv_control"
android:layout_width="@dimen/x88"
android:background="@drawable/bg_control_oval2_selector"
android:layout_height="@dimen/x88"
android:layout_marginBottom="@dimen/x18"
android:scaleType="centerInside" />

View File

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<corners android:topLeftRadius="12dp" android:topRightRadius="12dp" />
<solid android:color="#B3000000" />
</shape>

View File

@ -10,9 +10,9 @@ ext {
manifestPlaceholders = [
//
// serverHost : "https://napi.yaoulive.com",
serverHost : "https://napi.yaoulive.com",
//
serverHost : "https://ceshi.yaoulive.com",
// serverHost : "https://ceshi.yaoulive.com",
//
txMapAppKey : "EOZBZ-ASLCU-4XPV3-BDCHZ-4E3Q7-H4BWB",

View File

@ -46,7 +46,7 @@ public class LiveFaceUnityDialogFragment extends AbsDialogFragment {
@Override
protected boolean canCancel() {
return false;
return true;
}
@Override