Browse Source

lyw 上传

授权码生成工具
lyw 5 months ago
parent
commit
ead5d0142e
10 changed files with 160 additions and 52 deletions
  1. +30
    -20
      app/src/main/java/com/bonait/bnframework/ui/dialog/EditGoodsDialog.java
  2. +20
    -4
      app/src/main/java/com/bonait/bnframework/ui/fragment/goods/LocalGoodsFragment.java
  3. +29
    -0
      app/src/main/java/com/bonait/bnframework/ui/widget/NewToastUtil.java
  4. +14
    -13
      app/src/main/res/layout/activity_edit_process.xml
  5. +1
    -1
      app/src/main/res/layout/fragment_local_goods.xml
  6. +2
    -2
      app/src/main/res/layout/item/layout/dialog_delete_classify.xml
  7. +10
    -10
      app/src/main/res/layout/item/layout/layout_add_goods_mainfood.xml
  8. +2
    -2
      app/src/main/res/layout/item/layout/layout_edit_goods_sub_attribute.xml
  9. +26
    -0
      app/src/main/res/values-en/strings.xml
  10. +26
    -0
      app/src/main/res/values/strings.xml

+ 30
- 20
app/src/main/java/com/bonait/bnframework/ui/dialog/EditGoodsDialog.java View File

@@ -199,7 +199,7 @@ public class EditGoodsDialog extends DialogFragment {
String name = viewBinding.layoutName.editName.getText().toString();
if(name.isEmpty()){
if(getContext()!=null){
NewToastUtil.getInstance().showToast("名称不能为空");
NewToastUtil.getInstance().showToast("名称不能为空","The name cannot be empty");
}
return;
}
@@ -218,7 +218,7 @@ public class EditGoodsDialog extends DialogFragment {
case R.id.btn_next2:
if(!selectAttributeListAdapter.isAllSelected()){
if(getContext()!=null){
NewToastUtil.getInstance().showToast("请选择每行对应的子属性");
NewToastUtil.getInstance().showToast("请选择每行对应的子属性","Select the subattribute for each row!");
}
return;
}
@@ -228,32 +228,42 @@ public class EditGoodsDialog extends DialogFragment {
changePage(3);
return;
}
if(viewBinding.layoutAttribute.groupDesc.getText().toString().contains("不存在选中组合")){
NewToastUtil.getInstance().showToast("不存在该组合");
if(viewBinding.layoutAttribute.groupDesc.getText().toString().contains(getString(R.string.text_haveattr))){
NewToastUtil.getInstance().showToast(getString(R.string.text_haveattr));
}else {
if(subattributeGroup!=null){
if(!isEdit){
if(GoodsProcessDetailDBUtil.getByGroupId(subattributeGroup.id).isEmpty()){
viewBinding.layoutAttribute.groupDesc.setText("存在选中组合\n(没有工序)");
NewToastUtil.getInstance().showToast("该组合没有工序,请先编辑工序");
viewBinding.layoutAttribute.groupDesc.setText(getString(R.string.text_haveattr_1));
NewToastUtil.getInstance().showToast(getString(R.string.info_editprocess));
return;
}
}
changePage(3);
}else {
NewToastUtil.getInstance().showToast("数据为空");
NewToastUtil.getInstance().showToast(getString(R.string.info_datanull));
}
}
break;
case R.id.btn_to_cook:
if(subattributeGroup == null){
NewToastUtil.getInstance().showToast("数据为空");
NewToastUtil.getInstance().showToast(getString(R.string.info_datanull));
}else {
if(GoodsProcessDetailDBUtil.getByGroupId(subattributeGroup.id).isEmpty()){
NewToastUtil.getInstance().showToast(isEdit?
(subattributeGroup.name.isEmpty()?("当前配方没有工序,请先编辑工序"):
("当前组合【"+subattributeGroup.name+"】没有工序,请先编辑工序"))
:"当前组合没有工序,请前往菜品研发编辑工序");
switch (getString(R.string.language)){
case "en":
NewToastUtil.getInstance().showToast(isEdit?
(subattributeGroup.name.isEmpty()?("The current recipe has no process, please edit the process first!"):
("The current recipe【"+subattributeGroup.name+"】has no process,please edit the process first!"))
:"The current combination has no process, please go to the Menu Develop and editing process");
break;
case "zh":
NewToastUtil.getInstance().showToast(isEdit?
(subattributeGroup.name.isEmpty()?("当前配方没有工序,请先编辑工序"):
("当前组合【"+subattributeGroup.name+"】没有工序,请先编辑工序"))
:"当前组合没有工序,请前往菜品研发编辑工序");
break;
}
return;
}
jumpToCook();
@@ -390,7 +400,7 @@ public class EditGoodsDialog extends DialogFragment {
groupList.add(subattributeGroup.name);
viewBinding.layoutAttribute.spinnerList.setSelection(groupList.size()-1);
NewToastUtil.getInstance().showToast("创建组合【"+subattributeGroup.name+"】成功");
viewBinding.layoutAttribute.groupDesc.setText("存在选中组合\n(没有工序)");
viewBinding.layoutAttribute.groupDesc.setText(getString(R.string.text_haveattr_1));
RecordManager.getInstance().addLogRecord("角色操作日志", subattributeGroup.name+"-创建配方成功");
}else {
subattributeGroup.name = selectAttributeListAdapter.getSubAttributeNameList();//修改名称顺序
@@ -580,12 +590,12 @@ public class EditGoodsDialog extends DialogFragment {
@Override
public void onClick() {
if(!hasGroup().isEmpty()){
viewBinding.layoutAttribute.groupDesc.setText("存在选中组合");
viewBinding.layoutAttribute.btnNext2.setText("下一步");
viewBinding.layoutAttribute.groupDesc.setText(getString(R.string.text_haveattr_2));
viewBinding.layoutAttribute.btnNext2.setText(getString(R.string.btn_next));
if(GoodsProcessDetailDBUtil.getByGroupId(subattributeGroup.id).isEmpty()){
viewBinding.layoutAttribute.groupDesc.setText("存在选中组合\n(没有工序)");
viewBinding.layoutAttribute.groupDesc.setText(getString(R.string.text_haveattr_1));
}
if(viewBinding.layoutAttribute.groupDesc.getText().toString().contains("没有工序")){
if(viewBinding.layoutAttribute.groupDesc.getText().toString().contains("没有工序")||viewBinding.layoutAttribute.groupDesc.getText().toString().contains("No Process")){
if(!isEdit){
viewBinding.layoutAttribute.btnNext2.setBackgroundResource(R.drawable.bg_round25_gray_btn);
}
@@ -619,7 +629,7 @@ public class EditGoodsDialog extends DialogFragment {
viewBinding.layoutAttribute.spinnerList.setSelection(pos);
}else{
viewBinding.layoutAttribute.spinnerList.setSelection(0);
viewBinding.layoutAttribute.groupDesc.setText("不存在选中组合");
viewBinding.layoutAttribute.groupDesc.setText(getString(R.string.text_haveattr));
if(!isEdit){
viewBinding.layoutAttribute.btnNext2.setBackgroundResource(R.drawable.bg_round25_gray_btn);
}else {
@@ -691,14 +701,14 @@ public class EditGoodsDialog extends DialogFragment {
updateAttributeData("");
}else {
updateAttributeData(viewBinding.layoutAttribute.spinnerList.getSelectedItem().toString());
viewBinding.layoutAttribute.groupDesc.setText("存在选中组合");
viewBinding.layoutAttribute.groupDesc.setText(getString(R.string.text_haveattr_2));
viewBinding.layoutAttribute.btnNext2.setBackgroundResource(R.drawable.bg_round25_yellow_btn);
viewBinding.layoutAttribute.groupDesc.postDelayed(new Runnable() {
@Override
public void run() {
hasGroup();
if(GoodsProcessDetailDBUtil.getByGroupId(subattributeGroup.id).isEmpty()){
viewBinding.layoutAttribute.groupDesc.setText("存在选中组合\n(没有工序)");
viewBinding.layoutAttribute.groupDesc.setText(getString(R.string.text_haveattr_1));
}
}
},300);


+ 20
- 4
app/src/main/java/com/bonait/bnframework/ui/fragment/goods/LocalGoodsFragment.java View File

@@ -197,8 +197,16 @@ public class LocalGoodsFragment extends BaseFragment {
BPA_GOODS bean = mData.get(position);
DialogDeleteClassifyBinding binding = DialogDeleteClassifyBinding.bind(layoutView);
DisplayManager.scaleViewGroup(binding.getRoot());
binding.title.setText("删除菜品");
binding.edit.setText("是否删除["+bean.name+"]下所有组合配方?");
binding.title.setText(getString(R.string.text_deleterecipe));
switch (getString(R.string.text_deleterecipe)){
case "en":
binding.edit.setText("Delete ["+bean.name+"] all recipes?");
break;
case "zh":
binding.edit.setText("是否删除["+bean.name+"]下所有组合配方?");
break;
}

binding.cancel.setOnClickListener(view1 ->{
xCom.dismissX();
});
@@ -210,13 +218,21 @@ public class LocalGoodsFragment extends BaseFragment {
GoodsProcessDetailDBUtil.deleteByGoodsId(bean.id);
SubAttributeGroupDBUtil.deleteByGoodsId(bean.id);
if(GoodsDBUtil.delete(bean)){
NewToastUtil.getInstance().showToast("删除["+bean.name+"]成功!");
switch (getString(R.string.text_deleterecipe)){
case "en":
binding.edit.setText("Delete ["+bean.name+"] all recipes?");
break;
case "zh":
binding.edit.setText("是否删除["+bean.name+"]下所有组合配方?");
break;
}
NewToastUtil.getInstance().showToast("删除["+bean.name+"]成功!","Delete ["+bean.name+"] Success!");
goodsList.remove(bean);
goodsAdapter.notifyDataSetChanged();
xCom.dismissX();
RecordManager.getInstance().addLogRecord("角色操作日志","删除["+bean.name+"]菜品成功!");
}else {
NewToastUtil.getInstance().showToast("删除["+bean.name+"]失败!");
NewToastUtil.getInstance().showToast("删除["+bean.name+"]失败!","Delete ["+bean.name+"] Fail!");
}
});
});


+ 29
- 0
app/src/main/java/com/bonait/bnframework/ui/widget/NewToastUtil.java View File

@@ -15,6 +15,7 @@ import androidx.core.content.ContextCompat;

import com.bonait.bnframework.MainApplication;
import com.bonait.bnframework.R;
import com.bonait.bnframework.common.constant.ConfigName;
import com.bonait.bnframework.databinding.ViewLayoutToastBinding;
import com.bonait.bnframework.ui.util.DimensUtil;
import com.bonait.bnframework.ui.util.DisplayManager;
@@ -65,6 +66,34 @@ public class NewToastUtil {
});
}

public void showToast(String message_zh,String message_en){
handler.post(() -> {
if(toast != null){
toast.cancel();
}
toast = new Toast(MainApplication.getContext());
String content = "";
switch (ConfigName.getInstance().app.getString(R.string.language)){
case "en":
content = message_en;
break;
case "zh":
content = message_zh;
break;
}
if(content.length() > 50){
content = content.substring(0,50)+"...";
}
View layout = LayoutInflater.from(MainApplication.getContext()).inflate(R.layout.view_layout_toast,null);
ViewLayoutToastBinding binding = ViewLayoutToastBinding.bind(layout);
DisplayManager.scaleViewGroup(binding.getRoot());
binding.toastText.setText(content);
toast.setGravity(Gravity.BOTTOM,0, (int) (DisplayManager.getWidthScaleRate()* DimensUtil.getDimens(10)));
toast.setDuration(Toast.LENGTH_SHORT);
toast.setView(layout);
toast.show();
});
}
public void showToastBottom(String message){
handler.post(() -> {
if(toast != null){


+ 14
- 13
app/src/main/res/layout/activity_edit_process.xml View File

@@ -35,7 +35,7 @@
android:id="@+id/btn_copy_process"
android:layout_width="@dimen/dp_150"
style="@style/TextView_btn_normal"
android:text="导入工序"
android:text="@string/btn_tolead"
android:paddingLeft="@dimen/dp_10"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toTopOf="@id/line1"
@@ -69,7 +69,7 @@
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toBottomOf="@id/line1"
style="@style/TextView_normal_size"
android:text="步骤:"
android:text="@string/text_step"
android:layout_marginTop="@dimen/dp_10"
android:textColor="#567722"
android:layout_marginLeft="@dimen/dp_10"
@@ -82,7 +82,8 @@
app:layout_constraintLeft_toRightOf="@id/line2"
app:layout_constraintTop_toBottomOf="@id/line1"
style="@style/TextView_normal_size"
android:text="烹饪工序:"
android:text="@string/text_cookprocess"
android:textSize="25dp"
android:textColor="#823E17"
android:layout_marginLeft="@dimen/dp_20"
/>
@@ -146,13 +147,13 @@
<!--模拟炒制-->
<TextView
android:id="@+id/btn_simulation"
android:layout_width="@dimen/dp_180"
android:layout_width="@dimen/dp_240"
style="@style/TextView_btn_normal"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toLeftOf="@id/line2"
android:layout_marginBottom="@dimen/dp_25"
android:text="模拟炒制"
android:text="@string/btn_cooksimulate"
/>

<!--添加-->
@@ -160,7 +161,7 @@
android:id="@+id/btn_add"
android:layout_width="@dimen/dp_150"
style="@style/TextView_btn_normal"
android:text="+添加"
android:text="@string/btn_add"
app:layout_constraintLeft_toLeftOf="@id/line2"
app:layout_constraintBottom_toBottomOf="parent"
android:layout_marginBottom="@dimen/dp_120"
@@ -171,7 +172,7 @@
android:id="@+id/btn_insert"
android:layout_width="@dimen/dp_150"
style="@style/TextView_btn_normal"
android:text="插入"
android:text="@string/btn_insert"
app:layout_constraintLeft_toLeftOf="@id/line2"
android:layout_marginLeft="@dimen/dp_270"
app:layout_constraintBottom_toBottomOf="parent"
@@ -203,7 +204,7 @@
android:id="@+id/btn_insert_up"
android:layout_width="@dimen/dp_170"
style="@style/TextView_btn_normal"
android:text="向上插入"
android:text="@string/btn_upinsert"
android:layout_marginBottom="@dimen/dp_10"
/>

@@ -212,7 +213,7 @@
android:id="@+id/btn_insert_down"
android:layout_width="@dimen/dp_170"
style="@style/TextView_btn_normal"
android:text="向下插入"
android:text="@string/btn_Downinsert"
android:layout_marginBottom="@dimen/dp_10"
/>
</LinearLayout>
@@ -224,7 +225,7 @@
android:layout_width="@dimen/dp_150"
style="@style/TextView_btn_normal"
android:background="@drawable/bg_round50_green_btn"
android:text="修改"
android:text="@string/btn_revise"
app:layout_constraintLeft_toLeftOf="@id/line2"
app:layout_constraintBottom_toBottomOf="parent"
android:layout_marginBottom="@dimen/dp_25"
@@ -236,7 +237,7 @@
android:layout_width="@dimen/dp_150"
style="@style/TextView_btn_normal"
android:background="@drawable/bg_round50_red_btn"
android:text="删除"
android:text="@string/btn_delete"
app:layout_constraintLeft_toLeftOf="@id/line2"
app:layout_constraintBottom_toBottomOf="parent"
android:layout_marginBottom="@dimen/dp_25"
@@ -259,13 +260,13 @@
android:gravity="center"
android:paddingLeft="@dimen/dp_5"
android:paddingRight="@dimen/dp_50"
android:text=" 保存并返回"
android:text="@string/text_savereturn"
android:textColor="@color/white"
android:textSize="@dimen/sp_32" />
<TextView
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:text="编辑工序"
android:text="@string/btn_editprocess"
android:textColor="@color/white"
android:textSize="36sp"
android:layout_gravity="center"


+ 1
- 1
app/src/main/res/layout/fragment_local_goods.xml View File

@@ -21,7 +21,7 @@
android:layout_marginBottom="2dp"
android:ellipsize="middle"
android:textSize="@dimen/sp_32"
android:text="添加分类"
android:text="@string/btn_addclass"
android:textColor="#823E17"
android:gravity="center"
android:background="#EFE9D2"/>


+ 2
- 2
app/src/main/res/layout/item/layout/dialog_delete_classify.xml View File

@@ -45,7 +45,7 @@
android:layout_height="@dimen/dp_80"
android:textSize="@dimen/sp_32"
android:textColor="@color/white"
android:text="取消"
android:text="@string/btn_cancel"
android:background="@drawable/bg_round25_yellow_btn"
android:layout_gravity="bottom"
android:layout_marginBottom="@dimen/dp_20"
@@ -58,7 +58,7 @@
android:layout_height="@dimen/dp_80"
android:textSize="@dimen/sp_32"
android:textColor="@color/white"
android:text="确认"
android:text="@string/tip_save_confirm"
android:background="@drawable/bg_round25_yellow_btn"
android:layout_gravity="bottom"
android:layout_marginBottom="@dimen/dp_20"


+ 10
- 10
app/src/main/res/layout/item/layout/layout_add_goods_mainfood.xml View File

@@ -17,7 +17,7 @@
android:paddingLeft="@dimen/dp_80"
android:paddingRight="@dimen/dp_80"
android:singleLine="true"
android:text="按编号填写主料名称"
android:text="@string/text_writeprocess"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toTopOf="parent" />

@@ -45,7 +45,7 @@
android:layout_width="@dimen/dp_250"
android:layout_height="match_parent"
android:background="@drawable/input_bj"
android:hint="1号位"
android:hint="@string/text_bit_1"
android:inputType="text"
android:lines="1"
android:padding="@dimen/dp_3"
@@ -69,7 +69,7 @@
android:layout_width="@dimen/dp_250"
android:layout_height="match_parent"
android:background="@drawable/input_bj"
android:hint="2号位"
android:hint="@string/text_bit_2"
android:inputType="text"
android:lines="1"
android:padding="@dimen/dp_3"
@@ -105,7 +105,7 @@
android:layout_width="@dimen/dp_250"
android:layout_height="match_parent"
android:background="@drawable/input_bj"
android:hint="3号位"
android:hint="@string/text_bit_3"
android:inputType="text"
android:lines="1"
android:padding="@dimen/dp_3"
@@ -129,7 +129,7 @@
android:layout_width="@dimen/dp_250"
android:layout_height="match_parent"
android:background="@drawable/input_bj"
android:hint="4号位"
android:hint="@string/text_bit_4"
android:inputType="text"
android:lines="1"
android:padding="@dimen/dp_3"
@@ -221,7 +221,7 @@
android:textSize="@dimen/sp_48"
android:textColor="@color/white"
android:background="@drawable/bg_round25_yellow_btn"
android:text="去烹饪"
android:text="@string/btn_cooking"
/>

<LinearLayout
@@ -239,9 +239,9 @@
android:layout_marginLeft="@dimen/dp_30"
android:background="@drawable/bg_round25_green_btn"
android:gravity="center"
android:text="编辑工序"
android:text="@string/btn_editprocess"
android:textColor="@color/white"
android:textSize="@dimen/sp_48" />
android:textSize="35dp" />

<TextView
android:id="@+id/btn_delete"
@@ -250,10 +250,10 @@
android:layout_marginTop="@dimen/dp_10"
android:layout_marginLeft="@dimen/dp_30"
android:gravity="center"
android:textSize="@dimen/sp_48"
android:textSize="35dp"
android:textColor="@color/white"
android:background="@drawable/bg_round25_red_btn"
android:text="删除配方"
android:text="@string/btn_deleterecipe"
/>
</LinearLayout>
</LinearLayout>


+ 2
- 2
app/src/main/res/layout/item/layout/layout_edit_goods_sub_attribute.xml View File

@@ -63,7 +63,7 @@

<TextView
android:id="@+id/group_desc"
android:layout_width="wrap_content"
android:layout_width="300dp"
android:textSize="@dimen/sp_32"
android:layout_height="@dimen/dp_120"
app:layout_constraintLeft_toLeftOf="parent"
@@ -71,7 +71,7 @@
app:layout_constraintRight_toRightOf="parent"
android:layout_marginTop="@dimen/dp_30"
android:textColor="@color/blue"
tools:text="存在选中组合\n(没有工序)"
tools:text="@string/text_haveattr_1"
android:gravity="center"
/>



+ 26
- 0
app/src/main/res/values-en/strings.xml View File

@@ -97,6 +97,7 @@
<string name="text_downloadinfo">Please download the product first!</string>
<string name="btn_update">Update</string>
<string name="btn_delete">Delete</string>
<string name="text_deleterecipe">Delete Recipe</string>
<string name="btn_deleteall">Delete All</string>
<string name="btn_updateall">Update All</string>
<string name="text_edit">Edit Recipe</string>
@@ -109,4 +110,29 @@
<string name="text_commodityab">Commodity Attribute:</string>
<string name="text_defaultab">Default Attribute:</string>
<string name="text_prev">Prev</string>
<string name="btn_cooking">Cooking</string>
<string name="btn_editprocess">Edit Process</string>
<string name="btn_deleterecipe">Delete Recipe</string>
<string name="text_writeprocess">Fill in the main material name</string>
<string name="text_bit_1">1 Bit</string>
<string name="text_bit_2">2 Bit</string>
<string name="text_bit_3">3 Bit</string>
<string name="text_bit_4">4 Bit</string>
<string name="text_savereturn">Save&amp;return</string>
<string name="btn_tolead">To Lead</string>
<string name="text_step">Cook Step</string>
<string name="text_cookprocess">Cook Process</string>
<string name="btn_cooksimulate">Simulation Cook</string>
<string name="btn_add">+Add</string>
<string name="btn_insert">Insert</string>
<string name="btn_upinsert">UpInsert</string>
<string name="btn_Downinsert">DownInsert</string>
<string name="btn_revise">Revise</string>
<string name="text_haveattr_1">There are selection attributes\n(No Process)</string>
<string name="text_haveattr_2">There are selection attributes</string>
<string name="text_haveattr">Null</string>
<string name="info_datanull">Data Null</string>
<string name="info_editprocess">This combination has no process, please edit the process first!</string>
<string name="info_selectprocess">Please select the subattribute for each row!</string>
<string name="btn_addclass">Add Class</string>
</resources>

+ 26
- 0
app/src/main/res/values/strings.xml View File

@@ -97,6 +97,7 @@
<string name="text_downloadinfo">请先下载该商品</string>
<string name="btn_update">上传</string>
<string name="btn_delete">删除</string>
<string name="text_deleterecipe">删除菜品</string>
<string name="btn_deleteall">删除所有商品</string>
<string name="btn_updateall">上传所有商品</string>
<string name="text_edit">编辑菜品</string>
@@ -109,4 +110,29 @@
<string name="text_commodityab">商品属性:</string>
<string name="text_defaultab">默认属性:</string>
<string name="text_prev">上一步</string>
<string name="btn_cooking">去烹饪</string>
<string name="btn_editprocess">编辑工序</string>
<string name="btn_deleterecipe">删除配方</string>
<string name="text_writeprocess">按编号填写主料名称</string>
<string name="text_bit_1">1号位</string>
<string name="text_bit_2">2号位</string>
<string name="text_bit_3">3号位</string>
<string name="text_bit_4">4号位</string>
<string name="text_savereturn">保存并返回</string>
<string name="btn_tolead">导入工序</string>
<string name="text_step">步骤</string>
<string name="text_cookprocess">烹饪工艺</string>
<string name="btn_cooksimulate">模拟炒制</string>
<string name="btn_add">+添加</string>
<string name="btn_insert">插入</string>
<string name="btn_upinsert">向上插入</string>
<string name="btn_Downinsert">向下插入</string>
<string name="btn_revise">修改</string>
<string name="text_haveattr_1">存在选择组合\n(没有工序)</string>
<string name="text_haveattr_2">存在选择组合</string>
<string name="text_haveattr">不存在选中组合</string>
<string name="info_datanull">数据为空</string>
<string name="info_editprocess">该组合没有工序,请先编辑工序</string>
<string name="info_selectprocess">请选择每行对应的子属性!</string>
<string name="btn_addclass">添加分类</string>
</resources>

Loading…
Cancel
Save