From 80c5609bb7022074af8becd2f305ac5a5ffe22de Mon Sep 17 00:00:00 2001 From: Yutousama <583819556@qq.com> Date: Thu, 22 Sep 2022 00:02:45 +0800 Subject: [PATCH] update --- .../adapters/ContainerRecyclerAdapter.java | 18 ++++++++++- .../faceunity/adapters/vh/AnimViewHolder.java | 14 +++++++-- .../adapters/vh/AnimojiViewHolder.java | 16 ++++++++-- .../faceunity/adapters/vh/BaseViewHolder.java | 1 + .../adapters/vh/BeautyBodyViewHolder.java | 27 +++++++++++----- .../adapters/vh/BeautyShapeViewHolder.java | 11 +++++++ .../adapters/vh/BeautySkinViewHolder.java | 9 ++++++ .../adapters/vh/BigHeadViewHolder.java | 10 ++++++ .../adapters/vh/FilterViewHolder.java | 31 ++++++++++++------- .../adapters/vh/FineStickerViewHolder.java | 9 ++++++ .../vh/MakeupCustomItemViewHolder.java | 16 ++++++++-- .../adapters/vh/MakeupViewHolder.java | 18 +++++++++++ .../adapters/vh/StickerViewHolder.java | 25 +++++++++++++++ .../adapters/vh/StyleViewHolder.java | 25 +++++++++++++++ .../yunbao/faceunity/ui/FaceUnityView.java | 4 ++- .../yunbao/faceunity/utils/FaceSPUtils.java | 4 +++ 16 files changed, 209 insertions(+), 29 deletions(-) diff --git a/FaceUnity/src/main/java/com/yunbao/faceunity/adapters/ContainerRecyclerAdapter.java b/FaceUnity/src/main/java/com/yunbao/faceunity/adapters/ContainerRecyclerAdapter.java index 2fbc66920..b00235a82 100644 --- a/FaceUnity/src/main/java/com/yunbao/faceunity/adapters/ContainerRecyclerAdapter.java +++ b/FaceUnity/src/main/java/com/yunbao/faceunity/adapters/ContainerRecyclerAdapter.java @@ -72,8 +72,15 @@ public class ContainerRecyclerAdapter extends RecyclerView.Adapter list) { this.list = list; this.selectPosition = -1; + hideSeekBar(); } public int getSelectPosition() { @@ -218,4 +226,12 @@ public class ContainerRecyclerAdapter extends RecyclerView.Adapter { adapter.getAnimojiDataFactory().onFilterSelected((AnimationFilterBean) itemView.getTag()); @@ -29,7 +32,7 @@ public class AnimViewHolder extends BaseViewHolder{ public void setData(BaseBean data) { itemView.setTag(data); icon.setImageResource(data.getImageRes()); - icon.setSelected(getAdapterPosition()==getSelectPosition()); + icon.setSelected(getAdapterPosition() == getSelectPosition()); } @Override @@ -41,4 +44,9 @@ public class AnimViewHolder extends BaseViewHolder{ public void saveData() { } + + @Override + public void reset(List list) { + adapter.setSelectPosition(0); + } } diff --git a/FaceUnity/src/main/java/com/yunbao/faceunity/adapters/vh/AnimojiViewHolder.java b/FaceUnity/src/main/java/com/yunbao/faceunity/adapters/vh/AnimojiViewHolder.java index 4abd779e9..719be05c3 100644 --- a/FaceUnity/src/main/java/com/yunbao/faceunity/adapters/vh/AnimojiViewHolder.java +++ b/FaceUnity/src/main/java/com/yunbao/faceunity/adapters/vh/AnimojiViewHolder.java @@ -10,6 +10,8 @@ import com.yunbao.faceunity.R; import com.yunbao.faceunity.entity.AnimojiBean; import com.yunbao.faceunity.entity.BaseBean; +import java.util.List; + /** * Animoji */ @@ -32,7 +34,7 @@ public class AnimojiViewHolder extends BaseViewHolder { icon.setImageResource(data.getImageRes()); int adapterPosition = getAdapterPosition(); int selectPosition = getSelectPosition(); - if(loadData()){ + if (loadData()) { return; } icon.setSelected(adapterPosition == selectPosition); @@ -41,7 +43,7 @@ public class AnimojiViewHolder extends BaseViewHolder { @Override public boolean loadData() { - String data = adapter.getString(getClass().getSimpleName()); + String data = adapter.getString(getName(this)); if (data != null) { icon.setSelected(getAdapterPosition() == Integer.parseInt(data)); return true; @@ -51,6 +53,14 @@ public class AnimojiViewHolder extends BaseViewHolder { @Override public void saveData() { - adapter.save(getClass().getSimpleName(), String.valueOf(getAdapterPosition())); + adapter.save(getName(this), String.valueOf(getAdapterPosition())); } + + @Override + public void reset(List list) { + adapter.del(getName(this)); + adapter.setSelectPosition(0); + } + + } diff --git a/FaceUnity/src/main/java/com/yunbao/faceunity/adapters/vh/BaseViewHolder.java b/FaceUnity/src/main/java/com/yunbao/faceunity/adapters/vh/BaseViewHolder.java index b8374bfa7..f350d0494 100644 --- a/FaceUnity/src/main/java/com/yunbao/faceunity/adapters/vh/BaseViewHolder.java +++ b/FaceUnity/src/main/java/com/yunbao/faceunity/adapters/vh/BaseViewHolder.java @@ -35,6 +35,7 @@ public abstract class BaseViewHolder extends RecyclerView.ViewHolder { public abstract boolean loadData(); public abstract void saveData(); + public abstract void reset(List list); } diff --git a/FaceUnity/src/main/java/com/yunbao/faceunity/adapters/vh/BeautyBodyViewHolder.java b/FaceUnity/src/main/java/com/yunbao/faceunity/adapters/vh/BeautyBodyViewHolder.java index 172338798..bf4c31ab3 100644 --- a/FaceUnity/src/main/java/com/yunbao/faceunity/adapters/vh/BeautyBodyViewHolder.java +++ b/FaceUnity/src/main/java/com/yunbao/faceunity/adapters/vh/BeautyBodyViewHolder.java @@ -13,10 +13,12 @@ import com.yunbao.faceunity.entity.ModelAttributeData; import com.yunbao.faceunity.seekbar.DiscreteSeekBar; import com.yunbao.faceunity.utils.SeekBarUtils; +import java.util.List; + /** * 美体 */ -public class BeautyBodyViewHolder extends BaseViewHolder{ +public class BeautyBodyViewHolder extends BaseViewHolder { private ImageView icon; private TextView title; private TextView value; @@ -28,14 +30,14 @@ 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(){ + 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); + BeautyBodyViewHolder.this.value.setText(String.format("%.1f", toValue)); + adapter.getBodyBeautyDataFactory().updateParamIntensity(bean.getKey(), toValue); saveData(); } }); @@ -46,7 +48,7 @@ public class BeautyBodyViewHolder extends BaseViewHolder{ itemView.setTag(data); icon.setImageResource(data.getImageRes()); title.setText(data.getDesRes()); - if(loadData()){ + if (loadData()) { return; } ModelAttributeData attributeData = data.getModelAttributeData(); @@ -60,8 +62,8 @@ public class BeautyBodyViewHolder extends BaseViewHolder{ @Override public boolean loadData() { BodyBeautyBean bean = (BodyBeautyBean) itemView.getTag(); - String val = adapter.getString(getName(this) + bean); - if(val==null){ + String val = adapter.getString(getName(this) + bean.getKey()); + if (val == null) { return false; } ModelAttributeData attributeData = bean.getModelAttributeData(); @@ -76,7 +78,16 @@ public class BeautyBodyViewHolder extends BaseViewHolder{ @Override public void saveData() { BodyBeautyBean bean = (BodyBeautyBean) itemView.getTag(); - String key=getName(this)+bean.getKey(); + String key = getName(this) + bean.getKey(); adapter.save(key, (String) value.getText()); } + + @Override + public void reset(List list) { + String name = getName(this); + for (BaseBean bean : list) { + adapter.del(name + bean.getKey()); + } + adapter.notifyDataSetChanged(); + } } diff --git a/FaceUnity/src/main/java/com/yunbao/faceunity/adapters/vh/BeautyShapeViewHolder.java b/FaceUnity/src/main/java/com/yunbao/faceunity/adapters/vh/BeautyShapeViewHolder.java index 5171f210f..f415b93bf 100644 --- a/FaceUnity/src/main/java/com/yunbao/faceunity/adapters/vh/BeautyShapeViewHolder.java +++ b/FaceUnity/src/main/java/com/yunbao/faceunity/adapters/vh/BeautyShapeViewHolder.java @@ -13,6 +13,8 @@ import com.yunbao.faceunity.entity.ModelAttributeData; import com.yunbao.faceunity.seekbar.DiscreteSeekBar; import com.yunbao.faceunity.utils.SeekBarUtils; +import java.util.List; + /** * 美型 */ @@ -80,4 +82,13 @@ public class BeautyShapeViewHolder extends BaseViewHolder { FaceBeautyBean bean = (FaceBeautyBean) itemView.getTag(); adapter.save(getName(this)+bean.getKey(), (String) value.getText()); } + + @Override + public void reset(List list) { + String name = getName(this); + for (BaseBean bean : list) { + adapter.del(name+bean.getKey()); + } + adapter.notifyDataSetChanged(); + } } diff --git a/FaceUnity/src/main/java/com/yunbao/faceunity/adapters/vh/BeautySkinViewHolder.java b/FaceUnity/src/main/java/com/yunbao/faceunity/adapters/vh/BeautySkinViewHolder.java index 3d667ada6..c8a73e0ae 100644 --- a/FaceUnity/src/main/java/com/yunbao/faceunity/adapters/vh/BeautySkinViewHolder.java +++ b/FaceUnity/src/main/java/com/yunbao/faceunity/adapters/vh/BeautySkinViewHolder.java @@ -13,6 +13,8 @@ import com.yunbao.faceunity.entity.ModelAttributeData; import com.yunbao.faceunity.seekbar.DiscreteSeekBar; import com.yunbao.faceunity.utils.SeekBarUtils; +import java.util.List; + /** * 美肤 */ @@ -81,4 +83,11 @@ public class BeautySkinViewHolder extends BaseViewHolder{ String val= (String) value.getText(); adapter.save(getName(this)+key,val); } + + @Override + public void reset(List list) { + for (BaseBean bean : list) { + adapter.del(getName(this)+bean.getKey()); + } + } } diff --git a/FaceUnity/src/main/java/com/yunbao/faceunity/adapters/vh/BigHeadViewHolder.java b/FaceUnity/src/main/java/com/yunbao/faceunity/adapters/vh/BigHeadViewHolder.java index 757a4d7a6..567293887 100644 --- a/FaceUnity/src/main/java/com/yunbao/faceunity/adapters/vh/BigHeadViewHolder.java +++ b/FaceUnity/src/main/java/com/yunbao/faceunity/adapters/vh/BigHeadViewHolder.java @@ -10,6 +10,8 @@ import com.yunbao.faceunity.entity.BaseBean; import com.yunbao.faceunity.entity.FunctionEnum; import com.yunbao.faceunity.entity.PropBean; +import java.util.List; + /** * 大头 */ @@ -35,6 +37,7 @@ public class BigHeadViewHolder extends BaseViewHolder { if(loadData()){ return; } + if (getAdapterPosition() == 0) { icon.setBackgroundResource(R.drawable.bg_control_oval2_selector); } @@ -62,4 +65,11 @@ public class BigHeadViewHolder extends BaseViewHolder { PropBean bean = (PropBean) itemView.getTag(); adapter.save(getName(this),bean.getKey()); } + + @Override + public void reset(List list) { + adapter.del(getName(this)); + itemView.callOnClick(); + adapter.setSelectPosition(0); + } } diff --git a/FaceUnity/src/main/java/com/yunbao/faceunity/adapters/vh/FilterViewHolder.java b/FaceUnity/src/main/java/com/yunbao/faceunity/adapters/vh/FilterViewHolder.java index 21e3df717..e6c7c8853 100644 --- a/FaceUnity/src/main/java/com/yunbao/faceunity/adapters/vh/FilterViewHolder.java +++ b/FaceUnity/src/main/java/com/yunbao/faceunity/adapters/vh/FilterViewHolder.java @@ -10,6 +10,8 @@ import com.yunbao.faceunity.R; import com.yunbao.faceunity.entity.BaseBean; import com.yunbao.faceunity.entity.FaceBeautyFilterBean; +import java.util.List; + /** * 滤镜 */ @@ -22,8 +24,8 @@ public class FilterViewHolder extends BaseViewHolder { icon = itemView.findViewById(R.id.iv_control); title = itemView.findViewById(R.id.tv_control); itemView.setOnClickListener(view -> { - FaceBeautyFilterBean bean= (FaceBeautyFilterBean) itemView.getTag(); - adapter.getFaceBeautyDataFactory().onFilterSelected(bean.getKey(),bean.getIntensity(),bean.getDesRes()); + FaceBeautyFilterBean bean = (FaceBeautyFilterBean) itemView.getTag(); + adapter.getFaceBeautyDataFactory().onFilterSelected(bean.getKey(), bean.getIntensity(), bean.getDesRes()); setSelectPosition(getAdapterPosition()); saveData(); }); @@ -34,33 +36,40 @@ public class FilterViewHolder extends BaseViewHolder { itemView.setTag(data); icon.setImageResource(data.getImageRes()); title.setText(data.getDesRes()); - if(loadData()){ + if (loadData()) { return; } - icon.setSelected(getSelectPosition()==getAdapterPosition()); - title.setSelected(getSelectPosition()==getAdapterPosition()); + icon.setSelected(getSelectPosition() == getAdapterPosition()); + title.setSelected(getSelectPosition() == getAdapterPosition()); } @Override public boolean loadData() { - FaceBeautyFilterBean bean= (FaceBeautyFilterBean) itemView.getTag(); + FaceBeautyFilterBean bean = (FaceBeautyFilterBean) itemView.getTag(); String val = adapter.getString(getName(this)); - if(val==null){ + if (val == null) { return false; } - if(!val.equals(bean.getKey())){ + if (!val.equals(bean.getKey())) { return false; } icon.setSelected(true); title.setSelected(true); - adapter.getFaceBeautyDataFactory().onFilterSelected(bean.getKey(),bean.getIntensity(),bean.getDesRes()); + 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()); + FaceBeautyFilterBean bean = (FaceBeautyFilterBean) itemView.getTag(); + adapter.save(getName(this), bean.getKey()); + } + + @Override + public void reset(List list) { + adapter.del(getName(this)); + itemView.callOnClick(); + adapter.setSelectPosition(0); } } diff --git a/FaceUnity/src/main/java/com/yunbao/faceunity/adapters/vh/FineStickerViewHolder.java b/FaceUnity/src/main/java/com/yunbao/faceunity/adapters/vh/FineStickerViewHolder.java index a88da6845..52d5c613f 100644 --- a/FaceUnity/src/main/java/com/yunbao/faceunity/adapters/vh/FineStickerViewHolder.java +++ b/FaceUnity/src/main/java/com/yunbao/faceunity/adapters/vh/FineStickerViewHolder.java @@ -13,6 +13,8 @@ import com.yunbao.faceunity.entity.BaseBean; import com.yunbao.faceunity.entity.net.FineStickerEntity; import com.yunbao.faceunity.utils.net.StickerDownloadHelper; +import java.util.List; + /** * 精品贴纸 */ @@ -65,6 +67,13 @@ public class FineStickerViewHolder extends BaseViewHolder implements StickerDown adapter.save(getName(this), bean.getKey()); } + @Override + public void reset(List list) { + adapter.del(getName(this)); + itemView.callOnClick(); + adapter.setSelectPosition(0); + } + @Override public void onGetTags(String[] tags) { diff --git a/FaceUnity/src/main/java/com/yunbao/faceunity/adapters/vh/MakeupCustomItemViewHolder.java b/FaceUnity/src/main/java/com/yunbao/faceunity/adapters/vh/MakeupCustomItemViewHolder.java index 591dcfd99..58cee9fdc 100644 --- a/FaceUnity/src/main/java/com/yunbao/faceunity/adapters/vh/MakeupCustomItemViewHolder.java +++ b/FaceUnity/src/main/java/com/yunbao/faceunity/adapters/vh/MakeupCustomItemViewHolder.java @@ -13,6 +13,8 @@ import com.yunbao.faceunity.entity.MakeupCustomBean; import com.yunbao.faceunity.repo.MakeupSource; import com.yunbao.faceunity.seekbar.DiscreteSeekBar; +import java.util.List; + public class MakeupCustomItemViewHolder extends BaseViewHolder { private ImageView icon; private TextView title; @@ -73,7 +75,7 @@ public class MakeupCustomItemViewHolder extends BaseViewHolder { @Override public boolean loadData() { MakeupCustomBean bean = (MakeupCustomBean) itemView.getTag(); - String model = adapter.getString(getName(this) + "_model"); + String model = adapter.getString(getName(this)); String val = adapter.getString(getName(this) + bean.getKey() + "_val"); if (model == null || val == null) { return false; @@ -104,10 +106,20 @@ public class MakeupCustomItemViewHolder extends BaseViewHolder { if(key==null){ return; } - adapter.save(getName(this) + "_model", key); + adapter.save(getName(this), key); adapter.save(getName(this) + bean.getKey() + "_val", adapter.getSeekBar().getProgress() + ""); } + @Override + public void reset(List list) { + adapter.del(getName(this)); + for (BaseBean bean : list) { + adapter.del(getName(this) + bean.getKey() + "_val"); + } + itemView.callOnClick(); + adapter.setSelectPosition(0); + } + public String getMakeupKey(int beanType) { String key = null; switch (beanType) { diff --git a/FaceUnity/src/main/java/com/yunbao/faceunity/adapters/vh/MakeupViewHolder.java b/FaceUnity/src/main/java/com/yunbao/faceunity/adapters/vh/MakeupViewHolder.java index 920711c4a..acc0bde3b 100644 --- a/FaceUnity/src/main/java/com/yunbao/faceunity/adapters/vh/MakeupViewHolder.java +++ b/FaceUnity/src/main/java/com/yunbao/faceunity/adapters/vh/MakeupViewHolder.java @@ -10,6 +10,8 @@ import com.yunbao.faceunity.R; import com.yunbao.faceunity.entity.BaseBean; import com.yunbao.faceunity.entity.MakeupCombinationBean; +import java.util.List; + /** * 美妆 */ @@ -47,6 +49,17 @@ public class MakeupViewHolder extends BaseViewHolder { @Override public boolean loadData() { + MakeupCombinationBean bean = (MakeupCombinationBean) 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.getMakeupDataFactory().onMakeupCombinationSelected(bean); return true; } @@ -56,4 +69,9 @@ public class MakeupViewHolder extends BaseViewHolder { MakeupCombinationBean bean = (MakeupCombinationBean) itemView.getTag(); adapter.save(getName(this),bean.getKey()); } + + @Override + public void reset(Listlist) { + + } } diff --git a/FaceUnity/src/main/java/com/yunbao/faceunity/adapters/vh/StickerViewHolder.java b/FaceUnity/src/main/java/com/yunbao/faceunity/adapters/vh/StickerViewHolder.java index 19f215587..efdaced34 100644 --- a/FaceUnity/src/main/java/com/yunbao/faceunity/adapters/vh/StickerViewHolder.java +++ b/FaceUnity/src/main/java/com/yunbao/faceunity/adapters/vh/StickerViewHolder.java @@ -10,6 +10,8 @@ import com.yunbao.faceunity.entity.BaseBean; import com.yunbao.faceunity.entity.FunctionEnum; import com.yunbao.faceunity.entity.PropBean; +import java.util.List; + /** * 普通贴纸 */ @@ -23,6 +25,7 @@ public class StickerViewHolder extends BaseViewHolder{ adapter.getPropDataFactory().setPropType(FunctionEnum.STICKER); adapter.getPropDataFactory().onItemSelected(bean); setSelectPosition(getAdapterPosition()); + saveData(); }); } @@ -30,6 +33,9 @@ public class StickerViewHolder extends BaseViewHolder{ public void setData(BaseBean data) { itemView.setTag(data); icon.setImageResource(data.getImageRes()); + if(loadData()){ + return; + } if(getAdapterPosition()==0){ icon.setBackgroundResource(R.drawable.bg_control_oval2_selector); } @@ -38,12 +44,31 @@ public class StickerViewHolder extends BaseViewHolder{ @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.STICKER); + adapter.getPropDataFactory().onItemSelected(bean); return true; } @Override public void saveData() { + PropBean bean= (PropBean) itemView.getTag(); + adapter.save(getName(this),bean.getKey()); + } + @Override + public void reset(List list) { + adapter.del(getName(this)); + itemView.callOnClick(); + adapter.setSelectPosition(0); } } diff --git a/FaceUnity/src/main/java/com/yunbao/faceunity/adapters/vh/StyleViewHolder.java b/FaceUnity/src/main/java/com/yunbao/faceunity/adapters/vh/StyleViewHolder.java index b362976a2..4bb4b8666 100644 --- a/FaceUnity/src/main/java/com/yunbao/faceunity/adapters/vh/StyleViewHolder.java +++ b/FaceUnity/src/main/java/com/yunbao/faceunity/adapters/vh/StyleViewHolder.java @@ -9,6 +9,8 @@ import androidx.annotation.NonNull; import com.yunbao.faceunity.R; import com.yunbao.faceunity.entity.BaseBean; +import java.util.List; + /** * 风格推荐 */ @@ -23,6 +25,7 @@ public class StyleViewHolder extends BaseViewHolder{ BaseBean bean= (BaseBean) itemView.getTag(); adapter.getFaceBeautyDataFactory().onStyleSelected(bean.getKey()); setSelectPosition(getAdapterPosition()); + saveData(); }); } @@ -31,18 +34,40 @@ public class StyleViewHolder extends BaseViewHolder{ 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() { + BaseBean bean= (BaseBean) 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().onStyleSelected(bean.getKey()); return true; } @Override public void saveData() { + BaseBean bean= (BaseBean) itemView.getTag(); + adapter.save(getName(this),bean.getKey()); + } + @Override + public void reset(List list) { + adapter.del(getName(this)); + itemView.callOnClick(); + adapter.setSelectPosition(0); } } diff --git a/FaceUnity/src/main/java/com/yunbao/faceunity/ui/FaceUnityView.java b/FaceUnity/src/main/java/com/yunbao/faceunity/ui/FaceUnityView.java index 01f6b99f7..ef2f8e0bf 100644 --- a/FaceUnity/src/main/java/com/yunbao/faceunity/ui/FaceUnityView.java +++ b/FaceUnity/src/main/java/com/yunbao/faceunity/ui/FaceUnityView.java @@ -117,7 +117,9 @@ public class FaceUnityView extends LinearLayout implements StickerDownloadHelper ArrayList list = MakeupSource.buildCustomClasses(); setTab(createTabs(list)); }); - + menu2Reset.setOnClickListener(view -> { + containerAdapter.reset(); + }); } private void goBackMainMenu() { diff --git a/FaceUnity/src/main/java/com/yunbao/faceunity/utils/FaceSPUtils.java b/FaceUnity/src/main/java/com/yunbao/faceunity/utils/FaceSPUtils.java index 98e86fe30..0781c7b7c 100644 --- a/FaceUnity/src/main/java/com/yunbao/faceunity/utils/FaceSPUtils.java +++ b/FaceUnity/src/main/java/com/yunbao/faceunity/utils/FaceSPUtils.java @@ -26,4 +26,8 @@ public class FaceSPUtils { public boolean saveBool(String key,boolean value){ return mSharedPreferences.getBoolean(key,false); } + + public void del(String key) { + mSharedPreferences.edit().remove(key).apply(); + } }