@@ -4,10 +4,10 @@ | |||
<selectionStates> | |||
<SelectionState runConfigName="app"> | |||
<option name="selectionMode" value="DROPDOWN" /> | |||
<DropdownSelection timestamp="2024-05-29T08:06:21.150986500Z"> | |||
<DropdownSelection timestamp="2024-05-29T09:08:55.500220600Z"> | |||
<Target type="DEFAULT_BOOT"> | |||
<handle> | |||
<DeviceId pluginId="Default" identifier="serial=192.168.1.7:5555;connection=fd2c211c" /> | |||
<DeviceId pluginId="Default" identifier="serial=127.0.0.1:7555;connection=65d0277c" /> | |||
</handle> | |||
</Target> | |||
</DropdownSelection> | |||
@@ -13,14 +13,13 @@ import com.bonait.bnframework.common.constant.ConfigName; | |||
import com.bonait.bnframework.common.constant.MessageName; | |||
import com.bonait.bnframework.common.db.QueryDB; | |||
import com.bonait.bnframework.common.db.mode.BPA_CLOUDDATA; | |||
import com.bonait.bnframework.common.db.mode.BPA_GOODS_OLD; | |||
import com.bonait.bnframework.common.db.mode.BPA_GOODSRECIPE; | |||
import com.bonait.bnframework.common.db.mode.BPA_GOODS_OLD; | |||
import com.bonait.bnframework.common.db.mode.BPA_MATERIAL; | |||
import com.bonait.bnframework.common.db.mode.BPA_PLCADDRESS; | |||
import com.bonait.bnframework.common.db.mode.BPA_PROCESS; | |||
import com.bonait.bnframework.common.db.mode.BPA_PROCESSModel; | |||
import com.bonait.bnframework.common.db.mode.BPA_SYSTEMSET; | |||
import com.bonait.bnframework.common.db.mode.Res_PLCADDRESS; | |||
import com.bonait.bnframework.common.helper.ConfigUtil; | |||
import com.bonait.bnframework.common.helper.Json; | |||
import com.bonait.bnframework.common.http.callback.json.JsonDialogCallback; | |||
@@ -1035,7 +1034,7 @@ public class ConfigData { | |||
*/ | |||
public void RevertPLCProcess() { | |||
try { | |||
List<Res_PLCADDRESS> plcaddresses = ConfigName.getInstance().PlcAddress_大炒; | |||
// List<Res_PLCADDRESS> plcaddresses = ConfigName.getInstance().PlcAddress_大炒; | |||
List<ProcessT> processTS = ConfigName.getInstance().Process_桌面小炒; | |||
// if (ConfigName.getInstance().versionSelectionEnum.equals("大炒版本")) { | |||
@@ -255,7 +255,7 @@ public class CookingActivity extends BaseActivity { | |||
} | |||
} | |||
if( !NewExecuteTheRecipe.IsStart){ | |||
ToastUtils.info("客官,当前菜品已停止炒制!!!"); | |||
NewToastUtil.getInstance().showToast("客官,当前菜品已停止炒制!!!"); | |||
break; | |||
} | |||
boolean status = NewExecuteTheRecipe.Execute(item); | |||
@@ -331,7 +331,7 @@ public class DiyProcessActivity extends BaseActivity { | |||
stepAdapter.notifyDataSetChanged(); | |||
viewBinding.recycleStep.smoothScrollToPosition(processDetails.size()-1); | |||
}else { | |||
NewToastUtil.getInstance().showToast("参数错误!"); | |||
// NewToastUtil.getInstance().showToast("参数错误!"); | |||
} | |||
} | |||
@@ -385,7 +385,6 @@ public class DiyProcessActivity extends BaseActivity { | |||
NewToastUtil.getInstance().showToast("修改失败,选中步骤名称不相同!"); | |||
return; | |||
} | |||
BPA_GOODS_PROCESS_DETAIL processDetail = getSelectItemFromValue(); | |||
processDetails.set(index_update, getSelectItemFromValue()); | |||
stepAdapter.notifyDataSetChanged(); | |||
NewToastUtil.getInstance().showToast("修改步骤[" + (index_update + 1) + ":" + obj_update.processname + "]成功!"); | |||
@@ -24,7 +24,6 @@ import com.bonait.bnframework.common.db.util.SubAttributeGroupDBUtil; | |||
import com.bonait.bnframework.common.helper.I.MyClickListener; | |||
import com.bonait.bnframework.common.utils.AlertDialogUtils; | |||
import com.bonait.bnframework.common.utils.DisplayManager; | |||
import com.bonait.bnframework.common.utils.ToastUtils; | |||
import com.bonait.bnframework.databinding.ActivityEditClassifyBinding; | |||
import com.bonait.bnframework.databinding.DialogAddClassifyBinding; | |||
import com.bonait.bnframework.databinding.DialogDeleteClassifyBinding; | |||
@@ -148,17 +147,43 @@ public class EditClassifyActivity extends BaseActivity { | |||
viewBinding.listAttribute.setAdapter(attributeAdapter); | |||
attributeAdapter.notifyDataSetChanged(); | |||
subattributeAdapter = new SubattributeAdapter(context, R.layout.item_subattribute, subattributeList, new MyClickListener() { | |||
subattributeAdapter = new SubattributeAdapter(context, R.layout.item_subattribute, subattributeList, new SubattributeAdapter.MyClickListener() { | |||
@Override | |||
public void clickListener(View v, Object data) { | |||
public void clickName(View v,int position,BPA_SUBATTRIBUTE data) { | |||
AlertDialogUtils.showCancelAndConfirmDialog(EditClassifyActivity.this, R.layout.dialog_add_classify, (layoutView, xCom) -> { | |||
DialogAddClassifyBinding binding = DialogAddClassifyBinding.bind(layoutView); | |||
DisplayManager.scaleViewGroup(binding.getRoot()); | |||
binding.title.setText("修改子属性名称"); | |||
binding.edit.setHint("请输入子属性名称"); | |||
binding.edit.setText(data.name); | |||
binding.submit.setOnClickListener(view1 -> { | |||
String input = String.valueOf(binding.edit.getText()); | |||
if(!input.isEmpty()){ | |||
for(BPA_SUBATTRIBUTE bean:subattributeList){ | |||
if(bean.name.equals(input)){ | |||
NewToastUtil.getInstance().showToast("已有该子属性,请换一个名称!"); | |||
return; | |||
} | |||
} | |||
BPA_SUBATTRIBUTE subattribute = (BPA_SUBATTRIBUTE)data; | |||
subattribute.name = input; | |||
SubAttributeDBUtil.update(subattribute); | |||
subattributeAdapter.notifyDataSetChanged(); | |||
if(position-1>=0 && !subattributeList.isEmpty()){ | |||
viewBinding.listSubattribute.smoothScrollToPosition(position-1); | |||
} | |||
xCom.dismissX(); | |||
}else { | |||
NewToastUtil.getInstance().showToast("名称不能为空!"); | |||
} | |||
}); | |||
}); | |||
} | |||
@Override | |||
public void clickListenerNew(View v, int k, Object data) { | |||
public void clickDelete(View v,int position,BPA_SUBATTRIBUTE data) { | |||
//删除 | |||
removeSubAttribute(k,data); | |||
removeSubAttribute(position,data); | |||
} | |||
}); | |||
viewBinding.listSubattribute.setAdapter(subattributeAdapter); | |||
@@ -198,7 +223,7 @@ public class EditClassifyActivity extends BaseActivity { | |||
@SuppressLint("NonConstantResourceId") | |||
@OnClick({R.id.btn_add_classify,R.id.btn_update_classify,R.id.btn_add_attribute,R.id.btn_delete_attribute,R.id.btn_add_subattribute,R.id.btn_delete_classify}) | |||
@OnClick({R.id.btn_add_classify,R.id.btn_update_attribute,R.id.btn_update_classify,R.id.btn_add_attribute,R.id.btn_delete_attribute,R.id.btn_add_subattribute,R.id.btn_delete_classify}) | |||
public void onViewClicked(View view) { | |||
switch (view.getId()){ | |||
@@ -217,6 +242,9 @@ public class EditClassifyActivity extends BaseActivity { | |||
case R.id.btn_delete_attribute://删除属性 | |||
removeAttribute(); | |||
break; | |||
case R.id.btn_update_attribute://删除属性 | |||
updateAttribute(); | |||
break; | |||
case R.id.btn_add_subattribute://添加子属性 | |||
addSubAttribute(); | |||
break; | |||
@@ -237,7 +265,7 @@ public class EditClassifyActivity extends BaseActivity { | |||
if(!input.isEmpty()){ | |||
for (Map.Entry<String, String> entry : classifyList.entrySet()) { | |||
if(entry.getKey().equals(input)){ | |||
ToastUtils.info("已有该分类,请换一个名称!"); | |||
NewToastUtil.getInstance().showToast("已有该分类,请换一个名称!"); | |||
return; | |||
} | |||
} | |||
@@ -251,13 +279,13 @@ public class EditClassifyActivity extends BaseActivity { | |||
spinnerAdapter.notifyDataSetChanged(); | |||
selectClassify(classifyList.size()-1);//更新数据 | |||
ToastUtils.info("添加["+input+"]成功!"); | |||
NewToastUtil.getInstance().showToast("添加["+input+"]成功!"); | |||
}else { | |||
ToastUtils.info("添加["+input+"]失败!"); | |||
NewToastUtil.getInstance().showToast("添加["+input+"]失败!"); | |||
} | |||
xCom.dismissX(); | |||
}else { | |||
ToastUtils.info("名称不能为空!"); | |||
NewToastUtil.getInstance().showToast("名称不能为空!"); | |||
} | |||
}); | |||
}); | |||
@@ -282,7 +310,7 @@ public class EditClassifyActivity extends BaseActivity { | |||
if(!input.isEmpty()){ | |||
for (Map.Entry<String, String> entry : classifyList.entrySet()) { | |||
if(entry.getKey().equals(input)){ | |||
ToastUtils.info("已有该分类,请换一个名称!"); | |||
NewToastUtil.getInstance().showToast("已有该分类,请换一个名称!"); | |||
return; | |||
} | |||
} | |||
@@ -300,7 +328,7 @@ public class EditClassifyActivity extends BaseActivity { | |||
xCom.dismissX(); | |||
}else { | |||
ToastUtils.info("名称不能为空!"); | |||
NewToastUtil.getInstance().showToast("名称不能为空!"); | |||
} | |||
}); | |||
}); | |||
@@ -333,10 +361,10 @@ public class EditClassifyActivity extends BaseActivity { | |||
classifyNameList.addAll(classifyList.keySet()); | |||
spinnerAdapter.notifyDataSetChanged(); | |||
selectClassify(classifyPosition-1);//更新数据 | |||
ToastUtils.info("删除["+classifyName+"]成功!"); | |||
NewToastUtil.getInstance().showToast("删除["+classifyName+"]成功!"); | |||
xCom.dismissX(); | |||
}else { | |||
ToastUtils.info("删除["+classifyName+"]失败!"); | |||
NewToastUtil.getInstance().showToast("删除["+classifyName+"]失败!"); | |||
} | |||
}); | |||
}); | |||
@@ -362,7 +390,7 @@ public class EditClassifyActivity extends BaseActivity { | |||
if(!input.isEmpty()){ | |||
for(BPA_ATTRIBUTE bean:attributeList){ | |||
if(bean.name.equals(input)){ | |||
ToastUtils.info("已有该属性,请换一个名称!"); | |||
NewToastUtil.getInstance().showToast("已有该属性,请换一个名称!"); | |||
return; | |||
} | |||
} | |||
@@ -374,11 +402,12 @@ public class EditClassifyActivity extends BaseActivity { | |||
attributeList.add(attribute); | |||
attributePosition = attributeList.size()-1; | |||
attributeAdapter.setSelectPosition(attributeList.size()-1); | |||
viewBinding.listAttribute.smoothScrollToPosition(attributePosition); | |||
attributeAdapter.notifyDataSetChanged(); | |||
subattributeList.clear(); | |||
subattributeAdapter.notifyDataSetChanged(); | |||
}else { | |||
ToastUtils.info("名称不能为空!"); | |||
NewToastUtil.getInstance().showToast("名称不能为空!"); | |||
} | |||
}); | |||
}); | |||
@@ -419,6 +448,42 @@ public class EditClassifyActivity extends BaseActivity { | |||
} | |||
} | |||
/** | |||
* 修改属性 | |||
*/ | |||
private void updateAttribute(){ | |||
if(classifyPosition==0){ | |||
return; | |||
} | |||
if(attributePosition>=0&&attributePosition<attributeList.size()){ | |||
AlertDialogUtils.showCancelAndConfirmDialog(this, R.layout.dialog_add_classify, (layoutView, xCom) -> { | |||
DialogAddClassifyBinding binding = DialogAddClassifyBinding.bind(layoutView); | |||
DisplayManager.scaleViewGroup(binding.getRoot()); | |||
binding.title.setText("修改属性名称"); | |||
binding.edit.setHint("请输入属性名称"); | |||
binding.edit.setText(attributeList.get(attributePosition).name); | |||
binding.submit.setOnClickListener(view1 -> { | |||
String input = String.valueOf(binding.edit.getText()); | |||
if(!input.isEmpty()){ | |||
for(BPA_ATTRIBUTE bean:attributeList){ | |||
if(bean.name.equals(input)){ | |||
NewToastUtil.getInstance().showToast("已有该属性,请换一个名称!"); | |||
return; | |||
} | |||
} | |||
BPA_ATTRIBUTE attribute = attributeList.get(attributePosition); | |||
attribute.name = input; | |||
AttributeDBUtil.update(attribute); | |||
attributeAdapter.notifyDataSetChanged(); | |||
xCom.dismissX(); | |||
}else { | |||
NewToastUtil.getInstance().showToast("名称不能为空!"); | |||
} | |||
}); | |||
}); | |||
} | |||
} | |||
/** | |||
* 添加子属性 | |||
*/ | |||
@@ -426,6 +491,10 @@ public class EditClassifyActivity extends BaseActivity { | |||
if(classifyPosition==0){ | |||
return; | |||
} | |||
if(attributeList.size()<=0){ | |||
NewToastUtil.getInstance().showToast("请先添加属性"); | |||
return; | |||
} | |||
AlertDialogUtils.showCancelAndConfirmDialog(this, R.layout.dialog_add_classify, (layoutView, xCom) -> { | |||
DialogAddClassifyBinding binding = DialogAddClassifyBinding.bind(layoutView); | |||
DisplayManager.scaleViewGroup(binding.getRoot()); | |||
@@ -437,7 +506,7 @@ public class EditClassifyActivity extends BaseActivity { | |||
if(!input.isEmpty()){ | |||
for(BPA_SUBATTRIBUTE bean:subattributeList){ | |||
if(bean.name.equals(input)){ | |||
ToastUtils.info("已有该子属性,请换一个名称!"); | |||
NewToastUtil.getInstance().showToast("已有该子属性,请换一个名称!"); | |||
return; | |||
} | |||
} | |||
@@ -448,8 +517,9 @@ public class EditClassifyActivity extends BaseActivity { | |||
xCom.dismissX(); | |||
subattributeList.add(subattribute); | |||
subattributeAdapter.notifyDataSetChanged(); | |||
viewBinding.listSubattribute.smoothScrollToPosition(subattributeList.size()-1); | |||
}else { | |||
ToastUtils.info("名称不能为空!"); | |||
NewToastUtil.getInstance().showToast("名称不能为空!"); | |||
} | |||
}); | |||
}); | |||
@@ -470,6 +540,9 @@ public class EditClassifyActivity extends BaseActivity { | |||
} | |||
SubAttributeDBUtil.delete(bean); | |||
subattributeList.remove(position); | |||
if(position-1>=0 && !subattributeList.isEmpty()){ | |||
viewBinding.listSubattribute.smoothScrollToPosition(position-1); | |||
} | |||
subattributeAdapter.notifyDataSetChanged(); | |||
} | |||
@@ -32,6 +32,12 @@ public class SelectAttributeListAdapter extends ArrayAdapter<BPA_ATTRIBUTE> { | |||
private List<SelectSubAttributeAdapter> subAttributeAdapters = new ArrayList<>(); | |||
private int resource1; | |||
public List<BPA_ATTRIBUTE> datas; | |||
private String groupIdList=""; | |||
public void setGroupIdList(String groupIdList) { | |||
this.groupIdList = groupIdList; | |||
} | |||
public SelectAttributeListAdapter(@NonNull Context context, int resource, @NonNull List<BPA_ATTRIBUTE> objects) { | |||
super(context, resource, objects); | |||
subAttributeAdapters.clear(); | |||
@@ -59,9 +65,10 @@ public class SelectAttributeListAdapter extends ArrayAdapter<BPA_ATTRIBUTE> { | |||
if(recyclerView.getAdapter()==null && position == subAttributeAdapters.size()){ | |||
List<BPA_SUBATTRIBUTE> subattributeList = SubAttributeDBUtil.getByParentAttributeId(bean.id); | |||
SelectSubAttributeAdapter adapter = new SelectSubAttributeAdapter(); | |||
adapter.setGroupIdList(groupIdList); | |||
adapter.setNewData(subattributeList); | |||
adapter.setListener(listener); | |||
adapter.setCurrentPosition(0); | |||
adapter.setCurrentPosition(-1); | |||
recyclerView.setAdapter(adapter); | |||
LogUtils.d(" SelectAttributeListAdapter getView position="+position); | |||
if(position == subAttributeAdapters.size()){ | |||
@@ -26,6 +26,12 @@ public class SelectSubAttributeAdapter extends BaseAdapter<BPA_SUBATTRIBUTE,Sele | |||
this.listener = listener; | |||
} | |||
private String groupIdList=""; | |||
public void setGroupIdList(String groupIdList) { | |||
this.groupIdList = groupIdList; | |||
} | |||
@NonNull | |||
@Override | |||
public SelectSubAttributeAdapter.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) { | |||
@@ -39,9 +45,22 @@ public class SelectSubAttributeAdapter extends BaseAdapter<BPA_SUBATTRIBUTE,Sele | |||
DisplayManager.scaleViewGroup(holder.binding.getRoot()); | |||
} | |||
BPA_SUBATTRIBUTE subattribute = mData.get(position); | |||
if(groupIdList.contains("-")){ | |||
String[] res = groupIdList.split("-"); | |||
for(String s : res){ | |||
if(s.equals(subattribute.name)){ | |||
mCurrentPosition = position; | |||
} | |||
} | |||
}else { | |||
if(subattribute.name.equals(groupIdList)){ | |||
mCurrentPosition = position; | |||
} | |||
} | |||
holder.binding.name.setText(subattribute.name+""); | |||
holder.binding.name.setSelected(mCurrentPosition == position); | |||
holder.binding.name.setOnClickListener(new View.OnClickListener() { | |||
@Override | |||
public void onClick(View view) { | |||
@@ -12,7 +12,6 @@ import androidx.annotation.Nullable; | |||
import com.bonait.bnframework.R; | |||
import com.bonait.bnframework.common.db.mode.BPA_SUBATTRIBUTE; | |||
import com.bonait.bnframework.common.helper.I.MyClickListener; | |||
import com.bonait.bnframework.common.utils.DisplayManager; | |||
import java.util.List; | |||
@@ -47,13 +46,23 @@ public class SubattributeAdapter extends ArrayAdapter<BPA_SUBATTRIBUTE> { | |||
DisplayManager.scaleViewGroup(view.findViewById(R.id.root)); | |||
name.setText(bean.name+""); | |||
name.setOnClickListener(new View.OnClickListener() { | |||
@Override | |||
public void onClick(View view) { | |||
if(mListener!=null) mListener.clickName(view,position,bean); | |||
} | |||
}); | |||
delete.setOnClickListener(new View.OnClickListener() { | |||
@Override | |||
public void onClick(View view) { | |||
if(mListener!=null) mListener.clickListenerNew(view,position,bean); | |||
if(mListener!=null) mListener.clickDelete(view,position,bean); | |||
} | |||
}); | |||
return view; | |||
} | |||
public interface MyClickListener{ | |||
void clickDelete(View v,int position,BPA_SUBATTRIBUTE data); | |||
void clickName(View v,int position,BPA_SUBATTRIBUTE data); | |||
} | |||
} |
@@ -127,12 +127,15 @@ public class AttributeSelectDialog extends DialogFragment { | |||
dismiss(); | |||
}); | |||
viewBinding.btnSubmit.setOnClickListener(view -> { | |||
if(!selectAttributeListAdapter.isAllSelected()){ | |||
if(getContext()!=null){ | |||
NewToastUtil.getInstance().showToast("请选择每行对应的子属性"); | |||
} | |||
return; | |||
} | |||
// if(hasGroup().isEmpty()){ | |||
// NewToastUtil.getInstance().showToast("请选择每行对应的子属性"); | |||
// } | |||
// if(!selectAttributeListAdapter.isAllSelected()){ | |||
// if(getContext()!=null){ | |||
// NewToastUtil.getInstance().showToast("请选择每行对应的子属性"); | |||
// } | |||
// return; | |||
// } | |||
BPA_GOODS_SUBATTRIBUTE_GROUP currentGroupBean = SubAttributeGroupDBUtil.getById(groupId); | |||
if(currentGroupBean!=null){ | |||
if(selectAttributeListAdapter.getSubAttributeIdList().equals(currentGroupBean.subAttributeIdList)){ | |||
@@ -182,6 +185,41 @@ public class AttributeSelectDialog extends DialogFragment { | |||
}); | |||
} | |||
/** | |||
* 判断是否存在该组合 | |||
*/ | |||
private String hasGroup(){ | |||
String groupId = ""; | |||
String idList = selectAttributeListAdapter.getSubAttributeIdList(); | |||
for(BPA_GOODS_SUBATTRIBUTE_GROUP bean : SubAttributeGroupDBUtil.getByGoodsId(goods.id)){ | |||
if(bean.subAttributeIdList.equals(idList)){ | |||
groupId = bean.id; | |||
break; | |||
}else if(bean.subAttributeIdList.contains(",")&&idList.contains(",")){ | |||
String[] res = bean.subAttributeIdList.split(","); | |||
String[] res2 = idList.split(","); | |||
if (res.length == res2.length) { | |||
boolean xx = true; | |||
for (String s : res) { | |||
if (!idList.contains(s)) { | |||
xx = false; | |||
break; | |||
} | |||
} | |||
if (xx) { | |||
groupId = bean.id; | |||
break; | |||
} | |||
} | |||
} | |||
} | |||
LogUtils.d(TAG+"hasGroup groupId="+groupId); | |||
if(groupId.isEmpty()){ | |||
return ""; | |||
} | |||
return groupId; | |||
} | |||
public interface DialogCallBack{ | |||
void submit(); | |||
} |
@@ -8,10 +8,12 @@ import android.graphics.drawable.ColorDrawable; | |||
import android.os.Bundle; | |||
import android.view.Gravity; | |||
import android.view.LayoutInflater; | |||
import android.view.MotionEvent; | |||
import android.view.View; | |||
import android.view.ViewGroup; | |||
import android.view.Window; | |||
import android.view.WindowManager; | |||
import android.widget.AdapterView; | |||
import androidx.annotation.NonNull; | |||
import androidx.annotation.Nullable; | |||
@@ -122,7 +124,8 @@ public class EditGoodsDialog extends DialogFragment { | |||
window.setAttributes(params); | |||
} | |||
initView(); | |||
updateAttributeData(); | |||
updateAttributeData(""); | |||
groupSpinnerView(); | |||
} | |||
@Override | |||
@@ -168,12 +171,12 @@ public class EditGoodsDialog extends DialogFragment { | |||
} | |||
break; | |||
case R.id.btn_next2: | |||
if(!selectAttributeListAdapter.isAllSelected()){ | |||
if(getContext()!=null){ | |||
NewToastUtil.getInstance().showToast("请选择每行对应的子属性"); | |||
} | |||
return; | |||
} | |||
// if(!selectAttributeListAdapter.isAllSelected()){ | |||
// if(getContext()!=null){ | |||
// NewToastUtil.getInstance().showToast("请选择每行对应的子属性"); | |||
// } | |||
// return; | |||
// } | |||
if(!hasGroup().isEmpty()){ | |||
changePage(3); | |||
}else { | |||
@@ -445,23 +448,10 @@ public class EditGoodsDialog extends DialogFragment { | |||
/** | |||
* 刷新属性数据 | |||
*/ | |||
public void updateAttributeData(){ | |||
public void updateAttributeData(String nameList){ | |||
LogUtils.d(TAG+" updateAttributeData"); | |||
groupList.clear(); | |||
groupList.add("未选择"); | |||
for (BPA_GOODS_SUBATTRIBUTE_GROUP group : SubAttributeGroupDBUtil.getByGoodsId(goodId)){ | |||
groupList.add(group.name); | |||
} | |||
int pos = 0; | |||
for(int i =0;i<groupList.size();i++){ | |||
if(groupList.get(i).equals(selectAttributeListAdapter.getSubAttributeNameList())){ | |||
pos = i+1; | |||
} | |||
} | |||
spinnerAdapter = new ClassifySpinnerAdapter(getContext(), groupList); | |||
viewBinding.layoutAttribute.spinnerList.setAdapter(spinnerAdapter); | |||
viewBinding.layoutAttribute.spinnerList.setSelection(pos); | |||
selectAttributeListAdapter = new SelectAttributeListAdapter(getContext(), R.layout.item_select_attribute_list,attributeList); | |||
selectAttributeListAdapter.setGroupIdList(nameList); | |||
selectAttributeListAdapter.setListener(new SelectAttributeListAdapter.CallBackListener() { | |||
@Override | |||
public void onClick() { | |||
@@ -470,7 +460,7 @@ public class EditGoodsDialog extends DialogFragment { | |||
int pos = 0; | |||
for(int i =0;i<groupList.size();i++){ | |||
if(groupList.get(i).equals(selectAttributeListAdapter.getSubAttributeNameList())){ | |||
pos = i+1; | |||
pos = i; | |||
} | |||
} | |||
viewBinding.layoutAttribute.spinnerList.setSelection(pos); | |||
@@ -480,6 +470,56 @@ public class EditGoodsDialog extends DialogFragment { | |||
} | |||
}); | |||
viewBinding.layoutAttribute.listAttribute.setAdapter(selectAttributeListAdapter); | |||
} | |||
private boolean isUserClicked = false; | |||
private void groupSpinnerView(){ | |||
groupList.clear(); | |||
groupList.add("未选择"); | |||
for (BPA_GOODS_SUBATTRIBUTE_GROUP group : SubAttributeGroupDBUtil.getByGoodsId(goodId)){ | |||
if(group.name!=null&&!group.name.isEmpty()){ | |||
groupList.add(group.name); | |||
} | |||
} | |||
int pos = 0; | |||
// for(int i =0;i<groupList.size();i++){ | |||
// if(groupList.get(i).equals(selectAttributeListAdapter.getSubAttributeNameList())){ | |||
// pos = i+1; | |||
// } | |||
// } | |||
spinnerAdapter = new ClassifySpinnerAdapter(getContext(), groupList); | |||
viewBinding.layoutAttribute.spinnerList.setAdapter(spinnerAdapter); | |||
viewBinding.layoutAttribute.spinnerList.setSelection(pos); | |||
viewBinding.layoutAttribute.spinnerList.setOnTouchListener(new View.OnTouchListener() { | |||
@Override | |||
public boolean onTouch(View view, MotionEvent motionEvent) { | |||
isUserClicked = true; | |||
view.performClick(); | |||
return false; | |||
} | |||
}); | |||
viewBinding.layoutAttribute.spinnerList.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() { | |||
@Override | |||
public void onItemSelected(AdapterView<?> adapterView, View view, int i, long l) { | |||
if(isUserClicked){ | |||
if(i==0){ | |||
viewBinding.layoutAttribute.groupDesc.setText(""); | |||
updateAttributeData(viewBinding.layoutAttribute.spinnerList.getSelectedItem().toString()); | |||
}else { | |||
updateAttributeData(viewBinding.layoutAttribute.spinnerList.getSelectedItem().toString()); | |||
viewBinding.layoutAttribute.groupDesc.setText("存在该组合"); | |||
} | |||
isUserClicked = false; | |||
} | |||
} | |||
@Override | |||
public void onNothingSelected(AdapterView<?> adapterView) { | |||
} | |||
}); | |||
} | |||
/** | |||
@@ -143,7 +143,7 @@ public class LocalGoodsFragment extends BaseFragment { | |||
DialogDeleteClassifyBinding binding = DialogDeleteClassifyBinding.bind(layoutView); | |||
DisplayManager.scaleViewGroup(binding.getRoot()); | |||
binding.title.setText("删除菜品"); | |||
binding.edit.setText("是否删除["+bean.name+"]下所有属性组合配方?"); | |||
binding.edit.setText("是否删除["+bean.name+"]下所有组合配方?"); | |||
binding.cancel.setOnClickListener(view1 ->{ | |||
xCom.dismissX(); | |||
}); | |||
@@ -128,7 +128,7 @@ | |||
android:layout_height="wrap_content" | |||
android:divider="@color/color3" | |||
android:dividerHeight="@dimen/dp_1" | |||
android:layout_marginBottom="@dimen/dp_200" | |||
android:layout_marginBottom="@dimen/dp_290" | |||
/> | |||
<TextView | |||
@@ -158,6 +158,20 @@ | |||
android:layout_alignBottom="@id/list_attribute" | |||
android:layout_marginBottom="-180dp" | |||
/> | |||
<TextView | |||
android:id="@+id/btn_update_attribute" | |||
android:layout_width="@dimen/dp_235" | |||
android:layout_height="@dimen/dp_70" | |||
android:layout_centerHorizontal="true" | |||
android:background="@drawable/bg_round15_yellow_btn" | |||
android:text="修改属性" | |||
android:textColor="@color/white" | |||
android:gravity="center" | |||
android:textSize="@dimen/sp_32" | |||
android:layout_alignBottom="@id/list_attribute" | |||
android:layout_marginBottom="-270dp" | |||
/> | |||
</RelativeLayout> | |||
@@ -43,7 +43,12 @@ | |||
android:background="@drawable/bg_tab_text" | |||
android:gravity="center" | |||
android:textSize="@dimen/sp_32" | |||
android:layout_height="match_parent"/> | |||
android:layout_height="match_parent" | |||
android:focusableInTouchMode="true" | |||
android:focusable="true" | |||
> | |||
<requestFocus/> | |||
</TextView> | |||
<TextView | |||
android:id="@+id/tv_silos" | |||
@@ -54,7 +59,10 @@ | |||
android:textSize="@dimen/sp_32" | |||
android:gravity="center" | |||
android:textColor="@drawable/bg_tab_text_color_selector" | |||
android:layout_height="match_parent"/> | |||
android:layout_height="match_parent" | |||
android:focusableInTouchMode="true" | |||
android:focusable="true" | |||
/> | |||
</LinearLayout> | |||
@@ -7,8 +7,8 @@ | |||
android:layout_height="wrap_content"> | |||
<!--子属性选择--> | |||
<androidx.constraintlayout.widget.ConstraintLayout | |||
android:layout_width="@dimen/dp_660" | |||
android:layout_height="wrap_content" | |||
android:layout_width="@dimen/dp_740" | |||
android:layout_height="@dimen/dp_1100" | |||
app:layout_constraintLeft_toLeftOf="parent" | |||
app:layout_constraintRight_toRightOf="parent" | |||
app:layout_constraintTop_toTopOf="parent" | |||
@@ -28,24 +28,23 @@ | |||
<ListView | |||
android:id="@+id/list_attribute" | |||
android:layout_width="@dimen/dp_620" | |||
android:layout_height="wrap_content" | |||
android:layout_width="match_parent" | |||
android:layout_height="0dp" | |||
app:layout_constraintTop_toBottomOf="@id/title2" | |||
app:layout_constraintBottom_toTopOf="@id/btn_submit" | |||
app:layout_constraintLeft_toLeftOf="parent" | |||
android:layout_margin="@dimen/dp_20" | |||
android:divider="#00000000" | |||
android:orientation="vertical" | |||
tools:layout_height="@dimen/dp_500" | |||
/> | |||
<TextView | |||
android:id="@+id/btn_submit" | |||
android:layout_width="@dimen/dp_155" | |||
android:layout_height="@dimen/dp_80" | |||
app:layout_constraintTop_toBottomOf="@id/list_attribute" | |||
app:layout_constraintLeft_toLeftOf="parent" | |||
app:layout_constraintRight_toRightOf="parent" | |||
app:layout_constraintBottom_toBottomOf="parent" | |||
android:layout_marginLeft="@dimen/dp_480" | |||
android:layout_marginEnd="@dimen/dp_20" | |||
android:layout_marginBottom="@dimen/dp_20" | |||
android:layout_marginTop="@dimen/dp_30" | |||
style="@style/TextView_btn_dialog" | |||
@@ -57,7 +56,6 @@ | |||
android:layout_width="@dimen/dp_155" | |||
android:layout_height="@dimen/dp_80" | |||
app:layout_constraintLeft_toLeftOf="parent" | |||
app:layout_constraintTop_toBottomOf="@id/list_attribute" | |||
app:layout_constraintBottom_toBottomOf="parent" | |||
android:layout_marginLeft="@dimen/dp_20" | |||
android:layout_marginTop="@dimen/dp_30" | |||
@@ -9,7 +9,7 @@ | |||
<FrameLayout | |||
android:layout_width="@dimen/dp_700" | |||
android:layout_height="@dimen/dp_350" | |||
android:layout_height="wrap_content" | |||
android:layout_gravity="center" | |||
android:background="@drawable/bg_round25_white" | |||
> | |||
@@ -27,17 +27,17 @@ | |||
<TextView | |||
android:id="@+id/edit" | |||
android:layout_width="@dimen/dp_500" | |||
android:layout_height="@dimen/dp_100" | |||
android:layout_height="wrap_content" | |||
app:layout_constraintLeft_toRightOf="@id/title" | |||
app:layout_constraintTop_toTopOf="@id/title" | |||
android:textSize="@dimen/sp_36" | |||
android:text="是否删除?" | |||
android:gravity="center" | |||
android:maxLines="1" | |||
android:maxLength="15" | |||
android:paddingLeft="@dimen/dp_10" | |||
android:paddingRight="@dimen/dp_10" | |||
android:layout_gravity="center" | |||
android:layout_marginTop="@dimen/dp_150" | |||
android:layout_marginBottom="@dimen/dp_150" | |||
/> | |||
<Button | |||
android:id="@+id/cancel" | |||
@@ -1,7 +1,7 @@ | |||
<?xml version="1.0" encoding="utf-8"?> | |||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" | |||
android:layout_width="@dimen/dp_660" | |||
android:layout_height="wrap_content" | |||
android:layout_width="@dimen/dp_740" | |||
android:layout_height="@dimen/dp_1100" | |||
xmlns:app="http://schemas.android.com/apk/res-auto" | |||
xmlns:tools="http://schemas.android.com/tools" | |||
android:background="@drawable/bg_round25_white"> | |||
@@ -32,26 +32,27 @@ | |||
<Spinner | |||
android:id="@+id/spinner_list" | |||
style="@style/commonSpinnerStyle" | |||
android:layout_width="@dimen/dp_460" | |||
android:layout_width="0dp" | |||
android:layout_height="@dimen/dp_90" | |||
android:layout_centerVertical="true" | |||
app:layout_constraintLeft_toRightOf="@id/desc1" | |||
app:layout_constraintTop_toTopOf="@id/desc1" | |||
android:layout_marginLeft="@dimen/dp_10" | |||
app:layout_constraintRight_toRightOf="parent" | |||
android:layout_marginEnd="@dimen/dp_20" | |||
android:layout_marginStart="@dimen/dp_20" | |||
/> | |||
<ListView | |||
android:id="@+id/list_attribute" | |||
android:layout_width="@dimen/dp_620" | |||
android:layout_height="wrap_content" | |||
app:layout_constraintTop_toBottomOf="@id/desc1" | |||
android:layout_width="match_parent" | |||
android:layout_height="0dp" | |||
app:layout_constraintLeft_toLeftOf="parent" | |||
app:layout_constraintBottom_toTopOf="@id/btn_last2" | |||
app:layout_constraintTop_toBottomOf="@id/spinner_list" | |||
android:layout_margin="@dimen/dp_20" | |||
android:divider="#00000000" | |||
tools:layout_height="300dp" | |||
android:orientation="vertical" | |||
android:layout_marginBottom="@dimen/dp_100" | |||
/> | |||
<TextView | |||
@@ -65,7 +66,7 @@ | |||
android:layout_marginBottom="@dimen/dp_20" | |||
android:layout_marginTop="@dimen/dp_30" | |||
android:textColor="@color/blue" | |||
android:text="存在选中组合" | |||
tools:text="存在选中组合" | |||
android:gravity="center" | |||
/> | |||
@@ -73,10 +74,9 @@ | |||
android:id="@+id/btn_next2" | |||
android:layout_width="@dimen/dp_155" | |||
android:layout_height="@dimen/dp_80" | |||
app:layout_constraintTop_toBottomOf="@id/list_attribute" | |||
app:layout_constraintLeft_toLeftOf="parent" | |||
app:layout_constraintRight_toRightOf="parent" | |||
app:layout_constraintBottom_toBottomOf="parent" | |||
android:layout_marginLeft="@dimen/dp_480" | |||
android:layout_marginEnd="@dimen/dp_20" | |||
android:layout_marginBottom="@dimen/dp_20" | |||
android:layout_marginTop="@dimen/dp_30" | |||
style="@style/TextView_btn_dialog" | |||
@@ -88,7 +88,6 @@ | |||
android:layout_width="@dimen/dp_155" | |||
android:layout_height="@dimen/dp_80" | |||
app:layout_constraintLeft_toLeftOf="parent" | |||
app:layout_constraintTop_toBottomOf="@id/list_attribute" | |||
app:layout_constraintBottom_toBottomOf="parent" | |||
android:layout_marginLeft="@dimen/dp_20" | |||
android:layout_marginTop="@dimen/dp_30" | |||
@@ -12,6 +12,8 @@ | |||
android:layout_height="@dimen/dp_90" | |||
style="@style/TextView_desc" | |||
tools:text="口味:" | |||
android:maxLength="10" | |||
android:ellipsize="middle" | |||
/> | |||
<androidx.recyclerview.widget.RecyclerView | |||
android:layout_width="match_parent" | |||