From a0de3475e53efdabbeb4e9b24d2039eb5de8f104 Mon Sep 17 00:00:00 2001 From: liup <1454939542@qq.com> Date: Mon, 18 Nov 2024 11:42:41 +0800 Subject: [PATCH] =?UTF-8?q?=E4=B8=BB=E6=96=99=E5=90=8D=E7=A7=B0=E5=B1=95?= =?UTF-8?q?=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .idea/other.xml | 329 ------------------ .../common/constant/ConfigName.java | 2 +- .../ui/adapter/step/FoodNameAdapter.java | 64 ++++ .../ui/dialog/EditGoodsDialog.java | 22 +- .../layout/item/layout/dialog_edit_goods.xml | 2 +- .../res/layout/item/layout/item_food_name.xml | 28 ++ .../item/layout/layout_add_goods_mainfood.xml | 19 +- 7 files changed, 131 insertions(+), 335 deletions(-) delete mode 100644 .idea/other.xml create mode 100644 app/src/main/java/com/bonait/bnframework/ui/adapter/step/FoodNameAdapter.java create mode 100644 app/src/main/res/layout/item/layout/item_food_name.xml diff --git a/.idea/other.xml b/.idea/other.xml deleted file mode 100644 index 104e542e..00000000 --- a/.idea/other.xml +++ /dev/null @@ -1,329 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/app/src/main/java/com/bonait/bnframework/common/constant/ConfigName.java b/app/src/main/java/com/bonait/bnframework/common/constant/ConfigName.java index 610b7571..f7df10f9 100644 --- a/app/src/main/java/com/bonait/bnframework/common/constant/ConfigName.java +++ b/app/src/main/java/com/bonait/bnframework/common/constant/ConfigName.java @@ -33,7 +33,7 @@ import java.util.concurrent.ConcurrentHashMap; * 配置文件 */ public class ConfigName { - public static boolean isTEST = false; + public static boolean isTEST = true; public boolean is800WithFeeding = false;//是否是800带投料版 有5个投料位 public boolean isPhoneVersion = false;//是否适配手机 public boolean isHighVersion = false;//是否适配高版本 diff --git a/app/src/main/java/com/bonait/bnframework/ui/adapter/step/FoodNameAdapter.java b/app/src/main/java/com/bonait/bnframework/ui/adapter/step/FoodNameAdapter.java new file mode 100644 index 00000000..e1d36b07 --- /dev/null +++ b/app/src/main/java/com/bonait/bnframework/ui/adapter/step/FoodNameAdapter.java @@ -0,0 +1,64 @@ +package com.bonait.bnframework.ui.adapter.step; + +import android.annotation.SuppressLint; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; + +import androidx.annotation.NonNull; +import androidx.recyclerview.widget.RecyclerView; + +import com.bonait.bnframework.R; +import com.bonait.bnframework.common.constant.ConfigName; +import com.bonait.bnframework.common.db.mode.BPA_GOODS_PROCESS_DETAIL; +import com.bonait.bnframework.databinding.ItemFoodNameBinding; +import com.bonait.bnframework.databinding.ItemStepBinding; +import com.bonait.bnframework.ui.adapter.BaseAdapter; +import com.bonait.bnframework.ui.util.DisplayManager; + +/** + * @author: liup + * @description: 步骤列表 + * @date: 2024/5/8 15:36. + */ +public class FoodNameAdapter extends BaseAdapter { + + @NonNull + @Override + public ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) { + return new ViewHolder(ItemFoodNameBinding.inflate(LayoutInflater.from(parent.getContext()), parent, false)); + } + + @Override + public void onBindViewHolder(@NonNull ViewHolder holder, @SuppressLint("RecyclerView") int position) { + try { + if(holder.binding.getRoot().getWidth()==0){ + if(holder.binding.name.getTextSize()> 32|| holder.binding.name.getTextSize()< 28){ + DisplayManager.scaleViewGroup(holder.binding.getRoot()); + } + } + holder.binding.root.setSelected(mCurrentPosition == position); + holder.binding.name.setText((position+1)+"."+mData.get(position)); + } catch (Exception e) { + e.printStackTrace(); + } + } + + @Override + protected void onItemClick(View v, int position) { + + } + + + public static class ViewHolder extends RecyclerView.ViewHolder { + private ItemFoodNameBinding binding; + + + public ViewHolder(ItemFoodNameBinding view) { + super(view.getRoot()); + binding = view; + } + } +} + + diff --git a/app/src/main/java/com/bonait/bnframework/ui/dialog/EditGoodsDialog.java b/app/src/main/java/com/bonait/bnframework/ui/dialog/EditGoodsDialog.java index 6fdbfa4b..d0898d25 100644 --- a/app/src/main/java/com/bonait/bnframework/ui/dialog/EditGoodsDialog.java +++ b/app/src/main/java/com/bonait/bnframework/ui/dialog/EditGoodsDialog.java @@ -52,6 +52,7 @@ import com.bonait.bnframework.modules.home.fragment.from.ImageChooseActivity; import com.bonait.bnframework.ui.activity.DiyProcessActivity; import com.bonait.bnframework.ui.adapter.classify.ClassifySpinnerAdapter; import com.bonait.bnframework.ui.adapter.classify.SelectAttributeListAdapter; +import com.bonait.bnframework.ui.adapter.step.FoodNameAdapter; import com.bonait.bnframework.ui.util.AdbCommandUtil; import com.bonait.bnframework.ui.util.DimensUtil; import com.bonait.bnframework.ui.util.DisplayManager; @@ -420,6 +421,10 @@ public class EditGoodsDialog extends DialogFragment { viewBinding.layoutMainfoods.editName4.setText(""); viewBinding.layoutMainfoods.editName5.setText(""); // viewBinding.layoutMainfoods.editName6.setText(""); + List namesList = new ArrayList<>(); + FoodNameAdapter adapter = new FoodNameAdapter(); + adapter.setNewData(namesList); + viewBinding.layoutMainfoods.recycleView.setAdapter(adapter); if(subattributeGroup!=null){ ArrayList list = GoodsProcessDetailDBUtil.getByGroupId(subattributeGroup.id); for(BPA_GOODS_PROCESS_DETAIL bean:list ){ @@ -431,6 +436,8 @@ public class EditGoodsDialog extends DialogFragment { if(!params.isEmpty()){ int position = -1;//几号位 String name = "";//主料名称 + String weight = ""; + String positonS = ""; for (HashMap.Entry entry : params.entrySet()) { String key = entry.getKey(); String value = entry.getValue(); @@ -438,15 +445,24 @@ public class EditGoodsDialog extends DialogFragment { name = value; }else if(key.contains("主料位置")){ position = Integer.parseInt(value.replace("号位","")); + positonS = ",位置:"+ position+"号位"; + }else if(key.equals("重量")){ + weight = ",重量:"+value; + }else if(key.equals("主料重量")){ + weight = ",重量:"+value; } } - if(position>=0){ - updateName(position,name); + if(!name.isEmpty()){ + namesList.add("名称:"+name+weight+positonS); } +// if(position>=0){ +// updateName(position,name); +// } } } } } + adapter.notifyDataSetChanged(); } } @@ -533,7 +549,7 @@ public class EditGoodsDialog extends DialogFragment { picUrl = goods.url; updateImage(picUrl); } - viewBinding.layoutMainfoods.ll3.setVisibility(ConfigName.getInstance().is800WithFeeding?View.VISIBLE:View.GONE); +// viewBinding.layoutMainfoods.ll3.setVisibility(ConfigName.getInstance().is800WithFeeding?View.VISIBLE:View.GONE); viewBinding.layoutName.editName.setText(Objects.requireNonNull(GoodsDBUtil.getById(goodId)).name); if(!isEdit){ diff --git a/app/src/main/res/layout/item/layout/dialog_edit_goods.xml b/app/src/main/res/layout/item/layout/dialog_edit_goods.xml index af16af2f..2c02d5cd 100644 --- a/app/src/main/res/layout/item/layout/dialog_edit_goods.xml +++ b/app/src/main/res/layout/item/layout/dialog_edit_goods.xml @@ -47,7 +47,7 @@ + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/item/layout/layout_add_goods_mainfood.xml b/app/src/main/res/layout/item/layout/layout_add_goods_mainfood.xml index d71906a4..2f7ec4f5 100644 --- a/app/src/main/res/layout/item/layout/layout_add_goods_mainfood.xml +++ b/app/src/main/res/layout/item/layout/layout_add_goods_mainfood.xml @@ -1,7 +1,7 @@ @@ -26,6 +26,7 @@ android:layout_width="match_parent" android:layout_height="@dimen/dp_80" android:id="@+id/ll1" + android:visibility="gone" app:layout_constraintLeft_toLeftOf="parent" app:layout_constraintRight_toRightOf="parent" app:layout_constraintTop_toBottomOf="@id/title3" @@ -85,6 +86,7 @@ + +