@@ -4,10 +4,10 @@ | |||
<selectionStates> | |||
<SelectionState runConfigName="app"> | |||
<option name="selectionMode" value="DROPDOWN" /> | |||
<DropdownSelection timestamp="2024-05-29T09:08:55.500220600Z"> | |||
<DropdownSelection timestamp="2024-05-30T03:09:49.889046200Z"> | |||
<Target type="DEFAULT_BOOT"> | |||
<handle> | |||
<DeviceId pluginId="Default" identifier="serial=127.0.0.1:7555;connection=65d0277c" /> | |||
<DeviceId pluginId="Default" identifier="serial=192.168.1.7:5555;connection=fbc1a4ca" /> | |||
</handle> | |||
</Target> | |||
</DropdownSelection> | |||
@@ -22,6 +22,14 @@ | |||
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" /> | |||
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" /> | |||
<uses-permission android:name="android.permission.CHANGE_WIFI_STATE" /> | |||
<uses-permission android:name="android.permission.READ_LOGS" | |||
tools:ignore="ProtectedPermissions" /> | |||
<uses-permission android:name="android.permission.DUMP" | |||
tools:ignore="ProtectedPermissions" /> | |||
<uses-permission android:name="android.permission.WRITE_SECURE_SETTINGS" | |||
tools:ignore="ProtectedPermissions" /> | |||
<uses-permission android:name="android.permission.SET_ANIMATION_SCALE" | |||
tools:ignore="ProtectedPermissions" /> | |||
<application | |||
android:name=".MainApplication" | |||
@@ -264,6 +264,11 @@ public class ModbusMaster implements IRead,IWrite ,IModbusMaster{ | |||
@Override | |||
public OperateResultT<Boolean> ReadBool(String address) { | |||
if(ConfigName.TEST){ | |||
AtomicReference<OperateResultT<Boolean>> resultValue=new AtomicReference<>(); | |||
resultValue.set(OperateResultT.CreateSuccess(false)); | |||
return resultValue.get(); | |||
} | |||
if(address==null||address.isEmpty()){ return OperateResultT.CreateFailedT("无效的地址");} | |||
if(!getConnected()){ return OperateResultT.CreateFailedT("设备未连接");} | |||
AtomicReference<OperateResultT<Boolean>>resultValue=new AtomicReference<>(); | |||
@@ -493,9 +498,12 @@ public class ModbusMaster implements IRead,IWrite ,IModbusMaster{ | |||
@Override | |||
public OperateResult WriteBool(String address, boolean value) { | |||
if(ConfigName.TEST){ | |||
return null; | |||
} | |||
if(address==null||address.isEmpty()){ return OperateResult.CreateFailed("无效的地址");} | |||
if(!getConnected()){ return OperateResult.CreateFailed("设备未连接");} | |||
AtomicReference<OperateResult>resultValue=new AtomicReference<>(); | |||
AtomicReference<OperateResult> resultValue=new AtomicReference<>(); | |||
new ExceptionServer(address, 1, new IExceptionHandling() { | |||
@Override | |||
public void onSuccess(int add) throws InterruptedException, ExecutionException, ModbusTransportException, ModbusInitException, ModbusRespException { | |||
@@ -650,6 +650,10 @@ public class ModbusHelper extends ModbusMaster { | |||
deviceErrorCode = bytes[0] & 0xFF; | |||
} | |||
} | |||
upError = ModbusHelper.get().getUpError(); | |||
upDownError = ModbusHelper.get().getUpDownError(); | |||
downError = ModbusHelper.get().getDownError(); | |||
stirError = ModbusHelper.get().getStirError(); | |||
Thread.sleep(ConfigName.TEST?500:200); | |||
}); | |||
} | |||
@@ -668,23 +672,16 @@ public class ModbusHelper extends ModbusMaster { | |||
return isDisconnect; | |||
} | |||
private boolean upError = false; | |||
private boolean upDownError = false; | |||
private boolean downError = false; | |||
private boolean stirError = false; | |||
public boolean hasErrorInfo(){ | |||
if(isBtnStop){ | |||
return true; | |||
} | |||
if(ModbusHelper.get().getUpError()){ | |||
return true; | |||
} | |||
if(ModbusHelper.get().getDownError()){ | |||
return true; | |||
} | |||
if(ModbusHelper.get().getUpDownError()){ | |||
return true; | |||
} | |||
if(ModbusHelper.get().getStirError()){ | |||
if(deviceErrorCode!=0){ | |||
return true; | |||
} | |||
return false; | |||
return isBtnStop || upError || downError || upDownError || stirError; | |||
} | |||
} | |||
@@ -111,6 +111,11 @@ public class LoginActivity extends BaseActivity{ | |||
initData(); | |||
} | |||
@Override | |||
protected void onResume() { | |||
super.onResume(); | |||
} | |||
/** | |||
* 初始化视图 | |||
* 对布局进行缩放 | |||
@@ -76,6 +76,12 @@ public class WelcomeActivity extends BaseActivity { | |||
} | |||
} | |||
@Override | |||
protected void onResume() { | |||
super.onResume(); | |||
// AdbCommandUtil.hideStatusBar(false); | |||
} | |||
private void initView(){ | |||
DisplayManager.scaleViewGroup(findViewById(R.id.root)); | |||
} | |||
@@ -39,6 +39,10 @@ public class imagebuttom extends LinearLayout { | |||
*/ | |||
public MyClickListener mListener=null; | |||
public void setmListener(MyClickListener mListener) { | |||
this.mListener = mListener; | |||
} | |||
private View root; | |||
public imagebuttom(Context context, @Nullable AttributeSet attrs) { | |||
@@ -51,7 +51,7 @@ public class NewExecuteTheRecipe { | |||
* 设置强制结束 | |||
*/ | |||
public static void setForcedEnd() { | |||
NewToastUtil.getInstance().showToast("客官,小菠萝正在强制结束当前炒制菜品,请耐心等候!!!"); | |||
NewToastUtil.getInstance().showToastBottom("客官,小菠萝正在强制结束当前炒制菜品,请耐心等候!!!"); | |||
IsForcedEnd = true; | |||
ModbusHelper.get().reset(); | |||
} | |||
@@ -74,11 +74,11 @@ public class NewExecuteTheRecipe { | |||
boolean status = false; | |||
try { | |||
if (IsForcedEnd) { | |||
NewToastUtil.getInstance().showToast("客官,小菠萝正在强制结束当前炒制菜品,请耐心等候!!!"); | |||
NewToastUtil.getInstance().showToastBottom("客官,小菠萝正在强制结束当前炒制菜品,请耐心等候!!!"); | |||
return false; | |||
} | |||
LogUtils.d("开始执行 "+ recipe.sort + "、" + recipe.processms); | |||
NewToastUtil.getInstance().showToast("开始执行:" + recipe.sort + "、" + recipe.processms); | |||
LogUtils.d("Execute开始执行 "+ recipe.sort + "、" + recipe.processms); | |||
NewToastUtil.getInstance().showToastBottom("开始执行:" + recipe.sort + "、" + recipe.processms); | |||
if (recipe.materialType == 0)//液体料 | |||
{ | |||
@@ -87,6 +87,7 @@ public class NewExecuteTheRecipe { | |||
{ | |||
ExecuteOperationSteps(recipe.processname, recipe.processvalue); | |||
} | |||
LogUtils.d("Execute结束执行 "+ recipe.sort + "、" + recipe.processms); | |||
} catch (Exception ex) { | |||
LogUtils.d("异常信息:" + ex.getMessage()); | |||
ToastUtils.error("异常信息:" + ex.getMessage()); | |||
@@ -174,7 +175,7 @@ public class NewExecuteTheRecipe { | |||
} | |||
EventBus.getDefault().post(new ProcessMakingEvent(2,"完成")); | |||
LogUtils.d("wait reset 物料结束时间 "+(System.currentTimeMillis()-a)); | |||
NewToastUtil.getInstance().showToast("投料完成"); | |||
NewToastUtil.getInstance().showToastBottom("投料完成"); | |||
} | |||
} catch (Exception ex) { | |||
LogUtils.d("异常信息:" + ex.getMessage()); | |||
@@ -261,7 +262,7 @@ public class NewExecuteTheRecipe { | |||
*/ | |||
private static void addMaterial(BPA_SILOS silos, int val) { | |||
try { | |||
NewToastUtil.getInstance().showToast("调料:"+silos.num+"号仓," + silos.name + ",重量" + val+"g"); | |||
NewToastUtil.getInstance().showToastBottom("调料:"+silos.num+"号仓," + silos.name + ",重量" + val+"g"); | |||
ModbusHelper.get().addMaterial(val,silos.num,false); | |||
} catch (Exception ex) { | |||
LogUtils.d("异常信息:" + ex.getMessage()); | |||
@@ -277,7 +278,7 @@ public class NewExecuteTheRecipe { | |||
private static boolean waiteMaterial(BPA_SILOS silos){ | |||
boolean isEnd = false; | |||
try { | |||
NewToastUtil.getInstance().showToast("调料:"+silos.name+",正在出调"); | |||
NewToastUtil.getInstance().showToastBottom("调料:"+silos.name+",正在出调"); | |||
isEnd = ModbusHelper.get().readMaterial(silos.num); | |||
} catch (Exception ex) { | |||
LogUtils.d("异常信息:" + ex.getMessage()); | |||
@@ -314,7 +315,7 @@ public class NewExecuteTheRecipe { | |||
} | |||
} | |||
String tip = type==0?"正转":"反转"; | |||
NewToastUtil.getInstance().showToast("工序:" + "搅拌控制," + tip+";档位,"+position/10+"档"); | |||
NewToastUtil.getInstance().showToastBottom("工序:" + "搅拌控制," + tip+";档位,"+position/10+"档"); | |||
if(!isTest){ | |||
ModbusHelper.get().setStirModel(type); | |||
} | |||
@@ -323,7 +324,7 @@ public class NewExecuteTheRecipe { | |||
String key = entry.getKey(); | |||
String value = entry.getValue(); | |||
if (key.contains("搅拌控制")) { | |||
NewToastUtil.getInstance().showToast("工序:" + key + "," + value); | |||
NewToastUtil.getInstance().showToastBottom("工序:" + key + "," + value); | |||
if(value.contains("启动")){ | |||
EventBus.getDefault().post(new ProcessMakingEvent(4,"启动搅拌")); | |||
if(!isTest){ | |||
@@ -387,7 +388,7 @@ public class NewExecuteTheRecipe { | |||
time2= Integer.parseInt(value); | |||
} | |||
} | |||
NewToastUtil.getInstance().showToast("工序:" + "搅拌控制,正反转切换;档位,"+position/10+"档"); | |||
NewToastUtil.getInstance().showToastBottom("工序:" + "搅拌控制,正反转切换;档位,"+position/10+"档"); | |||
if(!isTest){ | |||
ModbusHelper.get().setStirModel(2); | |||
ModbusHelper.get().setStirTime(1,time1); | |||
@@ -398,7 +399,7 @@ public class NewExecuteTheRecipe { | |||
String key = entry.getKey(); | |||
String value = entry.getValue(); | |||
if (key.contains("搅拌控制")) { | |||
NewToastUtil.getInstance().showToast("工序:" + key + "," + value); | |||
NewToastUtil.getInstance().showToastBottom("工序:" + key + "," + value); | |||
if(value.contains("启动")){ | |||
EventBus.getDefault().post(new ProcessMakingEvent(4,"启动搅拌")); | |||
if(!isTest){ | |||
@@ -458,7 +459,7 @@ public class NewExecuteTheRecipe { | |||
position = Integer.parseInt(value.replace("号位","")); | |||
} | |||
} | |||
NewToastUtil.getInstance().showToast("工序: 投入主料名称:"+name + " 主料位置:" + position); | |||
NewToastUtil.getInstance().showToastBottom("工序: 投入主料名称:"+name + " 主料位置:" + position); | |||
EventBus.getDefault().post(new ProcessMakingEvent(3,position+"|"+name)); | |||
if(!isTest){ | |||
ModbusHelper.get().addMainFood(position); | |||
@@ -536,7 +537,7 @@ public class NewExecuteTheRecipe { | |||
} | |||
} | |||
String tip = startHot? "启动加热":"停止加热"; | |||
NewToastUtil.getInstance().showToast("工序:" + "加热控制," + tip+";档位,"+hotNum/10+"档"); | |||
NewToastUtil.getInstance().showToastBottom("工序:" + "加热控制," + tip+";档位,"+hotNum/10+"档"); | |||
if(!isTest){ | |||
ModbusHelper.get().Heating(hotNum,startHot); | |||
} | |||
@@ -603,7 +604,7 @@ public class NewExecuteTheRecipe { | |||
private static boolean Read_Water(){ | |||
boolean isEnd = false; | |||
try { | |||
NewToastUtil.getInstance().showToast("液体:" + "正在出水"); | |||
NewToastUtil.getInstance().showToastBottom("液体:" + "正在出水"); | |||
isEnd = ModbusHelper.get().readWater(); | |||
} catch (Exception ex) { | |||
LogUtils.d("异常信息:" + ex.getMessage()); | |||
@@ -622,7 +623,7 @@ public class NewExecuteTheRecipe { | |||
for (HashMap.Entry<String, String> entry : data.entrySet()) { | |||
String key = entry.getKey(); | |||
String value = entry.getValue(); | |||
NewToastUtil.getInstance().showToast("工序:" + "等待"+value+"秒"); | |||
NewToastUtil.getInstance().showToastBottom("工序:" + "等待"+value+"秒"); | |||
if (key.contains("(秒)")) { | |||
int val = Integer.parseInt(value); | |||
Thread.sleep(val * 1000); | |||
@@ -645,7 +646,7 @@ public class NewExecuteTheRecipe { | |||
for (HashMap.Entry<String, String> entry : data.entrySet()) { | |||
String key = entry.getKey(); | |||
String value = entry.getValue(); | |||
NewToastUtil.getInstance().showToast("工序: 等待"+value+"秒后出菜"); | |||
NewToastUtil.getInstance().showToastBottom("工序: 等待"+value+"秒后出菜"); | |||
if (key.contains("(秒)")) { | |||
int val = Integer.parseInt(value); | |||
Thread.sleep(val * 1000); | |||
@@ -665,7 +666,7 @@ public class NewExecuteTheRecipe { | |||
} | |||
ModbusHelper.get().setUpdDownMotor(1); | |||
ModbusHelper.get().setCookStatus(false); | |||
NewToastUtil.getInstance().showToast("出菜完成,结束制作!"); | |||
NewToastUtil.getInstance().showToastBottom("出菜完成,结束制作!"); | |||
} catch (Exception ex) { | |||
LogUtils.d("异常信息:" + ex.getMessage()); | |||
ToastUtils.error("异常信息:" + ex.getMessage()); | |||
@@ -685,7 +686,7 @@ public class NewExecuteTheRecipe { | |||
for (HashMap.Entry<String, String> entry : data.entrySet()) { | |||
String key = entry.getKey(); | |||
String value = entry.getValue(); | |||
NewToastUtil.getInstance().showToast("工序:" + key + "," + value); | |||
NewToastUtil.getInstance().showToastBottom("工序:" + key + "," + value); | |||
if (key.contains("(克)")) { | |||
int val = Integer.parseInt(value); | |||
EventBus.getDefault().post(new ProcessMakingEvent(2,"勾芡")); | |||
@@ -710,7 +711,7 @@ public class NewExecuteTheRecipe { | |||
LogUtils.d("wait reset 结束勾芡时间 "+(System.currentTimeMillis()-a)); | |||
} | |||
} | |||
NewToastUtil.getInstance().showToast("出菜完成,结束制作!"); | |||
NewToastUtil.getInstance().showToastBottom("出菜完成,结束制作!"); | |||
} catch (Exception ex) { | |||
LogUtils.d("异常信息:" + ex.getMessage()); | |||
ToastUtils.error("异常信息:" + ex.getMessage()); | |||
@@ -724,7 +725,7 @@ public class NewExecuteTheRecipe { | |||
private static boolean Read_ThickenWater(){ | |||
boolean isEnd = false; | |||
try { | |||
NewToastUtil.getInstance().showToast("液体:" + "正在勾芡"); | |||
NewToastUtil.getInstance().showToastBottom("液体:" + "正在勾芡"); | |||
isEnd = ModbusHelper.get().readThickenWater(); | |||
} catch (Exception ex) { | |||
LogUtils.d("异常信息:" + ex.getMessage()); | |||
@@ -63,7 +63,6 @@ public class BaseActivity extends QMUIActivity implements EasyPermissions.Permis | |||
} | |||
} | |||
/** | |||
* 跳转界面 | |||
*/ | |||
@@ -29,7 +29,7 @@ public class ConfigName { | |||
//是否是测试模式 | |||
public final static boolean TEST = true; | |||
//日志打印 | |||
public final static boolean LOG_TEST = true; | |||
public final static boolean LOG_TEST = false; | |||
//region 单例模式 | |||
private static volatile ConfigName mInstance = null; //实例变量设置私有,防止直接通过类名访问 | |||
@@ -0,0 +1,49 @@ | |||
package com.bonait.bnframework.common.utils; | |||
import android.util.Log; | |||
import com.bonait.bnframework.HBL.Thread.ThreadManager; | |||
import java.io.DataOutputStream; | |||
import java.io.IOException; | |||
import java.nio.charset.StandardCharsets; | |||
/** | |||
* @author: liup | |||
* @description: adb命令 | |||
* @date: 2024/5/30 11:12. | |||
*/ | |||
public class AdbCommandUtil { | |||
/** | |||
* 隐藏显示状态栏 | |||
* @param hide | |||
* @return | |||
*/ | |||
public static void hideStatusBar(boolean hide) { | |||
ThreadManager.get().execute(new Thread(()->{ | |||
DataOutputStream dataOutputStream = null; | |||
try { | |||
// 申请su权限 | |||
Process process = Runtime.getRuntime().exec("su"); | |||
dataOutputStream = new DataOutputStream(process.getOutputStream()); | |||
// 执行命令 | |||
String command = hide?"am broadcast -a action.HIDE_STATUSBAR":"am broadcast -a action.SHOW_STATUSBAR"; | |||
dataOutputStream.write(command.getBytes(StandardCharsets.UTF_8)); | |||
dataOutputStream.flush(); | |||
dataOutputStream.writeBytes("exit\n"); | |||
dataOutputStream.flush(); | |||
process.waitFor(); | |||
} catch (Exception e) { | |||
Log.e("hideStatusBar", e.getMessage(), e); | |||
} finally { | |||
try { | |||
if (dataOutputStream != null) { | |||
dataOutputStream.close(); | |||
} | |||
} catch (IOException e) { | |||
Log.e("hideStatusBar", e.getMessage(), e); | |||
} | |||
} | |||
})); | |||
} | |||
} |
@@ -128,16 +128,18 @@ public class CookingActivity extends BaseActivity { | |||
} | |||
viewBinding.startGoodmake.setOnClickListener(v->{ | |||
if (ConfigName.getInstance().isFastClick()) { | |||
NewToastUtil.getInstance().showToast("点击太快了,请重试"); | |||
NewToastUtil.getInstance().showToastBottom("点击太快了,请重试"); | |||
return; | |||
} | |||
if(!isMaking){ | |||
isMaking = true; | |||
NewExecuteTheRecipe.IsForcedEnd = false; | |||
onRecordStart(); | |||
}else { | |||
isMaking = false; | |||
NewExecuteTheRecipe.IsForcedEnd = true; | |||
NewExecuteTheRecipe.IsStart = false; | |||
onRecordStop(); | |||
NewExecuteTheRecipe.IsForcedEnd = false; | |||
setReset(); | |||
} | |||
}); | |||
@@ -159,14 +161,6 @@ public class CookingActivity extends BaseActivity { | |||
if(!isTest){ | |||
ThreadManager.get().execute(new Thread(()->{ | |||
ModbusHelper.get().reset(); | |||
ModbusHelper.get().setCookStatus(false); | |||
})); | |||
ThreadManager.get().execute(new Thread(() -> { | |||
ModbusHelper.get().addWater(0f,true); | |||
ModbusHelper.get().addThickenWater(0f,true); | |||
for(int i =1;i<=9;i++){ | |||
ModbusHelper.get().addMaterial(0f,i,true); | |||
} | |||
})); | |||
} | |||
@@ -230,19 +224,19 @@ public class CookingActivity extends BaseActivity { | |||
ModbusHelper.get().setCookStatus(true); | |||
} | |||
for (BPA_GOODS_PROCESS_DETAIL item : goodsrecipes) { | |||
Message message = new Message(); | |||
message.what = MSG_Fresh_Step; | |||
message.arg1 = position; | |||
handler.sendMessage(message); | |||
if( !NewExecuteTheRecipe.IsStart){ | |||
NewToastUtil.getInstance().showToastBottom("客官,当前菜品已停止炒制!!!"); | |||
break; | |||
} | |||
if(!isTest){ | |||
if(ModbusHelper.get().isBtnStop()){ | |||
NewToastUtil.getInstance().showToast("设备已急停,请关闭急停按钮再调试!"); | |||
NewToastUtil.getInstance().showToastBottom("设备已急停,请关闭急停按钮再调试!"); | |||
isError = true; | |||
break; | |||
} | |||
if(ModbusHelper.get().hasErrorInfo()){ | |||
String tip = ModbusHelper.get().isBtnStop()?"设备已急停,请关闭急停按钮再调试!":"设备有报警,请前往设备故障页检查!"; | |||
NewToastUtil.getInstance().showToast(tip); | |||
NewToastUtil.getInstance().showToastBottom(tip); | |||
runOnUiThread(new Runnable() { | |||
@Override | |||
public void run() { | |||
@@ -253,13 +247,14 @@ public class CookingActivity extends BaseActivity { | |||
break; | |||
} | |||
} | |||
if( !NewExecuteTheRecipe.IsStart){ | |||
NewToastUtil.getInstance().showToast("客官,当前菜品已停止炒制!!!"); | |||
break; | |||
} | |||
Message message = new Message(); | |||
message.what = MSG_Fresh_Step; | |||
message.arg1 = position; | |||
handler.sendMessage(message); | |||
boolean status = NewExecuteTheRecipe.Execute(item); | |||
position++; | |||
} | |||
LogUtils.d("制作线程 MakeThread 结束 ==》 菜品配方 goodsrecipes="+goodsrecipes.toString()); | |||
} catch (Exception ex) { | |||
LogUtils.d("异常信息:" + ex.getMessage()); | |||
NewToastUtil.getInstance().showToastError("异常信息:" + ex.getMessage()); | |||
@@ -283,7 +278,9 @@ public class CookingActivity extends BaseActivity { | |||
onRecordStop(); | |||
if (NewExecuteTheRecipe.IsForcedEnd)//强制结束 | |||
{ | |||
NewToastUtil.getInstance().showToast("客官,当前菜品已强制结束!!!"); | |||
NewToastUtil.getInstance().showToastBottom("客官,当前菜品已强制结束!!!"); | |||
}else{ | |||
NewToastUtil.getInstance().showToastBottom("客官,当前菜品已制作完成!!!"); | |||
} | |||
} | |||
}); | |||
@@ -222,7 +222,7 @@ public class DiyProcessActivity extends BaseActivity { | |||
intent.putExtra("subAttributeGroupName",subAttributeGroupName); | |||
intent.putExtra("goodId",goodId); | |||
intent.putStringArrayListExtra("mainFoods",mainFoods); | |||
startActivityForResult(intent,REQUEST_RECORD_ACTIVITY); | |||
startActivity(intent); | |||
}); | |||
viewBinding.llInsert.setVisibility(View.GONE); | |||
viewBinding.btnInsert.setOnClickListener(view -> { | |||
@@ -609,21 +609,17 @@ public class DiyProcessActivity extends BaseActivity { | |||
} | |||
} | |||
public static final int REQUEST_RECORD_ACTIVITY = 1001; | |||
private boolean isFirst = true; | |||
@Override | |||
protected void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) { | |||
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 && data.getBooleanExtra("update",false)){ | |||
processDetails.clear(); | |||
processDetails.addAll(GoodsProcessDetailDBUtil.getByGroupId(subAttributeGroupId)); | |||
stepAdapter.setCurrentPosition(0); | |||
stepAdapter.notifyDataSetChanged(); | |||
} | |||
protected void onResume() { | |||
super.onResume(); | |||
if(!isFirst){ | |||
processDetails.clear(); | |||
processDetails.addAll(GoodsProcessDetailDBUtil.getByGroupId(subAttributeGroupId)); | |||
stepAdapter.setCurrentPosition(0); | |||
stepAdapter.notifyDataSetChanged(); | |||
} | |||
isFirst = false; | |||
} | |||
@Override | |||
@@ -47,6 +47,11 @@ public class MainActivity extends BaseActivity { | |||
initView(); | |||
} | |||
@Override | |||
protected void onResume() { | |||
super.onResume(); | |||
} | |||
private void initView(){ | |||
viewBinding.viewpager.addOnPageChangeListener(pageChangeListener); | |||
// 设置viewPager缓存多少个fragment | |||
@@ -21,7 +21,6 @@ import androidx.core.content.ContextCompat; | |||
import com.bonait.bnframework.HBL.Thread.ThreadManager; | |||
import com.bonait.bnframework.R; | |||
import com.bonait.bnframework.Service.ModbusHelper; | |||
import com.bonait.bnframework.business.ExecuteTheRecipe; | |||
import com.bonait.bnframework.business.NewExecuteTheRecipe; | |||
import com.bonait.bnframework.common.base.BaseActivity; | |||
import com.bonait.bnframework.common.constant.ConfigName; | |||
@@ -32,6 +31,7 @@ import com.bonait.bnframework.common.db.mode.BPA_GOODS_SUBATTRIBUTE_GROUP; | |||
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.helper.I.MyClickListener; | |||
import com.bonait.bnframework.common.utils.AlertDialogUtils; | |||
import com.bonait.bnframework.common.utils.DimensUtil; | |||
import com.bonait.bnframework.common.utils.DisplayManager; | |||
@@ -41,6 +41,7 @@ import com.bonait.bnframework.ui.dialog.DeviceControlDialog; | |||
import com.bonait.bnframework.ui.widget.NewToastUtil; | |||
import java.util.ArrayList; | |||
import java.util.Collections; | |||
import java.util.List; | |||
/** | |||
@@ -169,17 +170,28 @@ public class RecProcessActivity extends BaseActivity { | |||
viewBinding.title.setText(subAttributeGroupName.isEmpty()? goods.name :(goods.name+"-"+subAttributeGroupName)); | |||
} | |||
viewBinding.pauseGoodmake.setOnClickListener(v->{ | |||
if (isStart) { | |||
if (!IsPause) { | |||
onRecordPause(); | |||
viewBinding.pauseGoodmake.setImageResource(R.mipmap.zhizuo_jx1); | |||
} else { | |||
onRecordPauseStart(); | |||
viewBinding.pauseGoodmake.setImageResource(R.mipmap.zhizuo_zt1); | |||
} | |||
}); | |||
viewBinding.startGoodmake.setOnClickListener(v->{ | |||
if (!isStart) { | |||
onRecordStart(); | |||
} else { | |||
onRecordStop(); | |||
viewBinding.startGoodmake.setmListener(new MyClickListener() { | |||
@Override | |||
public void clickListener(View v, Object data) { | |||
boolean status = (boolean) data; | |||
if(status){ | |||
onRecordStart(); | |||
}else{ | |||
onRecordStop(); | |||
} | |||
} | |||
@Override | |||
public void clickListenerNew(View v, int k, Object data) { | |||
} | |||
}); | |||
stepAdapter = new StepAdapter(); | |||
@@ -189,28 +201,28 @@ public class RecProcessActivity extends BaseActivity { | |||
viewBinding.save.btnSave.setOnClickListener(v->{ | |||
BPA_GOODS goods2 = GoodsDBUtil.getById(goodId); | |||
String name = subAttributeGroupName.isEmpty()? goods2.name :(goods2.name+"-"+subAttributeGroupName); | |||
AlertDialogUtils.showTipDialog(this, "请确认", "是否覆盖掉【"+name+"】下所有的工序?", new AlertDialogUtils.DialogClickListener() { | |||
AlertDialogUtils.showTipDialog(this, "请确认", "是否覆盖掉【"+name+"】下所有的工序?", | |||
new AlertDialogUtils.DialogClickListener() { | |||
@Override | |||
public void onConfirm() { | |||
if(ConfigName.getInstance().isFastClick()){ | |||
return; | |||
} | |||
int sc = TimeOut <= 0 ? 180 : TimeOut; | |||
BPA_GOODS_SUBATTRIBUTE_GROUP bean = SubAttributeGroupDBUtil.getByGoodIdAndListId(goodId,subAttributeGroupId); | |||
BPA_GOODS_SUBATTRIBUTE_GROUP bean = SubAttributeGroupDBUtil.getById(subAttributeGroupId); | |||
SubAttributeGroupDBUtil.updateMakeTime(bean.id,sc); | |||
stepList = stepAdapter.getData(); | |||
for (int k = 0; k < stepList.size(); k++) { | |||
stepList.get(k).id = java.util.UUID.randomUUID().toString(); | |||
stepList.get(k).goodsSubAttributeGroupId = bean.id; | |||
stepList.get(k).sort = k + 1; | |||
} | |||
GoodsProcessDetailDBUtil.removeList(GoodsProcessDetailDBUtil.getByGroupId(subAttributeGroupId)); | |||
if(GoodsProcessDetailDBUtil.addList(stepList)){ | |||
NewToastUtil.getInstance().showToast("【"+name+"】工序保存成功!"); | |||
}else { | |||
NewToastUtil.getInstance().showToast("【"+name+"】工序保存失败!"); | |||
} | |||
setResult(RESULT_OK, null); | |||
finish(); | |||
} | |||
@@ -243,16 +255,13 @@ public class RecProcessActivity extends BaseActivity { | |||
* 关闭所有接口 | |||
*/ | |||
private void close(){ | |||
ThreadManager.get().execute(new Thread(() -> ModbusHelper.get().setStirMotor(0,2))); | |||
ThreadManager.get().execute(new Thread(() -> ModbusHelper.get().setUpdDownMotor(1))); | |||
ThreadManager.get().execute(new Thread(() -> ModbusHelper.get().Heating(0,false))); | |||
ThreadManager.get().execute(new Thread(() -> { | |||
ModbusHelper.get().addWater(0f,true); | |||
ThreadManager.get().execute(new Thread(()->{ | |||
ModbusHelper.get().reset(); | |||
ModbusHelper.get().setCookStatus(false); | |||
})); | |||
ThreadManager.get().execute(new Thread(() -> { | |||
ModbusHelper.get().addWater(0f,true); | |||
ModbusHelper.get().addThickenWater(0f,true); | |||
})); | |||
ThreadManager.get().execute(new Thread(() -> { | |||
for(int i =1;i<=9;i++){ | |||
ModbusHelper.get().addMaterial(0f,i,true); | |||
} | |||
@@ -262,9 +271,27 @@ public class RecProcessActivity extends BaseActivity { | |||
private DeviceControlDialog.DeviceCallBack deviceCallBack = new DeviceControlDialog.DeviceCallBack() { | |||
@Override | |||
public void onClickEvent(int type, String value,long time, BPA_GOODS_PROCESS_DETAIL detail) { | |||
if(detail!=null){ | |||
// List<BPA_GOODS_PROCESS_DETAIL> list = new ArrayList<>(); | |||
// list.add(detail); | |||
int curtime = (int) ((SystemClock.elapsedRealtime() - viewBinding.runtime.getBase()) / 1000);//当前点击多少秒 | |||
int time_c = curtime - ClikTime; | |||
ClikTime = curtime; | |||
List<BPA_GOODS_PROCESS_DETAIL> list = new ArrayList<>(); | |||
if(time_c>0){ | |||
BPA_GOODS_PROCESS_DETAIL pf = new BPA_GOODS_PROCESS_DETAIL(); | |||
pf.materialType = 1; | |||
pf.processname = "延迟"; | |||
pf.processms = "延迟(" + time_c + ")"; | |||
pf.processvalue = "延迟(秒)," + time_c; | |||
list.add(pf); | |||
} | |||
list.add(detail); | |||
stepAdapter.addData(list); | |||
viewBinding.recycleStep.smoothScrollToPosition(stepAdapter.getData().size()-1); | |||
} | |||
switch (type){ | |||
case 1: | |||
stepList.add(detail); | |||
if(value.contains("启动加热")){ | |||
isFire = true; | |||
String[] res = value.split("\\|"); | |||
@@ -282,21 +309,18 @@ public class RecProcessActivity extends BaseActivity { | |||
changeDevicePic(); | |||
break; | |||
case 2: | |||
stepList.add(detail); | |||
viewBinding.device.btnSilos.setBackgroundResource(R.drawable.bg_btn_run_anim_looper); | |||
((AnimationDrawable)viewBinding.device.btnSilos.getBackground()).start(); | |||
handler.removeMessages(MSG_STOP_SILOS); | |||
handler.sendEmptyMessageDelayed(MSG_STOP_SILOS,time); | |||
break; | |||
case 3: | |||
stepList.add(detail); | |||
viewBinding.device.btnMainFood.setBackgroundResource(R.drawable.bg_btn_run_anim_looper); | |||
((AnimationDrawable)viewBinding.device.btnMainFood.getBackground()).start(); | |||
handler.removeMessages(MSG_STOP_FOOD); | |||
handler.sendEmptyMessageDelayed(MSG_STOP_FOOD,time); | |||
break; | |||
case 4: | |||
stepList.add(detail); | |||
switch (value){ | |||
case "启动搅拌": | |||
isStir=true; | |||
@@ -364,7 +388,7 @@ public class RecProcessActivity extends BaseActivity { | |||
}else{ | |||
animatorX = PropertyValuesHolder.ofFloat("scaleX", 0.5f, 1f); | |||
animatorY = PropertyValuesHolder.ofFloat("scaleY", 0.5f, 1f); | |||
animatorMY = PropertyValuesHolder.ofFloat("translationY", 300f, 0f); | |||
animatorMY = PropertyValuesHolder.ofFloat("translationY", 100f, 0f); | |||
} | |||
ObjectAnimator.ofPropertyValuesHolder(viewBinding.device.getRoot(), animatorX, animatorY,animatorMY).start(); | |||
} | |||
@@ -453,11 +477,9 @@ public class RecProcessActivity extends BaseActivity { | |||
viewBinding.runtime.setBase(SystemClock.elapsedRealtime() - recordingTime);// 跳过已经记录了的时间,起到继续计时的作用 | |||
viewBinding.runtime.start(); | |||
viewBinding.textMs.setText("请先{开始}录制"); | |||
//重置暂停开关 | |||
IsPause = false; | |||
viewBinding.pauseGoodmake.SetStatus(false); | |||
viewBinding.pauseGoodmake.setVisibility(View.VISIBLE); | |||
ExecuteTheRecipe.WritePLC("暂停开关", false, null); | |||
viewBinding.pauseGoodmake.setImageResource(R.mipmap.zhizuo_zt1); | |||
// viewBinding.pauseGoodmake.setVisibility(View.VISIBLE); | |||
IsStart = true; | |||
viewBinding.textMs.setVisibility(View.GONE); | |||
@@ -473,7 +495,6 @@ public class RecProcessActivity extends BaseActivity { | |||
* 停止计时器 | |||
*/ | |||
public void onRecordStop() { | |||
clear(); | |||
viewBinding.runtime.stop(); | |||
viewBinding.startGoodmake.SetStatus(false); | |||
IsStart = false; | |||
@@ -488,16 +509,12 @@ public class RecProcessActivity extends BaseActivity { | |||
//重置暂停开关 | |||
IsPause = false; | |||
viewBinding.pauseGoodmake.SetStatus(false); | |||
viewBinding.pauseGoodmake.setImageResource(R.mipmap.zhizuo_zt1); | |||
viewBinding.pauseGoodmake.setVisibility(View.GONE); | |||
ExecuteTheRecipe.WritePLC("暂停开关", false, null); | |||
ExecuteTheRecipe.WritePLC("搅拌", false, null); | |||
ExecuteTheRecipe.WritePLC("加热", false, null); | |||
ConfigName.getInstance().IsOpenHuoLi = false; | |||
ExecuteTheRecipe.BottomClick("平移-去1号位"); | |||
//自动出餐 | |||
AutomaticServing(); | |||
clear(); | |||
//弹出列表 | |||
viewBinding.save.getRoot().setVisibility(View.VISIBLE); | |||
viewBinding.save.recycleStepSave.setAdapter(stepAdapter); | |||
@@ -514,12 +531,11 @@ public class RecProcessActivity extends BaseActivity { | |||
bean.processname = "出菜"; | |||
bean.processms = "出菜(" + time_c + ")"; | |||
bean.processvalue = "等待(秒)," + time_c; | |||
stepList.add(bean); | |||
ThreadManager.get().execute(new Thread(()->{ | |||
ExecuteTheRecipe.ExecuteOperationSteps(bean.processname, bean.processvalue); | |||
})); | |||
stepAdapter.addData(new ArrayList<>(Collections.singleton(bean))); | |||
viewBinding.recycleStep.smoothScrollToPosition(stepAdapter.getData().size()-1); | |||
} | |||
/** | |||
* 暂停计时器 | |||
*/ | |||
@@ -26,6 +26,7 @@ import com.bonait.bnframework.common.db.mode.BPA_GOODS_CLASSIFY; | |||
import com.bonait.bnframework.common.db.util.GoodsClassifyDBUtil; | |||
import com.bonait.bnframework.common.db.util.GoodsDBUtil; | |||
import com.bonait.bnframework.common.glide.GlideUtil; | |||
import com.bonait.bnframework.common.utils.AdbCommandUtil; | |||
import com.bonait.bnframework.common.utils.DimensUtil; | |||
import com.bonait.bnframework.common.utils.DisplayManager; | |||
import com.bonait.bnframework.databinding.DialogAddGoodsBinding; | |||
@@ -92,6 +93,7 @@ public class AddGoodsDialog extends DialogFragment { | |||
params.height = ViewGroup.LayoutParams.MATCH_PARENT; | |||
window.setAttributes(params); | |||
} | |||
AdbCommandUtil.hideStatusBar(true); | |||
updateClassifyData(classifyPosition); | |||
} | |||
@@ -26,6 +26,7 @@ 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.AdbCommandUtil; | |||
import com.bonait.bnframework.common.utils.AlertDialogUtils; | |||
import com.bonait.bnframework.common.utils.DisplayManager; | |||
import com.bonait.bnframework.databinding.DialogAttributeSelectBinding; | |||
@@ -92,6 +93,7 @@ public class AttributeSelectDialog extends DialogFragment { | |||
params.height = ViewGroup.LayoutParams.MATCH_PARENT; | |||
window.setAttributes(params); | |||
} | |||
AdbCommandUtil.hideStatusBar(true); | |||
updateAttributeData(); | |||
initListener(); | |||
} | |||
@@ -30,6 +30,7 @@ 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_SILOS; | |||
import com.bonait.bnframework.common.db.mode.BPA_SILOS_CALIBRATE; | |||
import com.bonait.bnframework.common.utils.AdbCommandUtil; | |||
import com.bonait.bnframework.common.utils.DisplayManager; | |||
import com.bonait.bnframework.databinding.DialogDeviceControlBinding; | |||
import com.bonait.bnframework.ui.widget.NewToastUtil; | |||
@@ -108,6 +109,7 @@ public class DeviceControlDialog extends DialogFragment { | |||
window.setAttributes(params); | |||
window.setDimAmount(0.5f); | |||
} | |||
AdbCommandUtil.hideStatusBar(true); | |||
initView(); | |||
} | |||
@@ -160,8 +162,8 @@ public class DeviceControlDialog extends DialogFragment { | |||
BPA_GOODS_PROCESS_DETAIL detail = new BPA_GOODS_PROCESS_DETAIL(); | |||
detail.processname = "加热"; | |||
detail.materialType = 1; | |||
detail.processvalue = "加热档位,"+progressFire*10+"|加热控制,启动加热|延迟(秒),0"; | |||
detail.processms = "加热("+progressFire*10+",启动加热,0)"; | |||
detail.processvalue = "加热档位,"+progressFire+"档|加热控制,启动加热|延迟(秒),0"; | |||
detail.processms = "加热("+progressFire+"档,启动加热,0)"; | |||
deviceCallBack.onClickEvent(type,"启动加热|"+progressFire,0,detail); | |||
}); | |||
//停止加热 | |||
@@ -173,8 +175,8 @@ public class DeviceControlDialog extends DialogFragment { | |||
BPA_GOODS_PROCESS_DETAIL detail = new BPA_GOODS_PROCESS_DETAIL(); | |||
detail.processname = "加热"; | |||
detail.materialType = 1; | |||
detail.processvalue = "加热档位,"+progressFire*10+"|加热控制,停止加热|延迟(秒),0"; | |||
detail.processms = "加热("+progressFire*10+",启动加热,0)"; | |||
detail.processvalue = "加热档位,"+0+"档|加热控制,停止加热|延迟(秒),0"; | |||
detail.processms = "加热("+0+"档,停止加热,0)"; | |||
deviceCallBack.onClickEvent(type,"停止加热",0,detail); | |||
}); | |||
//档位条加减 | |||
@@ -469,10 +471,10 @@ public class DeviceControlDialog extends DialogFragment { | |||
BPA_GOODS_PROCESS_DETAIL detail = new BPA_GOODS_PROCESS_DETAIL(); | |||
detail.processname = "双向搅拌"; | |||
detail.materialType = 1; | |||
detail.processvalue = "搅拌档位,"+progressStir*10+"|搅拌控制,启动搅拌|正转时间,3|反转时间,3|延迟(秒),0"; | |||
detail.processms = "双向搅拌("+progressStir*10+",启动搅拌,3,3,0)"; | |||
detail.processvalue = "搅拌档位,"+progressStir+"档|搅拌控制,启动搅拌|正转时间,3|反转时间,3|延迟(秒),0"; | |||
detail.processms = "双向搅拌("+progressStir+"档,启动搅拌,3,3,0)"; | |||
if(progressStir==0){ | |||
NewToastUtil.getInstance().showToast("搅拌 档位:0"); | |||
NewToastUtil.getInstance().showToast("启动搅拌 档位:0"); | |||
deviceCallBack.onClickEvent(type,"停止搅拌",0,detail); | |||
return; | |||
} | |||
@@ -485,8 +487,8 @@ public class DeviceControlDialog extends DialogFragment { | |||
BPA_GOODS_PROCESS_DETAIL detail = new BPA_GOODS_PROCESS_DETAIL(); | |||
detail.processname = "双向搅拌"; | |||
detail.materialType = 1; | |||
detail.processvalue = "搅拌档位,"+progressStir*10+"|搅拌控制,停止搅拌|正转时间,3|反转时间,3|延迟(秒),0"; | |||
detail.processms = "双向搅拌("+progressStir*10+",停止搅拌,3,3,0)"; | |||
detail.processvalue = "搅拌档位,"+progressStir+"档|搅拌控制,停止搅拌|正转时间,3|反转时间,3|延迟(秒),0"; | |||
detail.processms = "双向搅拌("+0+"档,停止搅拌,3,3,0)"; | |||
viewBinding.layoutStir.stirProgress.setValue(0,true); | |||
NewToastUtil.getInstance().showToast("停止搅拌"); | |||
ThreadManager.get().execute(new Thread(() -> ModbusHelper.get().setStirMotor(0,2))); | |||
@@ -31,6 +31,7 @@ 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.glide.GlideUtil; | |||
import com.bonait.bnframework.common.utils.AdbCommandUtil; | |||
import com.bonait.bnframework.common.utils.DimensUtil; | |||
import com.bonait.bnframework.common.utils.DisplayManager; | |||
import com.bonait.bnframework.common.utils.ProcessValueUtil; | |||
@@ -91,6 +92,7 @@ public class EditGoodsDialog extends DialogFragment { | |||
public void onCreate(@Nullable Bundle savedInstanceState) { | |||
super.onCreate(savedInstanceState); | |||
setStyle(STYLE_NORMAL, R.style.DialogScale); | |||
if(getArguments()!=null){ | |||
goodId = getArguments().getString("goodId"); | |||
isEdit = getArguments().getBoolean("isEdit"); | |||
@@ -123,6 +125,7 @@ public class EditGoodsDialog extends DialogFragment { | |||
params.height = ViewGroup.LayoutParams.MATCH_PARENT; | |||
window.setAttributes(params); | |||
} | |||
AdbCommandUtil.hideStatusBar(true); | |||
initView(); | |||
updateAttributeData(""); | |||
groupSpinnerView(); | |||
@@ -178,7 +181,7 @@ public class EditGoodsDialog extends DialogFragment { | |||
// return; | |||
// } | |||
// if(!hasGroup().isEmpty()){ | |||
if(viewBinding.layoutAttribute.groupDesc.getText().toString().equals("存在选中组合")){ | |||
if(viewBinding.layoutAttribute.groupDesc.getText().toString().equals("存在选中组合") || isEdit){ | |||
changePage(3); | |||
}else { | |||
NewToastUtil.getInstance().showToast("不存在该组合"); | |||
@@ -468,7 +471,9 @@ public class EditGoodsDialog extends DialogFragment { | |||
viewBinding.layoutAttribute.spinnerList.setSelection(pos); | |||
}else{ | |||
viewBinding.layoutAttribute.groupDesc.setText("不存在选中组合"); | |||
viewBinding.layoutAttribute.btnNext2.setBackgroundResource(R.drawable.bg_round25_gray_btn); | |||
if(!isEdit){ | |||
viewBinding.layoutAttribute.btnNext2.setBackgroundResource(R.drawable.bg_round25_gray_btn); | |||
} | |||
} | |||
} | |||
}); | |||
@@ -503,14 +508,18 @@ public class EditGoodsDialog extends DialogFragment { | |||
return false; | |||
} | |||
}); | |||
viewBinding.layoutAttribute.btnNext2.setBackgroundResource(R.drawable.bg_round25_gray_btn); | |||
if(!isEdit){ | |||
viewBinding.layoutAttribute.btnNext2.setBackgroundResource(R.drawable.bg_round25_gray_btn); | |||
} | |||
viewBinding.layoutAttribute.spinnerList.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() { | |||
@Override | |||
public void onItemSelected(AdapterView<?> adapterView, View view, int i, long l) { | |||
if(isUserClicked){ | |||
if(i==0){ | |||
viewBinding.layoutAttribute.groupDesc.setText(""); | |||
viewBinding.layoutAttribute.btnNext2.setBackgroundResource(R.drawable.bg_round25_gray_btn); | |||
if(!isEdit){ | |||
viewBinding.layoutAttribute.btnNext2.setBackgroundResource(R.drawable.bg_round25_gray_btn); | |||
} | |||
updateAttributeData(viewBinding.layoutAttribute.spinnerList.getSelectedItem().toString()); | |||
}else { | |||
updateAttributeData(viewBinding.layoutAttribute.spinnerList.getSelectedItem().toString()); | |||
@@ -227,7 +227,8 @@ public class LocalGoodsFragment extends BaseFragment { | |||
} | |||
goodsAdapter.setNewData(goodsList); | |||
classifyAdapter.setCurrentPosition(0); | |||
int last = Math.max(classifyAdapter.getCurrentPosition(), 0); | |||
classifyAdapter.setCurrentPosition(last); | |||
classifyAdapter.setNewData(classifyList); | |||
} | |||
@@ -58,7 +58,28 @@ public class NewToastUtil { | |||
ViewLayoutToastBinding binding = ViewLayoutToastBinding.bind(layout); | |||
DisplayManager.scaleViewGroup(binding.getRoot()); | |||
binding.toastText.setText(content); | |||
toast.setGravity(Gravity.BOTTOM,0,DimensUtil.getDimens(100)); | |||
toast.setGravity(Gravity.BOTTOM,0, (int) (DisplayManager.getWidthScaleRate()*DimensUtil.getDimens(100))); | |||
toast.setDuration(Toast.LENGTH_SHORT); | |||
toast.setView(layout); | |||
toast.show(); | |||
}); | |||
} | |||
public void showToastBottom(String message){ | |||
handler.post(() -> { | |||
if(toast != null){ | |||
toast.cancel(); | |||
} | |||
toast = new Toast(MainApplication.getContext()); | |||
String content = message; | |||
if(message.length() > 50){ | |||
content = message.substring(0,50)+"..."; | |||
} | |||
View layout = LayoutInflater.from(MainApplication.getContext()).inflate(R.layout.view_layout_toast,null); | |||
ViewLayoutToastBinding binding = ViewLayoutToastBinding.bind(layout); | |||
DisplayManager.scaleViewGroup(binding.getRoot()); | |||
binding.toastText.setText(content); | |||
toast.setGravity(Gravity.BOTTOM,0, (int) (DisplayManager.getWidthScaleRate()*DimensUtil.getDimens(10))); | |||
toast.setDuration(Toast.LENGTH_SHORT); | |||
toast.setView(layout); | |||
toast.show(); | |||
@@ -79,7 +100,7 @@ public class NewToastUtil { | |||
ViewLayoutToastBinding binding = ViewLayoutToastBinding.bind(layout); | |||
DisplayManager.scaleViewGroup(binding.getRoot()); | |||
binding.toastText.setText(content); | |||
toast.setGravity(Gravity.BOTTOM,0,DimensUtil.getDimens(180)); | |||
toast.setGravity(Gravity.BOTTOM,0, (int) (DisplayManager.getWidthScaleRate()*DimensUtil.getDimens(180))); | |||
toast.setDuration(Toast.LENGTH_SHORT); | |||
toast.setView(layout); | |||
toast.show(); | |||
@@ -112,7 +133,7 @@ public class NewToastUtil { | |||
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.setGravity(Gravity.BOTTOM,0, (int) (DisplayManager.getWidthScaleRate()*DimensUtil.getDimens(180))); | |||
toast.setDuration(Toast.LENGTH_SHORT); | |||
toast.setView(layout); | |||
toast.show(); | |||
@@ -27,7 +27,7 @@ | |||
<TextView | |||
android:id="@+id/goodname" | |||
android:layout_width="340dp" | |||
android:layout_width="match_parent" | |||
android:layout_height="wrap_content" | |||
android:fontFamily="@font/fz2" | |||
android:shadowColor="#65000000" | |||
@@ -35,6 +35,10 @@ | |||
android:shadowDy="10.0" | |||
android:shadowRadius="6.0" | |||
android:text="爆炒鱼香肉丝" | |||
android:maxLines="1" | |||
android:singleLine="true" | |||
android:ellipsize="middle" | |||
android:layout_marginEnd="@dimen/dp_110" | |||
android:textColor="@color/black" | |||
android:textSize="45dp" /> | |||
@@ -52,6 +52,7 @@ | |||
android:focusable="true" | |||
android:layout_marginBottom="350dp" | |||
android:gravity="center" | |||
tools:visibility="visible" | |||
android:textSize="50dp"/> | |||
<FrameLayout | |||
@@ -106,7 +107,7 @@ | |||
app:imagesrc_tz="@mipmap/zhizuo_js2" /> | |||
</FrameLayout> | |||
<com.bonait.bnframework.ViewModel.CustomView.imagebuttom | |||
<ImageView | |||
android:id="@+id/pause_goodmake" | |||
android:layout_width="@dimen/dp_100" | |||
android:layout_height="@dimen/dp_100" | |||
@@ -115,8 +116,7 @@ | |||
android:layout_marginEnd="@dimen/dp_25" | |||
android:layout_marginBottom="@dimen/dp_90" | |||
android:layout_gravity="end|bottom" | |||
app:imagesrc_ks="@mipmap/zhizuo_zt1" | |||
app:imagesrc_tz="@mipmap/zhizuo_jx1" /> | |||
/> | |||
<androidx.recyclerview.widget.RecyclerView | |||
android:id="@+id/recycleStep" | |||
@@ -10,7 +10,7 @@ | |||
<LinearLayout | |||
android:layout_width="@dimen/dp_700" | |||
android:layout_height="@dimen/dp_1050" | |||
android:layout_height="@dimen/dp_1100" | |||
android:padding="20dp" | |||
android:background="@drawable/silosbj" | |||
android:layout_gravity="center" | |||
@@ -45,12 +45,19 @@ | |||
android:orientation="vertical" | |||
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager" /> | |||
<ImageView | |||
<TextView | |||
android:id="@+id/btn_save" | |||
android:layout_width="wrap_content" | |||
android:layout_width="@dimen/dp_500" | |||
android:layout_height="@dimen/dp_100" | |||
android:layout_gravity="center_horizontal" | |||
android:scaleType="fitCenter" | |||
android:src="@mipmap/queding2" /> | |||
android:background="@drawable/bg_round15_red_btn" | |||
android:layout_marginTop="@dimen/dp_20" | |||
android:text="保存工序" | |||
android:gravity="center" | |||
android:textColor="@color/white" | |||
android:textSize="@dimen/sp_46" | |||
android:textStyle="bold" | |||
/> | |||
</LinearLayout> | |||
</FrameLayout> |
@@ -16,19 +16,7 @@ | |||
android:layout_height="match_parent"> | |||
</androidx.recyclerview.widget.RecyclerView> | |||
<Button | |||
android:id="@+id/btn_fresh" | |||
android:layout_width="@dimen/dp_150" | |||
android:layout_height="@dimen/dp_70" | |||
android:textSize="@dimen/sp_32" | |||
android:textColor="@color/white" | |||
android:text="刷新" | |||
android:background="@drawable/bg_round15_yellow_btn" | |||
android:layout_alignParentBottom="true" | |||
android:layout_alignParentEnd="true" | |||
android:layout_marginEnd="@dimen/dp_20" | |||
android:layout_marginBottom="@dimen/dp_20" | |||
/> | |||
<TextView | |||
android:id="@+id/line1" | |||
@@ -54,6 +42,20 @@ | |||
app:spanCount="3" | |||
android:layout_height="match_parent"> | |||
</androidx.recyclerview.widget.RecyclerView> | |||
<Button | |||
android:id="@+id/btn_fresh" | |||
android:layout_width="@dimen/dp_150" | |||
android:layout_height="@dimen/dp_70" | |||
android:textSize="@dimen/sp_32" | |||
android:textColor="@color/white" | |||
android:text="刷新" | |||
android:background="@drawable/bg_round15_yellow_btn" | |||
android:layout_alignParentBottom="true" | |||
android:layout_alignParentEnd="true" | |||
android:layout_marginEnd="@dimen/dp_20" | |||
android:layout_marginBottom="@dimen/dp_20" | |||
/> | |||
</RelativeLayout> | |||
@@ -123,8 +123,8 @@ | |||
<item name="qmui_topbar_title_color">@color/qmui_config_color_white</item> | |||
<item name="qmui_topbar_subtitle_color">@color/qmui_config_color_white</item> | |||
<item name="qmui_topbar_text_btn_color_state_list">@color/s_topbar_btn_color</item> | |||
<item name="qmui_topbar_height">48dp</item> | |||
<item name="qmui_topbar_image_btn_height">48dp</item> | |||
<item name="qmui_topbar_height">80dp</item> | |||
<item name="qmui_topbar_image_btn_height">80dp</item> | |||
<item name="qmui_topbar_title_text_size">32sp</item> | |||
<item name="android:background">@color/topbj1</item> | |||
</style> | |||