@@ -152,9 +152,9 @@ dependencies { | |||
//轮播图 | |||
implementation 'com.youth.banner:banner:1.4.10' | |||
//图片加载 | |||
implementation 'com.github.bumptech.glide:glide:4.11.0' | |||
annotationProcessor 'com.github.bumptech.glide:compiler:4.11.0' | |||
// //图片加载 | |||
// implementation 'com.github.bumptech.glide:glide:4.11.0' | |||
// annotationProcessor 'com.github.bumptech.glide:compiler:4.11.0' | |||
implementation 'com.yanzhenjie:permission:2.0.0-rc12' | |||
@@ -198,4 +198,8 @@ dependencies { | |||
//leak 内存泄漏检测 | |||
debugImplementation 'com.squareup.leakcanary:leakcanary-android:2.0-alpha-3' | |||
//腾讯bugly | |||
//sdk地址 https://bugly.qq.com/docs/user-guide/instruction-manual-android/?v=1.0.0 | |||
implementation 'com.tencent.bugly:crashreport:latest.release' //其中latest.release指代最新Bugly SDK版本号,也可以指定明确的版本号,例如4.0.3 | |||
} |
@@ -37,9 +37,9 @@ | |||
android:name=".ViewModel.ActivityViewModel.DiyUpdate1Activity" | |||
android:screenOrientation="portrait" | |||
android:exported="false" /> | |||
<!--android:windowSoftInputMode="adjustPan"--> | |||
<activity | |||
android:name=".ui.activity.DiyProcessActivity" | |||
android:windowSoftInputMode="adjustPan" | |||
android:screenOrientation="portrait" | |||
android:exported="false" /> | |||
<activity | |||
@@ -4,10 +4,18 @@ package com.bonait.bnframework; | |||
import android.annotation.SuppressLint; | |||
import android.app.Application; | |||
import android.content.Context; | |||
import android.text.TextUtils; | |||
import com.apkfuns.logutils.LogUtils; | |||
import com.bonait.bnframework.HBL.Thread.ThreadManager; | |||
import com.bonait.bnframework.common.constant.ConfigName; | |||
import com.bonait.bnframework.common.glide.GlideApp; | |||
import com.bonait.bnframework.common.utils.NetworkUtils; | |||
import com.tencent.bugly.crashreport.CrashReport; | |||
import java.io.BufferedReader; | |||
import java.io.FileReader; | |||
import java.io.IOException; | |||
/** | |||
* Created by FYF on 2019/3/19. | |||
@@ -30,5 +38,55 @@ public class MainApplication extends Application { | |||
ConfigName.getInstance().dishesCon = this; | |||
ConfigName.getInstance().app = this; | |||
ThreadManager.get().inti(); | |||
initBugly(); | |||
} | |||
@Override | |||
public void onLowMemory() { | |||
LogUtils.d("MainApplication onLowMemory"); | |||
super.onLowMemory(); | |||
GlideApp.get(this).clearMemory(); | |||
} | |||
public void initBugly() { | |||
Context context = getApplicationContext(); | |||
// 获取当前包名 | |||
String packageName = context.getPackageName(); | |||
// 获取当前进程名 | |||
String processName = getProcessName(android.os.Process.myPid()); | |||
// 设置是否为上报进程 | |||
CrashReport.UserStrategy strategy = new CrashReport.UserStrategy(context); | |||
strategy.setUploadProcess(processName == null || processName.equals(packageName)); | |||
// 初始化Bugly | |||
CrashReport.initCrashReport(getApplicationContext(), "755585040c", true); | |||
} | |||
/** | |||
* 获取进程号对应的进程名 | |||
* | |||
* @param pid 进程号 | |||
* @return 进程名 | |||
*/ | |||
private static String getProcessName(int pid) { | |||
BufferedReader reader = null; | |||
try { | |||
reader = new BufferedReader(new FileReader("/proc/" + pid + "/cmdline")); | |||
String processName = reader.readLine(); | |||
if (!TextUtils.isEmpty(processName)) { | |||
processName = processName.trim(); | |||
} | |||
return processName; | |||
} catch (Throwable throwable) { | |||
throwable.printStackTrace(); | |||
} finally { | |||
try { | |||
if (reader != null) { | |||
reader.close(); | |||
} | |||
} catch (IOException exception) { | |||
exception.printStackTrace(); | |||
} | |||
} | |||
return null; | |||
} | |||
} |
@@ -484,9 +484,6 @@ public class ModbusHelper extends ModbusMaster { | |||
if(res1.Content){ | |||
WriteBool("M100",false); | |||
LogUtils.d(" 设备掉线了"); | |||
if(!isDisconnect){ | |||
ToastUtils.info("设备掉线了"); | |||
} | |||
isDisconnect = true; | |||
}else { | |||
isDisconnect = false; | |||
@@ -505,8 +502,6 @@ public class ModbusHelper extends ModbusMaster { | |||
} | |||
ExecuteTheRecipe.IsStart = false; | |||
ExecuteTheRecipe.IsForcedEnd = true; | |||
}else { | |||
} | |||
} | |||
@@ -516,13 +511,29 @@ public class ModbusHelper extends ModbusMaster { | |||
WriteBool(getPLC(ControlAdress.状态读取启动).PlcAddress,true); | |||
OperateResultT<short[]> res = ReadShort(statusModel.PlcAddress,1); | |||
if(res.isSuccess){ | |||
statusModel.Value.setValue(res.Content); | |||
// statusModel.Value.setValue(res.Content); | |||
byte[] bytes = DataConvertLib.shorts2Bytes(res.Content); | |||
if(bytes.length>=2){ | |||
deviceErrorCode = bytes[0] & 0xFF; | |||
} | |||
} | |||
Thread.sleep(ConfigName.TEST?2000:200); | |||
}); | |||
} | |||
private int deviceErrorCode = 0; | |||
public int getDeviceErrorCode() { | |||
return deviceErrorCode; | |||
} | |||
public void setDeviceErrorCode(int deviceErrorCode) { | |||
this.deviceErrorCode = deviceErrorCode; | |||
} | |||
public boolean getDisconnect(){ | |||
return isDisconnect; | |||
} | |||
} | |||
@@ -9,4 +9,14 @@ public class item_gx { | |||
public String data; | |||
public boolean IsWL=false; | |||
@Override | |||
public String toString() { | |||
return "item_gx{" + | |||
"name='" + name + '\'' + | |||
", datatype=" + datatype + | |||
", data='" + data + '\'' + | |||
", IsWL=" + IsWL + | |||
'}'; | |||
} | |||
} |
@@ -1,8 +1,5 @@ | |||
package com.bonait.bnframework.ViewModel.FragmentViewModel; | |||
import static com.bonait.bnframework.MainApplication.getContext; | |||
import static com.lzy.okgo.utils.HttpUtils.runOnUiThread; | |||
import android.annotation.SuppressLint; | |||
import android.graphics.Color; | |||
import android.os.Bundle; | |||
@@ -20,22 +17,15 @@ import android.widget.ArrayAdapter; | |||
import androidx.annotation.NonNull; | |||
import androidx.annotation.Nullable; | |||
import androidx.core.content.ContextCompat; | |||
import com.apkfuns.logutils.LogUtils; | |||
import com.bonait.bnframework.HBL.DataUtil.DataConvertLib; | |||
import com.bonait.bnframework.HBL.DataUtil.ErrorCodeManager; | |||
import com.bonait.bnframework.HBL.DataUtil.NotifyPropVar; | |||
import com.bonait.bnframework.HBL.Interface.IRunT; | |||
import com.bonait.bnframework.HBL.Result.OperateResultT; | |||
import com.bonait.bnframework.HBL.Thread.ThreadManager; | |||
import com.bonait.bnframework.Model.ErrorCodeBean; | |||
import com.bonait.bnframework.R; | |||
import com.bonait.bnframework.Service.ControlAdress; | |||
import com.bonait.bnframework.Service.ModbusHelper; | |||
import com.bonait.bnframework.Service.PLCModel; | |||
import com.bonait.bnframework.common.base.BaseFragment; | |||
import com.bonait.bnframework.common.constant.ConfigName; | |||
import com.bonait.bnframework.common.utils.DisplayManager; | |||
import com.bonait.bnframework.common.utils.ToastUtils; | |||
import com.bonait.bnframework.databinding.FragmentHomeDeviceBinding; | |||
@@ -58,8 +48,7 @@ public class HomeDeviceFragment extends BaseFragment { | |||
private List<String> mainFoodList; | |||
private int seasoningPos = -1; | |||
private int mainFoodPos = -1; | |||
private static final int MSG_UPDATE_STATUS = 1; | |||
private static final int MSG_UPDATE_ERROR_CODE = 2; | |||
private static final int MSG_FRESH_DEVICE = 1000; | |||
@@ -69,18 +58,17 @@ public class HomeDeviceFragment extends BaseFragment { | |||
public void handleMessage(@NonNull Message msg) { | |||
super.handleMessage(msg); | |||
switch (msg.what){ | |||
case MSG_UPDATE_STATUS: | |||
boolean status = (boolean) msg.obj; | |||
changeTextDeviceStatus(2,status?"掉线":"在线"); | |||
break; | |||
case MSG_UPDATE_ERROR_CODE: | |||
int code = (int) msg.obj; | |||
case MSG_FRESH_DEVICE: | |||
if(hasMessages(MSG_FRESH_DEVICE)){ | |||
removeMessages(MSG_FRESH_DEVICE); | |||
} | |||
sendEmptyMessageDelayed(MSG_FRESH_DEVICE,500); | |||
for(ErrorCodeBean bean : ErrorCodeManager.getInstance().getDataBeans()){ | |||
if(bean.getCode() == code){ | |||
if(bean.getCode() == ModbusHelper.get().getDeviceErrorCode()){ | |||
changeTextDeviceStatus(1,bean.getName()+" "+bean.getDescription()); | |||
} | |||
} | |||
changeTextDeviceStatus(2,ModbusHelper.get().getConnected()?"在线":"掉线"); | |||
break; | |||
} | |||
} | |||
@@ -121,87 +109,13 @@ public class HomeDeviceFragment extends BaseFragment { | |||
mainFoodList.add("主料仓4(投料4)"); | |||
mainFoodList.add("主料仓5(投料5)"); | |||
mainFoodList.add("主料仓6(投料6)"); | |||
handler.post(() -> { | |||
try { | |||
PLCModel<short[]> statusModel = ModbusHelper.get().controlAddress.get(ControlAdress.状态读取); | |||
// ModbusHelper.get().WriteBool(ModbusHelper.get().getPLC(ControlAdress.状态读取启动).PlcAddress,true); | |||
OperateResultT<short[]> res = ModbusHelper.get().ReadShort(statusModel.PlcAddress,1); | |||
byte[] bytes = DataConvertLib.shorts2Bytes(res.Content); | |||
if(bytes.length>=2){ | |||
progressFire = bytes[1] & 0xFF; | |||
} | |||
if(!release){ | |||
viewBinding.fireProgress.setValue(progressFire,true); | |||
} | |||
if(handler.hasMessages(MSG_FRESH_DEVICE)){ | |||
handler.removeMessages(MSG_FRESH_DEVICE); | |||
} | |||
handler.sendEmptyMessageDelayed(MSG_FRESH_DEVICE,500); | |||
PLCModel<short[]> statusModel2 = ModbusHelper.get().controlAddress.get(ControlAdress.搅拌档位); | |||
OperateResultT<short[]> res2 = ModbusHelper.get().ReadShort(statusModel2.PlcAddress,1); | |||
byte[] bytes2 = DataConvertLib.shorts2Bytes(res2.Content); | |||
progressStir = bytes2[0] & 0xFF; | |||
if(!release){ | |||
viewBinding.stirProgress.setValue(progressStir,true); | |||
} | |||
LogUtils.d("HomeDeviceFragment initData progressFire="+progressFire +" progressStir="+progressStir); | |||
}catch (Exception e){ | |||
LogUtils.d(e.getMessage()+""); | |||
} | |||
}); | |||
NotifyPropVar<short[]> notifyPropVar1 = (NotifyPropVar<short[]>)ModbusHelper.get().getPLC(ControlAdress.状态读取).Value; | |||
notify1 = new IRunT<short[]>() { | |||
@Override | |||
public void Run(short[] shorts) { | |||
byte[] bytes = DataConvertLib.shorts2Bytes(shorts); | |||
String result = DataConvertLib.bytesToString(bytes); | |||
if(ConfigName.LOG_TEST){ | |||
LogUtils.d("HomeDeviceFragment result="+result +" bytes.length="+bytes.length); | |||
} | |||
if(handler!=null){ | |||
if(ErrorCodeManager.getInstance().getDataBeans()!=null){ | |||
int code = 0; | |||
if(bytes.length>=2){ | |||
code = bytes[0] & 0xFF; | |||
if(ConfigName.LOG_TEST){ | |||
LogUtils.d("HomeDeviceFragment code="+code ); | |||
} | |||
} | |||
Message message = new Message(); | |||
message.what = MSG_UPDATE_ERROR_CODE; | |||
message.obj = code; | |||
if(handler.hasMessages(MSG_UPDATE_ERROR_CODE)){ | |||
handler.removeMessages(MSG_UPDATE_ERROR_CODE); | |||
} | |||
handler.sendMessageDelayed(message,500); | |||
} | |||
} | |||
} | |||
}; | |||
if(notifyPropVar1!=null){ | |||
notifyPropVar1.Register(HomeDeviceFragment.class.getSimpleName(), notify1); | |||
} | |||
NotifyPropVar<Boolean> notifyPropVar = (NotifyPropVar<Boolean>)ModbusHelper.get().getPLC(ControlAdress.掉线标志).Value; | |||
notify = new IRunT<Boolean>() { | |||
@Override | |||
public void Run(Boolean status) { | |||
if(ConfigName.LOG_TEST){ | |||
LogUtils.d("HomeDeviceFragment status="+status ); | |||
} | |||
if(handler!=null){ | |||
Message message = new Message(); | |||
message.what = 1; | |||
message.obj = status; | |||
if(handler.hasMessages(MSG_UPDATE_STATUS)){ | |||
handler.removeMessages(MSG_UPDATE_STATUS); | |||
} | |||
handler.sendMessageDelayed(message,500); | |||
} | |||
} | |||
}; | |||
if(notifyPropVar!=null){ | |||
notifyPropVar.Register(HomeDeviceFragment.class.getSimpleName(), notify); | |||
} | |||
} | |||
private void initView(){ | |||
@@ -74,14 +74,14 @@ public class GoodsProcessDetailDBUtil { | |||
public static ArrayList<BPA_GOODS_PROCESS_DETAIL> getByGroupId(String groupId) { | |||
String orderby = QueryDB.Desc_Sort_Up + ',' + QueryDB.Desc_Time_Up; | |||
String where = "goodsSubAttributeGroupId=?"; | |||
String[] args = new String[]{"0", groupId}; | |||
String[] args = new String[]{groupId}; | |||
ArrayList<BPA_GOODS_PROCESS_DETAIL> data = new ArrayList<>(); | |||
ArrayList<Object> obj = QueryDB.Get(BPA_GOODS_PROCESS_DETAIL.class, where, args, orderby); | |||
for (Object item : obj) { | |||
BPA_GOODS_PROCESS_DETAIL k = (BPA_GOODS_PROCESS_DETAIL) item; | |||
data.add(k); | |||
} | |||
LogUtils.d("getByGroupId 根据商品属性组合查询旗下的工序列表 data=" + data.toString()); | |||
LogUtils.d("getByGroupId 根据商品属性组合查询旗下的工序列表 groupId="+groupId+" ;data=" + data.toString()); | |||
return data; | |||
} | |||
@@ -94,7 +94,7 @@ public class SubAttributeGroupDBUtil { | |||
* @return BPA_GOODS_SUBATTRIBUTE_GROUP | |||
*/ | |||
public static BPA_GOODS_SUBATTRIBUTE_GROUP getById(String id) { | |||
String orderby = QueryDB.Desc_Sort_Up; | |||
String orderby = QueryDB.Desc_Time_Up; | |||
String where = "isDelete=? and id=?"; | |||
String[] args = new String[]{"0", id}; | |||
ArrayList<Object> obj = QueryDB.Get(BPA_GOODS_SUBATTRIBUTE_GROUP.class, where, args, orderby); | |||
@@ -108,7 +108,7 @@ public class SubAttributeGroupDBUtil { | |||
* @return BPA_GOODS_SUBATTRIBUTE_GROUP | |||
*/ | |||
public static BPA_GOODS_SUBATTRIBUTE_GROUP getByName(String name) { | |||
String orderby = QueryDB.Desc_Sort_Up; | |||
String orderby = QueryDB.Desc_Time_Up; | |||
String where = "isDelete=? and name=?"; | |||
String[] args = new String[]{"0", name}; | |||
ArrayList<Object> obj = QueryDB.Get(BPA_GOODS_SUBATTRIBUTE_GROUP.class, where, args, orderby); | |||
@@ -122,7 +122,7 @@ public class SubAttributeGroupDBUtil { | |||
* @return BPA_GOODS_SUBATTRIBUTE_GROUP | |||
*/ | |||
public static BPA_GOODS_SUBATTRIBUTE_GROUP getByGoodIdAndListId(String goodsId,String subAttributeIdList) { | |||
String orderby = QueryDB.Desc_Sort_Up; | |||
String orderby = QueryDB.Desc_Time_Up; | |||
String where = "isDelete=? and goodsId=? and subAttributeIdList=?"; | |||
String[] args = new String[]{"0",goodsId, subAttributeIdList}; | |||
ArrayList<Object> obj = QueryDB.Get(BPA_GOODS_SUBATTRIBUTE_GROUP.class, where, args, orderby); | |||
@@ -138,7 +138,7 @@ public class SubAttributeGroupDBUtil { | |||
* @return ArrayList<BPA_GOODS_SUBATTRIBUTE_GROUP> | |||
*/ | |||
public static ArrayList<BPA_GOODS_SUBATTRIBUTE_GROUP> getByGoodsId(String goodsId) { | |||
String orderby = QueryDB.Desc_Sort_Up; | |||
String orderby = QueryDB.Desc_Time_Up; | |||
String where = "isDelete=? and goodsId=?"; | |||
String[] args = new String[]{"0",goodsId}; | |||
ArrayList<BPA_GOODS_SUBATTRIBUTE_GROUP> data = new ArrayList<>(); | |||
@@ -461,6 +461,18 @@ public class DisplayManager | |||
} | |||
} | |||
/** | |||
* 判断是否需要缩放 避免adapter重绘时多次缩放 | |||
* @param view | |||
* @return | |||
*/ | |||
public static boolean shouldScale(TextView view){ | |||
if(view.getTextSize()> 34 || view.getTextSize()< 30){ | |||
return true; | |||
} | |||
return false; | |||
} | |||
public static void scaleViewRemote(View view) | |||
{ | |||
scaleView(view,(float) mfDeviceScaleRate); | |||
@@ -2,6 +2,7 @@ package com.bonait.bnframework.ui.activity; | |||
import static com.bonait.bnframework.MainApplication.getContext; | |||
import android.annotation.SuppressLint; | |||
import android.content.Intent; | |||
import android.os.Bundle; | |||
import android.view.View; | |||
@@ -9,25 +10,30 @@ import android.widget.AdapterView; | |||
import android.widget.ArrayAdapter; | |||
import androidx.annotation.Nullable; | |||
import androidx.core.content.ContextCompat; | |||
import com.apkfuns.logutils.LogUtils; | |||
import com.bonait.bnframework.R; | |||
import com.bonait.bnframework.ViewModel.CustomView.fragment_gx; | |||
import com.bonait.bnframework.ViewModel.CustomView.item_gx; | |||
import com.bonait.bnframework.common.base.BaseActivity; | |||
import com.bonait.bnframework.common.db.QueryDB; | |||
import com.bonait.bnframework.common.db.mode.BPA_GOODS; | |||
import com.bonait.bnframework.common.db.mode.BPA_GOODSRECIPE; | |||
import com.bonait.bnframework.common.db.mode.BPA_GOODS_PROCESS_DETAIL; | |||
import com.bonait.bnframework.common.db.mode.BPA_MATERIAL; | |||
import com.bonait.bnframework.common.db.mode.BPA_PROCESS; | |||
import com.bonait.bnframework.common.db.mode.BPA_PROCESSModel; | |||
import com.bonait.bnframework.common.db.util.GoodsDBUtil; | |||
import com.bonait.bnframework.common.utils.AlertDialogUtils; | |||
import com.bonait.bnframework.common.db.util.GoodsProcessDetailDBUtil; | |||
import com.bonait.bnframework.common.utils.DisplayManager; | |||
import com.bonait.bnframework.common.utils.ProcessValueUtil; | |||
import com.bonait.bnframework.databinding.ActivityEditProcessBinding; | |||
import com.bonait.bnframework.databinding.DialogDeleteClassifyBinding; | |||
import com.bonait.bnframework.ui.adapter.DiyStepAdapter; | |||
import com.bonait.bnframework.ui.dialog.AttributeSelectDialog; | |||
import com.bonait.bnframework.ui.widget.NewToastUtil; | |||
import com.bonait.bnframework.ui.widget.ProcessValueView; | |||
import java.util.ArrayList; | |||
import java.util.HashMap; | |||
import java.util.LinkedHashMap; | |||
import java.util.Map; | |||
@@ -45,7 +51,7 @@ public class DiyProcessActivity extends BaseActivity { | |||
/** | |||
* 1-6个主料仓名称 | |||
*/ | |||
ArrayList<String> mainFoods = new ArrayList<>(); | |||
private ArrayList<String> mainFoods = new ArrayList<>(); | |||
/** | |||
* 商品id | |||
@@ -68,7 +74,16 @@ public class DiyProcessActivity extends BaseActivity { | |||
/** | |||
* 工序步骤 | |||
*/ | |||
public ArrayList<BPA_GOODSRECIPE> goodsRecipes = new ArrayList<>(); | |||
private ArrayList<BPA_GOODS_PROCESS_DETAIL> processDetails = new ArrayList<>(); | |||
/** | |||
* 左边步骤adapter | |||
*/ | |||
private DiyStepAdapter stepAdapter; | |||
/** | |||
* 导入已有属性组合弹窗 | |||
*/ | |||
private AttributeSelectDialog attributeSelectDialog; | |||
@Override | |||
@@ -80,18 +95,161 @@ public class DiyProcessActivity extends BaseActivity { | |||
DisplayManager.scaleViewGroup(viewBinding.getRoot()); | |||
Intent intent = getIntent(); | |||
if(intent != null){ | |||
mainFoods = intent.getStringArrayListExtra("mainFoods"); | |||
if(intent.getStringArrayListExtra("mainFoods")!=null){ | |||
mainFoods = intent.getStringArrayListExtra("mainFoods"); | |||
} | |||
goodId = intent.getStringExtra("goodId"); | |||
subAttributeGroupId = intent.getStringExtra("subAttributeGroupId"); | |||
subAttributeGroupName = intent.getStringExtra("subAttributeGroupName"); | |||
} | |||
if(mainFoods.isEmpty()){ | |||
mainFoods.add(""); | |||
mainFoods.add(""); | |||
mainFoods.add(""); | |||
mainFoods.add(""); | |||
mainFoods.add(""); | |||
mainFoods.add(""); | |||
} | |||
initView(); | |||
initData(); | |||
initTopBar(); | |||
} | |||
/** | |||
* 初始化视图 | |||
* | |||
*/ | |||
private void initView(){ | |||
BPA_GOODS goods = GoodsDBUtil.getById(goodId); | |||
if(goods!=null){ | |||
viewBinding.title.setText(subAttributeGroupName.isEmpty() ? goods.name:(goods.name+"——"+subAttributeGroupName)); | |||
} | |||
initProcessModel(); | |||
initStepAdapter(); | |||
initBtnListener(); | |||
} | |||
/** | |||
* 左边步骤列表初始化 | |||
*/ | |||
private void initStepAdapter(){ | |||
stepAdapter = new DiyStepAdapter() { | |||
@Override | |||
protected void clickMoveUp(int position) { | |||
int index_up = stepAdapter.getCurrentPosition(); | |||
if (index_up > 0) { | |||
BPA_GOODS_PROCESS_DETAIL obj_up = (BPA_GOODS_PROCESS_DETAIL) processDetails.get(index_up); | |||
processDetails.remove(obj_up); | |||
processDetails.add(index_up - 1, obj_up); | |||
//移动光标 | |||
setSelectPos(index_up - 1); | |||
} else { | |||
NewToastUtil.getInstance().showToast("已经是最顶部!"); | |||
} | |||
} | |||
@Override | |||
protected void clickMoveDown(int position) { | |||
int index_down = stepAdapter.getCurrentPosition(); | |||
if (index_down < processDetails.size() - 1 && index_down >= 0) { | |||
BPA_GOODS_PROCESS_DETAIL obj_down = (BPA_GOODS_PROCESS_DETAIL) processDetails.get(index_down); | |||
processDetails.remove(obj_down); | |||
processDetails.add(index_down + 1, obj_down); | |||
//移动光标 | |||
setSelectPos(index_down + 1); | |||
} else { | |||
NewToastUtil.getInstance().showToast("已经是最底部!"); | |||
} | |||
} | |||
@Override | |||
protected void onItemClick(View v, int position) { | |||
updateProcessSpinner(mData.get(position)); | |||
} | |||
}; | |||
processDetails = GoodsProcessDetailDBUtil.getByGroupId(subAttributeGroupId); | |||
stepAdapter.setCurrentPosition(0); | |||
stepAdapter.setNewData(processDetails); | |||
if(!processDetails.isEmpty()){ | |||
updateProcessSpinner(processDetails.get(0)); | |||
} | |||
viewBinding.recycleStep.setItemAnimator(null); | |||
viewBinding.recycleStep.setHasFixedSize(true); | |||
// viewBinding.recycleStep.addItemDecoration(new RecyclerView.ItemDecoration() { | |||
// @Override | |||
// public void getItemOffsets(@NonNull Rect outRect, @NonNull View view, @NonNull RecyclerView parent, @NonNull RecyclerView.State state) { | |||
// super.getItemOffsets(outRect, view, parent, state); | |||
// outRect.right = DimensUtil.getDimens(32); | |||
// } | |||
// }); | |||
viewBinding.recycleStep.setAdapter(stepAdapter); | |||
} | |||
/** | |||
* 按钮点击监听 | |||
*/ | |||
private void initBtnListener(){ | |||
viewBinding.btnAdd.setOnClickListener(view -> { | |||
addProcess(); | |||
}); | |||
viewBinding.btnUpdate.setOnClickListener(view -> { | |||
updateProcess(); | |||
}); | |||
viewBinding.btnDelete.setOnClickListener(view -> { | |||
deleteProcess(); | |||
}); | |||
//模拟炒制 | |||
viewBinding.btnSimulation.setOnClickListener(view -> { | |||
//TODO 跳转 | |||
}); | |||
viewBinding.llInsert.setVisibility(View.GONE); | |||
viewBinding.btnInsert.setOnClickListener(view -> { | |||
if(viewBinding.llInsert.getVisibility() == View.VISIBLE){ | |||
viewBinding.llInsert.setVisibility(View.GONE); | |||
viewBinding.llInsert.animate() | |||
.translationY(viewBinding.llInsert.getHeight()) | |||
.setDuration(300) | |||
.start(); | |||
}else{ | |||
viewBinding.llInsert.setVisibility(View.VISIBLE); | |||
viewBinding.llInsert.animate() | |||
.translationY(0) | |||
.setDuration(300) | |||
.start(); | |||
} | |||
}); | |||
viewBinding.btnInsertUp.setOnClickListener(view -> { | |||
insertUpProcess(); | |||
}); | |||
viewBinding.btnInsertDown.setOnClickListener(view -> { | |||
insertDownProcess(); | |||
}); | |||
viewBinding.btnCopyProcess.setOnClickListener(view -> { | |||
if(attributeSelectDialog == null){ | |||
attributeSelectDialog = new AttributeSelectDialog(); | |||
} | |||
Bundle bundle = new Bundle(); | |||
bundle.putString("goodId",goodId); | |||
bundle.putString("groupId",subAttributeGroupId); | |||
attributeSelectDialog.setArguments(bundle); | |||
attributeSelectDialog.setListener(new AttributeSelectDialog.DialogCallBack() { | |||
@Override | |||
public void submit() { | |||
processDetails = GoodsProcessDetailDBUtil.getByGroupId(subAttributeGroupId); | |||
stepAdapter.setCurrentPosition(0); | |||
stepAdapter.setNewData(processDetails); | |||
if(!processDetails.isEmpty()){ | |||
updateProcessSpinner(processDetails.get(0)); | |||
} | |||
} | |||
}); | |||
attributeSelectDialog.show(getSupportFragmentManager(),"导入工序dialog"); | |||
}); | |||
} | |||
private void initData(){ | |||
/** | |||
* 初始化工序模型 | |||
*/ | |||
private void initProcessModel(){ | |||
//初始化工序 | |||
ArrayList<BPA_PROCESS> data = QueryDB.GetProcessALL(); | |||
int i = 0; | |||
@@ -112,39 +270,212 @@ public class DiyProcessActivity extends BaseActivity { | |||
@Override | |||
public void onItemSelected(AdapterView<?> adapterView, View view, int i, long l) { | |||
String id = processMap.get(viewBinding.spinnerProcess.getSelectedItem().toString()); | |||
SelectItemFrom(id); | |||
selectItemFrom(id); | |||
} | |||
@Override | |||
public void onNothingSelected(AdapterView<?> adapterView) { | |||
} | |||
}); | |||
SelectItemFrom(id); | |||
selectItemFrom(id); | |||
} | |||
//3.工序步骤 | |||
// gxbz_adapter = new gongxubuzhou_adapter(getContext(), R.layout.gx_item1, (List<BPA_GOODSRECIPE>) bpa_goodsrecipes, null); | |||
// datatab_gxbz.setAdapter(gxbz_adapter); | |||
// datatab_gxbz.setOnItemClickListener(new AdapterView.OnItemClickListener() { | |||
// @Override | |||
// public void onItemClick(AdapterView<?> parent, View view, int position, long l) { | |||
// // TODO Auto-generated method stub | |||
// gxbz_adapter.setSelectedPosition(position); | |||
// gxbz_adapter.notifyDataSetInvalidated(); | |||
// | |||
// SetSelectGX(bpa_goodsrecipes.get(position));//单击工序行,显示变量 | |||
// } | |||
// }); | |||
/** | |||
* 添加工序 | |||
*/ | |||
private void addProcess(){ | |||
BPA_GOODS_PROCESS_DETAIL goodsrecipe = getSelectItemFromValue(); | |||
if (goodsrecipe != null) { | |||
BPA_GOODS_PROCESS_DETAIL processDetail = getSelectItemFromValue(); | |||
GoodsProcessDetailDBUtil.add(processDetail); | |||
processDetails.add(processDetail); | |||
stepAdapter.setCurrentPosition(processDetails.size()-1); | |||
stepAdapter.notifyDataSetChanged(); | |||
viewBinding.recycleStep.smoothScrollToPosition(processDetails.size()-1); | |||
}else { | |||
NewToastUtil.getInstance().showToast("参数错误!"); | |||
} | |||
} | |||
private void initView(){ | |||
// SubAttributeGroupDBUtil.getByGoodIdAndListId(goodId,subAttributeGroupId); | |||
BPA_GOODS goods = GoodsDBUtil.getById(goodId); | |||
viewBinding.title.setText(goods==null?(subAttributeGroupName+""):(goods.name+subAttributeGroupName)); | |||
/** | |||
* 向上插入工序 | |||
*/ | |||
private void insertUpProcess(){ | |||
BPA_GOODS_PROCESS_DETAIL goodSrecipeUp = getSelectItemFromValue(); | |||
if (goodSrecipeUp != null) { | |||
int index_update = stepAdapter.getCurrentPosition(); | |||
if (index_update >= 0 && processDetails.size()>0) { | |||
BPA_GOODS_PROCESS_DETAIL processDetail = getSelectItemFromValue(); | |||
GoodsProcessDetailDBUtil.add(processDetail); | |||
processDetails.add(index_update,processDetail); | |||
stepAdapter.setCurrentPosition(index_update); | |||
stepAdapter.notifyDataSetChanged(); | |||
viewBinding.recycleStep.smoothScrollToPosition(index_update); | |||
}else { | |||
NewToastUtil.getInstance().showToast("请先选择步骤!"); | |||
} | |||
} | |||
} | |||
/** | |||
* 向下插入工序 | |||
*/ | |||
private void insertDownProcess(){ | |||
BPA_GOODS_PROCESS_DETAIL goodSrecipeUp = getSelectItemFromValue(); | |||
if (goodSrecipeUp != null) { | |||
int index_update = stepAdapter.getCurrentPosition(); | |||
if (index_update >= 0 && !processDetails.isEmpty()) { | |||
BPA_GOODS_PROCESS_DETAIL processDetail = getSelectItemFromValue(); | |||
GoodsProcessDetailDBUtil.add(processDetail); | |||
processDetails.add(index_update+1,processDetail); | |||
stepAdapter.setCurrentPosition(index_update+1); | |||
stepAdapter.notifyDataSetChanged(); | |||
viewBinding.recycleStep.smoothScrollToPosition(index_update+1); | |||
}else { | |||
NewToastUtil.getInstance().showToast("请先选择步骤!"); | |||
} | |||
} | |||
} | |||
private void initTopBar(){ | |||
/** | |||
* 修改工序 | |||
*/ | |||
private void updateProcess(){ | |||
int index_update = stepAdapter.getCurrentPosition(); | |||
if (index_update >= 0 && index_update < processDetails.size()) { | |||
BPA_GOODS_PROCESS_DETAIL obj_update = (BPA_GOODS_PROCESS_DETAIL) processDetails.get(index_update); | |||
String selectname = viewBinding.spinnerProcess.getSelectedItem().toString(); | |||
if (!obj_update.processname.equals(selectname)) { | |||
NewToastUtil.getInstance().showToast("请先选择步骤!"); | |||
return; | |||
} | |||
BPA_GOODS_PROCESS_DETAIL processDetail = getSelectItemFromValue(); | |||
GoodsProcessDetailDBUtil.update(processDetail); | |||
processDetails.set(index_update, getSelectItemFromValue()); | |||
stepAdapter.notifyDataSetChanged(); | |||
NewToastUtil.getInstance().showToast("修改步骤[" + (index_update + 1) + ":" + obj_update.processname + "]成功!"); | |||
} else { | |||
NewToastUtil.getInstance().showToast("请先选择步骤!"); | |||
} | |||
} | |||
/** | |||
* 删除工序 | |||
*/ | |||
private void deleteProcess(){ | |||
int index_delete = stepAdapter.getCurrentPosition(); | |||
if (index_delete >= 0 && index_delete < processDetails.size()) { | |||
BPA_GOODS_PROCESS_DETAIL processDetail = (BPA_GOODS_PROCESS_DETAIL) processDetails.get(index_delete); | |||
processDetails.remove(processDetail); | |||
GoodsProcessDetailDBUtil.delete(processDetail); | |||
stepAdapter.notifyDataSetChanged(); | |||
//移动光标 | |||
if (index_delete - 1 >= 0) { | |||
setSelectPos(index_delete - 1); | |||
} | |||
NewToastUtil.getInstance().showToast("删除步骤[" + processDetail.processname + "]成功!"); | |||
} else { | |||
NewToastUtil.getInstance().showToast("请先选择步骤!"); | |||
} | |||
} | |||
/** | |||
* 获取右边工序的变量 | |||
* | |||
* @return | |||
*/ | |||
public BPA_GOODS_PROCESS_DETAIL getSelectItemFromValue() { | |||
BPA_GOODS_PROCESS_DETAIL processDetail = new BPA_GOODS_PROCESS_DETAIL(); | |||
try { | |||
processDetail.goodsSubAttributeGroupId = subAttributeGroupId; | |||
String name = viewBinding.spinnerProcess.getSelectedItem().toString(); | |||
boolean IsVerify = true; | |||
StringBuilder description = new StringBuilder(); | |||
// 延迟,100|延迟,100|延迟,100|延迟,100| | |||
StringBuilder data = new StringBuilder(); | |||
StringBuilder desc = new StringBuilder(); | |||
if (name.contains("液体料")) { | |||
processDetail.materialType = 0; | |||
for (int i = 0; i < viewBinding.llProcessValue.getChildCount(); i++) { | |||
ProcessValueView viw = (ProcessValueView) viewBinding.llProcessValue.getChildAt(i); | |||
String values = viw.GetValues(); | |||
if (!values.isEmpty()) { | |||
data.append(viw.model.name).append(",").append(values).append("|"); | |||
desc.append(values).append(","); | |||
} | |||
} | |||
if (data.length() == 0) { | |||
IsVerify = false; | |||
description.append("物料不能为空,请至少勾选一个物料"); | |||
} | |||
} else { | |||
processDetail.materialType = 1; | |||
String mainFoodName = ""; | |||
int position = -1;//几号位 | |||
for (int i = 0; i < viewBinding.llProcessValue.getChildCount(); i++) { | |||
ProcessValueView viw = (ProcessValueView) viewBinding.llProcessValue.getChildAt(i); | |||
String values = viw.GetValues(); | |||
if (values.isEmpty()) { | |||
IsVerify = false; | |||
description.append(viw.model.name).append("不能为空"); | |||
} else { | |||
data.append(viw.model.name).append(",").append(values).append("|"); | |||
desc.append(values).append(","); | |||
} | |||
if(viw.model.name.contains("位置")){ | |||
position = Integer.parseInt(values.replace("号位","")); | |||
} | |||
if(viw.model.name.contains("主料名称")){ | |||
mainFoodName = values; | |||
} | |||
} | |||
if(position>0){ | |||
LogUtils.d(TAG+" getSelectItemFromValue 修改主料名称 old mainFoods="+mainFoods.toString()); | |||
mainFoods.set(position-1,mainFoodName); | |||
LogUtils.d(TAG+" getSelectItemFromValue 修改主料名称 new mainFoods="+mainFoods.toString()); | |||
} | |||
} | |||
if (IsVerify) { | |||
processDetail.processname = name; | |||
processDetail.processms = name + "(" + desc.substring(0, desc.length() - 1) + ")"; | |||
processDetail.processvalue = data.substring(0, data.length() - 1); | |||
LogUtils.d("修改工序 pf="+processDetail.toString()); | |||
return processDetail; | |||
} else { | |||
NewToastUtil.getInstance().showToast(description.toString()); | |||
return null; | |||
} | |||
} catch (Exception ex) { | |||
return null; | |||
} | |||
} | |||
/** | |||
* 移动光标 选中步骤 | |||
* @param index | |||
*/ | |||
@SuppressLint("NotifyDataSetChanged") | |||
public void setSelectPos(int index) { | |||
stepAdapter.setCurrentPosition(index); | |||
stepAdapter.notifyDataSetChanged(); | |||
viewBinding.recycleStep.smoothScrollToPosition(index); | |||
updateProcessSpinner(stepAdapter.getData().get(index)); | |||
} | |||
/** | |||
* 栏目 | |||
*/ | |||
private void initTopBar(){ | |||
viewBinding.topbar.setBackgroundColor(ContextCompat.getColor(getContext(), R.color.topbj1)); | |||
viewBinding.topbar.setTitle("编辑工序"); | |||
viewBinding.topbar.addLeftImageButton(R.mipmap.fanhui, R.id.topbar).setOnClickListener(new View.OnClickListener() { | |||
@Override | |||
public void onClick(View view) { | |||
finish(); | |||
} | |||
}); | |||
} | |||
/** | |||
@@ -152,21 +483,26 @@ public class DiyProcessActivity extends BaseActivity { | |||
* | |||
* @param id | |||
*/ | |||
public void SelectItemFrom(String id) { | |||
public void selectItemFrom(String id) { | |||
try { | |||
viewBinding.llProcessValue.removeAllViews(); | |||
ArrayList<BPA_PROCESSModel> mode = QueryDB.GetProcessModelProcessID(id); | |||
LogUtils.d(TAG+" selectItemFrom id="+id +" mode="+mode.toString() ); | |||
if (!mode.isEmpty())//工序 | |||
{ | |||
LogUtils.d("SelectItemFrom 1"); | |||
for (BPA_PROCESSModel item : mode) { | |||
item_gx gx = new item_gx(); | |||
gx.datatype = item.datatype; | |||
gx.name = item.name; | |||
gx.data = item.data; | |||
gx.IsWL = false; | |||
fragment_gx gongxu = new fragment_gx(this, null, gx); | |||
ProcessValueView view = new ProcessValueView(this, null, gx); | |||
if(item.datatype == 2){ | |||
view.setListener(spinnerSelectListener); | |||
} | |||
LogUtils.d("SelectItemFrom gx="+gx.toString()); | |||
viewBinding.llProcessValue.addView(gongxu); | |||
viewBinding.llProcessValue.addView(view); | |||
} | |||
} else //物料 | |||
{ | |||
@@ -176,12 +512,66 @@ public class DiyProcessActivity extends BaseActivity { | |||
gx.datatype = 0;//液体料都是数字 | |||
gx.name = item2.name; | |||
gx.IsWL = true; | |||
fragment_gx gongxu = new fragment_gx(this, null, gx); | |||
ProcessValueView gongxu = new ProcessValueView(this, null, gx); | |||
LogUtils.d("SelectItemFrom gx="+gx.toString()); | |||
viewBinding.llProcessValue.addView(gongxu); | |||
} | |||
} | |||
} catch (Exception ex) { | |||
LogUtils.d("SelectItemFrom ex="+ex.getMessage()); | |||
ex.printStackTrace(); | |||
} | |||
} | |||
/** | |||
* 右边工序变量选项监听 | |||
*/ | |||
private ProcessValueView.SpinnerSelectCallBack spinnerSelectListener = new ProcessValueView.SpinnerSelectCallBack() { | |||
@Override | |||
public void onSelect(int position,String name) { | |||
for (int i = 0; i < viewBinding.llProcessValue.getChildCount(); i++) { | |||
ProcessValueView processValueView = (ProcessValueView) viewBinding.llProcessValue.getChildAt(i); | |||
if(processValueView.model.name.equals("主料名称")){ | |||
if(!mainFoods.isEmpty() && mainFoods.size()>position){ | |||
processValueView.setMainFoodName(mainFoods.get(position)); | |||
} | |||
} | |||
} | |||
} | |||
}; | |||
/** | |||
* 根据选中步骤显示变量 | |||
* | |||
* @param processDetail | |||
*/ | |||
public void updateProcessSpinner(BPA_GOODS_PROCESS_DETAIL processDetail) { | |||
try { | |||
//1.根据工序名称显示工序集合 | |||
viewBinding.spinnerProcess.setSelection(processMapIndex.get(processDetail.processname)); | |||
String id = processMap.get(viewBinding.spinnerProcess.getSelectedItem().toString()); | |||
selectItemFrom(id); | |||
//2.根据工序变量集合-获取变量名称和值 | |||
HashMap<String, String> formulation = ProcessValueUtil.dealProcessValue(processDetail.processvalue); | |||
for (int i = 0; i < viewBinding.llProcessValue.getChildCount(); i++) { | |||
ProcessValueView processValueView = (ProcessValueView) viewBinding.llProcessValue.getChildAt(i); | |||
String res = formulation.get(processValueView.model.name); | |||
if (res != null) { | |||
processValueView.SetValues(res); | |||
}else { | |||
if(processValueView.model.name.equals("主料名称")){ | |||
processValueView.setMainFoodName(mainFoods.get(0)); | |||
} | |||
} | |||
} | |||
LogUtils.e("SetSelectGX formulation="+formulation.toString()); | |||
} catch (Exception ex) { | |||
NewToastUtil.getInstance().showToastRedColor(this,"异常:"+ex.getMessage(),ex.getMessage()); | |||
} | |||
} | |||
@@ -192,42 +582,12 @@ public class DiyProcessActivity extends BaseActivity { | |||
super.onActivityResult(requestCode, resultCode, data); | |||
LogUtils.d(TAG+" onActivityResult requestCode="+requestCode+" resultCode="+resultCode+" data="+data); | |||
if (requestCode == REQUEST_RECORD_ACTIVITY&& resultCode==RESULT_OK) { | |||
if(data!=null){ | |||
if(data.getSerializableExtra("goodsRecipes")!=null){ | |||
goodsRecipes.clear(); | |||
try { | |||
goodsRecipes =(ArrayList<BPA_GOODSRECIPE>) data.getSerializableExtra("goodsRecipes"); | |||
}catch (Exception e){ | |||
e.printStackTrace(); | |||
} | |||
} | |||
//录制页面返回 是否替换所有工序 | |||
if (data!=null && data.getBooleanExtra("update",false)){ | |||
processDetails.clear(); | |||
processDetails.addAll(GoodsProcessDetailDBUtil.getByGroupId(subAttributeGroupId)); | |||
stepAdapter.notifyDataSetChanged(); | |||
} | |||
AlertDialogUtils.showCancelAndConfirmDialog(this, R.layout.dialog_delete_classify, (layoutView, xCom) -> { | |||
DialogDeleteClassifyBinding binding = DialogDeleteClassifyBinding.bind(layoutView); | |||
DisplayManager.scaleViewGroup(binding.getRoot()); | |||
binding.title.setText("修改工序"); | |||
binding.edit.setText("是否删除所有工序,并替换为录制的工序?"); | |||
binding.submit.setOnClickListener(view1 -> { | |||
// if(GoodsClassifyDBUtil.deleteById(classifyId)){ | |||
// AttributeDBUtil.deleteByClassifyId(classifyId); | |||
// GoodsDBUtil.deleteByClassifyId(classifyId); | |||
// SubAttributeGroupDBUtil.deleteByClassifyId(classifyId); | |||
// SubAttributeDBUtil.deleteByClassifyId(classifyId); | |||
// | |||
// classifyList.remove(classifyName); | |||
// classifyNameList.clear(); | |||
// classifyNameList.addAll(classifyList.keySet()); | |||
// spinnerAdapter.notifyDataSetChanged(); | |||
// selectClassify(classifyPosition-1);//更新数据 | |||
// ToastUtils.info("删除["+classifyName+"]成功!"); | |||
// xCom.dismissX(); | |||
// }else { | |||
// ToastUtils.info("删除["+classifyName+"]失败!"); | |||
// } | |||
// gxbz_adapter.notifyDataSetChanged(); | |||
}); | |||
}); | |||
} | |||
} | |||
} |
@@ -7,7 +7,6 @@ import android.view.MotionEvent; | |||
import android.view.View; | |||
import android.widget.AdapterView; | |||
import android.widget.ArrayAdapter; | |||
import android.widget.Toast; | |||
import androidx.annotation.Nullable; | |||
@@ -316,6 +315,9 @@ public class EditClassifyActivity extends BaseActivity { | |||
DisplayManager.scaleViewGroup(binding.getRoot()); | |||
binding.title.setText("删除分类名称"); | |||
binding.edit.setText("是否删除["+classifyName+"]分类下所有商品及属性?"); | |||
binding.cancel.setOnClickListener(view1 ->{ | |||
xCom.dismissX(); | |||
}); | |||
binding.submit.setOnClickListener(view1 -> { | |||
if(GoodsClassifyDBUtil.deleteById(classifyId)){ | |||
AttributeDBUtil.deleteByClassifyId(classifyId); | |||
@@ -394,7 +396,7 @@ public class EditClassifyActivity extends BaseActivity { | |||
String classifyId = classifyList.get(viewBinding.spinnerClassify.getSelectedItem().toString()); | |||
String goodName = SubAttributeGroupDBUtil.isIncludeByClassify(classifyId,bean.name); | |||
if(!goodName.isEmpty()){ | |||
NewToastUtil.showToast(this,"商品["+goodName+"]正在使用["+bean.name+"]属性,请先删除对应商品", Toast.LENGTH_SHORT); | |||
NewToastUtil.getInstance().showToast("商品["+goodName+"]正在使用["+bean.name+"]属性,请先删除对应商品"); | |||
return; | |||
} | |||
} | |||
@@ -460,7 +462,7 @@ public class EditClassifyActivity extends BaseActivity { | |||
String classifyId = classifyList.get(viewBinding.spinnerClassify.getSelectedItem().toString()); | |||
String goodName = SubAttributeGroupDBUtil.isIncludeByClassify(classifyId,bean.name); | |||
if(!goodName.isEmpty()){ | |||
NewToastUtil.showToast(this,"商品["+goodName+"]正在使用["+bean.name+"]属性,请先删除对应商品", Toast.LENGTH_SHORT); | |||
NewToastUtil.getInstance().showToast("商品["+goodName+"]正在使用["+bean.name+"]属性,请先删除对应商品"); | |||
return; | |||
} | |||
SubAttributeDBUtil.delete(bean); | |||
@@ -30,6 +30,9 @@ public abstract class ClassifyAdapter extends BaseAdapter<BPA_GOODS_CLASSIFY,Cla | |||
@SuppressLint("SetTextI18n") | |||
@Override | |||
public void onBindViewHolder(@NonNull ClassifyAdapter.ViewHolder holder, @SuppressLint("RecyclerView") int position) { | |||
if(DisplayManager.shouldScale(holder.binding.name)){ | |||
DisplayManager.scaleViewGroup(holder.binding.getRoot()); | |||
} | |||
if(holder.binding.name.getTextSize()>34||holder.binding.name.getTextSize()<30){ | |||
DisplayManager.scaleViewGroup(holder.binding.getRoot()); | |||
} | |||
@@ -0,0 +1,82 @@ | |||
package com.bonait.bnframework.ui.adapter; | |||
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.common.base.BaseAdapter; | |||
import com.bonait.bnframework.common.db.mode.BPA_GOODS_PROCESS_DETAIL; | |||
import com.bonait.bnframework.common.utils.DisplayManager; | |||
import com.bonait.bnframework.databinding.ItemStepBinding; | |||
/** | |||
* @author: liup | |||
* @description: 商品列表 | |||
* @date: 2024/5/8 15:36. | |||
*/ | |||
public abstract class DiyStepAdapter extends BaseAdapter<BPA_GOODS_PROCESS_DETAIL, DiyStepAdapter.ViewHolder> { | |||
@NonNull | |||
@Override | |||
public ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) { | |||
return new ViewHolder(ItemStepBinding.inflate(LayoutInflater.from(parent.getContext()), parent, false)); | |||
} | |||
@Override | |||
public void onBindViewHolder(@NonNull ViewHolder holder, @SuppressLint("RecyclerView") int position) { | |||
try { | |||
if(DisplayManager.shouldScale(holder.binding.name)){ | |||
DisplayManager.scaleViewGroup(holder.binding.getRoot()); | |||
} | |||
holder.binding.root.setSelected(mCurrentPosition == position); | |||
holder.binding.removeUp.setVisibility(mCurrentPosition == position?View.VISIBLE:View.GONE); | |||
holder.binding.removeDown.setVisibility(mCurrentPosition == position?View.VISIBLE:View.GONE); | |||
holder.binding.name.setText("1."+mData.get(position).processname); | |||
holder.binding.root.setOnClickListener(new View.OnClickListener() { | |||
@Override | |||
public void onClick(View view) { | |||
int last = mCurrentPosition; | |||
mCurrentPosition = position; | |||
notifyItemChanged(last); | |||
notifyItemChanged(mCurrentPosition); | |||
onItemClick(view,position); | |||
} | |||
}); | |||
holder.binding.removeDown.setOnClickListener(new View.OnClickListener() { | |||
@Override | |||
public void onClick(View view) { | |||
clickMoveDown(position); | |||
} | |||
}); | |||
holder.binding.removeUp.setOnClickListener(new View.OnClickListener() { | |||
@Override | |||
public void onClick(View view) { | |||
clickMoveUp(position); | |||
} | |||
}); | |||
} catch (Exception e) { | |||
e.printStackTrace(); | |||
} | |||
} | |||
public static class ViewHolder extends RecyclerView.ViewHolder { | |||
private ItemStepBinding binding; | |||
public ViewHolder(ItemStepBinding view) { | |||
super(view.getRoot()); | |||
binding = view; | |||
} | |||
} | |||
protected abstract void clickMoveUp(int position); | |||
protected abstract void clickMoveDown(int position); | |||
} | |||
@@ -32,7 +32,7 @@ public abstract class LocalGoodsAdapter extends BaseAdapter<BPA_GOODS,LocalGoods | |||
@Override | |||
public void onBindViewHolder(@NonNull GoodsViewHolder holder, @SuppressLint("RecyclerView") int position) { | |||
try { | |||
if(holder.binding.name.getTextSize()>28||holder.binding.name.getTextSize()<24){ | |||
if(holder.binding.name.getTextSize()> 34 || holder.binding.name.getTextSize()< 30){ | |||
DisplayManager.scaleViewGroup(holder.binding.getRoot()); | |||
} | |||
holder.binding.add.setVisibility(View.GONE); | |||
@@ -97,7 +97,7 @@ public class SelectAttributeListAdapter extends ArrayAdapter<BPA_ATTRIBUTE> { | |||
} | |||
} | |||
String groupName = list.length()>0?list.substring(0,list.length()-1):""; | |||
LogUtils.d(" getSubAttributeList groupName="+groupName); | |||
LogUtils.d(" getSubAttributeNameList groupName="+groupName); | |||
return groupName; | |||
} | |||
@@ -108,11 +108,11 @@ public class SelectAttributeListAdapter extends ArrayAdapter<BPA_ATTRIBUTE> { | |||
StringBuilder list = new StringBuilder(); | |||
for (SelectSubAttributeAdapter adapter:subAttributeAdapters){ | |||
if(adapter.getCurrentPosition() >= 0 && adapter.getData().size()>adapter.getCurrentPosition()){ | |||
list.append(adapter.getData().get(adapter.getCurrentPosition()).name).append(","); | |||
list.append(adapter.getData().get(adapter.getCurrentPosition()).id).append(","); | |||
} | |||
} | |||
String groupName = list.length()>0?list.substring(0,list.length()-1):""; | |||
LogUtils.d(" getSubAttributeList groupName="+groupName); | |||
LogUtils.d(" getSubAttributeIdList groupids="+groupName); | |||
return groupName; | |||
} | |||
} |
@@ -13,7 +13,6 @@ import android.view.ViewGroup; | |||
import android.view.Window; | |||
import android.view.WindowManager; | |||
import android.widget.AdapterView; | |||
import android.widget.Toast; | |||
import androidx.annotation.NonNull; | |||
import androidx.annotation.Nullable; | |||
@@ -163,7 +162,7 @@ public class AddGoodsDialog extends DialogFragment { | |||
case 2: | |||
if(classifyList.isEmpty() || classifyPosition < 0 || classifyPosition>=classifyList.size()){ | |||
if(getContext()!=null){ | |||
NewToastUtil.showToast(getContext(),"请选择分类", Toast.LENGTH_SHORT); | |||
NewToastUtil.getInstance().showToast("请选择分类"); | |||
} | |||
return; | |||
} | |||
@@ -182,13 +181,13 @@ public class AddGoodsDialog extends DialogFragment { | |||
LogUtils.d(TAG+" name="+name); | |||
if(name.isEmpty()){ | |||
if(getContext()!=null){ | |||
NewToastUtil.showToast(getContext(),"名称不能为空", Toast.LENGTH_SHORT); | |||
NewToastUtil.getInstance().showToast("名称不能为空"); | |||
} | |||
return; | |||
} | |||
if(GoodsDBUtil.getByName(name)!=null){ | |||
if(getContext()!=null){ | |||
NewToastUtil.showToast(getContext(),"已有菜品,请换一个名称", Toast.LENGTH_SHORT); | |||
NewToastUtil.getInstance().showToast("已有菜品,请换一个名称"); | |||
} | |||
return; | |||
} | |||
@@ -0,0 +1,188 @@ | |||
package com.bonait.bnframework.ui.dialog; | |||
import android.content.DialogInterface; | |||
import android.graphics.Color; | |||
import android.graphics.drawable.ColorDrawable; | |||
import android.os.Bundle; | |||
import android.view.Gravity; | |||
import android.view.LayoutInflater; | |||
import android.view.View; | |||
import android.view.ViewGroup; | |||
import android.view.Window; | |||
import android.view.WindowManager; | |||
import androidx.annotation.NonNull; | |||
import androidx.annotation.Nullable; | |||
import androidx.appcompat.app.AppCompatActivity; | |||
import androidx.fragment.app.DialogFragment; | |||
import com.apkfuns.logutils.LogUtils; | |||
import com.bonait.bnframework.R; | |||
import com.bonait.bnframework.common.db.mode.BPA_ATTRIBUTE; | |||
import com.bonait.bnframework.common.db.mode.BPA_GOODS; | |||
import com.bonait.bnframework.common.db.mode.BPA_GOODS_PROCESS_DETAIL; | |||
import com.bonait.bnframework.common.db.mode.BPA_GOODS_SUBATTRIBUTE_GROUP; | |||
import com.bonait.bnframework.common.db.util.AttributeDBUtil; | |||
import com.bonait.bnframework.common.db.util.GoodsDBUtil; | |||
import com.bonait.bnframework.common.db.util.GoodsProcessDetailDBUtil; | |||
import com.bonait.bnframework.common.db.util.SubAttributeGroupDBUtil; | |||
import com.bonait.bnframework.common.utils.AlertDialogUtils; | |||
import com.bonait.bnframework.common.utils.DisplayManager; | |||
import com.bonait.bnframework.databinding.DialogAttributeSelectBinding; | |||
import com.bonait.bnframework.databinding.DialogDeleteClassifyBinding; | |||
import com.bonait.bnframework.ui.adapter.SelectAttributeListAdapter; | |||
import com.bonait.bnframework.ui.widget.NewToastUtil; | |||
import java.util.ArrayList; | |||
import java.util.List; | |||
/** | |||
* @author: liup | |||
* @description: | |||
* @date: 2024/5/17 13:42. | |||
*/ | |||
public class AttributeSelectDialog extends DialogFragment { | |||
private String TAG = " AttributeSelectDialog =>"; | |||
private DialogAttributeSelectBinding viewBinding; | |||
private String goodId = ""; | |||
private String groupId = ""; | |||
private BPA_GOODS goods; | |||
/** | |||
* 属性列表 | |||
*/ | |||
private List<BPA_ATTRIBUTE> attributeList = new ArrayList<>(); | |||
/** | |||
* 属性组合 | |||
*/ | |||
private SelectAttributeListAdapter selectAttributeListAdapter; | |||
private DialogCallBack listener; | |||
@Override | |||
public void onCreate(@Nullable Bundle savedInstanceState) { | |||
super.onCreate(savedInstanceState); | |||
setStyle(STYLE_NORMAL, R.style.DialogLeft); | |||
if (getArguments() != null) { | |||
goodId = getArguments().getString("goodId"); | |||
groupId = getArguments().getString("groupId"); | |||
} | |||
goods = GoodsDBUtil.getById(goodId); | |||
if (goods != null) { | |||
attributeList = AttributeDBUtil.getByClassify(goods.classifyId); | |||
} | |||
} | |||
@Nullable | |||
@Override | |||
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { | |||
viewBinding = DialogAttributeSelectBinding.inflate(inflater, container, false); | |||
DisplayManager.scaleViewGroup(viewBinding.getRoot()); | |||
return viewBinding.getRoot(); | |||
} | |||
@Override | |||
public void onStart() { | |||
super.onStart(); | |||
if (getDialog() != null) { | |||
Window window = getDialog().getWindow(); | |||
assert window != null; | |||
window.setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT)); | |||
WindowManager.LayoutParams params = window.getAttributes(); | |||
params.gravity = Gravity.CENTER; | |||
params.width = ViewGroup.LayoutParams.MATCH_PARENT; | |||
params.height = ViewGroup.LayoutParams.MATCH_PARENT; | |||
window.setAttributes(params); | |||
} | |||
updateAttributeData(); | |||
initListener(); | |||
} | |||
@Override | |||
public void onDismiss(@NonNull DialogInterface dialog) { | |||
super.onDismiss(dialog); | |||
} | |||
@Override | |||
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) { | |||
super.onViewCreated(view, savedInstanceState); | |||
} | |||
/** | |||
* 刷新属性数据 | |||
*/ | |||
public void updateAttributeData(){ | |||
LogUtils.d(TAG+" updateAttributeData"); | |||
selectAttributeListAdapter = new SelectAttributeListAdapter(getContext(), R.layout.item_select_attribute_list,attributeList); | |||
viewBinding.listAttribute.setAdapter(selectAttributeListAdapter); | |||
} | |||
public void setListener(DialogCallBack listener){ | |||
this.listener = listener; | |||
} | |||
private void initListener(){ | |||
viewBinding.btnClose.setOnClickListener(view -> { | |||
dismiss(); | |||
}); | |||
viewBinding.btnClose2.setOnClickListener(view -> { | |||
dismiss(); | |||
}); | |||
viewBinding.btnSubmit.setOnClickListener(view -> { | |||
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)){ | |||
NewToastUtil.getInstance().showToast("当前正在编辑此组合,无法导入"); | |||
return; | |||
} | |||
} | |||
BPA_GOODS_SUBATTRIBUTE_GROUP group = SubAttributeGroupDBUtil.getByGoodIdAndListId(goodId,selectAttributeListAdapter.getSubAttributeIdList()); | |||
if(group == null){ | |||
NewToastUtil.getInstance().showToast("还未创建该组合,无法导入"); | |||
return; | |||
} | |||
List<BPA_GOODS_PROCESS_DETAIL> list = GoodsProcessDetailDBUtil.getByGroupId(group.id); | |||
if(!list.isEmpty()){ | |||
AlertDialogUtils.showCancelAndConfirmDialog((AppCompatActivity) getActivity(), R.layout.dialog_delete_classify, (layoutView, xCom) -> { | |||
DialogDeleteClassifyBinding binding = DialogDeleteClassifyBinding.bind(layoutView); | |||
DisplayManager.scaleViewGroup(binding.getRoot()); | |||
binding.title.setText("导入工序"); | |||
binding.edit.setText("导入后将覆盖当前所有工序,请确认"); | |||
binding.cancel.setOnClickListener(view1 ->{ | |||
xCom.dismissX(); | |||
}); | |||
binding.submit.setOnClickListener(view1 -> { | |||
for (BPA_GOODS_PROCESS_DETAIL bean: list){ | |||
BPA_GOODS_PROCESS_DETAIL newBean = new BPA_GOODS_PROCESS_DETAIL(); | |||
newBean.goodsSubAttributeGroupId = groupId; | |||
newBean.materialID = bean.materialID; | |||
newBean.processms = bean.processms; | |||
newBean.processname = bean.processname; | |||
newBean.processvalue = bean.processvalue; | |||
newBean.materialType = bean.materialType; | |||
newBean.value = bean.value; | |||
newBean.sort = bean.sort; | |||
GoodsProcessDetailDBUtil.add(newBean); | |||
} | |||
xCom.dismissX(); | |||
dismiss(); | |||
if(listener!=null){ | |||
listener.submit(); | |||
} | |||
}); | |||
}); | |||
}else { | |||
NewToastUtil.getInstance().showToast("该组合没有工序,无法导入"); | |||
} | |||
}); | |||
} | |||
public interface DialogCallBack{ | |||
void submit(); | |||
} | |||
} |
@@ -0,0 +1,270 @@ | |||
package com.bonait.bnframework.ui.dialog; | |||
import android.content.DialogInterface; | |||
import android.graphics.Color; | |||
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 android.widget.ArrayAdapter; | |||
import androidx.annotation.NonNull; | |||
import androidx.annotation.Nullable; | |||
import androidx.fragment.app.DialogFragment; | |||
import com.apkfuns.logutils.LogUtils; | |||
import com.bonait.bnframework.HBL.Thread.ThreadManager; | |||
import com.bonait.bnframework.R; | |||
import com.bonait.bnframework.Service.ModbusHelper; | |||
import com.bonait.bnframework.common.db.QueryDB; | |||
import com.bonait.bnframework.common.db.mode.BPA_MATERIAL; | |||
import com.bonait.bnframework.common.db.mode.BPA_SILOS; | |||
import com.bonait.bnframework.common.utils.DisplayManager; | |||
import com.bonait.bnframework.databinding.DialogDeviceControlBinding; | |||
import com.bonait.bnframework.ui.widget.NewToastUtil; | |||
import com.litao.slider.NiftySlider; | |||
import java.util.ArrayList; | |||
import java.util.List; | |||
/** | |||
* @author: liup | |||
* @description: | |||
* @date: 2024/5/20 17:51. | |||
*/ | |||
public class DeviceControlDialog extends DialogFragment { | |||
private String TAG = " DeviceControlDialog =>"; | |||
private DialogDeviceControlBinding viewBinding; | |||
private DeviceCallBack callBack; | |||
/** | |||
* 1加热 2调料 3主料 4搅拌 | |||
*/ | |||
private int type = 0; | |||
/** | |||
* 火力档位 | |||
*/ | |||
private int progressFire; | |||
/** | |||
* 搅拌档位 | |||
*/ | |||
private int progressStir; | |||
/** | |||
* 料仓号 | |||
*/ | |||
private int seasoningPos=-1; | |||
/** | |||
* 料仓列表 | |||
*/ | |||
private List<String> seasoningList = new ArrayList<>(); | |||
/** | |||
* 主料仓列表 | |||
*/ | |||
private List<String> mainFoodList = new ArrayList<>(); | |||
@Override | |||
public void onCreate(@Nullable Bundle savedInstanceState) { | |||
super.onCreate(savedInstanceState); | |||
setStyle(STYLE_NORMAL, R.style.DialogLeft); | |||
if(getArguments()!=null){ | |||
type = getArguments().getInt("type"); | |||
} | |||
} | |||
@Nullable | |||
@Override | |||
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { | |||
viewBinding = DialogDeviceControlBinding.inflate(inflater, container, false); | |||
DisplayManager.scaleViewGroup(viewBinding.getRoot()); | |||
return viewBinding.getRoot(); | |||
} | |||
@Override | |||
public void onStart() { | |||
super.onStart(); | |||
if (getDialog() != null) { | |||
Window window = getDialog().getWindow(); | |||
assert window != null; | |||
window.setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT)); | |||
WindowManager.LayoutParams params = window.getAttributes(); | |||
params.gravity = Gravity.CENTER; | |||
params.width = ViewGroup.LayoutParams.MATCH_PARENT; | |||
params.height = ViewGroup.LayoutParams.MATCH_PARENT; | |||
window.setAttributes(params); | |||
} | |||
initView(); | |||
} | |||
private void initView(){ | |||
viewBinding.layoutFire.getRoot().setVisibility(type==1?View.VISIBLE:View.GONE); | |||
viewBinding.layoutSilos.getRoot().setVisibility(type==2?View.VISIBLE:View.GONE); | |||
viewBinding.layoutFood.getRoot().setVisibility(type==3?View.VISIBLE:View.GONE); | |||
viewBinding.layoutStir.getRoot().setVisibility(type==4?View.VISIBLE:View.GONE); | |||
} | |||
private void initData(){ | |||
seasoningList = new ArrayList<>(); | |||
for(BPA_SILOS silos: QueryDB.GetSilosALL()){ | |||
List<BPA_MATERIAL> materials = QueryDB.GetMaterialBySilosID(silos.id); | |||
if(!materials.isEmpty()){ | |||
String name = QueryDB.GetMaterialBySilosID(silos.id).get(0).name; | |||
if(name!=null && !name.isEmpty()){ | |||
seasoningList.add("液体"+silos.num+"("+name+")"); | |||
}else { | |||
seasoningList.add("液体"+silos.num+"(未设置)"); | |||
} | |||
}else { | |||
seasoningList.add("液体"+silos.num+"(未设置)"); | |||
} | |||
} | |||
mainFoodList = new ArrayList<>(); | |||
mainFoodList.add("主料仓1"); | |||
mainFoodList.add("主料仓2"); | |||
mainFoodList.add("主料仓3"); | |||
mainFoodList.add("主料仓4"); | |||
mainFoodList.add("主料仓5"); | |||
mainFoodList.add("主料仓6"); | |||
} | |||
/** | |||
* 加热模块 | |||
*/ | |||
private void initFire(){ | |||
//开始加热 | |||
viewBinding.layoutFire.btnStartFire.setOnClickListener(view->{ | |||
NewToastUtil.getInstance().showToast("启动加热 档位:"+progressFire); | |||
ThreadManager.get().execute(new Thread(() -> ModbusHelper.get().Heating(progressFire,true))); | |||
}); | |||
//停止加热 | |||
viewBinding.layoutFire.btnStopFire.setOnClickListener(view->{ | |||
NewToastUtil.getInstance().showToast("停止加热"); | |||
ThreadManager.get().execute(new Thread(() -> ModbusHelper.get().Heating(progressFire,false))); | |||
}); | |||
//档位条加减 | |||
viewBinding.layoutFire.btnFireUp.setOnClickListener(view->{ | |||
if(progressFire<10){ | |||
progressFire++; | |||
} | |||
viewBinding.layoutFire.fireProgress.setValue(progressFire,true); | |||
}); | |||
viewBinding.layoutFire.btnFireDown.setOnClickListener(view->{ | |||
if(progressFire>0){ | |||
progressFire--; | |||
} | |||
viewBinding.layoutFire.fireProgress.setValue(progressFire,true); | |||
}); | |||
viewBinding.layoutFire.fireProgress.setValue(0,false); | |||
//档位条 | |||
viewBinding.layoutFire.fireProgress.setOnValueChangeListener(new NiftySlider.OnValueChangeListener() { | |||
@Override | |||
public void onValueChange(@NonNull NiftySlider niftySlider, float v, boolean b) { | |||
viewBinding.layoutFire.fireProgress.setThumbText((int) v + ""); | |||
progressFire = (int) v; | |||
} | |||
}); | |||
} | |||
/** | |||
* 液料模块 | |||
*/ | |||
private void initSilos(){ | |||
//加水 | |||
viewBinding.layoutSilos.addWater.setOnClickListener(view->{ | |||
String waterValue = viewBinding.layoutSilos.editWater.getText().toString(); | |||
if(!waterValue.isEmpty()){ | |||
NewToastUtil.getInstance().showToast("开始加水 "+waterValue+"g"); | |||
ThreadManager.get().execute(new Thread(() -> { | |||
ModbusHelper.get().addWater(Integer.parseInt(viewBinding.layoutSilos.editWater.getText().toString()),false); | |||
})); | |||
}else { | |||
NewToastUtil.getInstance().showToast("值不能为空!"); | |||
} | |||
}); | |||
//勾芡 | |||
viewBinding.layoutSilos.addQianWater.setOnClickListener(view->{ | |||
String value = viewBinding.layoutSilos.editQianWater.getText().toString(); | |||
if(!value.isEmpty()){ | |||
NewToastUtil.getInstance().showToast("开始勾芡 "+value+"g"); | |||
ThreadManager.get().execute(new Thread(() -> { | |||
ModbusHelper.get().addThickenWater(Integer.parseInt(viewBinding.layoutSilos.editQianWater.getText().toString()), false); | |||
})); | |||
}else { | |||
NewToastUtil.getInstance().showToast("值不能为空!"); | |||
} | |||
}); | |||
//调料 | |||
viewBinding.layoutSilos.addQianWater.setOnClickListener(view->{ | |||
String value2 = viewBinding.layoutSilos.editSeasoningWater.getText().toString(); | |||
if(seasoningPos>=0){ | |||
if(!value2.isEmpty()){ | |||
NewToastUtil.getInstance().showToast("添加调料 "+(seasoningPos+1)+"号仓 "+value2+"g"); | |||
ThreadManager.get().execute(new Thread(() -> { | |||
ModbusHelper.get().addMaterial(Integer.parseInt(value2),(seasoningPos+1),false); | |||
})); | |||
}else { | |||
NewToastUtil.getInstance().showToast("值不能为空!"); | |||
} | |||
}else { | |||
NewToastUtil.getInstance().showToast("请选择仓号!"); | |||
} | |||
}); | |||
ArrayAdapter<String> adapter1 = new ArrayAdapter<>(getContext(), R.layout.spinner_text_item_text_size26, seasoningList); | |||
adapter1.setDropDownViewResource(R.layout.spinner_dropdown_item_text_size26); | |||
viewBinding.layoutSilos.spinnerSeasoningWater.setAdapter(adapter1); | |||
viewBinding.layoutSilos.spinnerSeasoningWater.setOnTouchListener(new View.OnTouchListener() { | |||
@Override | |||
public boolean onTouch(View view, MotionEvent motionEvent) { | |||
view.performClick(); | |||
return false; | |||
} | |||
}); | |||
viewBinding.layoutSilos.spinnerSeasoningWater.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() { | |||
@Override | |||
public void onItemSelected(AdapterView<?> adapterView, View view, int i, long l) { | |||
LogUtils.d(" ----- onItemSelected i="+i); | |||
seasoningPos = i; | |||
} | |||
@Override | |||
public void onNothingSelected(AdapterView<?> adapterView) { | |||
} | |||
}); | |||
} | |||
/** | |||
* 主料模块 | |||
*/ | |||
private void initFood(){ | |||
//开始加热 | |||
} | |||
/** | |||
* 搅拌模块 | |||
*/ | |||
private void initStir(){ | |||
} | |||
@Override | |||
public void onDismiss(@NonNull DialogInterface dialog) { | |||
super.onDismiss(dialog); | |||
} | |||
@Override | |||
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) { | |||
super.onViewCreated(view, savedInstanceState); | |||
} | |||
public interface DeviceCallBack{ | |||
void onClickEvent(int type,String value); | |||
} | |||
} |
@@ -12,7 +12,6 @@ import android.view.View; | |||
import android.view.ViewGroup; | |||
import android.view.Window; | |||
import android.view.WindowManager; | |||
import android.widget.Toast; | |||
import androidx.annotation.NonNull; | |||
import androidx.annotation.Nullable; | |||
@@ -129,7 +128,7 @@ public class EditGoodsDialog extends DialogFragment { | |||
*/ | |||
@SuppressLint("NonConstantResourceId") | |||
@OnClick({R.id.btn_close1, R.id.btn_close2,R.id.btn_close3, | |||
R.id.btn_next1,R.id.btn_next2,R.id.btn_next3,R.id.btn_last1,R.id.btn_last3, | |||
R.id.btn_next1,R.id.btn_next2,R.id.btn_to_cook,R.id.btn_last1,R.id.btn_edit_process, | |||
R.id.good_image,R.id.btn_last2}) | |||
public void onViewClicked(View view) { | |||
switch (view.getId()) { | |||
@@ -143,7 +142,7 @@ public class EditGoodsDialog extends DialogFragment { | |||
String name = viewBinding.layoutName.editName.getText().toString(); | |||
if(name.isEmpty()){ | |||
if(getContext()!=null){ | |||
NewToastUtil.showToast(getContext(),"名称不能为空", Toast.LENGTH_SHORT); | |||
NewToastUtil.getInstance().showToast("名称不能为空"); | |||
} | |||
return; | |||
} | |||
@@ -162,16 +161,16 @@ public class EditGoodsDialog extends DialogFragment { | |||
case R.id.btn_next2: | |||
if(!selectAttributeListAdapter.isAllSelected()){ | |||
if(getContext()!=null){ | |||
NewToastUtil.showToast(getContext(),"请选择每行对应的子属性", Toast.LENGTH_SHORT); | |||
NewToastUtil.getInstance().showToast("请选择每行对应的子属性"); | |||
} | |||
return; | |||
} | |||
changePage(3); | |||
break; | |||
case R.id.btn_last3: | |||
case R.id.btn_to_cook: | |||
jumpToCook(); | |||
break; | |||
case R.id.btn_next3: | |||
case R.id.btn_edit_process: | |||
jumpToEdit(); | |||
break; | |||
case R.id.btn_last2: | |||
@@ -235,11 +234,18 @@ public class EditGoodsDialog extends DialogFragment { | |||
subattributeGroup.goodsId = goods.id; | |||
subattributeGroup.maketime = 0; | |||
subattributeGroup.name = ""; | |||
subattributeGroup.subAttributeIdList = ""; | |||
if(selectAttributeListAdapter != null && selectAttributeListAdapter.datas!=null && !selectAttributeListAdapter.datas.isEmpty()){ | |||
subattributeGroup.name = selectAttributeListAdapter.getSubAttributeNameList(); | |||
subattributeGroup.subAttributeIdList = selectAttributeListAdapter.getSubAttributeIdList(); | |||
} | |||
SubAttributeGroupDBUtil.add(subattributeGroup); | |||
}else { | |||
if(selectAttributeListAdapter != null && selectAttributeListAdapter.datas!=null && !selectAttributeListAdapter.datas.isEmpty()){ | |||
subattributeGroup.name = selectAttributeListAdapter.getSubAttributeNameList(); | |||
subattributeGroup.subAttributeIdList = selectAttributeListAdapter.getSubAttributeIdList(); | |||
} | |||
SubAttributeGroupDBUtil.update(subattributeGroup); | |||
} | |||
} | |||
@@ -262,7 +268,7 @@ public class EditGoodsDialog extends DialogFragment { | |||
if(!processvalue.isEmpty()){ | |||
HashMap<String,String> params = ProcessValueUtil.dealProcessValue(processvalue); | |||
if(!params.isEmpty()){ | |||
int position = 0;//几号位 | |||
int position = -1;//几号位 | |||
String name = "";//主料名称 | |||
for (HashMap.Entry<String, String> entry : params.entrySet()) { | |||
String key = entry.getKey(); | |||
@@ -273,7 +279,9 @@ public class EditGoodsDialog extends DialogFragment { | |||
position = Integer.parseInt(value.replace("号位","")); | |||
} | |||
} | |||
updateName(position,name); | |||
if(position>=0){ | |||
updateName(position,name); | |||
} | |||
} | |||
} | |||
} | |||
@@ -285,6 +293,7 @@ public class EditGoodsDialog extends DialogFragment { | |||
* 更新单个主料仓名称 | |||
*/ | |||
private void updateName(int position,String name){ | |||
LogUtils.d(TAG+" updateName position="+position+" ;name="+name); | |||
switch (position){ | |||
case 1: | |||
viewBinding.layoutMainfoods.editName1.setText(name); | |||
@@ -330,7 +339,7 @@ public class EditGoodsDialog extends DialogFragment { | |||
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); | |||
intent.putStringArrayListExtra("mainFoods",mainFoods); | |||
intent.putExtra("goodId",goods.id); | |||
intent.putExtra("subAttributeGroupId",selectAttributeListAdapter.getSubAttributeIdList()); | |||
intent.putExtra("subAttributeGroupId",subattributeGroup.id); | |||
intent.putExtra("subAttributeGroupName",selectAttributeListAdapter.getSubAttributeNameList()); | |||
startActivity(intent); | |||
dismiss(); | |||
@@ -32,7 +32,7 @@ import java.util.Objects; | |||
/** | |||
* @author: liup | |||
* @description: | |||
* @description: 云端菜谱 | |||
* @date: 2024/5/9 9:48. | |||
*/ | |||
public class CloudGoodsFragment extends BaseFragment { | |||
@@ -0,0 +1,127 @@ | |||
package com.bonait.bnframework.ui.fragment; | |||
import android.annotation.SuppressLint; | |||
import android.graphics.Color; | |||
import android.os.Bundle; | |||
import android.os.Handler; | |||
import android.os.Looper; | |||
import android.os.Message; | |||
import android.text.Spannable; | |||
import android.text.SpannableStringBuilder; | |||
import android.text.style.ForegroundColorSpan; | |||
import android.view.LayoutInflater; | |||
import android.view.View; | |||
import androidx.annotation.NonNull; | |||
import androidx.annotation.Nullable; | |||
import com.bonait.bnframework.HBL.DataUtil.ErrorCodeManager; | |||
import com.bonait.bnframework.Model.ErrorCodeBean; | |||
import com.bonait.bnframework.R; | |||
import com.bonait.bnframework.Service.ModbusHelper; | |||
import com.bonait.bnframework.common.base.BaseFragment; | |||
import com.bonait.bnframework.common.utils.DisplayManager; | |||
import com.bonait.bnframework.databinding.FragmentHomeDevicesBinding; | |||
/** | |||
* @author: liup | |||
* @description: 设备信息 | |||
* @date: 2024/5/17 16:48. | |||
*/ | |||
public class HomeDevicesFragment extends BaseFragment { | |||
protected FragmentHomeDevicesBinding viewBinding; | |||
private static final int MSG_FRESH_DEVICE = 1000; | |||
@SuppressLint("HandlerLeak") | |||
private Handler handler = new Handler(Looper.getMainLooper()){ | |||
@Override | |||
public void handleMessage(@NonNull Message msg) { | |||
super.handleMessage(msg); | |||
switch (msg.what){ | |||
case MSG_FRESH_DEVICE: | |||
if(hasMessages(MSG_FRESH_DEVICE)){ | |||
removeMessages(MSG_FRESH_DEVICE); | |||
} | |||
sendEmptyMessageDelayed(MSG_FRESH_DEVICE,500); | |||
for(ErrorCodeBean bean : ErrorCodeManager.getInstance().getDataBeans()){ | |||
if(bean.getCode() == ModbusHelper.get().getDeviceErrorCode()){ | |||
changeTextDeviceStatus(1,bean.getName()+" "+bean.getDescription()); | |||
} | |||
} | |||
changeTextDeviceStatus(2,ModbusHelper.get().getConnected()?"在线":"掉线"); | |||
break; | |||
} | |||
} | |||
}; | |||
@Override | |||
protected View onCreateView() { | |||
View root = LayoutInflater.from(getActivity()).inflate(R.layout.fragment_home_device, null); | |||
viewBinding = FragmentHomeDevicesBinding.bind(root); | |||
return root; | |||
} | |||
@Override | |||
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) { | |||
super.onViewCreated(view, savedInstanceState); | |||
DisplayManager.scaleViewGroup(viewBinding.getRoot()); | |||
initView(); | |||
} | |||
private void initView(){ | |||
viewBinding.device.btnMainFood.setOnClickListener(view->{ | |||
}); | |||
viewBinding.device.btnSilos.setOnClickListener(view->{ | |||
}); | |||
viewBinding.device.btnStir.setOnClickListener(view->{ | |||
}); | |||
viewBinding.device.btnFire.setOnClickListener(view->{ | |||
}); | |||
} | |||
/** | |||
* 设备状态更新 | |||
* @param position | |||
* @param desc | |||
*/ | |||
private void changeTextDeviceStatus(int position,String desc){ | |||
if(position == 1){ | |||
String content = "设备信息: "+desc; | |||
SpannableStringBuilder spannable = new SpannableStringBuilder(content); | |||
spannable.setSpan(new ForegroundColorSpan(Color.parseColor("#795548")), 6, content.length(), Spannable.SPAN_EXCLUSIVE_INCLUSIVE);//SPAN_EXCLUSIVE_INCLUSIVE前面不包括后面包括 | |||
viewBinding.deviceErrorCode.setText(spannable); | |||
}else { | |||
String content = "设备状态: "+desc; | |||
SpannableStringBuilder spannable = new SpannableStringBuilder(content); | |||
spannable.setSpan(new ForegroundColorSpan(Color.parseColor("#795548")), 5, content.length(), Spannable.SPAN_EXCLUSIVE_INCLUSIVE);//SPAN_EXCLUSIVE_INCLUSIVE前面不包括后面包括 | |||
viewBinding.deviceErrorCode.setText(spannable); | |||
viewBinding.deviceConnect.setText(spannable); | |||
} | |||
} | |||
@Override | |||
public void onResume() { | |||
super.onResume(); | |||
handler.sendEmptyMessageDelayed(MSG_FRESH_DEVICE,500); | |||
} | |||
@Override | |||
public void onPause() { | |||
super.onPause(); | |||
if(handler!=null){ | |||
handler.removeCallbacksAndMessages(null); | |||
} | |||
} | |||
@Override | |||
public void onDestroy() { | |||
super.onDestroy(); | |||
if(handler != null){ | |||
handler.removeCallbacksAndMessages(null); | |||
handler = null; | |||
} | |||
} | |||
} |
@@ -50,14 +50,22 @@ public class HomeFoodsFragment extends BaseFragment { | |||
private HomeGoodsViewModel viewModel; | |||
private boolean connect = false; | |||
private Handler handler = new Handler(Looper.getMainLooper()){ | |||
@Override | |||
public void handleMessage(@NonNull Message msg) { | |||
super.handleMessage(msg); | |||
switch (msg.what){ | |||
case 1: | |||
viewBinding.topbar.removeAllRightViews(); | |||
viewBinding.topbar.addRightTextButton("设备状态:"+(ModbusHelper.get().getConnected() ? "已连接" : "未连接"),R.id.status_image); | |||
if(connect != ModbusHelper.get().getConnected() ){ | |||
viewBinding.topbar.removeAllRightViews(); | |||
if(ModbusHelper.get().getConnected()){ | |||
viewBinding.topbar.addRightTextButton("设备状态:未连接",R.id.status_image); | |||
}else { | |||
viewBinding.topbar.addRightTextButton("设备状态:已连接",R.id.status_image); | |||
} | |||
} | |||
if(hasMessages(1)){ | |||
removeMessages(1); | |||
} | |||
@@ -43,7 +43,7 @@ import java.util.ArrayList; | |||
/** | |||
* @author: liup | |||
* @description: | |||
* @description: 本地菜谱 | |||
* @date: 2024/5/9 9:48. | |||
*/ | |||
public class LocalGoodsFragment extends BaseFragment { | |||
@@ -126,6 +126,9 @@ public class LocalGoodsFragment extends BaseFragment { | |||
DisplayManager.scaleViewGroup(binding.getRoot()); | |||
binding.title.setText("删除菜品"); | |||
binding.edit.setText("是否删除["+bean.name+"]下所有属性组合配方?"); | |||
binding.cancel.setOnClickListener(view1 ->{ | |||
xCom.dismissX(); | |||
}); | |||
binding.submit.setOnClickListener(view1 -> { | |||
GoodsProcessDetailDBUtil.deleteByGoodsId(bean.id); | |||
SubAttributeGroupDBUtil.deleteByGoodsId(bean.id); | |||
@@ -122,7 +122,6 @@ public class HomeGoodsViewModel extends ViewModel { | |||
if(!SubAttributeGroupDBUtil.isExist(goods.id,goodsTechnologyActionListBean.getGoodsAttributeId())){ | |||
BPA_GOODS_SUBATTRIBUTE_GROUP group = new BPA_GOODS_SUBATTRIBUTE_GROUP(); | |||
group.name = goodsTechnologyActionListBean.getGoodsAttributeId();// | |||
group.id = goodsTechnologyActionListBean.getGoodsAttributeId(); | |||
group.goodsId = goods.id; | |||
groupList.add(goodsTechnologyActionListBean.getGoodsAttributeId()); | |||
SubAttributeGroupDBUtil.add(group); | |||
@@ -1,4 +1,4 @@ | |||
package com.bonait.bnframework.ViewModel.CustomView; | |||
package com.bonait.bnframework.ui.widget; | |||
import android.content.Context; | |||
import android.util.AttributeSet; | |||
@@ -10,7 +10,6 @@ import android.widget.LinearLayout; | |||
import androidx.annotation.Nullable; | |||
import com.bonait.bnframework.R; | |||
import com.bonait.bnframework.common.constant.ConfigName; | |||
import com.bonait.bnframework.common.helper.I.MyClickListener; | |||
import java.util.ArrayList; | |||
@@ -20,7 +19,7 @@ import butterknife.BindView; | |||
import butterknife.ButterKnife; | |||
import butterknife.OnClick; | |||
public class fire_control extends LinearLayout { | |||
public class FireView extends LinearLayout { | |||
@BindView(R.id.colse) | |||
ImageView colse; | |||
@BindView(R.id.hl1) | |||
@@ -58,8 +57,16 @@ public class fire_control extends LinearLayout { | |||
*/ | |||
public MyClickListener mListener=null; | |||
private View root; | |||
/** | |||
* 是否可以点击 | |||
*/ | |||
private boolean enableClick = false; | |||
public void setEnableClick(boolean enableClick){ | |||
this.enableClick = enableClick; | |||
} | |||
public fire_control(Context context, @Nullable AttributeSet attrs) { | |||
public FireView(Context context, @Nullable AttributeSet attrs) { | |||
super(context, attrs); | |||
root=LayoutInflater.from(context).inflate(R.layout.item_fire_control, this); | |||
ButterKnife.bind(this, root); | |||
@@ -78,18 +85,6 @@ public class fire_control extends LinearLayout { | |||
ImageViews.add(hl8); | |||
ImageViews.add(hl9); | |||
ImageViews.add(hl10); | |||
// if(ConfigName.getInstance().HeatingGear.get(ConfigName.getInstance().HuoLi)!=null) | |||
// { | |||
// int k= ConfigName.getInstance().HeatingGear.get(ConfigName.getInstance().HuoLi); | |||
// for (int i = 0; i<ImageViews.size(); i++) | |||
// { | |||
// if((i)>(k-1)) | |||
// { | |||
// ImageViews.get(i).setVisibility(View.GONE); | |||
// } | |||
// } | |||
// } | |||
//设置 关闭 | |||
SetLevel(0); | |||
} | |||
@@ -97,6 +92,9 @@ public class fire_control extends LinearLayout { | |||
@OnClick({R.id.colse, | |||
R.id.hl1,R.id.hl2,R.id.hl3,R.id.hl4,R.id.hl5,R.id.hl6,R.id.hl7,R.id.hl8,R.id.hl9,R.id.hl10}) | |||
public void onViewClicked(View view) { | |||
if(!enableClick){ | |||
return; | |||
} | |||
switch (view.getId()) { | |||
case R.id.colse://选择菜谱按钮点击 | |||
if(Status) |
@@ -11,6 +11,7 @@ import android.widget.Toast; | |||
import androidx.core.content.ContextCompat; | |||
import com.bonait.bnframework.MainApplication; | |||
import com.bonait.bnframework.R; | |||
import com.bonait.bnframework.common.utils.DimensUtil; | |||
import com.bonait.bnframework.common.utils.DisplayManager; | |||
@@ -23,18 +24,36 @@ import com.bonait.bnframework.databinding.ViewLayoutToastBinding; | |||
*/ | |||
public class NewToastUtil { | |||
public static void showToast(Context context,String message,int duration){ | |||
Toast toast = new Toast(context); | |||
private static NewToastUtil instance; | |||
private Toast toast; | |||
public static synchronized NewToastUtil getInstance(){ | |||
if(instance == null){ | |||
synchronized (NewToastUtil.class){ | |||
if(instance == null){ | |||
instance = new NewToastUtil(); | |||
} | |||
} | |||
} | |||
return instance; | |||
} | |||
public void showToast(String message){ | |||
if(toast != null){ | |||
toast.cancel(); | |||
} | |||
toast = new Toast(MainApplication.getContext()); | |||
// toast.cancel(); | |||
String content = message; | |||
if(message.length() > 50){ | |||
content = message.substring(0,50)+"..."; | |||
} | |||
View layout = LayoutInflater.from(context).inflate(R.layout.view_layout_toast,null); | |||
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,DimensUtil.getDimens(180)); | |||
toast.setDuration(duration); | |||
toast.setDuration(Toast.LENGTH_SHORT); | |||
toast.setView(layout); | |||
toast.show(); | |||
} | |||
@@ -45,10 +64,12 @@ public class NewToastUtil { | |||
* @param context | |||
* @param message | |||
* @param colorText | |||
* @param duration | |||
*/ | |||
public void showToastTextColor(Context context,String message,String colorText,int color,int duration){ | |||
Toast toast = new Toast(context); | |||
public void showToastRedColor(Context context,String message,String colorText){ | |||
if(toast == null){ | |||
toast = new Toast(MainApplication.getContext()); | |||
} | |||
toast.cancel(); | |||
String content = message; | |||
if(message.length() > 50){ | |||
content = message.substring(0,50)+"..."; | |||
@@ -57,13 +78,13 @@ public class NewToastUtil { | |||
ViewLayoutToastBinding binding = ViewLayoutToastBinding.bind(layout); | |||
DisplayManager.scaleViewGroup(binding.getRoot()); | |||
SpannableStringBuilder spannableStringBuilder = new SpannableStringBuilder(content); | |||
int index = content.indexOf(colorText); | |||
int index = colorText==null?0:content.indexOf(colorText); | |||
if(index>0){ | |||
spannableStringBuilder.setSpan(new ForegroundColorSpan(ContextCompat.getColor(context, color)),index,index+colorText.length(), Spanned.SPAN_EXCLUSIVE_INCLUSIVE); | |||
spannableStringBuilder.setSpan(new ForegroundColorSpan(ContextCompat.getColor(context, R.color.red_primary)),index,index+colorText.length(), Spanned.SPAN_EXCLUSIVE_INCLUSIVE); | |||
} | |||
binding.toastText.setText(spannableStringBuilder); | |||
toast.setGravity(Gravity.BOTTOM,0,DimensUtil.getDimens(180)); | |||
toast.setDuration(duration); | |||
toast.setDuration(Toast.LENGTH_SHORT); | |||
toast.setView(layout); | |||
toast.show(); | |||
} | |||
@@ -0,0 +1,197 @@ | |||
package com.bonait.bnframework.ui.widget; | |||
import android.content.Context; | |||
import android.text.InputType; | |||
import android.util.AttributeSet; | |||
import android.view.LayoutInflater; | |||
import android.view.View; | |||
import android.widget.AdapterView; | |||
import android.widget.ArrayAdapter; | |||
import android.widget.RelativeLayout; | |||
import com.bonait.bnframework.R; | |||
import com.bonait.bnframework.ViewModel.CustomView.item_gx; | |||
import com.bonait.bnframework.common.utils.DisplayManager; | |||
import com.bonait.bnframework.databinding.ViewProcessValueBinding; | |||
import java.util.ArrayList; | |||
import java.util.LinkedHashMap; | |||
import java.util.Map; | |||
import butterknife.ButterKnife; | |||
/** | |||
* @author: liup | |||
* @description: | |||
* @date: 2024/5/16 17:53. | |||
*/ | |||
public class ProcessValueView extends RelativeLayout { | |||
private ViewProcessValueBinding viewBinding; | |||
public item_gx model; | |||
private Map<String,Integer> editsp_map = new LinkedHashMap<>(); | |||
private SpinnerSelectCallBack listener; | |||
public ProcessValueView(Context context, AttributeSet attrs,item_gx mode) { | |||
super(context, attrs); | |||
View root= LayoutInflater.from(context).inflate(R.layout.view_process_value, this); | |||
ButterKnife.bind(this, root); | |||
viewBinding = ViewProcessValueBinding.bind(root); | |||
DisplayManager.scaleViewGroup(viewBinding.getRoot()); | |||
model = mode; | |||
Init(); | |||
} | |||
public void setMainFoodName(String name){ | |||
if(model.name.equals("主料名称")){ | |||
viewBinding.edit.setText(name); | |||
} | |||
} | |||
public void setListener(SpinnerSelectCallBack listener){ | |||
this.listener = listener; | |||
} | |||
public void Init() | |||
{ | |||
viewBinding.name.setText(model.name.trim()); | |||
if(model.IsWL) | |||
{ | |||
viewBinding.check.setVisibility(View.VISIBLE); | |||
}else | |||
{ | |||
viewBinding.check.setVisibility(View.GONE); | |||
} | |||
viewBinding.check.setChecked(false); | |||
switch (model.datatype) | |||
{ | |||
case 0://数字 | |||
viewBinding.spinner.setVisibility(View.GONE); | |||
viewBinding.edit.setVisibility(View.VISIBLE); | |||
if(model.IsWL) | |||
{ | |||
viewBinding.edit.setInputType(InputType.TYPE_CLASS_NUMBER | InputType.TYPE_NUMBER_FLAG_DECIMAL); | |||
}else | |||
{ | |||
viewBinding.edit.setInputType(InputType.TYPE_CLASS_NUMBER); | |||
} | |||
viewBinding.edit.setText("0".toCharArray(), 0, "0".length()); | |||
break; | |||
case 1://字符串 | |||
viewBinding.spinner.setVisibility(View.GONE); | |||
viewBinding.edit.setVisibility(View.VISIBLE); | |||
viewBinding.edit.setInputType(InputType.TYPE_CLASS_TEXT); | |||
break; | |||
case 2://选项 | |||
viewBinding.spinner.setVisibility(View.VISIBLE); | |||
viewBinding.edit.setVisibility(View.GONE); | |||
if(!model.data.isEmpty() && model.data.contains("、")) | |||
{ | |||
String[] res = model.data.split("[、]"); | |||
int index=1; | |||
for (String item: res) | |||
{ | |||
editsp_map.put(item,index); | |||
index++; | |||
} | |||
}else | |||
{ | |||
editsp_map.put(model.data,1); | |||
} | |||
ArrayAdapter<String> adapter2 = new ArrayAdapter<>(getContext(), R.layout.spinner_text_item, new ArrayList<>(editsp_map.keySet())); | |||
adapter2.setDropDownViewResource(R.layout.spinner_dropdown_item); | |||
viewBinding.spinner.setAdapter(adapter2); | |||
viewBinding.spinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() { | |||
@Override | |||
public void onItemSelected(AdapterView<?> adapterView, View view, int i, long l) { | |||
if(listener!=null && viewBinding.spinner.getSelectedItem().toString().contains("号位")){ | |||
listener.onSelect(i,viewBinding.spinner.getSelectedItem().toString()); | |||
} | |||
} | |||
@Override | |||
public void onNothingSelected(AdapterView<?> adapterView) { | |||
} | |||
}); | |||
break; | |||
} | |||
} | |||
/** | |||
* 获取选择变量 | |||
* @return | |||
*/ | |||
public String GetValues() | |||
{ | |||
String ResStu=""; | |||
switch (model.datatype) | |||
{ | |||
case 0://数字 | |||
String text= viewBinding.edit.getText().toString(); | |||
if(text.isEmpty()) | |||
{ | |||
text="0"; | |||
} | |||
if(model.IsWL) | |||
{ | |||
double val=Double.parseDouble(text); | |||
if(viewBinding.check.isChecked()) | |||
{ | |||
ResStu=String.format("%.1f", val); | |||
} | |||
}else | |||
{ | |||
int val=Integer.parseInt(text); | |||
ResStu=String.valueOf(val); | |||
} | |||
break; | |||
case 1://字符串 | |||
if(model.IsWL) | |||
{ | |||
if(viewBinding.check.isChecked()) | |||
{ | |||
ResStu=viewBinding.edit.getText().toString(); | |||
} | |||
}else | |||
{ | |||
ResStu=viewBinding.edit.getText().toString(); | |||
} | |||
break; | |||
case 2://选项 | |||
ResStu=viewBinding.spinner.getSelectedItem().toString(); | |||
break; | |||
} | |||
return ResStu; | |||
} | |||
/** | |||
* 设置变量 | |||
* @param value | |||
*/ | |||
public void SetValues(String value) | |||
{ | |||
switch (model.datatype) | |||
{ | |||
case 0://数字 | |||
case 1://字符串 | |||
viewBinding.edit.setText(value); | |||
if(model.IsWL) | |||
{ | |||
viewBinding.check.setChecked(true); | |||
} | |||
break; | |||
case 2://选项 | |||
Object res= editsp_map.get(value); | |||
if(res!=null) | |||
{ | |||
viewBinding.spinner.setSelection((int)res-1); | |||
} | |||
break; | |||
} | |||
} | |||
public interface SpinnerSelectCallBack{ | |||
void onSelect(int position,String name); | |||
} | |||
} |
@@ -0,0 +1,55 @@ | |||
package com.bonait.bnframework.ui.widget; | |||
import android.content.Context; | |||
import android.util.AttributeSet; | |||
import android.util.DisplayMetrics; | |||
import androidx.recyclerview.widget.LinearLayoutManager; | |||
import androidx.recyclerview.widget.LinearSmoothScroller; | |||
import androidx.recyclerview.widget.RecyclerView; | |||
import com.bonait.bnframework.R; | |||
/** | |||
* @author: liup | |||
* @description: 滚动偏移量 | |||
* @date: 2024/5/17 9:42. | |||
*/ | |||
public class SmoothLayoutManager extends LinearLayoutManager { | |||
public SmoothLayoutManager(Context context) { | |||
super(context); | |||
} | |||
public SmoothLayoutManager(Context context, int orientation, boolean reverseLayout) { | |||
super(context, orientation, reverseLayout); | |||
} | |||
public SmoothLayoutManager(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) { | |||
super(context, attrs, defStyleAttr, defStyleRes); | |||
} | |||
@Override | |||
public void smoothScrollToPosition(RecyclerView recyclerView, RecyclerView.State state, int position) { | |||
Context context = recyclerView.getContext(); | |||
LinearSmoothScroller smoothScroller = new LinearSmoothScroller(context) { | |||
@Override | |||
public int calculateDtToFit(int viewStart, int viewEnd, int boxStart, int boxEnd, | |||
int snapPreference) { | |||
return boxStart - viewStart + context.getResources().getDimensionPixelSize(R.dimen.dp_50); | |||
} | |||
// @Override | |||
// public int getVerticalSnapPreference() { | |||
// return SNAP_TO_START; | |||
// } | |||
@Override | |||
protected float calculateSpeedPerPixel(DisplayMetrics displayMetrics) { | |||
return 50f / displayMetrics.densityDpi; | |||
} | |||
}; | |||
smoothScroller.setTargetPosition(position); | |||
startSmoothScroll(smoothScroller); | |||
} | |||
} |
@@ -0,0 +1,21 @@ | |||
<?xml version="1.0" encoding="utf-8"?> | |||
<selector xmlns:android="http://schemas.android.com/apk/res/android"> | |||
<item android:state_pressed="true"> | |||
<shape> | |||
<solid android:color="#FF9800"/> | |||
<corners android:bottomLeftRadius="@dimen/dp_50" | |||
android:topLeftRadius="@dimen/dp_50"/> | |||
</shape> | |||
</item> | |||
<item> | |||
<shape> | |||
<solid android:color="#567722"/> | |||
<corners android:bottomLeftRadius="@dimen/dp_50" | |||
android:topLeftRadius="@dimen/dp_50"/> | |||
</shape> | |||
</item> | |||
</selector> |
@@ -0,0 +1,21 @@ | |||
<?xml version="1.0" encoding="utf-8"?> | |||
<selector xmlns:android="http://schemas.android.com/apk/res/android"> | |||
<item android:state_pressed="true"> | |||
<shape> | |||
<solid android:color="#FF9800"/> | |||
<corners android:bottomRightRadius="@dimen/dp_50" | |||
android:topRightRadius="@dimen/dp_50"/> | |||
</shape> | |||
</item> | |||
<item> | |||
<shape> | |||
<solid android:color="#567722"/> | |||
<corners android:bottomRightRadius="@dimen/dp_50" | |||
android:topRightRadius="@dimen/dp_50"/> | |||
</shape> | |||
</item> | |||
</selector> |
@@ -0,0 +1,15 @@ | |||
<?xml version="1.0" encoding="utf-8"?> | |||
<selector xmlns:android="http://schemas.android.com/apk/res/android"> | |||
<item android:state_selected="true" | |||
> | |||
<shape > | |||
<solid android:color="@color/textbg_green"/> | |||
</shape> | |||
</item> | |||
<item > | |||
<shape > | |||
<solid android:color="@color/white"/> | |||
</shape> | |||
</item> | |||
</selector> |
@@ -0,0 +1,6 @@ | |||
<?xml version="1.0" encoding="utf-8"?> | |||
<selector xmlns:android="http://schemas.android.com/apk/res/android"> | |||
<item android:state_selected="true" android:color="@color/white"/> | |||
<item android:color="@color/black"/> | |||
</selector> |
@@ -0,0 +1,17 @@ | |||
<?xml version="1.0" encoding="utf-8"?> | |||
<selector xmlns:android="http://schemas.android.com/apk/res/android"> | |||
<item android:state_pressed="true"> | |||
<shape> | |||
<corners android:radius="@dimen/dp_15"/> | |||
<solid android:color="#FF9800"/> | |||
</shape> | |||
</item> | |||
<item> | |||
<shape> | |||
<corners android:radius="@dimen/dp_15"/> | |||
<solid android:color="#BEAA6A"/> | |||
</shape> | |||
</item> | |||
</selector> |
@@ -68,7 +68,7 @@ | |||
app:layout_constraintTop_toBottomOf="@id/line1" | |||
app:layout_constraintBottom_toBottomOf="parent" | |||
app:layout_constraintLeft_toLeftOf="parent" | |||
android:layout_marginLeft="@dimen/dp_290" | |||
android:layout_marginLeft="@dimen/dp_320" | |||
android:background="@color/color3" | |||
/> | |||
@@ -82,7 +82,7 @@ | |||
android:text="步骤:" | |||
android:layout_marginTop="@dimen/dp_10" | |||
android:textColor="#567722" | |||
android:layout_marginLeft="@dimen/dp_20" | |||
android:layout_marginLeft="@dimen/dp_10" | |||
/> | |||
<TextView | |||
android:id="@+id/tv_2" | |||
@@ -99,17 +99,20 @@ | |||
<!--步骤列表--> | |||
<androidx.recyclerview.widget.RecyclerView | |||
android:id="@+id/recycle_step" | |||
android:layout_width="@dimen/dp_250" | |||
android:layout_width="@dimen/dp_300" | |||
android:layout_height="0dp" | |||
app:layout_constraintLeft_toLeftOf="parent" | |||
app:layout_constraintTop_toBottomOf="@id/tv_1" | |||
app:layout_constraintBottom_toBottomOf="parent" | |||
android:layout_marginLeft="@dimen/dp_10" | |||
android:layout_marginTop="@dimen/dp_10" | |||
android:layout_marginLeft="@dimen/dp_20" | |||
android:layout_marginBottom="@dimen/dp_110" | |||
/> | |||
android:orientation="vertical" | |||
app:layout_constraintBottom_toBottomOf="parent" | |||
app:layout_constraintLeft_toLeftOf="parent" | |||
app:layout_constraintTop_toBottomOf="@id/tv_1" | |||
app:layoutManager="com.bonait.bnframework.ui.widget.SmoothLayoutManager" | |||
/> | |||
<LinearLayout | |||
android:id="@+id/ll_1" | |||
@@ -125,7 +128,7 @@ | |||
<Spinner | |||
android:id="@+id/spinner_process" | |||
style="@style/commonSpinnerStyle" | |||
android:layout_width="@dimen/dp_260" | |||
android:layout_width="@dimen/dp_200" | |||
android:layout_height="@dimen/dp_70" | |||
/> | |||
</LinearLayout> | |||
@@ -162,58 +165,93 @@ | |||
android:text="模拟炒制" | |||
/> | |||
<LinearLayout | |||
android:layout_width="0dp" | |||
<!--添加--> | |||
<TextView | |||
android:id="@+id/btn_add" | |||
android:layout_width="@dimen/dp_150" | |||
style="@style/TextView_btn_normal" | |||
android:text="+添加" | |||
app:layout_constraintLeft_toLeftOf="@id/line2" | |||
app:layout_constraintRight_toRightOf="parent" | |||
app:layout_constraintBottom_toBottomOf="parent" | |||
android:layout_marginBottom="@dimen/dp_120" | |||
android:gravity="center" | |||
android:layout_height="wrap_content"> | |||
<!--添加--> | |||
<TextView | |||
android:id="@+id/btn_add" | |||
android:layout_width="@dimen/dp_150" | |||
style="@style/TextView_btn_normal" | |||
android:text="+添加" | |||
android:layout_marginRight="@dimen/dp_80" | |||
/> | |||
<!--插入--> | |||
<TextView | |||
android:id="@+id/btn_insert" | |||
android:layout_width="@dimen/dp_150" | |||
style="@style/TextView_btn_normal" | |||
android:text="插入" | |||
/> | |||
</LinearLayout> | |||
android:layout_marginLeft="@dimen/dp_60" | |||
/> | |||
<!--插入--> | |||
<TextView | |||
android:id="@+id/btn_insert" | |||
android:layout_width="@dimen/dp_150" | |||
style="@style/TextView_btn_normal" | |||
android:text="插入" | |||
app:layout_constraintLeft_toLeftOf="@id/line2" | |||
android:layout_marginLeft="@dimen/dp_270" | |||
app:layout_constraintBottom_toBottomOf="parent" | |||
android:layout_marginBottom="@dimen/dp_120" | |||
/> | |||
<!--向上向下插入--> | |||
<LinearLayout | |||
android:layout_width="0dp" | |||
android:layout_width="wrap_content" | |||
android:layout_height="wrap_content" | |||
app:layout_constraintLeft_toLeftOf="@id/line2" | |||
app:layout_constraintRight_toRightOf="parent" | |||
app:layout_constraintBottom_toBottomOf="parent" | |||
android:layout_marginBottom="@dimen/dp_25" | |||
android:layout_marginBottom="@dimen/dp_190" | |||
android:layout_marginLeft="@dimen/dp_260" | |||
android:gravity="center" | |||
android:layout_height="wrap_content"> | |||
<!--修改--> | |||
<TextView | |||
android:id="@+id/btn_update" | |||
android:layout_width="@dimen/dp_150" | |||
style="@style/TextView_btn_normal" | |||
android:background="@drawable/bg_round50_green_btn" | |||
android:text="修改" | |||
android:layout_marginRight="@dimen/dp_80" | |||
/> | |||
<!--删除--> | |||
<TextView | |||
android:id="@+id/btn_delete" | |||
android:layout_width="@dimen/dp_150" | |||
style="@style/TextView_btn_normal" | |||
android:background="@drawable/bg_round50_red_btn" | |||
android:text="删除" | |||
/> | |||
android:orientation="vertical" | |||
android:visibility="visible" | |||
> | |||
<LinearLayout | |||
android:id="@+id/ll_insert" | |||
android:layout_width="wrap_content" | |||
android:layout_height="match_parent" | |||
android:orientation="vertical" | |||
android:translationY="@dimen/dp_160" | |||
> | |||
<!--向上插入--> | |||
<TextView | |||
android:id="@+id/btn_insert_up" | |||
android:layout_width="@dimen/dp_170" | |||
style="@style/TextView_btn_normal" | |||
android:text="向上插入" | |||
android:layout_marginBottom="@dimen/dp_10" | |||
/> | |||
<!--向下插入--> | |||
<TextView | |||
android:id="@+id/btn_insert_down" | |||
android:layout_width="@dimen/dp_170" | |||
style="@style/TextView_btn_normal" | |||
android:text="向下插入" | |||
android:layout_marginBottom="@dimen/dp_10" | |||
/> | |||
</LinearLayout> | |||
</LinearLayout> | |||
<!--修改--> | |||
<TextView | |||
android:id="@+id/btn_update" | |||
android:layout_width="@dimen/dp_150" | |||
style="@style/TextView_btn_normal" | |||
android:background="@drawable/bg_round50_green_btn" | |||
android:text="修改" | |||
app:layout_constraintLeft_toLeftOf="@id/line2" | |||
app:layout_constraintBottom_toBottomOf="parent" | |||
android:layout_marginBottom="@dimen/dp_25" | |||
android:layout_marginLeft="@dimen/dp_60" | |||
/> | |||
<!--删除--> | |||
<TextView | |||
android:id="@+id/btn_delete" | |||
android:layout_width="@dimen/dp_150" | |||
style="@style/TextView_btn_normal" | |||
android:background="@drawable/bg_round50_red_btn" | |||
android:text="删除" | |||
app:layout_constraintLeft_toLeftOf="@id/line2" | |||
app:layout_constraintBottom_toBottomOf="parent" | |||
android:layout_marginBottom="@dimen/dp_25" | |||
android:layout_marginLeft="@dimen/dp_270" | |||
/> | |||
</androidx.constraintlayout.widget.ConstraintLayout> | |||
@@ -0,0 +1,81 @@ | |||
<?xml version="1.0" encoding="utf-8"?> | |||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" | |||
android:layout_width="match_parent" | |||
xmlns:app="http://schemas.android.com/apk/res-auto" | |||
xmlns:tools="http://schemas.android.com/tools" | |||
android:background="#7F000000" | |||
android:layout_height="match_parent"> | |||
<!--子属性选择--> | |||
<androidx.constraintlayout.widget.ConstraintLayout | |||
android:layout_width="@dimen/dp_660" | |||
android:layout_height="wrap_content" | |||
app:layout_constraintLeft_toLeftOf="parent" | |||
app:layout_constraintRight_toRightOf="parent" | |||
app:layout_constraintTop_toTopOf="parent" | |||
app:layout_constraintBottom_toBottomOf="parent" | |||
android:background="@drawable/bg_round25_white"> | |||
<TextView | |||
android:id="@+id/title2" | |||
android:layout_width="match_parent" | |||
android:layout_height="@dimen/dp_80" | |||
app:layout_constraintTop_toTopOf="parent" | |||
app:layout_constraintLeft_toLeftOf="parent" | |||
android:background="@drawable/bg_round25_top_yellow" | |||
style="@style/TextView_btn_dialog" | |||
android:text="导入已有组合工序" | |||
/> | |||
<ListView | |||
android:id="@+id/list_attribute" | |||
android:layout_width="@dimen/dp_620" | |||
android:layout_height="wrap_content" | |||
app:layout_constraintTop_toBottomOf="@id/title2" | |||
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_constraintBottom_toBottomOf="parent" | |||
android:layout_marginLeft="@dimen/dp_480" | |||
android:layout_marginBottom="@dimen/dp_20" | |||
android:layout_marginTop="@dimen/dp_30" | |||
style="@style/TextView_btn_dialog" | |||
android:text="确定" | |||
/> | |||
<TextView | |||
android:id="@+id/btn_close2" | |||
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" | |||
android:layout_marginBottom="@dimen/dp_20" | |||
style="@style/TextView_btn_dialog" | |||
android:text="取消" | |||
/> | |||
<ImageView | |||
android:id="@+id/btn_close" | |||
android:layout_width="@dimen/dp_80" | |||
android:layout_height="@dimen/dp_80" | |||
app:layout_constraintRight_toRightOf="parent" | |||
app:layout_constraintTop_toTopOf="parent" | |||
style="@style/TextView_btn_dialog" | |||
android:background="@mipmap/ic_clear_white_48dp" | |||
/> | |||
</androidx.constraintlayout.widget.ConstraintLayout> | |||
</androidx.constraintlayout.widget.ConstraintLayout> |
@@ -39,6 +39,19 @@ | |||
android:paddingRight="@dimen/dp_10" | |||
android:layout_gravity="center" | |||
/> | |||
<Button | |||
android:id="@+id/cancel" | |||
android:layout_width="@dimen/dp_155" | |||
android:layout_height="@dimen/dp_80" | |||
android:textSize="@dimen/sp_32" | |||
android:textColor="@color/white" | |||
android:text="取消" | |||
android:background="@drawable/bg_round25_yellow_btn" | |||
android:layout_gravity="bottom" | |||
android:layout_marginBottom="@dimen/dp_20" | |||
android:layout_marginLeft="@dimen/dp_30" | |||
/> | |||
<Button | |||
android:id="@+id/submit" | |||
android:layout_width="@dimen/dp_155" | |||
@@ -0,0 +1,45 @@ | |||
<?xml version="1.0" encoding="utf-8"?> | |||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" | |||
android:layout_width="match_parent" | |||
android:layout_height="match_parent" | |||
xmlns:app="http://schemas.android.com/apk/res-auto" | |||
xmlns:tools="http://schemas.android.com/tools"> | |||
<include | |||
android:id="@+id/layout_fire" | |||
android:layout_width="match_parent" | |||
android:layout_height="@dimen/dp_550" | |||
app:layout_constraintLeft_toLeftOf="parent" | |||
app:layout_constraintTop_toTopOf="parent" | |||
layout="@layout/layout_fire_control" | |||
android:visibility="gone" | |||
tools:visibility="visible" | |||
/> | |||
<include | |||
android:id="@+id/layout_food" | |||
android:layout_width="match_parent" | |||
android:layout_height="@dimen/dp_550" | |||
app:layout_constraintLeft_toLeftOf="parent" | |||
app:layout_constraintTop_toTopOf="parent" | |||
layout="@layout/layout_food_control" | |||
android:visibility="gone" | |||
/> | |||
<include | |||
android:id="@+id/layout_silos" | |||
android:layout_width="match_parent" | |||
android:layout_height="@dimen/dp_550" | |||
app:layout_constraintLeft_toLeftOf="parent" | |||
app:layout_constraintTop_toTopOf="parent" | |||
layout="@layout/layout_silos_control" | |||
android:visibility="gone" | |||
/> | |||
<include | |||
android:id="@+id/layout_stir" | |||
android:layout_width="match_parent" | |||
android:layout_height="@dimen/dp_550" | |||
app:layout_constraintLeft_toLeftOf="parent" | |||
app:layout_constraintTop_toTopOf="parent" | |||
layout="@layout/layout_stir_control" | |||
android:visibility="gone" | |||
/> | |||
</androidx.constraintlayout.widget.ConstraintLayout> |
@@ -225,17 +225,17 @@ | |||
android:gravity="center" | |||
app:layout_constraintLeft_toLeftOf="parent"> | |||
<TextView | |||
android:id="@+id/btn_next3" | |||
android:id="@+id/btn_edit_process" | |||
android:layout_width="@dimen/dp_255" | |||
android:layout_height="@dimen/dp_120" | |||
android:gravity="center" | |||
android:textSize="@dimen/sp_48" | |||
android:textColor="@color/white" | |||
android:background="@drawable/bg_round25_green_btn" | |||
android:text="编辑工艺" | |||
android:text="编辑工序" | |||
/> | |||
<TextView | |||
android:id="@+id/btn_last3" | |||
android:id="@+id/btn_to_cook" | |||
android:layout_width="@dimen/dp_255" | |||
android:layout_height="@dimen/dp_120" | |||
android:layout_marginLeft="@dimen/dp_50" | |||
@@ -0,0 +1,140 @@ | |||
<?xml version="1.0" encoding="utf-8"?> | |||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" | |||
android:layout_width="match_parent" | |||
android:layout_height="@dimen/dp_550" | |||
android:background="@color/white" | |||
xmlns:app="http://schemas.android.com/apk/res-auto" | |||
xmlns:tools="http://schemas.android.com/tools"> | |||
<TextView | |||
android:id="@+id/title_fire" | |||
android:layout_width="wrap_content" | |||
android:layout_height="wrap_content" | |||
app:layout_constraintTop_toTopOf="parent" | |||
app:layout_constraintLeft_toLeftOf="parent" | |||
android:textSize="@dimen/sp_42" | |||
android:textColor="#BEAA6A" | |||
android:textStyle="bold" | |||
android:text="加热模组:" | |||
android:paddingTop="@dimen/dp_20" | |||
android:paddingBottom="@dimen/dp_20" | |||
android:layout_marginLeft="@dimen/dp_20" | |||
/> | |||
<TextView | |||
android:id="@+id/tv_fire_select" | |||
android:layout_width="wrap_content" | |||
android:layout_height="@dimen/dp_70" | |||
app:layout_constraintTop_toBottomOf="@id/title_fire" | |||
app:layout_constraintLeft_toLeftOf="parent" | |||
android:layout_marginTop="@dimen/dp_40" | |||
android:layout_marginLeft="@dimen/dp_20" | |||
android:text="加热档位" | |||
android:textSize="@dimen/sp_36" | |||
android:gravity="center" | |||
/> | |||
<TextView | |||
android:id="@+id/btn_fire_down" | |||
android:layout_width="@dimen/dp_70" | |||
android:layout_height="@dimen/dp_70" | |||
android:background="@drawable/selector_text_click_yellow_round15" | |||
android:text="-" | |||
android:paddingLeft="@dimen/dp_20" | |||
android:paddingRight="@dimen/dp_20" | |||
android:gravity="center" | |||
android:textSize="@dimen/sp_36" | |||
android:textColor="@color/white" | |||
app:layout_constraintTop_toTopOf="@id/tv_fire_select" | |||
app:layout_constraintLeft_toRightOf="@id/tv_fire_select" | |||
android:layout_marginLeft="@dimen/dp_10" | |||
/> | |||
<com.litao.slider.NiftySlider | |||
android:id="@+id/fireProgress" | |||
android:layout_width="@dimen/dp_450" | |||
android:layout_height="wrap_content" | |||
android:layout_centerVertical="true" | |||
android:hapticFeedbackEnabled="true" | |||
android:stepSize="1" | |||
tools:value="2" | |||
android:valueFrom="0" | |||
android:valueTo="10" | |||
app:enableDrawHalo="false" | |||
app:thumbColor="@color/we_read_thumb_color" | |||
app:thumbRadius="13dp" | |||
app:thumbText="0" | |||
app:thumbTextBold="true" | |||
app:thumbTextColor="@color/we_read_theme_color" | |||
app:thumbTextSize="12sp" | |||
app:thumbWithinTrackBounds="true" | |||
app:trackColor="@color/pro1" | |||
app:trackColorInactive="@color/pro2" | |||
app:layout_constraintTop_toTopOf="@id/btn_fire_down" | |||
app:layout_constraintBottom_toBottomOf="@id/btn_fire_down" | |||
app:layout_constraintLeft_toRightOf="@id/btn_fire_down" | |||
android:layout_marginLeft="@dimen/dp_10" | |||
app:trackHeight="26dp" /> | |||
<TextView | |||
android:id="@+id/btn_fire_up" | |||
android:layout_width="@dimen/dp_70" | |||
android:layout_height="@dimen/dp_70" | |||
android:background="@drawable/selector_text_click_yellow_round15" | |||
android:text="+" | |||
android:paddingLeft="@dimen/dp_20" | |||
android:paddingRight="@dimen/dp_20" | |||
android:gravity="center" | |||
android:textSize="@dimen/sp_36" | |||
android:textColor="@color/white" | |||
app:layout_constraintTop_toTopOf="@id/tv_fire_select" | |||
app:layout_constraintLeft_toRightOf="@id/fireProgress" | |||
android:layout_marginLeft="@dimen/dp_10" | |||
/> | |||
<TextView | |||
android:id="@+id/btn_start_fire" | |||
android:layout_width="wrap_content" | |||
android:layout_height="@dimen/dp_120" | |||
android:textSize="@dimen/sp_42" | |||
android:text="启动加热" | |||
android:paddingLeft="@dimen/dp_40" | |||
android:paddingRight="@dimen/dp_40" | |||
android:layout_marginTop="@dimen/dp_80" | |||
android:layout_marginLeft="@dimen/dp_100" | |||
android:gravity="center" | |||
android:clickable="true" | |||
android:textColor="@color/white" | |||
android:background="@drawable/selector_text_click_yellow_round15" | |||
app:layout_constraintTop_toBottomOf="@id/tv_fire_select" | |||
app:layout_constraintLeft_toLeftOf="parent" | |||
/> | |||
<TextView | |||
android:id="@+id/btn_stop_fire" | |||
android:layout_width="wrap_content" | |||
android:text="停止加热" | |||
android:layout_height="@dimen/dp_120" | |||
android:textSize="@dimen/sp_42" | |||
android:paddingLeft="@dimen/dp_40" | |||
android:paddingRight="@dimen/dp_40" | |||
android:layout_marginTop="@dimen/dp_80" | |||
android:layout_marginLeft="@dimen/dp_120" | |||
android:gravity="center" | |||
android:textColor="@color/white" | |||
android:background="@drawable/selector_text_click_yellow_round15" | |||
app:layout_constraintTop_toBottomOf="@id/tv_fire_select" | |||
app:layout_constraintLeft_toRightOf="@id/btn_start_fire" | |||
/> | |||
<TextView | |||
android:id="@+id/btn_close1" | |||
android:layout_width="@dimen/dp_200" | |||
android:layout_height="@dimen/dp_100" | |||
app:layout_constraintRight_toRightOf="parent" | |||
app:layout_constraintBottom_toBottomOf="parent" | |||
android:gravity="center" | |||
android:textSize="@dimen/sp_42" | |||
android:textColor="#00A8E1" | |||
android:text="关 闭" | |||
android:textStyle="bold" | |||
/> | |||
</androidx.constraintlayout.widget.ConstraintLayout> |
@@ -0,0 +1,143 @@ | |||
<?xml version="1.0" encoding="utf-8"?> | |||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" | |||
android:layout_width="match_parent" | |||
android:layout_height="@dimen/dp_550" | |||
android:background="@color/white" | |||
xmlns:app="http://schemas.android.com/apk/res-auto" | |||
xmlns:tools="http://schemas.android.com/tools"> | |||
<ImageView | |||
android:id="@+id/img_mainfood" | |||
android:layout_width="@dimen/dp_600" | |||
android:layout_height="@dimen/dp_550" | |||
app:layout_constraintTop_toTopOf="parent" | |||
app:layout_constraintLeft_toLeftOf="parent" | |||
app:layout_constraintRight_toRightOf="parent" | |||
android:src="@mipmap/device_small_cook3" | |||
/> | |||
<TextView | |||
android:id="@+id/title_food" | |||
android:layout_width="wrap_content" | |||
android:layout_height="wrap_content" | |||
app:layout_constraintTop_toTopOf="parent" | |||
app:layout_constraintLeft_toLeftOf="parent" | |||
android:textSize="@dimen/sp_42" | |||
android:textColor="#BEAA6A" | |||
android:textStyle="bold" | |||
android:text="倒料模组:" | |||
android:paddingTop="@dimen/dp_20" | |||
android:layout_marginLeft="@dimen/dp_20" | |||
/> | |||
<TextView | |||
android:layout_width="wrap_content" | |||
android:layout_height="wrap_content" | |||
app:layout_constraintLeft_toRightOf="@id/title_food" | |||
app:layout_constraintBottom_toBottomOf="@id/title_food" | |||
android:layout_marginTop="@dimen/dp_20" | |||
android:text="(点击图中仓号即可倒料)" | |||
android:textColor="#BEAA6A" | |||
android:textSize="@dimen/sp_24" | |||
android:paddingBottom="@dimen/dp_10" | |||
/> | |||
<TextView | |||
android:id="@+id/btn_food1" | |||
android:layout_width="@dimen/dp_80" | |||
android:layout_height="@dimen/dp_80" | |||
android:text="①" | |||
android:textSize="@dimen/sp_54" | |||
android:textColor="@color/red_primary" | |||
android:gravity="center" | |||
app:layout_constraintLeft_toLeftOf="@id/img_mainfood" | |||
app:layout_constraintTop_toTopOf="@id/img_mainfood" | |||
android:layout_marginLeft="@dimen/dp_100" | |||
android:layout_marginTop="@dimen/dp_100" | |||
/> | |||
<TextView | |||
android:id="@+id/btn_food2" | |||
android:layout_width="@dimen/dp_80" | |||
android:layout_height="@dimen/dp_80" | |||
android:text="②" | |||
android:textSize="@dimen/sp_54" | |||
android:textColor="@color/red_primary" | |||
android:gravity="center" | |||
app:layout_constraintLeft_toLeftOf="@id/img_mainfood" | |||
app:layout_constraintTop_toTopOf="@id/img_mainfood" | |||
android:layout_marginLeft="@dimen/dp_250" | |||
android:layout_marginTop="@dimen/dp_100" | |||
/> | |||
<TextView | |||
android:id="@+id/btn_food3" | |||
android:layout_width="@dimen/dp_80" | |||
android:layout_height="@dimen/dp_80" | |||
android:text="③" | |||
android:textSize="@dimen/sp_54" | |||
android:textColor="@color/red_primary" | |||
android:gravity="center" | |||
app:layout_constraintLeft_toLeftOf="@id/img_mainfood" | |||
app:layout_constraintTop_toTopOf="@id/img_mainfood" | |||
android:layout_marginLeft="@dimen/dp_400" | |||
android:layout_marginTop="@dimen/dp_100" | |||
/> | |||
<TextView | |||
android:id="@+id/btn_food4" | |||
android:layout_width="@dimen/dp_80" | |||
android:layout_height="@dimen/dp_80" | |||
android:text="①" | |||
android:textSize="@dimen/sp_54" | |||
android:textColor="@color/red_primary" | |||
android:gravity="center" | |||
app:layout_constraintLeft_toLeftOf="@id/img_mainfood" | |||
app:layout_constraintTop_toTopOf="@id/img_mainfood" | |||
android:layout_marginLeft="@dimen/dp_100" | |||
android:layout_marginTop="@dimen/dp_300" | |||
/> | |||
<TextView | |||
android:id="@+id/btn_food5" | |||
android:layout_width="@dimen/dp_80" | |||
android:layout_height="@dimen/dp_80" | |||
android:text="②" | |||
android:textSize="@dimen/sp_54" | |||
android:textColor="@color/red_primary" | |||
android:gravity="center" | |||
app:layout_constraintLeft_toLeftOf="@id/img_mainfood" | |||
app:layout_constraintTop_toTopOf="@id/img_mainfood" | |||
android:layout_marginLeft="@dimen/dp_250" | |||
android:layout_marginTop="@dimen/dp_300" | |||
/> | |||
<TextView | |||
android:id="@+id/btn_food6" | |||
android:layout_width="@dimen/dp_80" | |||
android:layout_height="@dimen/dp_80" | |||
android:text="③" | |||
android:textSize="@dimen/sp_54" | |||
android:textColor="@color/red_primary" | |||
android:gravity="center" | |||
app:layout_constraintLeft_toLeftOf="@id/img_mainfood" | |||
app:layout_constraintTop_toTopOf="@id/img_mainfood" | |||
android:layout_marginLeft="@dimen/dp_400" | |||
android:layout_marginTop="@dimen/dp_300" | |||
/> | |||
<TextView | |||
android:id="@+id/btn_close1" | |||
android:layout_width="@dimen/dp_200" | |||
android:layout_height="@dimen/dp_100" | |||
app:layout_constraintRight_toRightOf="parent" | |||
app:layout_constraintBottom_toBottomOf="parent" | |||
android:gravity="center" | |||
android:textSize="@dimen/sp_42" | |||
android:textColor="#00A8E1" | |||
android:text="关 闭" | |||
android:textStyle="bold" | |||
/> | |||
</androidx.constraintlayout.widget.ConstraintLayout> |
@@ -0,0 +1,135 @@ | |||
<?xml version="1.0" encoding="utf-8"?> | |||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" | |||
android:layout_width="match_parent" | |||
android:layout_height="@dimen/dp_550" | |||
android:background="@color/white" | |||
xmlns:app="http://schemas.android.com/apk/res-auto" | |||
xmlns:tools="http://schemas.android.com/tools"> | |||
<TextView | |||
android:id="@+id/title_silos" | |||
android:layout_width="wrap_content" | |||
android:layout_height="wrap_content" | |||
android:paddingTop="@dimen/dp_20" | |||
app:layout_constraintTop_toTopOf="parent" | |||
app:layout_constraintLeft_toLeftOf="parent" | |||
android:textSize="@dimen/sp_42" | |||
android:textColor="#BEAA6A" | |||
android:textStyle="bold" | |||
android:text="调料模组:" | |||
android:paddingBottom="@dimen/dp_20" | |||
android:layout_marginLeft="@dimen/dp_20" | |||
/> | |||
<EditText | |||
android:id="@+id/editWater" | |||
android:layout_width="@dimen/dp_500" | |||
android:layout_height="@dimen/dp_90" | |||
android:layout_marginLeft="@dimen/dp_60" | |||
android:background="@drawable/input_bj" | |||
android:hint="加水重量(g)" | |||
android:inputType="number" | |||
android:maxLines="1" | |||
android:padding="@dimen/dp_5" | |||
android:layout_gravity="center_vertical" | |||
android:textSize="@dimen/sp_32" | |||
android:layout_marginTop="@dimen/dp_20" | |||
app:layout_constraintTop_toBottomOf="@id/title_silos" | |||
app:layout_constraintLeft_toLeftOf="parent"/> | |||
<TextView | |||
android:id="@+id/addWater" | |||
android:layout_width="@dimen/dp_180" | |||
android:layout_height="@dimen/dp_90" | |||
android:textSize="@dimen/sp_32" | |||
android:text="开始加水" | |||
android:gravity="center" | |||
android:textColor="@color/white" | |||
android:layout_marginLeft="@dimen/dp_20" | |||
android:background="@drawable/selector_text_click_yellow_round15" | |||
app:layout_constraintLeft_toRightOf="@id/editWater" | |||
app:layout_constraintTop_toTopOf="@id/editWater" | |||
/> | |||
<EditText | |||
android:id="@+id/editQianWater" | |||
android:layout_width="@dimen/dp_500" | |||
android:layout_height="@dimen/dp_90" | |||
android:layout_marginLeft="@dimen/dp_60" | |||
android:background="@drawable/input_bj" | |||
android:hint="加芡重量(g)" | |||
android:inputType="number" | |||
android:maxLines="1" | |||
android:padding="@dimen/dp_5" | |||
android:layout_gravity="center_vertical" | |||
android:textSize="@dimen/sp_32" | |||
android:layout_marginTop="@dimen/dp_20" | |||
app:layout_constraintTop_toBottomOf="@id/editWater" | |||
app:layout_constraintLeft_toLeftOf="parent"/> | |||
<TextView | |||
android:id="@+id/addQianWater" | |||
android:layout_width="@dimen/dp_180" | |||
android:layout_height="@dimen/dp_90" | |||
android:textSize="@dimen/sp_32" | |||
android:text="开始加芡" | |||
android:gravity="center" | |||
android:textColor="@color/white" | |||
android:layout_marginLeft="@dimen/dp_20" | |||
android:background="@drawable/selector_text_click_yellow_round15" | |||
app:layout_constraintLeft_toRightOf="@id/editQianWater" | |||
app:layout_constraintTop_toTopOf="@id/editQianWater" | |||
/> | |||
<Spinner | |||
android:id="@+id/spinnerSeasoningWater" | |||
style="@style/commonSpinnerStyle" | |||
android:layout_width="@dimen/dp_330" | |||
android:layout_height="@dimen/dp_90" | |||
android:layout_centerVertical="true" | |||
android:layout_marginTop="@dimen/dp_20" | |||
app:layout_constraintTop_toBottomOf="@id/editQianWater" | |||
app:layout_constraintLeft_toLeftOf="@id/editQianWater"/> | |||
<EditText | |||
android:id="@+id/editSeasoningWater" | |||
android:layout_width="@dimen/dp_150" | |||
android:layout_height="@dimen/dp_90" | |||
android:background="@drawable/input_bj" | |||
android:hint="重量(g)" | |||
android:inputType="number" | |||
android:maxLines="1" | |||
android:padding="@dimen/dp_5" | |||
android:layout_gravity="center_vertical" | |||
android:gravity="center" | |||
android:textSize="@dimen/sp_32" | |||
android:layout_marginTop="@dimen/dp_20" | |||
app:layout_constraintTop_toBottomOf="@id/addQianWater" | |||
app:layout_constraintRight_toRightOf="@id/editQianWater"/> | |||
<TextView | |||
android:id="@+id/addSeasoningWater" | |||
android:layout_width="@dimen/dp_180" | |||
android:layout_height="@dimen/dp_90" | |||
android:textSize="@dimen/sp_36" | |||
android:text="添加调料" | |||
android:textColor="@color/white" | |||
android:gravity="center" | |||
android:layout_marginTop="@dimen/dp_20" | |||
android:background="@drawable/selector_text_click_yellow_round15" | |||
app:layout_constraintTop_toBottomOf="@id/addQianWater" | |||
app:layout_constraintLeft_toLeftOf="@id/addQianWater" | |||
/> | |||
<TextView | |||
android:id="@+id/btn_close1" | |||
android:layout_width="@dimen/dp_200" | |||
android:layout_height="@dimen/dp_100" | |||
app:layout_constraintRight_toRightOf="parent" | |||
app:layout_constraintBottom_toBottomOf="parent" | |||
android:gravity="center" | |||
android:textSize="@dimen/sp_42" | |||
android:textColor="#00A8E1" | |||
android:text="关 闭" | |||
android:textStyle="bold" | |||
/> | |||
</androidx.constraintlayout.widget.ConstraintLayout> |
@@ -0,0 +1,180 @@ | |||
<?xml version="1.0" encoding="utf-8"?> | |||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" | |||
android:layout_width="match_parent" | |||
android:layout_height="@dimen/dp_550" | |||
android:background="@color/white" | |||
xmlns:app="http://schemas.android.com/apk/res-auto" | |||
xmlns:tools="http://schemas.android.com/tools"> | |||
<TextView | |||
android:id="@+id/title_fire" | |||
android:layout_width="wrap_content" | |||
android:layout_height="wrap_content" | |||
app:layout_constraintTop_toTopOf="parent" | |||
app:layout_constraintLeft_toLeftOf="parent" | |||
android:textSize="@dimen/sp_42" | |||
android:textColor="#BEAA6A" | |||
android:textStyle="bold" | |||
android:text="搅拌模组:" | |||
android:paddingTop="@dimen/dp_20" | |||
android:paddingBottom="@dimen/dp_20" | |||
android:paddingLeft="@dimen/dp_20" | |||
/> | |||
<TextView | |||
android:id="@+id/tv_fire_select" | |||
android:layout_width="wrap_content" | |||
android:layout_height="@dimen/dp_70" | |||
app:layout_constraintTop_toBottomOf="@id/title_fire" | |||
app:layout_constraintLeft_toLeftOf="parent" | |||
android:layout_marginTop="@dimen/dp_20" | |||
android:layout_marginLeft="@dimen/dp_20" | |||
android:text="搅拌档位" | |||
android:textSize="@dimen/sp_36" | |||
android:gravity="center" | |||
/> | |||
<TextView | |||
android:id="@+id/btn_fire_down" | |||
android:layout_width="@dimen/dp_70" | |||
android:layout_height="@dimen/dp_70" | |||
android:background="@drawable/selector_text_click_yellow_round15" | |||
android:text="-" | |||
android:paddingLeft="@dimen/dp_20" | |||
android:paddingRight="@dimen/dp_20" | |||
android:gravity="center" | |||
android:textSize="@dimen/sp_36" | |||
android:textColor="@color/white" | |||
app:layout_constraintTop_toTopOf="@id/tv_fire_select" | |||
app:layout_constraintLeft_toRightOf="@id/tv_fire_select" | |||
android:layout_marginLeft="@dimen/dp_10" | |||
/> | |||
<com.litao.slider.NiftySlider | |||
android:id="@+id/fireProgress" | |||
android:layout_width="@dimen/dp_450" | |||
android:layout_height="wrap_content" | |||
android:layout_centerVertical="true" | |||
android:hapticFeedbackEnabled="true" | |||
android:stepSize="1" | |||
tools:value="2" | |||
android:valueFrom="0" | |||
android:valueTo="10" | |||
app:enableDrawHalo="false" | |||
app:thumbColor="@color/we_read_thumb_color" | |||
app:thumbRadius="13dp" | |||
app:thumbText="0" | |||
app:thumbTextBold="true" | |||
app:thumbTextColor="@color/we_read_theme_color" | |||
app:thumbTextSize="12sp" | |||
app:thumbWithinTrackBounds="true" | |||
app:trackColor="@color/pro1" | |||
app:trackColorInactive="@color/pro2" | |||
app:layout_constraintTop_toTopOf="@id/btn_fire_down" | |||
app:layout_constraintBottom_toBottomOf="@id/btn_fire_down" | |||
app:layout_constraintLeft_toRightOf="@id/btn_fire_down" | |||
android:layout_marginLeft="@dimen/dp_10" | |||
app:trackHeight="26dp" /> | |||
<TextView | |||
android:id="@+id/btn_fire_up" | |||
android:layout_width="@dimen/dp_70" | |||
android:layout_height="@dimen/dp_70" | |||
android:background="@drawable/selector_text_click_yellow_round15" | |||
android:text="+" | |||
android:paddingLeft="@dimen/dp_20" | |||
android:paddingRight="@dimen/dp_20" | |||
android:gravity="center" | |||
android:textSize="@dimen/sp_36" | |||
android:textColor="@color/white" | |||
app:layout_constraintTop_toTopOf="@id/tv_fire_select" | |||
app:layout_constraintLeft_toRightOf="@id/fireProgress" | |||
android:layout_marginLeft="@dimen/dp_10" | |||
/> | |||
<TextView | |||
android:id="@+id/btn_stir_start" | |||
android:layout_width="wrap_content" | |||
android:layout_height="@dimen/dp_100" | |||
android:textSize="@dimen/sp_42" | |||
android:text="启动搅拌" | |||
android:paddingTop="@dimen/dp_10" | |||
android:paddingBottom="@dimen/dp_10" | |||
android:paddingLeft="@dimen/dp_40" | |||
android:paddingRight="@dimen/dp_40" | |||
android:layout_marginTop="@dimen/dp_30" | |||
android:layout_marginLeft="@dimen/dp_80" | |||
android:gravity="center" | |||
android:clickable="true" | |||
android:textColor="@color/white" | |||
android:background="@drawable/selector_text_click_yellow_round15" | |||
app:layout_constraintTop_toBottomOf="@id/tv_fire_select" | |||
app:layout_constraintLeft_toLeftOf="parent" | |||
/> | |||
<TextView | |||
android:id="@+id/btn_stir_stop" | |||
android:layout_width="wrap_content" | |||
android:layout_height="@dimen/dp_100" | |||
android:textSize="@dimen/sp_42" | |||
android:text="停止搅拌" | |||
android:paddingTop="@dimen/dp_10" | |||
android:paddingBottom="@dimen/dp_10" | |||
android:paddingLeft="@dimen/dp_40" | |||
android:paddingRight="@dimen/dp_40" | |||
android:layout_marginLeft="@dimen/dp_120" | |||
android:gravity="center" | |||
android:textColor="@color/white" | |||
android:background="@drawable/selector_text_click_yellow_round15" | |||
app:layout_constraintTop_toTopOf="@id/btn_stir_start" | |||
app:layout_constraintLeft_toRightOf="@id/btn_stir_start" | |||
/> | |||
<TextView | |||
android:id="@+id/btn_stir_up" | |||
android:layout_width="wrap_content" | |||
android:layout_height="@dimen/dp_100" | |||
android:textSize="@dimen/sp_42" | |||
android:text="电机上升" | |||
android:paddingTop="@dimen/dp_10" | |||
android:paddingBottom="@dimen/dp_10" | |||
android:paddingLeft="@dimen/dp_40" | |||
android:paddingRight="@dimen/dp_40" | |||
android:layout_marginTop="@dimen/dp_20" | |||
android:layout_marginLeft="@dimen/dp_80" | |||
android:gravity="center" | |||
android:textColor="@color/white" | |||
android:background="@drawable/selector_text_click_yellow_round15" | |||
app:layout_constraintTop_toBottomOf="@id/btn_stir_start" | |||
app:layout_constraintLeft_toLeftOf="parent" | |||
/> | |||
<TextView | |||
android:id="@+id/btn_stir_down" | |||
android:layout_width="wrap_content" | |||
android:layout_height="@dimen/dp_100" | |||
android:textSize="@dimen/sp_42" | |||
android:text="电机下降" | |||
android:paddingTop="@dimen/dp_10" | |||
android:paddingBottom="@dimen/dp_10" | |||
android:paddingLeft="@dimen/dp_40" | |||
android:paddingRight="@dimen/dp_40" | |||
android:layout_marginLeft="@dimen/dp_120" | |||
android:gravity="center" | |||
android:textColor="@color/white" | |||
android:background="@drawable/selector_text_click_yellow_round15" | |||
app:layout_constraintTop_toTopOf="@id/btn_stir_up" | |||
app:layout_constraintLeft_toRightOf="@id/btn_stir_up" | |||
/> | |||
<TextView | |||
android:id="@+id/btn_close1" | |||
android:layout_width="@dimen/dp_200" | |||
android:layout_height="@dimen/dp_100" | |||
app:layout_constraintRight_toRightOf="parent" | |||
app:layout_constraintBottom_toBottomOf="parent" | |||
android:gravity="center" | |||
android:textSize="@dimen/sp_42" | |||
android:textColor="#00A8E1" | |||
android:text="关 闭" | |||
android:textStyle="bold" | |||
/> | |||
</androidx.constraintlayout.widget.ConstraintLayout> |
@@ -117,17 +117,6 @@ | |||
android:gravity="center" | |||
/> | |||
<!-- <com.bonait.bnframework.ViewModel.CustomView.fire_control--> | |||
<!-- android:id="@+id/tv_fire_control"--> | |||
<!-- android:layout_width="wrap_content"--> | |||
<!-- android:layout_height="@dimen/dp_50"--> | |||
<!-- app:layout_constraintTop_toBottomOf="@id/tv1"--> | |||
<!-- app:layout_constraintLeft_toLeftOf="parent"--> | |||
<!-- android:layout_marginTop="@dimen/dp_20"--> | |||
<!-- android:layout_marginLeft="@dimen/dp_40"--> | |||
<!-- android:gravity="center"--> | |||
<!-- />--> | |||
<TextView | |||
android:id="@+id/tvDown" | |||
android:layout_width="wrap_content" | |||
@@ -0,0 +1,36 @@ | |||
<?xml version="1.0" encoding="utf-8"?> | |||
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" | |||
android:layout_width="match_parent" | |||
android:layout_height="match_parent"> | |||
<TextView | |||
android:id="@+id/deviceConnect" | |||
android:layout_width="wrap_content" | |||
android:layout_height="wrap_content" | |||
android:padding="@dimen/dp_10" | |||
android:textSize="@dimen/sp_32" | |||
android:textColor="@color/black" | |||
android:textStyle="bold" | |||
android:text="设备状态:" | |||
/> | |||
<TextView | |||
android:id="@+id/deviceErrorCode" | |||
android:layout_width="wrap_content" | |||
android:layout_height="wrap_content" | |||
android:padding="@dimen/dp_10" | |||
android:textSize="@dimen/sp_32" | |||
android:textColor="@color/black" | |||
android:textStyle="bold" | |||
android:text="设备信息:" | |||
android:layout_marginTop="@dimen/dp_50" | |||
/> | |||
<include | |||
android:id="@+id/device" | |||
android:layout_width="match_parent" | |||
android:layout_height="wrap_content" | |||
layout="@layout/view_device_control" | |||
android:layout_marginTop="@dimen/dp_150" | |||
/> | |||
</FrameLayout> |
@@ -2,102 +2,102 @@ | |||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" | |||
xmlns:tools="http://schemas.android.com/tools" | |||
android:layout_width="wrap_content" | |||
android:layout_height="@dimen/dp_50" | |||
android:layout_height="@dimen/dp_40" | |||
android:orientation="horizontal" | |||
tools:ignore="MissingDefaultResource"> | |||
<ImageView | |||
android:id="@+id/colse" | |||
android:layout_width="wrap_content" | |||
android:layout_height="match_parent" | |||
android:layout_width="@dimen/dp_40" | |||
android:layout_height="@dimen/dp_40" | |||
android:layout_gravity="center_vertical" | |||
android:layout_marginRight="@dimen/dp_10" | |||
android:layout_marginRight="@dimen/dp_5" | |||
android:scaleType="fitCenter" | |||
android:src="@mipmap/guangji"/> | |||
<ImageView | |||
android:id="@+id/hl1" | |||
android:scaleType="fitCenter" | |||
android:layout_width="wrap_content" | |||
android:layout_height="match_parent" | |||
android:layout_marginRight="@dimen/dp_10" | |||
android:layout_width="@dimen/dp_40" | |||
android:layout_height="@dimen/dp_40" | |||
android:layout_marginRight="@dimen/dp_5" | |||
android:layout_gravity="center_vertical" | |||
android:src="@mipmap/hlwqd"/> | |||
<ImageView | |||
android:id="@+id/hl2" | |||
android:scaleType="fitCenter" | |||
android:layout_width="wrap_content" | |||
android:layout_height="match_parent" | |||
android:layout_marginRight="@dimen/dp_10" | |||
android:layout_width="@dimen/dp_40" | |||
android:layout_height="@dimen/dp_40" | |||
android:layout_marginRight="@dimen/dp_5" | |||
android:layout_gravity="center_vertical" | |||
android:src="@mipmap/hlwqd"/> | |||
<ImageView | |||
android:id="@+id/hl3" | |||
android:scaleType="fitCenter" | |||
android:layout_width="wrap_content" | |||
android:layout_height="match_parent" | |||
android:layout_marginRight="@dimen/dp_10" | |||
android:layout_width="@dimen/dp_40" | |||
android:layout_height="@dimen/dp_40" | |||
android:layout_marginRight="@dimen/dp_5" | |||
android:layout_gravity="center_vertical" | |||
android:src="@mipmap/hlwqd"/> | |||
<ImageView | |||
android:id="@+id/hl4" | |||
android:scaleType="fitCenter" | |||
android:layout_width="wrap_content" | |||
android:layout_height="match_parent" | |||
android:layout_marginRight="@dimen/dp_10" | |||
android:layout_width="@dimen/dp_40" | |||
android:layout_height="@dimen/dp_40" | |||
android:layout_marginRight="@dimen/dp_5" | |||
android:layout_gravity="center_vertical" | |||
android:src="@mipmap/hlwqd"/> | |||
<ImageView | |||
android:id="@+id/hl5" | |||
android:scaleType="fitCenter" | |||
android:layout_width="wrap_content" | |||
android:layout_height="match_parent" | |||
android:layout_marginRight="@dimen/dp_10" | |||
android:layout_width="@dimen/dp_40" | |||
android:layout_height="@dimen/dp_40" | |||
android:layout_marginRight="@dimen/dp_5" | |||
android:layout_gravity="center_vertical" | |||
android:src="@mipmap/hlwqd"/> | |||
<ImageView | |||
android:id="@+id/hl6" | |||
android:scaleType="fitCenter" | |||
android:layout_width="wrap_content" | |||
android:layout_height="match_parent" | |||
android:layout_marginRight="@dimen/dp_10" | |||
android:layout_width="@dimen/dp_40" | |||
android:layout_height="@dimen/dp_40" | |||
android:layout_marginRight="@dimen/dp_5" | |||
android:layout_gravity="center_vertical" | |||
android:src="@mipmap/hlwqd"/> | |||
<ImageView | |||
android:id="@+id/hl7" | |||
android:scaleType="fitCenter" | |||
android:layout_width="wrap_content" | |||
android:layout_height="match_parent" | |||
android:layout_marginRight="@dimen/dp_10" | |||
android:layout_width="@dimen/dp_40" | |||
android:layout_height="@dimen/dp_40" | |||
android:layout_marginRight="@dimen/dp_5" | |||
android:layout_gravity="center_vertical" | |||
android:src="@mipmap/hlwqd"/> | |||
<ImageView | |||
android:id="@+id/hl8" | |||
android:scaleType="fitCenter" | |||
android:layout_width="wrap_content" | |||
android:layout_height="match_parent" | |||
android:layout_marginRight="@dimen/dp_10" | |||
android:layout_width="@dimen/dp_40" | |||
android:layout_height="@dimen/dp_40" | |||
android:layout_marginRight="@dimen/dp_5" | |||
android:layout_gravity="center_vertical" | |||
android:src="@mipmap/hlwqd"/> | |||
<ImageView | |||
android:id="@+id/hl9" | |||
android:scaleType="fitCenter" | |||
android:layout_width="wrap_content" | |||
android:layout_height="match_parent" | |||
android:layout_marginRight="@dimen/dp_10" | |||
android:layout_width="@dimen/dp_40" | |||
android:layout_height="@dimen/dp_40" | |||
android:layout_marginRight="@dimen/dp_5" | |||
android:layout_gravity="center_vertical" | |||
android:src="@mipmap/hlwqd"/> | |||
<ImageView | |||
android:id="@+id/hl10" | |||
android:scaleType="fitCenter" | |||
android:layout_width="wrap_content" | |||
android:layout_height="match_parent" | |||
android:layout_marginRight="@dimen/dp_10" | |||
android:layout_width="@dimen/dp_40" | |||
android:layout_height="@dimen/dp_40" | |||
android:layout_marginRight="@dimen/dp_5" | |||
android:layout_gravity="center_vertical" | |||
android:src="@mipmap/hlwqd"/> | |||
</LinearLayout> |
@@ -2,13 +2,13 @@ | |||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" | |||
xmlns:app="http://schemas.android.com/apk/res-auto" | |||
xmlns:tools="http://schemas.android.com/tools" | |||
android:layout_width="@dimen/dp_185" | |||
android:layout_height="@dimen/dp_185" | |||
android:layout_width="@dimen/dp_200" | |||
android:layout_height="@dimen/dp_200" | |||
> | |||
<androidx.constraintlayout.widget.ConstraintLayout | |||
android:layout_width="@dimen/dp_185" | |||
android:layout_height="@dimen/dp_215" | |||
android:layout_width="@dimen/dp_200" | |||
android:layout_height="@dimen/dp_200" | |||
> | |||
<ImageView | |||
@@ -31,7 +31,7 @@ | |||
tools:text="三月瓜" | |||
android:textAlignment="center" | |||
android:textColor="@color/black" | |||
android:textSize="@dimen/sp_26" | |||
android:textSize="@dimen/sp_32" | |||
android:textStyle="bold" | |||
android:ellipsize="middle" | |||
android:lines="1" | |||
@@ -0,0 +1,57 @@ | |||
<?xml version="1.0" encoding="utf-8"?> | |||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" | |||
android:layout_width="@dimen/dp_300" | |||
android:layout_height="wrap_content" | |||
xmlns:app="http://schemas.android.com/apk/res-auto" | |||
xmlns:tools="http://schemas.android.com/tools" | |||
android:id="@+id/root" | |||
android:orientation="vertical" | |||
> | |||
<LinearLayout | |||
android:layout_width="match_parent" | |||
android:orientation="horizontal" | |||
android:layout_height="@dimen/dp_70"> | |||
<TextView | |||
android:id="@+id/name" | |||
android:layout_width="@dimen/dp_140" | |||
android:layout_height="@dimen/dp_70" | |||
app:layout_constraintLeft_toLeftOf="parent" | |||
app:layout_constraintTop_toTopOf="parent" | |||
android:textColor="@drawable/selector_select_step_text_color" | |||
android:background="@drawable/selector_select_step_text_bg" | |||
tools:text="1.液体料" | |||
android:textSize="@dimen/sp_32" | |||
android:gravity="center_vertical" | |||
android:duplicateParentState="true" | |||
tools:background="@color/textbg_green" | |||
/> | |||
<ImageView | |||
android:id="@+id/remove_up" | |||
android:layout_width="@dimen/dp_70" | |||
android:layout_height="@dimen/dp_70" | |||
android:src="@mipmap/ll5" | |||
android:layout_marginLeft="@dimen/dp_10" | |||
/> | |||
<ImageView | |||
android:id="@+id/remove_down" | |||
android:layout_width="@dimen/dp_70" | |||
android:layout_height="@dimen/dp_70" | |||
android:src="@mipmap/ll6" | |||
android:layout_marginLeft="@dimen/dp_10" | |||
/> | |||
</LinearLayout> | |||
<!-- <TextView--> | |||
<!-- android:layout_width="match_parent"--> | |||
<!-- android:layout_height="wrap_content"--> | |||
<!-- android:textColor="@color/color4"--> | |||
<!-- android:textSize="@dimen/sp_24"--> | |||
<!-- tools:text="asasasasasas"--> | |||
<!-- android:paddingRight="@dimen/dp_30"--> | |||
<!-- android:paddingLeft="@dimen/dp_30"--> | |||
<!-- android:paddingBottom="@dimen/dp_10"--> | |||
<!-- />--> | |||
</LinearLayout> |
@@ -0,0 +1,52 @@ | |||
<?xml version="1.0" encoding="utf-8"?> | |||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" | |||
xmlns:app="http://schemas.android.com/apk/res-auto" | |||
xmlns:tools="http://schemas.android.com/tools" | |||
android:layout_width="@dimen/dp_430" | |||
android:layout_height="@dimen/dp_70" | |||
android:layout_marginBottom="@dimen/dp_10" | |||
android:id="@+id/root" | |||
android:gravity="center_vertical" | |||
android:orientation="horizontal"> | |||
<CheckBox | |||
android:id="@+id/check" | |||
android:layout_width="wrap_content" | |||
android:layout_height="wrap_content" | |||
android:layout_centerVertical="true" | |||
android:layout_marginLeft="@dimen/dp_10" | |||
android:buttonTint="@color/radiusImageView_selected_mask_color"/> | |||
<TextView | |||
android:id="@+id/name" | |||
android:paddingLeft="@dimen/dp_5" | |||
android:paddingRight="@dimen/dp_10" | |||
android:layout_width="@dimen/dp_190" | |||
android:layout_height="@dimen/dp_70" | |||
tools:text="液体料液体料液体料" | |||
android:textSize="@dimen/sp_28" | |||
android:maxLines="1" | |||
android:maxLength="10" | |||
android:gravity="center_vertical" | |||
android:layout_centerVertical="true" | |||
android:layout_toRightOf="@id/check" | |||
android:ellipsize="end" | |||
/> | |||
<Spinner | |||
android:id="@+id/spinner" | |||
style="@style/commonSpinnerStyle" | |||
android:layout_width="@dimen/dp_200" | |||
android:layout_height="@dimen/dp_70" | |||
android:layout_centerVertical="true" | |||
android:layout_alignParentRight="true" | |||
tools:visibility="visible" | |||
android:visibility="gone"/> | |||
<EditText | |||
android:id="@+id/edit" | |||
android:layout_width="@dimen/dp_200" | |||
android:layout_height="@dimen/dp_70" | |||
android:background="@drawable/input_bj" | |||
android:layout_alignParentRight="true" | |||
android:inputType="text" | |||
android:maxLines="1" | |||
android:padding="@dimen/dp_3" | |||
android:textSize="@dimen/sp_32" /> | |||
</RelativeLayout> |
@@ -0,0 +1,85 @@ | |||
<?xml version="1.0" encoding="utf-8"?> | |||
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" | |||
android:layout_width="match_parent" | |||
android:layout_height="match_parent" | |||
xmlns:tools="http://schemas.android.com/tools"> | |||
<ImageView | |||
android:id="@+id/img_device" | |||
android:layout_width="match_parent" | |||
android:layout_height="@dimen/dp_800" | |||
android:src="@mipmap/device_small_cook1" | |||
/> | |||
<TextView | |||
android:id="@+id/tv_tip" | |||
android:layout_width="wrap_content" | |||
android:layout_height="wrap_content" | |||
android:text="点击图片特定位置可调试对应功能" | |||
android:textColor="@color/color4" | |||
android:textSize="@dimen/sp_22" | |||
android:layout_marginLeft="@dimen/dp_20" | |||
/> | |||
<TextView | |||
android:id="@+id/btn_mainFood" | |||
android:layout_width="@dimen/dp_200" | |||
android:layout_height="@dimen/dp_100" | |||
android:textSize="@dimen/sp_48" | |||
android:gravity="center" | |||
android:textColor="#FFEB3B" | |||
tools:text="主料仓" | |||
tools:background="#7f00A8E1" | |||
android:layout_marginLeft="@dimen/dp_280" | |||
android:layout_marginTop="@dimen/dp_150" | |||
/> | |||
<TextView | |||
android:id="@+id/btn_silos" | |||
android:layout_width="@dimen/dp_80" | |||
android:layout_height="@dimen/dp_100" | |||
android:textSize="@dimen/sp_48" | |||
android:gravity="center" | |||
android:textColor="#FFEB3B" | |||
tools:text="液料" | |||
tools:background="#7f00A8E1" | |||
android:layout_marginLeft="@dimen/dp_250" | |||
android:layout_marginTop="@dimen/dp_350" | |||
/> | |||
<TextView | |||
android:id="@+id/btn_stir" | |||
android:layout_width="@dimen/dp_100" | |||
android:layout_height="@dimen/dp_150" | |||
android:textSize="@dimen/sp_48" | |||
android:gravity="center" | |||
android:textColor="#FFEB3B" | |||
tools:text="搅拌" | |||
tools:background="#7f00A8E1" | |||
android:layout_marginLeft="@dimen/dp_340" | |||
android:layout_marginTop="@dimen/dp_300" | |||
/> | |||
<LinearLayout | |||
android:id="@+id/ll_fire" | |||
android:layout_width="wrap_content" | |||
android:layout_height="@dimen/dp_40" | |||
android:layout_marginTop="@dimen/dp_570" | |||
android:orientation="horizontal" | |||
android:layout_gravity="center_horizontal" | |||
tools:layout_width="@dimen/dp_200" | |||
/> | |||
<TextView | |||
android:id="@+id/btn_fire" | |||
android:layout_width="@dimen/dp_400" | |||
android:layout_height="@dimen/dp_110" | |||
android:textSize="@dimen/sp_48" | |||
android:gravity="center" | |||
android:textColor="#FFEB3B" | |||
tools:text="搅拌" | |||
tools:background="#7f00A8E1" | |||
android:layout_marginLeft="@dimen/dp_200" | |||
android:layout_marginTop="@dimen/dp_500" | |||
/> | |||
</FrameLayout> |
@@ -3,7 +3,7 @@ | |||
<resources> | |||
<dimen name="home_tab_height">56dp</dimen> | |||
<dimen name="common_content_spacing">@dimen/qmui_content_spacing_horizontal</dimen> | |||
<dimen name="text_size_normal">32sp</dimen> | |||
<!-- ListView --> | |||
<dimen name="list_divider_height">1px</dimen> | |||
<dimen name="list_divider_height_negative">-1px</dimen> | |||
@@ -1455,6 +1455,7 @@ | |||
<dimen name="sp_40">40sp</dimen> | |||
<dimen name="sp_42">42sp</dimen> | |||
<dimen name="sp_45">45sp</dimen> | |||
<dimen name="sp_46">46sp</dimen> | |||
<dimen name="sp_48">48sp</dimen> | |||
<dimen name="sp_54">54sp</dimen> | |||
<dimen name="sp_60">60sp</dimen> | |||
@@ -362,6 +362,12 @@ | |||
<item name="android:windowFullscreen">true</item> | |||
<!-- Dialog进入及退出动画 --> | |||
<!-- <item name="android:windowAnimationStyle">@style/ActionSheetDialogRight</item>--> | |||
<item name="android:windowAnimationStyle">@style/ActionSheetDialogRight</item> | |||
</style> | |||
<!-- ActionSheet进出动画 --> | |||
<style name="ActionSheetDialogRight" parent="@android:style/Animation.Dialog"> | |||
<item name="android:windowEnterAnimation">@anim/anim_top_in</item> | |||
<item name="android:windowExitAnimation">@anim/anim_top_out</item> | |||
</style> | |||
</resources> |