Browse Source

修改问题;添加设备使用次数统计页面

桌面小炒机
liup 6 months ago
parent
commit
b83a460a6e
31 changed files with 802 additions and 230 deletions
  1. +2
    -2
      .idea/deploymentTargetSelector.xml
  2. +5
    -0
      app/src/main/AndroidManifest.xml
  3. +1
    -1
      app/src/main/java/com/bonait/bnframework/HBL/Communication/Modbus/ModbusMaster.java
  4. +32
    -0
      app/src/main/java/com/bonait/bnframework/Model/DeviceRecordBean.java
  5. +14
    -0
      app/src/main/java/com/bonait/bnframework/Service/ControlAdress.java
  6. +27
    -60
      app/src/main/java/com/bonait/bnframework/Service/ModbusHelper.java
  7. +30
    -31
      app/src/main/java/com/bonait/bnframework/ViewModel/ActivityViewModel/BottomNavigationNewActivity.java
  8. +31
    -28
      app/src/main/java/com/bonait/bnframework/business/ExecuteTheRecipe.java
  9. +10
    -8
      app/src/main/java/com/bonait/bnframework/business/NewExecuteTheRecipe.java
  10. +3
    -1
      app/src/main/java/com/bonait/bnframework/common/constant/ConfigName.java
  11. +12
    -9
      app/src/main/java/com/bonait/bnframework/common/helper/CrashHandler.java
  12. +7
    -3
      app/src/main/java/com/bonait/bnframework/common/utils/AdbCommandUtil.java
  13. +36
    -15
      app/src/main/java/com/bonait/bnframework/ui/activity/CookingActivity.java
  14. +94
    -0
      app/src/main/java/com/bonait/bnframework/ui/activity/DeviceRecordActivity.java
  15. +109
    -16
      app/src/main/java/com/bonait/bnframework/ui/activity/DiyProcessActivity.java
  16. +47
    -0
      app/src/main/java/com/bonait/bnframework/ui/adapter/DeviceRecordAdapter.java
  17. +24
    -0
      app/src/main/java/com/bonait/bnframework/ui/dialog/AddGoodsDialog.java
  18. +23
    -1
      app/src/main/java/com/bonait/bnframework/ui/dialog/AttributeSelectDialog.java
  19. +41
    -6
      app/src/main/java/com/bonait/bnframework/ui/dialog/DeviceControlDialog.java
  20. +31
    -9
      app/src/main/java/com/bonait/bnframework/ui/dialog/EditGoodsDialog.java
  21. +23
    -1
      app/src/main/java/com/bonait/bnframework/ui/dialog/SubOrderDialog.java
  22. +8
    -14
      app/src/main/java/com/bonait/bnframework/ui/fragment/HomeDevicesFragment.java
  23. +2
    -2
      app/src/main/java/com/bonait/bnframework/ui/widget/NewToastUtil.java
  24. +55
    -0
      app/src/main/res/layout/activity_device_record.xml
  25. +6
    -6
      app/src/main/res/layout/activity_edit_process.xml
  26. +59
    -5
      app/src/main/res/layout/dialog/layout/layout_stir_control.xml
  27. +5
    -5
      app/src/main/res/layout/dialog_with_cancel_confirm.xml
  28. +17
    -0
      app/src/main/res/layout/fragment_home_devices.xml
  29. +41
    -0
      app/src/main/res/layout/item/layout/item_device_record.xml
  30. +5
    -5
      app/src/main/res/layout/item/layout/view_layout_toast.xml
  31. +2
    -2
      build.gradle

+ 2
- 2
.idea/deploymentTargetSelector.xml View File

@@ -4,10 +4,10 @@
<selectionStates>
<SelectionState runConfigName="app">
<option name="selectionMode" value="DROPDOWN" />
<DropdownSelection timestamp="2024-06-04T09:46:39.139475300Z">
<DropdownSelection timestamp="2024-06-11T02:32:44.238613300Z">
<Target type="DEFAULT_BOOT">
<handle>
<DeviceId pluginId="Default" identifier="serial=127.0.0.1:7555;connection=14007664" />
<DeviceId pluginId="Default" identifier="serial=10.24.61.102:5555;connection=0070276e" />
</handle>
</Target>
</DropdownSelection>


+ 5
- 0
app/src/main/AndroidManifest.xml View File

@@ -76,6 +76,11 @@
android:screenOrientation="portrait"
android:launchMode="singleTask"
android:exported="false" />
<activity
android:name=".ui.activity.DeviceRecordActivity"
android:screenOrientation="portrait"
android:launchMode="singleTask"
android:exported="true" />
<activity
android:name=".ui.activity.ErrorInfoActivity"
android:screenOrientation="portrait"


+ 1
- 1
app/src/main/java/com/bonait/bnframework/HBL/Communication/Modbus/ModbusMaster.java View File

@@ -388,7 +388,7 @@ public class ModbusMaster implements IRead,IWrite ,IModbusMaster{
if(address==null||address.isEmpty()){ return OperateResultT.CreateFailedT("无效的地址");}
if(!getConnected()){ return OperateResultT.CreateFailedT("设备未连接");}
AtomicReference<OperateResultT<Integer>>resultValue=new AtomicReference<>();
ReadInt(address,1).OnSource((s)->{
ReadInt(address,2).OnSource((s)->{
resultValue.set(OperateResultT.CreateSuccess(s.Content[0]));
}).OnFailed(s->{
resultValue.set(OperateResultT.CreateFailedT(s.message));


+ 32
- 0
app/src/main/java/com/bonait/bnframework/Model/DeviceRecordBean.java View File

@@ -0,0 +1,32 @@
package com.bonait.bnframework.Model;

/**
* @author: liup
* @description:
* @date: 2024/6/11 11:24.
*/
public class DeviceRecordBean {
private String name;
private String value;

public DeviceRecordBean(String name, String value){
this.name = name;
this.value = value;
}

public String getName() {
return name;
}

public void setName(String name) {
this.name = name;
}

public String getValue() {
return value;
}

public void setValue(String value) {
this.value = value;
}
}

+ 14
- 0
app/src/main/java/com/bonait/bnframework/Service/ControlAdress.java View File

@@ -51,6 +51,20 @@ public enum ControlAdress {
下降超时报警,//M105
升降传感器异常,//M106
搅拌传感器异常,//M107


//统计使用时间和次数
上升次数,//D1050
下降次数,//D1052
投料1次数,//D1054
投料2次数,//D1056
投料3次数,//D1058
投料4次数,//D1060
投料5次数,//D1062
投料6次数,//D1064
加热时间,//D1066
搅拌时间,//D1068

//
// 搅拌检测,//X2
// 升降检测上限位,//X1


+ 27
- 60
app/src/main/java/com/bonait/bnframework/Service/ModbusHelper.java View File

@@ -4,9 +4,6 @@ import com.apkfuns.logutils.LogUtils;
import com.bonait.bnframework.HBL.Communication.Modbus.ModbusMaster;
import com.bonait.bnframework.HBL.DataUtil.DataConvertLib;
import com.bonait.bnframework.HBL.DataUtil.DataType;
import com.bonait.bnframework.HBL.DataUtil.NotifyPropVar;
import com.bonait.bnframework.HBL.Executor;
import com.bonait.bnframework.HBL.Interface.IRunT;
import com.bonait.bnframework.HBL.Logs.MessageLog;
import com.bonait.bnframework.HBL.Result.OperateResultT;
import com.bonait.bnframework.HBL.Thread.ThreadManager;
@@ -91,6 +88,17 @@ public class ModbusHelper extends ModbusMaster {
put(ControlAdress.下降超时报警,new PLCModel("M105",DataType.BOOLEAN,OperationModel.W));
put(ControlAdress.升降传感器异常,new PLCModel("M106",DataType.BOOLEAN,OperationModel.W));
put(ControlAdress.搅拌传感器异常,new PLCModel("M107",DataType.BOOLEAN,OperationModel.W));
//统计使用时间和次数
put(ControlAdress.上升次数,new PLCModel("D1050",DataType.SHORT,OperationModel.R));
put(ControlAdress.下降次数,new PLCModel("D1052",DataType.SHORT,OperationModel.R));
put(ControlAdress.投料1次数,new PLCModel("D1054",DataType.SHORT,OperationModel.R));
put(ControlAdress.投料2次数,new PLCModel("D1056",DataType.SHORT,OperationModel.R));
put(ControlAdress.投料3次数,new PLCModel("D1058",DataType.SHORT,OperationModel.R));
put(ControlAdress.投料4次数,new PLCModel("D1060",DataType.SHORT,OperationModel.R));
put(ControlAdress.投料5次数,new PLCModel("D1062",DataType.SHORT,OperationModel.R));
put(ControlAdress.投料6次数,new PLCModel("D1064",DataType.SHORT,OperationModel.R));
put(ControlAdress.加热时间,new PLCModel("D1066",DataType.SHORT,OperationModel.R));
put(ControlAdress.搅拌时间,new PLCModel("D1068",DataType.SHORT,OperationModel.R));
}};

private ConcurrentHashMap<String, BPA_SILOS_CALIBRATE> calibrationParMap=new ConcurrentHashMap<>();
@@ -401,7 +409,7 @@ public class ModbusHelper extends ModbusMaster {

/**
* 搅拌电机控制
* @param status 1 正转启动 2停止
* @param status 1 启动 2停止
*/
public void setStirMotor(int position,int status){
if(status == 2){
@@ -456,62 +464,11 @@ public class ModbusHelper extends ModbusMaster {
}
}

public NotifyPropVar<Boolean> IsRunning=new NotifyPropVar<Boolean>(false);

public int CurrentTime=0;

public void RtuInit(String comName,int baudRate){
new Thread(()->{ RtuConnect(comName,baudRate).OnSource(()->{ GetLooperStatus();});}).start();
}


/**
* 设置变量监听通知
* @param func
* @param action
* @param <T>
*/
public <T> void setPLCNotify(ControlAdress func,String key, IRunT<T> action){
// if(controlAddress.containsKey(func)){
// controlAddress.get(func).Value.Register(key,action);
// }
}

/**
* 写布尔信号
* @param func
* @param value
*/
public void WriteBoolSingle(ControlAdress func, boolean value){
// if(controlAddress.containsKey(func)){
// Executor.get().runThread(()->{
// WriteBool(controlAddress.get(func).PlcAddress,value).OnSource(()->{
// MessageLog.ShowInfo("写入 "+controlAddress.get(func).PlcAddress+":"+value);
// });
// });
// }
}

/**
* 写脉冲信号
* @param func
*/
public void PulseSignal(ControlAdress func){
// if(controlAddress.containsKey(func)){
// Executor.get().runThread(()->{
// WriteBool(controlAddress.get(func).PlcAddress,true);
// Sleep(1000);
// WriteBool(controlAddress.get(func).PlcAddress,false);
// });
// }
}

public <T> void WriteAsync(String address,T value) {
Executor.get().runThread(()->{
Write(address,value);
});
}

public void reset(){
try {
NewToastUtil.getInstance().showToast("正在复位");
@@ -524,7 +481,7 @@ public class ModbusHelper extends ModbusMaster {
break;
}
stirStop = ConfigName.TEST?false:setStirStop();
Thread.sleep(10);
Thread.sleep(50);
}
Thread.sleep(100);
setUpdDownMotor(1);
@@ -535,7 +492,7 @@ public class ModbusHelper extends ModbusMaster {
break;
}
upStop = ConfigName.TEST?false: ModbusHelper.get().readUpdDownStop(1);
Thread.sleep(10);
Thread.sleep(50);
}
setCookStatus(false);
NewToastUtil.getInstance().showToast("完成复位");
@@ -654,10 +611,10 @@ public class ModbusHelper extends ModbusMaster {

PLCModel<short[]> statusModel = controlAddress.get(ControlAdress.状态读取);
WriteBool(getPLC(ControlAdress.状态读取启动).PlcAddress,true);
OperateResultT<short[]> res = ReadShort(statusModel.PlcAddress,1);
if(res.isSuccess){
OperateResultT<short[]> deviceStatusRes = ReadShort(statusModel.PlcAddress,1);
if(deviceStatusRes.isSuccess){
// statusModel.Value.setValue(res.Content);
byte[] bytes = DataConvertLib.shorts2Bytes(res.Content);
byte[] bytes = DataConvertLib.shorts2Bytes(deviceStatusRes.Content);
if(bytes.length>=2){
deviceErrorCode = bytes[0] & 0xFF;
}
@@ -669,10 +626,20 @@ public class ModbusHelper extends ModbusMaster {
if(isBtnStop||upError||upDownError||downError||stirError){
NewExecuteTheRecipe.IsStart =false;
}

Thread.sleep(ConfigName.TEST?500:200);
});
}

public int deal2ShortDataToInt(short short1,short short2){
LogUtils.d(" deal2ShortDataToString short1="+short1+" ;short2="+short2);
// 将两个short组合成一个int
int result = (short1 & 0xFFFF) << 16 | (short2 & 0xFFFF);
LogUtils.d(" deal2ShortDataToString result="+result+" Integer.toHexString(combinedInt)="+Integer.toHexString(result));
return result;
}

private int deviceErrorCode = 0;

public int getDeviceErrorCode() {


+ 30
- 31
app/src/main/java/com/bonait/bnframework/ViewModel/ActivityViewModel/BottomNavigationNewActivity.java View File

@@ -13,7 +13,6 @@ import androidx.viewpager.widget.ViewPager;

import com.apkfuns.logutils.LogUtils;
import com.bonait.bnframework.HBL.Logs.MessageLog;
import com.bonait.bnframework.HBL.Thread.IThread;
import com.bonait.bnframework.HBL.Thread.ThreadManager;
import com.bonait.bnframework.R;
import com.bonait.bnframework.Service.ModbusHelper;
@@ -265,36 +264,36 @@ public class BottomNavigationNewActivity extends BaseActivity {
public void ReconnectModbus() {
try {

ThreadManager.get().StartLong("PLC断线重连线程", true, new IThread() {
@Override
public void Run() throws InterruptedException {
// try {
// if (ConfigName.getInstance().PlcIsConnect) {
// //ping 不通
// boolean status = ModbusTcpServer.ping2(ConfigName.getInstance().Address, 1, 1);
// if (!status) //ping 不通 连接
// {
// MessageLog.ShowInfo("PLC状态断开,尝试连接...");
// ConfigName.getInstance().PlcIsConnect = false;
// }
// } else {
// boolean status = ModbusTcpServer.ping2(ConfigName.getInstance().Address, 1, 1);
// if (status) {
// MessageLog.ShowInfo("设备 " + ConfigName.getInstance().Address + " PLC通讯正常,准备连接!");
// ModbusTcpServer.ConnectPLC();
// } else {
// MessageLog.ShowInfo("PLC状态断开,尝试连接...");
// ConfigName.getInstance().PlcIsConnect = false;
// }
// }
// Thread.sleep(10000);
// } catch (Exception e) {
// Log.i("PLC", "PLC重连接失败!" + e.getMessage());
// }
}
});
// ThreadManager.get().StartLong("PLC断线重连线程", true, new IThread() {
// @Override
// public void Run() throws InterruptedException {
//// try {
//// if (ConfigName.getInstance().PlcIsConnect) {
//// //ping 不通
//// boolean status = ModbusTcpServer.ping2(ConfigName.getInstance().Address, 1, 1);
//// if (!status) //ping 不通 连接
//// {
//// MessageLog.ShowInfo("PLC状态断开,尝试连接...");
//// ConfigName.getInstance().PlcIsConnect = false;
//// }
//// } else {
//// boolean status = ModbusTcpServer.ping2(ConfigName.getInstance().Address, 1, 1);
//// if (status) {
//// MessageLog.ShowInfo("设备 " + ConfigName.getInstance().Address + " PLC通讯正常,准备连接!");
//// ModbusTcpServer.ConnectPLC();
//// } else {
//// MessageLog.ShowInfo("PLC状态断开,尝试连接...");
//// ConfigName.getInstance().PlcIsConnect = false;
//// }
//// }
//// Thread.sleep(10000);
//// } catch (Exception e) {
//// Log.i("PLC", "PLC重连接失败!" + e.getMessage());
//// }
// }
//
//
// });
} catch (Exception e) {
MessageLog.ShowInfo("重新连接Modbus异常," + e.getMessage());
}


+ 31
- 28
app/src/main/java/com/bonait/bnframework/business/ExecuteTheRecipe.java View File

@@ -12,8 +12,6 @@ import androidx.annotation.NonNull;
import com.apkfuns.logutils.LogUtils;
import com.bonait.bnframework.HBL.Interface.IRun;
import com.bonait.bnframework.HBL.Interface.IRunT;
import com.bonait.bnframework.HBL.Thread.IThread;
import com.bonait.bnframework.HBL.Thread.ThreadManager;
import com.bonait.bnframework.Service.ModbusHelper;
import com.bonait.bnframework.ViewModel.CustomView.MyStatus;
import com.bonait.bnframework.common.constant.ConfigName;
@@ -427,6 +425,7 @@ public class ExecuteTheRecipe {
break;
}
isStop = ConfigName.TEST?false:ModbusHelper.get().setStirStop();
Thread.sleep(50);
}
}
}
@@ -485,7 +484,9 @@ public class ExecuteTheRecipe {
break;
}
isStop = ConfigName.TEST?false:ModbusHelper.get().setStirStop();
Thread.sleep(50);
}
Thread.sleep(100);
}
}
}
@@ -987,7 +988,9 @@ public class ExecuteTheRecipe {
break;
}
isStop = ConfigName.TEST?false: ModbusHelper.get().setStirStop();
Thread.sleep(50);
}
Thread.sleep(100);
ModbusHelper.get().setUpdDownMotor(1);
ModbusHelper.get().setCookStatus(false);
ToastUtils.info("出菜完成,结束制作!");
@@ -1201,32 +1204,32 @@ public class ExecuteTheRecipe {
}


ThreadManager.get().StartLong("PLC设备数据监听", true, new IThread() {
@Override
public void Run() throws InterruptedException {
try {
for (String item : ConfigName.getInstance().PLC_Address.keySet()) {
String key = item;
BPA_PLCADDRESS plcaddress = ConfigName.getInstance().PLC_Address.get(item);
if (plcaddress.isread == 1) {
Object val = ReadPLC(key);
ListeningValue.put(key, val);
}
}
if (ConfigName.getInstance().PlcIsConnect) {
TempControl();
ReadPLCStatus();
}
} catch (Exception ex) {
LogUtils.d("异常信息:" + ex.getMessage());
ToastUtils.error("异常信息:" + ex.getMessage());
}
Thread.sleep(50);
}
});
// ThreadManager.get().StartLong("PLC设备数据监听", true, new IThread() {
// @Override
// public void Run() throws InterruptedException {
// try {
// for (String item : ConfigName.getInstance().PLC_Address.keySet()) {
// String key = item;
// BPA_PLCADDRESS plcaddress = ConfigName.getInstance().PLC_Address.get(item);
// if (plcaddress.isread == 1) {
// Object val = ReadPLC(key);
// ListeningValue.put(key, val);
// }
// }
//
// if (ConfigName.getInstance().PlcIsConnect) {
// TempControl();
//
// ReadPLCStatus();
// }
//
// } catch (Exception ex) {
// LogUtils.d("异常信息:" + ex.getMessage());
// ToastUtils.error("异常信息:" + ex.getMessage());
// }
// Thread.sleep(50);
// }
// });
}
//endregion



+ 10
- 8
app/src/main/java/com/bonait/bnframework/business/NewExecuteTheRecipe.java View File

@@ -341,9 +341,9 @@ public class NewExecuteTheRecipe {
break;
}
isStop = ConfigName.TEST?false:ModbusHelper.get().setStirStop();
Thread.sleep(10);
Thread.sleep(50);
}
Thread.sleep(50);
Thread.sleep(100);
if(isTest && IsStart){
Thread.sleep(1000);
}
@@ -421,7 +421,7 @@ public class NewExecuteTheRecipe {
break;
}
isStop = ConfigName.TEST?false:ModbusHelper.get().setStirStop();
Thread.sleep(10);
Thread.sleep(50);
}
Thread.sleep(50);
if(IsStart && isTest){
@@ -687,7 +687,7 @@ public class NewExecuteTheRecipe {
break;
}
isStop = ConfigName.TEST?false: ModbusHelper.get().setStirStop();
Thread.sleep(10);
Thread.sleep(50);
}
Thread.sleep(50);
ModbusHelper.get().setUpdDownMotor(1);
@@ -789,9 +789,9 @@ public class NewExecuteTheRecipe {
break;
}
stirStop = ConfigName.TEST?false:ModbusHelper.get().setStirStop();
Thread.sleep(10);
Thread.sleep(50);
}
Thread.sleep(50);
Thread.sleep(100);
EventBus.getDefault().post(new ProcessMakingEvent(4,"停止搅拌"));
boolean isStop = true;
long lastTime = System.currentTimeMillis();
@@ -800,8 +800,9 @@ public class NewExecuteTheRecipe {
break;
}
isStop = ConfigName.TEST?false: ModbusHelper.get().readUpdDownStop(1);
Thread.sleep(10);
Thread.sleep(50);
}
Thread.sleep(50);
if(IsStart && isTest){
for(int i = 0;i<8 ;i++){
if(!IsStart){
@@ -823,8 +824,9 @@ public class NewExecuteTheRecipe {
break;
}
isStop = ConfigName.TEST?false: ModbusHelper.get().readUpdDownStop(2);
Thread.sleep(10);
Thread.sleep(50);
}
Thread.sleep(50);
if(IsStart && isTest){
for(int i = 0;i<8 ;i++){
if(!IsStart){


+ 3
- 1
app/src/main/java/com/bonait/bnframework/common/constant/ConfigName.java View File

@@ -27,7 +27,9 @@ import java.util.concurrent.ConcurrentHashMap;
*/
public class ConfigName {
//是否是测试模式
public final static boolean TEST = true;
public final static boolean TEST = false;
//崩溃重启
public final static boolean ERROR_ROOT = false;
//日志打印
public final static boolean LOG_TEST = false;
//region 单例模式


+ 12
- 9
app/src/main/java/com/bonait/bnframework/common/helper/CrashHandler.java View File

@@ -2,7 +2,6 @@ package com.bonait.bnframework.common.helper;

import android.annotation.SuppressLint;
import android.content.Context;
import android.content.Intent;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.content.pm.PackageManager.NameNotFoundException;
@@ -14,7 +13,8 @@ import android.util.Log;
import android.widget.Toast;

import com.apkfuns.logutils.LogUtils;
import com.bonait.bnframework.common.constant.ConfigName;
import com.bonait.bnframework.HBL.Thread.ThreadManager;
import com.bonait.bnframework.business.RecordManager;

import java.io.File;
import java.io.FileOutputStream;
@@ -88,7 +88,9 @@ public class CrashHandler implements UncaughtExceptionHandler {
* @return true:��������˸��쳣��Ϣ; ���򷵻�false.
*/
private boolean handleException(Throwable ex) {
if(ConfigName.TEST) return false;
ThreadManager.get().Stop("Modbus变量状态");
ThreadManager.get().Stop("日志信息保存");
// if(!ConfigName.ERROR_ROOT) return false;
if (ex == null)
return false;

@@ -103,18 +105,19 @@ public class CrashHandler implements UncaughtExceptionHandler {
Looper.loop();
}
}.start();
RecordManager.getInstance().addLogRecord("设备异常日志"," 设备崩溃了");
collectDeviceInfo(mContext);
saveCrashInfoFile(ex);

Intent intent = mContext.getPackageManager().getLaunchIntentForPackage(mContext.getPackageName());
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
mContext.startActivity(intent);
SystemClock.sleep(3000);
// Intent intent = mContext.getPackageManager().getLaunchIntentForPackage(mContext.getPackageName());
// intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
// mContext.startActivity(intent);
// SystemClock.sleep(3000);
} catch (Exception e) {
e.printStackTrace();
}
return true;
return false;
// return true;
}

/**


+ 7
- 3
app/src/main/java/com/bonait/bnframework/common/utils/AdbCommandUtil.java View File

@@ -2,11 +2,11 @@ package com.bonait.bnframework.common.utils;

import android.util.Log;

import com.apkfuns.logutils.LogUtils;
import com.bonait.bnframework.HBL.Thread.ThreadManager;

import java.io.DataOutputStream;
import java.io.IOException;
import java.nio.charset.StandardCharsets;

/**
* @author: liup
@@ -28,13 +28,17 @@ public class AdbCommandUtil {
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));
// process = Runtime.getRuntime().exec("system/bin/su");
// String command = hide?"am broadcast -a action.HIDE_STATUSBAR\n":"am broadcast -a action.SHOW_STATUSBAR\n";
String command = "am broadcast -a action.SHOW_STATUSBAR\n";
LogUtils.d("hideStatusBar command="+command);
dataOutputStream.write(command.getBytes());
dataOutputStream.flush();
dataOutputStream.writeBytes("exit\n");
dataOutputStream.flush();
process.waitFor();
} catch (Exception e) {
e.printStackTrace();
Log.e("hideStatusBar", e.getMessage(), e);
} finally {
try {


+ 36
- 15
app/src/main/java/com/bonait/bnframework/ui/activity/CookingActivity.java View File

@@ -232,20 +232,20 @@ public class CookingActivity extends BaseActivity {
private void startMakingThread(){
ThreadManager.get().execute(new Thread(()->{
if (NewExecuteTheRecipe.IsStart && goodsSubattributeGroup != null) {
ModbusHelper.get().reset();
if(!isTest){
ModbusHelper.get().reset();
}
long startTime= System.currentTimeMillis(); //起始时间
boolean hasError = false;//设备有异常报警
boolean isError = false;//执行异常
try {
RecordManager.getInstance().addLogRecord("订单处理日志",goodsSubattributeGroup.name+"-开始制作");
//获取工艺
ArrayList<BPA_GOODS_PROCESS_DETAIL> goodsrecipes = GoodsProcessDetailDBUtil.getByGroupId(goodsSubattributeGroup.id);
LogUtils.d("制作线程 MakeThread 启动 ==》 菜品配方 goodsrecipes="+goodsrecipes.toString());
LogUtils.d("制作线程 MakeThread 启动 ==》 菜品配方 goodsrecipes="+stepList.toString());
int position = 0;
if(!isTest){
ModbusHelper.get().setCookStatus(true);
}
for (BPA_GOODS_PROCESS_DETAIL item : goodsrecipes) {
for (BPA_GOODS_PROCESS_DETAIL item : stepList) {
if( !NewExecuteTheRecipe.IsStart){
NewToastUtil.getInstance().showToastBottom("客官,当前菜品已停止炒制!!!");
break;
@@ -253,11 +253,13 @@ public class CookingActivity extends BaseActivity {
if(!isTest){
if(ModbusHelper.get().isBtnStop()){
NewToastUtil.getInstance().showToastBottom("设备已急停,请关闭急停按钮再调试!");
Thread.sleep(2000);
hasError = true;
break;
}
if(ModbusHelper.get().hasErrorInfo()){
String tip = ModbusHelper.get().isBtnStop()?"设备已急停,请关闭急停按钮再调试!":"设备有报警,请前往设备故障页检查!";
Thread.sleep(2000);
NewToastUtil.getInstance().showToastBottom(tip);
runOnUiThread(new Runnable() {
@Override
@@ -279,7 +281,7 @@ public class CookingActivity extends BaseActivity {
boolean status = NewExecuteTheRecipe.Execute(item);
position++;
}
LogUtils.d("制作线程 MakeThread 结束 ==》 菜品配方 goodsrecipes="+goodsrecipes.toString());
LogUtils.d("制作线程 MakeThread 结束 ==》 菜品配方 goodsrecipes="+stepList.toString());
} catch (Exception ex) {
isError = true;
LogUtils.d("异常信息:" + ex.getMessage());
@@ -288,20 +290,35 @@ public class CookingActivity extends BaseActivity {
RecordManager.getInstance().addLogRecord("订单处理日志",goodsSubattributeGroup.name+"-制作异常");
RecordManager.getInstance().addOrderRecord(goodsSubattributeGroup,"异常");
RecordManager.getInstance().addSubOrderRecord(goodsSubattributeGroup,"异常");
}else {
RecordManager.getInstance().addLogRecord("订单处理日志",goodsSubattributeGroup.name+"-模拟制作异常");
RecordManager.getInstance().addOrderRecord(goodsSubattributeGroup,"异常");
RecordManager.getInstance().addSubOrderRecord(goodsSubattributeGroup,"异常");
}
} finally {
isMaking = false;
if(!isError && !isTest){
if(NewExecuteTheRecipe.IsForcedEnd){
RecordManager.getInstance().addLogRecord("订单处理日志",goodsSubattributeGroup.name+"-制作强行停止");
RecordManager.getInstance().addOrderRecord(goodsSubattributeGroup,"取消");
RecordManager.getInstance().addSubOrderRecord(goodsSubattributeGroup,"取消");
if(isTest){
if(!isError){
if(NewExecuteTheRecipe.IsForcedEnd){
RecordManager.getInstance().addLogRecord("订单处理日志",goodsSubattributeGroup.name+"-制作强行停止");
RecordManager.getInstance().addOrderRecord(goodsSubattributeGroup,"取消");
RecordManager.getInstance().addSubOrderRecord(goodsSubattributeGroup,"取消");
}else {
RecordManager.getInstance().addLogRecord("订单处理日志",goodsSubattributeGroup.name+"-制作完成");
RecordManager.getInstance().addOrderRecord(goodsSubattributeGroup,"完成");
RecordManager.getInstance().addSubOrderRecord(goodsSubattributeGroup,"完成");
}
}else {
RecordManager.getInstance().addLogRecord("订单处理日志",goodsSubattributeGroup.name+"-制作完成");
RecordManager.getInstance().addOrderRecord(goodsSubattributeGroup,"完成");
RecordManager.getInstance().addSubOrderRecord(goodsSubattributeGroup,"完成");
RecordManager.getInstance().addLogRecord("订单处理日志",goodsSubattributeGroup.name+"-制作异常");
RecordManager.getInstance().addOrderRecord(goodsSubattributeGroup,"异常");
RecordManager.getInstance().addSubOrderRecord(goodsSubattributeGroup,"异常");
}
}else {
RecordManager.getInstance().addLogRecord("订单处理日志",goodsSubattributeGroup.name+"-模拟制作完成");
RecordManager.getInstance().addOrderRecord(goodsSubattributeGroup,"完成");
RecordManager.getInstance().addSubOrderRecord(goodsSubattributeGroup,"完成");
}

if (!NewExecuteTheRecipe.IsForcedEnd && !ModbusHelper.get().hasErrorInfo() && NewExecuteTheRecipe.IsStart && !isTest){
long endTime = System.currentTimeMillis(); //结束时间
int time=(int) ((endTime-startTime)/1000);
@@ -311,7 +328,9 @@ public class CookingActivity extends BaseActivity {
}
NewExecuteTheRecipe.IsStart = false;

ModbusHelper.get().reset();
if(!isTest&&!hasError){
ModbusHelper.get().reset();
}
boolean finalIsError = hasError;
if(handler!=null){
handler.post(new Runnable() {
@@ -328,6 +347,8 @@ public class CookingActivity extends BaseActivity {
}else{
if(!finalIsError){
NewToastUtil.getInstance().showToastBottom("客官,当前菜品已制作完成!!!");
}else {
NewToastUtil.getInstance().showToastBottom("客官,设备有报警,请前往设备报警页查看!!!");
}
}
if(progressDialog !=null){


+ 94
- 0
app/src/main/java/com/bonait/bnframework/ui/activity/DeviceRecordActivity.java View File

@@ -0,0 +1,94 @@
package com.bonait.bnframework.ui.activity;

import android.os.Bundle;
import android.os.Handler;
import android.os.Looper;
import android.os.Message;

import androidx.annotation.NonNull;

import com.apkfuns.logutils.LogUtils;
import com.bonait.bnframework.HBL.Result.OperateResultT;
import com.bonait.bnframework.HBL.Thread.ThreadManager;
import com.bonait.bnframework.Model.DeviceRecordBean;
import com.bonait.bnframework.Service.ControlAdress;
import com.bonait.bnframework.Service.ModbusHelper;
import com.bonait.bnframework.common.base.BaseActivity;
import com.bonait.bnframework.common.utils.DisplayManager;
import com.bonait.bnframework.databinding.ActivityDeviceRecordBinding;
import com.bonait.bnframework.ui.adapter.DeviceRecordAdapter;
import com.bonait.bnframework.ui.widget.NewToastUtil;

import java.util.ArrayList;
import java.util.List;

/**
* @author: liup
* @description: 统计使用时间和次数
* @date: 2024/6/11 11:16.
*/
public class DeviceRecordActivity extends BaseActivity {
private ActivityDeviceRecordBinding viewBinding;
private List<DeviceRecordBean> dataList = new ArrayList<>();
private Handler handler = new Handler(Looper.getMainLooper()){
@Override
public void handleMessage(@NonNull Message msg) {
super.handleMessage(msg);
initView();
}
};

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
viewBinding = ActivityDeviceRecordBinding.inflate(getLayoutInflater());
setContentView(viewBinding.getRoot());
DisplayManager.scaleViewGroup(viewBinding.getRoot());
initTopBar();
NewToastUtil.getInstance().showToast("正在刷新数据...");
initData();
}

private void initTopBar(){
viewBinding.back.setOnClickListener(v->{
finish();
});
}

private void initData(){
dataList.clear();
ThreadManager.get().execute(new Thread(()->{
getData("上升次数",ControlAdress.上升次数);
getData("下降次数",ControlAdress.下降次数);
getData("投料1次数",ControlAdress.投料1次数);
getData("投料2次数",ControlAdress.投料2次数);
getData("投料3次数",ControlAdress.投料3次数);
getData("投料4次数",ControlAdress.投料4次数);
getData("投料5次数",ControlAdress.投料5次数);
getData("投料6次数",ControlAdress.投料6次数);
getData("加热时间(分钟)",ControlAdress.加热时间);
getData("搅拌时间(分钟)",ControlAdress.搅拌时间);
handler.sendEmptyMessage(0);
}));

}

private void getData(String name,ControlAdress controlAddress){
try {
OperateResultT<Integer> upNumRes = ModbusHelper.get().ReadInt(ModbusHelper.get().getPLC(controlAddress).PlcAddress);
OperateResultT<int[]> upNumRes2 = ModbusHelper.get().ReadInt(ModbusHelper.get().getPLC(controlAddress).PlcAddress,2);
if(upNumRes.isSuccess){
LogUtils.d("Combined int upNumRes= " + upNumRes.Content+" upNumRes2="+upNumRes2.Content);
dataList.add(new DeviceRecordBean(name,upNumRes.Content+""));
}
}catch (Exception e){
e.printStackTrace();
}
}

private void initView(){
DeviceRecordAdapter adapter = new DeviceRecordAdapter();
adapter.setNewData(dataList);
viewBinding.recyclerView.setAdapter(adapter);
}
}

+ 109
- 16
app/src/main/java/com/bonait/bnframework/ui/activity/DiyProcessActivity.java View File

@@ -5,19 +5,25 @@ import static com.bonait.bnframework.MainApplication.getContext;
import android.annotation.SuppressLint;
import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
import android.os.Looper;
import android.os.Message;
import android.view.MotionEvent;
import android.view.View;
import android.widget.AdapterView;
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.R;
import com.bonait.bnframework.ViewModel.CustomView.XComDialog;
import com.bonait.bnframework.ViewModel.CustomView.item_gx;
import com.bonait.bnframework.business.RecordManager;
import com.bonait.bnframework.common.base.BaseActivity;
import com.bonait.bnframework.common.constant.ConfigName;
import com.bonait.bnframework.common.db.QueryDB;
import com.bonait.bnframework.common.db.mode.BPA_GOODS;
import com.bonait.bnframework.common.db.mode.BPA_GOODS_PROCESS_DETAIL;
@@ -27,12 +33,15 @@ import com.bonait.bnframework.common.db.mode.BPA_PROCESSModel;
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.CookTimeUtils;
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.DialogWithCancelConfirmBinding;
import com.bonait.bnframework.ui.adapter.DiyStepAdapter;
import com.bonait.bnframework.ui.dialog.AttributeSelectDialog;
import com.bonait.bnframework.ui.dialog.WaiteProgressDialog;
import com.bonait.bnframework.ui.widget.NewToastUtil;
import com.bonait.bnframework.ui.widget.ProcessValueView;

@@ -71,11 +80,11 @@ public class DiyProcessActivity extends BaseActivity {
/**
* 工序数据
*/
Map<String, String> processMap = new LinkedHashMap<>();
private Map<String, String> processMap = new LinkedHashMap<>();
/**
* 工序坐标
*/
Map<String, Integer> processMapIndex = new LinkedHashMap<>();
private Map<String, Integer> processMapIndex = new LinkedHashMap<>();
/**
* 工序步骤
*/
@@ -89,7 +98,41 @@ public class DiyProcessActivity extends BaseActivity {
* 导入已有属性组合弹窗
*/
private AttributeSelectDialog attributeSelectDialog;

private WaiteProgressDialog progressDialog;
private Handler handler = new Handler(Looper.getMainLooper()){
@Override
public void handleMessage(@NonNull Message msg) {
super.handleMessage(msg);
switch (msg.what){
case 1:
if(progressDialog ==null){
progressDialog = new WaiteProgressDialog(DiyProcessActivity.this);
}else {
progressDialog.dismiss();
}
progressDialog.setTitleAndMessage("温馨提示","正在保存工序,请稍等...");
progressDialog.setCancelable(false);
progressDialog.show();
List<BPA_GOODS_PROCESS_DETAIL> processDetails1 = GoodsProcessDetailDBUtil.getByGroupId(subAttributeGroupId);
GoodsProcessDetailDBUtil.removeList(processDetails1);
for (int i =0;i<processDetails.size();i++){
processDetails.get(i).sort = i+1;
processDetails.get(i).goodsSubAttributeGroupId = subAttributeGroupId;
}
SubAttributeGroupDBUtil.updateMakeTime(subAttributeGroupId, CookTimeUtils.measureCookingTime(processDetails));
if(GoodsProcessDetailDBUtil.addList(processDetails)){
NewToastUtil.getInstance().showToast("保存成功");
RecordManager.getInstance().addLogRecord("角色操作日志","工序保存并返回-成功");
}else {
NewToastUtil.getInstance().showToastError("保存失败");
RecordManager.getInstance().addLogRecord("角色操作日志","工序保存并返回-失败");
}
LogUtils.d(TAG+" back");
finish();
break;
}
}
};

@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
@@ -174,7 +217,9 @@ public class DiyProcessActivity extends BaseActivity {
updateProcessSpinner(mData.get(position));
}
};
processDetails = GoodsProcessDetailDBUtil.getByGroupId(subAttributeGroupId);
processDetails.clear();

processDetails.addAll(GoodsProcessDetailDBUtil.getByGroupId(subAttributeGroupId));
stepAdapter.setCurrentPosition(0);
stepAdapter.setNewData(processDetails);
if(!processDetails.isEmpty()){
@@ -262,7 +307,7 @@ public class DiyProcessActivity extends BaseActivity {
@Override
public void submit() {
processDetails.clear();
processDetails = GoodsProcessDetailDBUtil.getByGroupId(subAttributeGroupId);
processDetails.addAll(GoodsProcessDetailDBUtil.getByGroupId(subAttributeGroupId));
changeMainFoods();
stepAdapter.setCurrentPosition(0);
stepAdapter.setNewData(processDetails);
@@ -516,7 +561,37 @@ public class DiyProcessActivity extends BaseActivity {
viewBinding.topbar.setBackgroundColor(ContextCompat.getColor(getContext(), R.color.topbj1));
viewBinding.topbar.setTitle("编辑工序");
viewBinding.back.setOnClickListener(v->{
finish();
AlertDialogUtils.showCancelAndConfirmDialog(this,R.layout.dialog_with_cancel_confirm, new XComDialog.OnDialogListener(){

@Override
public void onDialogClick(View layoutView, XComDialog xCom) {
DialogWithCancelConfirmBinding binding = DialogWithCancelConfirmBinding.bind(layoutView);
DisplayManager.scaleView(binding.getRoot());


binding.tvTitle.setText("保存并返回");
binding.tvContent.setText("即将退出页面,是否保存工序?");
binding.tvCancel.setText("不保存");
binding.tvConfirm.setText("保存");
binding.tvCancel.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
xCom.dismissX();
finish();
}
});
binding.tvConfirm.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
if(ConfigName.getInstance().isFastClick()){
return;
}
xCom.dismissX();
handler.sendEmptyMessage(1);
}
});
}
});
});
}

@@ -691,8 +766,10 @@ public class DiyProcessActivity extends BaseActivity {
processDetails.clear();
processDetails.addAll(GoodsProcessDetailDBUtil.getByGroupId(subAttributeGroupId));
changeMainFoods();
stepAdapter.setCurrentPosition(0);
stepAdapter.notifyDataSetChanged();
if(stepAdapter!=null){
stepAdapter.setCurrentPosition(0);
stepAdapter.notifyDataSetChanged();
}
if(!processDetails.isEmpty()){
updateProcessSpinner(processDetails.get(0));
}
@@ -703,18 +780,34 @@ public class DiyProcessActivity extends BaseActivity {
@Override
protected void onPause() {
LogUtils.d(TAG+" onPause1");
List<BPA_GOODS_PROCESS_DETAIL> processDetails1 = GoodsProcessDetailDBUtil.getByGroupId(subAttributeGroupId);
GoodsProcessDetailDBUtil.removeList(processDetails1);
for (int i =0;i<processDetails.size();i++){
processDetails.get(i).sort = i+1;
processDetails.get(i).goodsSubAttributeGroupId = subAttributeGroupId;
if(progressDialog !=null){
progressDialog.dismiss();
}
GoodsProcessDetailDBUtil.addList(processDetails);
SubAttributeGroupDBUtil.updateMakeTime(subAttributeGroupId, CookTimeUtils.measureCookingTime(processDetails));
LogUtils.d(TAG+" onPause2");
progressDialog = null;
super.onPause();
}

@Override
protected void onDestroy() {
super.onDestroy();
if(handler!=null){
handler.removeCallbacksAndMessages(null);
handler = null;
}
if(processDetails!=null){
processDetails.clear();
processDetails = null;
}
if(processMapIndex!=null){
processMapIndex.clear();
processMapIndex = null;
}
if(processMap!=null){
processMap.clear();
processMap = null;
}
}

@Override
protected String getClassName() {
return "编辑工序页";


+ 47
- 0
app/src/main/java/com/bonait/bnframework/ui/adapter/DeviceRecordAdapter.java View File

@@ -0,0 +1,47 @@
package com.bonait.bnframework.ui.adapter;

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.Model.DeviceRecordBean;
import com.bonait.bnframework.common.base.BaseAdapter;
import com.bonait.bnframework.databinding.ItemDeviceRecordBinding;

/**
* @author: liup
* @description:
* @date: 2024/6/11 11:23.
*/
public class DeviceRecordAdapter extends BaseAdapter<DeviceRecordBean,DeviceRecordAdapter.ViewHolder> {

@Override
protected void onItemClick(View v, int position) {

}

@NonNull
@Override
public ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
return new DeviceRecordAdapter.ViewHolder(ItemDeviceRecordBinding.inflate(LayoutInflater.from(parent.getContext()), parent, false));
}

@Override
public void onBindViewHolder(@NonNull ViewHolder holder, int position) {
holder.binding.name.setText(mData.get(position).getName()+"");
holder.binding.value.setText(mData.get(position).getValue()+"");
}

public static class ViewHolder extends RecyclerView.ViewHolder {
private ItemDeviceRecordBinding binding;


public ViewHolder(ItemDeviceRecordBinding view) {
super(view.getRoot());
binding = view;
}
}
}

+ 24
- 0
app/src/main/java/com/bonait/bnframework/ui/dialog/AddGoodsDialog.java View File

@@ -5,6 +5,7 @@ import android.content.DialogInterface;
import android.content.Intent;
import android.graphics.Color;
import android.graphics.drawable.ColorDrawable;
import android.os.Build;
import android.os.Bundle;
import android.view.Gravity;
import android.view.LayoutInflater;
@@ -92,11 +93,34 @@ public class AddGoodsDialog extends DialogFragment {
params.width = ViewGroup.LayoutParams.MATCH_PARENT;
params.height = ViewGroup.LayoutParams.MATCH_PARENT;
window.setAttributes(params);
fullScreen(window);
}
AdbCommandUtil.hideStatusBar(true);
updateClassifyData(classifyPosition);
}

private void fullScreen(Window window){
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
// 全屏显示,隐藏状态栏和导航栏,拉出状态栏和导航栏显示一会儿后消失。
// 启动游戏模式,设置状态栏和导航栏中的图标变小,变模糊或者弱化其效果
window.getDecorView().setSystemUiVisibility(
View.SYSTEM_UI_FLAG_LOW_PROFILE
| View.SYSTEM_UI_FLAG_LAYOUT_STABLE
| View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
| View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
| View.SYSTEM_UI_FLAG_HIDE_NAVIGATION
| View.SYSTEM_UI_FLAG_FULLSCREEN
| View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY);
//activity.getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_HIDE_NAVIGATION|View.SYSTEM_UI_FLAG_FULLSCREEN);
//activity.getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_FULLSCREEN | View.SYSTEM_UI_FLAG_HIDE_NAVIGATION);
} else {
// 全屏显示,隐藏状态栏
window.getDecorView().setSystemUiVisibility(View.INVISIBLE);
}
}
}

@Override
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);


+ 23
- 1
app/src/main/java/com/bonait/bnframework/ui/dialog/AttributeSelectDialog.java View File

@@ -3,6 +3,7 @@ package com.bonait.bnframework.ui.dialog;
import android.content.DialogInterface;
import android.graphics.Color;
import android.graphics.drawable.ColorDrawable;
import android.os.Build;
import android.os.Bundle;
import android.view.Gravity;
import android.view.LayoutInflater;
@@ -71,7 +72,27 @@ public class AttributeSelectDialog extends DialogFragment {
attributeList = AttributeDBUtil.getByClassify(goods.classifyId);
}
}

private void fullScreen(Window window){
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
// 全屏显示,隐藏状态栏和导航栏,拉出状态栏和导航栏显示一会儿后消失。
// 启动游戏模式,设置状态栏和导航栏中的图标变小,变模糊或者弱化其效果
window.getDecorView().setSystemUiVisibility(
View.SYSTEM_UI_FLAG_LOW_PROFILE
| View.SYSTEM_UI_FLAG_LAYOUT_STABLE
| View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
| View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
| View.SYSTEM_UI_FLAG_HIDE_NAVIGATION
| View.SYSTEM_UI_FLAG_FULLSCREEN
| View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY);
//activity.getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_HIDE_NAVIGATION|View.SYSTEM_UI_FLAG_FULLSCREEN);
//activity.getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_FULLSCREEN | View.SYSTEM_UI_FLAG_HIDE_NAVIGATION);
} else {
// 全屏显示,隐藏状态栏
window.getDecorView().setSystemUiVisibility(View.INVISIBLE);
}
}
}
@Nullable
@Override
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
@@ -92,6 +113,7 @@ public class AttributeSelectDialog extends DialogFragment {
params.width = ViewGroup.LayoutParams.MATCH_PARENT;
params.height = ViewGroup.LayoutParams.MATCH_PARENT;
window.setAttributes(params);
fullScreen(window);
}
AdbCommandUtil.hideStatusBar(true);
updateAttributeData();


+ 41
- 6
app/src/main/java/com/bonait/bnframework/ui/dialog/DeviceControlDialog.java View File

@@ -3,6 +3,7 @@ package com.bonait.bnframework.ui.dialog;
import android.content.DialogInterface;
import android.graphics.Color;
import android.graphics.drawable.ColorDrawable;
import android.os.Build;
import android.os.Bundle;
import android.view.Gravity;
import android.view.LayoutInflater;
@@ -109,11 +110,34 @@ public class DeviceControlDialog extends DialogFragment {
params.height = ViewGroup.LayoutParams.MATCH_PARENT;
window.setAttributes(params);
window.setDimAmount(0.5f);
fullScreen(window);
}
AdbCommandUtil.hideStatusBar(true);
initView();
}

private void fullScreen(Window window){
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
// 全屏显示,隐藏状态栏和导航栏,拉出状态栏和导航栏显示一会儿后消失。
// 启动游戏模式,设置状态栏和导航栏中的图标变小,变模糊或者弱化其效果
window.getDecorView().setSystemUiVisibility(
View.SYSTEM_UI_FLAG_LOW_PROFILE
| View.SYSTEM_UI_FLAG_LAYOUT_STABLE
| View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
| View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
| View.SYSTEM_UI_FLAG_HIDE_NAVIGATION
| View.SYSTEM_UI_FLAG_FULLSCREEN
| View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY);
//activity.getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_HIDE_NAVIGATION|View.SYSTEM_UI_FLAG_FULLSCREEN);
//activity.getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_FULLSCREEN | View.SYSTEM_UI_FLAG_HIDE_NAVIGATION);
} else {
// 全屏显示,隐藏状态栏
window.getDecorView().setSystemUiVisibility(View.INVISIBLE);
}
}
}

private void initView(){
viewBinding.layoutFire.getRoot().setVisibility(type==1?View.VISIBLE:View.GONE);
viewBinding.layoutSilos.getRoot().setVisibility(type==2?View.VISIBLE:View.GONE);
@@ -483,22 +507,33 @@ public class DeviceControlDialog extends DialogFragment {
viewBinding.layoutStir.stirProgress.setValue(progressStir,true);
});
viewBinding.layoutStir.btnStirStart.setOnClickListener(v->{
String timeS1 = viewBinding.layoutStir.edittextTime1.getText().toString();
String timeS2 = viewBinding.layoutStir.edittextTime2.getText().toString();
if(timeS1.isEmpty()){
timeS1 = "3";
}
if(timeS2.isEmpty()){
timeS2 = "3";
}
int time1 = Math.max(Integer.parseInt(timeS1),3);
int time2 = Math.max(Integer.parseInt(timeS2),3);
BPA_GOODS_PROCESS_DETAIL detail = new BPA_GOODS_PROCESS_DETAIL();
detail.processname = "双向搅拌";
detail.materialType = 1;
detail.processvalue = "搅拌档位,"+progressStir+"档|搅拌控制,启动搅拌|正转时间,3|反转时间,3|延迟(秒),0";
detail.processms = "双向搅拌("+progressStir+"档,启动搅拌,3,3,0)";
detail.processvalue = "搅拌档位,"+progressStir+"档|搅拌控制,启动搅拌|正转时间,"+time1+"|反转时间,"+time2+"|延迟(秒),0";
detail.processms = "双向搅拌("+progressStir+"档,启动搅拌,"+time1+","+time2+",0)";
if(progressStir==0){
NewToastUtil.getInstance().showToast("启动搅拌 档位:0");
deviceCallBack.onClickEvent(type,"停止搅拌",0,detail);
return;
}
NewToastUtil.getInstance().showToast("启动搅拌 档位:"+progressStir);
RecordManager.getInstance().addLogRecord("角色操作日志", "手动控制-"+"启动搅拌 档位:"+progressStir);
NewToastUtil.getInstance().showToast("启动双向搅拌 档位:"+progressStir);
RecordManager.getInstance().addLogRecord("角色操作日志", "手动控制-"+"启动双向搅拌 档位:"+progressStir);

ThreadManager.get().execute(new Thread(() -> {
ModbusHelper.get().setStirModel(2);
ModbusHelper.get().setStirTime(1,3);
ModbusHelper.get().setStirTime(2,3);
ModbusHelper.get().setStirTime(1, time1);
ModbusHelper.get().setStirTime(2,time2);
ModbusHelper.get().setStirMotor(progressStir,1);
}));
deviceCallBack.onClickEvent(type,"启动搅拌",0,detail);


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

@@ -5,6 +5,7 @@ import android.content.DialogInterface;
import android.content.Intent;
import android.graphics.Color;
import android.graphics.drawable.ColorDrawable;
import android.os.Build;
import android.os.Bundle;
import android.view.Gravity;
import android.view.LayoutInflater;
@@ -93,14 +94,6 @@ 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");
}
goods = GoodsDBUtil.getById(goodId);
if(goods!=null){
attributeList = AttributeDBUtil.getByClassify(goods.classifyId);
}
}

@Nullable
@@ -124,6 +117,15 @@ public class EditGoodsDialog extends DialogFragment {
params.width = ViewGroup.LayoutParams.MATCH_PARENT;
params.height = ViewGroup.LayoutParams.MATCH_PARENT;
window.setAttributes(params);
fullScreen(window);
}
if(getArguments()!=null){
goodId = getArguments().getString("goodId");
isEdit = getArguments().getBoolean("isEdit");
}
goods = GoodsDBUtil.getById(goodId);
if(goods!=null){
attributeList = AttributeDBUtil.getByClassify(goods.classifyId);
}
AdbCommandUtil.hideStatusBar(true);
initView();
@@ -141,7 +143,27 @@ public class EditGoodsDialog extends DialogFragment {
updateAttributeData("");
groupSpinnerView();
}

private void fullScreen(Window window){
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
// 全屏显示,隐藏状态栏和导航栏,拉出状态栏和导航栏显示一会儿后消失。
// 启动游戏模式,设置状态栏和导航栏中的图标变小,变模糊或者弱化其效果
window.getDecorView().setSystemUiVisibility(
View.SYSTEM_UI_FLAG_LOW_PROFILE
| View.SYSTEM_UI_FLAG_LAYOUT_STABLE
| View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
| View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
| View.SYSTEM_UI_FLAG_HIDE_NAVIGATION
| View.SYSTEM_UI_FLAG_FULLSCREEN
| View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY);
//activity.getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_HIDE_NAVIGATION|View.SYSTEM_UI_FLAG_FULLSCREEN);
//activity.getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_FULLSCREEN | View.SYSTEM_UI_FLAG_HIDE_NAVIGATION);
} else {
// 全屏显示,隐藏状态栏
window.getDecorView().setSystemUiVisibility(View.INVISIBLE);
}
}
}
@Override
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);


+ 23
- 1
app/src/main/java/com/bonait/bnframework/ui/dialog/SubOrderDialog.java View File

@@ -2,6 +2,7 @@ package com.bonait.bnframework.ui.dialog;

import android.graphics.Color;
import android.graphics.drawable.ColorDrawable;
import android.os.Build;
import android.os.Bundle;
import android.view.Gravity;
import android.view.LayoutInflater;
@@ -63,7 +64,27 @@ public class SubOrderDialog extends DialogFragment {
DisplayManager.scaleViewGroup(viewBinding.getRoot());
return viewBinding.getRoot();
}

private void fullScreen(Window window){
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
// 全屏显示,隐藏状态栏和导航栏,拉出状态栏和导航栏显示一会儿后消失。
// 启动游戏模式,设置状态栏和导航栏中的图标变小,变模糊或者弱化其效果
window.getDecorView().setSystemUiVisibility(
View.SYSTEM_UI_FLAG_LOW_PROFILE
| View.SYSTEM_UI_FLAG_LAYOUT_STABLE
| View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
| View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
| View.SYSTEM_UI_FLAG_HIDE_NAVIGATION
| View.SYSTEM_UI_FLAG_FULLSCREEN
| View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY);
//activity.getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_HIDE_NAVIGATION|View.SYSTEM_UI_FLAG_FULLSCREEN);
//activity.getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_FULLSCREEN | View.SYSTEM_UI_FLAG_HIDE_NAVIGATION);
} else {
// 全屏显示,隐藏状态栏
window.getDecorView().setSystemUiVisibility(View.INVISIBLE);
}
}
}
@Override
public void onStart() {
super.onStart();
@@ -76,6 +97,7 @@ public class SubOrderDialog extends DialogFragment {
params.width = ViewGroup.LayoutParams.WRAP_CONTENT;
params.height = ViewGroup.LayoutParams.WRAP_CONTENT;
window.setAttributes(params);
fullScreen(window);
}
AdbCommandUtil.hideStatusBar(true);
initView();


+ 8
- 14
app/src/main/java/com/bonait/bnframework/ui/fragment/HomeDevicesFragment.java View File

@@ -3,6 +3,7 @@ package com.bonait.bnframework.ui.fragment;
import android.animation.ObjectAnimator;
import android.animation.PropertyValuesHolder;
import android.annotation.SuppressLint;
import android.content.Intent;
import android.graphics.Color;
import android.graphics.drawable.AnimationDrawable;
import android.os.Bundle;
@@ -30,6 +31,7 @@ import com.bonait.bnframework.common.db.mode.BPA_GOODS_PROCESS_DETAIL;
import com.bonait.bnframework.common.utils.DimensUtil;
import com.bonait.bnframework.common.utils.DisplayManager;
import com.bonait.bnframework.databinding.FragmentHomeDevicesBinding;
import com.bonait.bnframework.ui.activity.DeviceRecordActivity;
import com.bonait.bnframework.ui.dialog.DeviceControlDialog;
import com.bonait.bnframework.ui.widget.NewToastUtil;

@@ -108,20 +110,7 @@ public class HomeDevicesFragment extends BaseFragment {
isUp = true;
isStir = false;
changeDevicePic();
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().addThickenWater(0f,true);
}));
ThreadManager.get().execute(new Thread(() -> {
for(int i =1;i<=9;i++){
ModbusHelper.get().addMaterial(0f,i,true);
}
}));
ModbusHelper.get().reset();
}

@Override
@@ -164,6 +153,11 @@ public class HomeDevicesFragment extends BaseFragment {
clear();
NewToastUtil.getInstance().showToast("复位完成");
});
viewBinding.deviceRecord.setOnClickListener(v->{
Intent intent = new Intent(getContext(), DeviceRecordActivity.class);
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP|Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(intent);
});
}

private DeviceControlDialog.DeviceCallBack deviceCallBack = new DeviceControlDialog.DeviceCallBack() {


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

@@ -58,7 +58,7 @@ public class NewToastUtil {
ViewLayoutToastBinding binding = ViewLayoutToastBinding.bind(layout);
DisplayManager.scaleViewGroup(binding.getRoot());
binding.toastText.setText(content);
toast.setGravity(Gravity.BOTTOM,0, (int) (DisplayManager.getWidthScaleRate()*DimensUtil.getDimens(100)));
toast.setGravity(Gravity.BOTTOM,0, (int) (DisplayManager.getWidthScaleRate()*DimensUtil.getDimens(10)));
toast.setDuration(Toast.LENGTH_SHORT);
toast.setView(layout);
toast.show();
@@ -133,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, (int) (DisplayManager.getWidthScaleRate()*DimensUtil.getDimens(180)));
toast.setGravity(Gravity.BOTTOM,0, (int) (DisplayManager.getWidthScaleRate()*DimensUtil.getDimens(10)));
toast.setDuration(Toast.LENGTH_SHORT);
toast.setView(layout);
toast.show();


+ 55
- 0
app/src/main/res/layout/activity_device_record.xml View File

@@ -0,0 +1,55 @@
<?xml version="1.0" encoding="utf-8"?>
<com.qmuiteam.qmui.widget.QMUIWindowInsetLayout 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"
android:orientation="vertical"
android:background="@color/white"
android:id="@+id/root"
android:fitsSystemWindows="true">

<com.qmuiteam.qmui.widget.QMUITopBarLayout
android:id="@+id/topbar"
android:layout_width="match_parent"
android:layout_height="wrap_content">

<TextView
android:id="@+id/back"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:drawableLeft="@mipmap/fanhui"
android:drawablePadding="@dimen/dp_5"
android:gravity="center"
android:paddingLeft="@dimen/dp_5"
android:paddingRight="@dimen/dp_50"
android:text=" 返 回"
android:textColor="@color/white"
android:textSize="@dimen/sp_32" />

<TextView
android:layout_gravity="center"
android:gravity="center"
android:text="设备使用统计"
android:textColor="@color/white"
android:textSize="@dimen/sp_36"
android:layout_width="match_parent"
android:layout_height="match_parent"/>
</com.qmuiteam.qmui.widget.QMUITopBarLayout>

<LinearLayout
android:layout_width="match_parent"
android:layout_marginTop="?attr/qmui_topbar_height"
android:orientation="vertical"
android:layout_height="match_parent">

<androidx.recyclerview.widget.RecyclerView
android:id="@+id/recycler_view"
android:layout_marginTop="@dimen/dp_10"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
/>
</LinearLayout>

</com.qmuiteam.qmui.widget.QMUIWindowInsetLayout>

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

@@ -259,18 +259,18 @@
android:id="@+id/topbar"
android:layout_width="match_parent"
android:layout_height="wrap_content" >

<TextView
android:id="@+id/back"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:textColor="@color/white"
android:textSize="@dimen/sp_32"
android:text=" 返 回"
android:paddingRight="@dimen/dp_50"
android:drawableLeft="@mipmap/fanhui"
android:drawablePadding="@dimen/dp_5"
android:gravity="center"
android:paddingLeft="@dimen/dp_5"
android:drawablePadding="@dimen/dp_5"
/>
android:paddingRight="@dimen/dp_50"
android:text=" 保存并返回"
android:textColor="@color/white"
android:textSize="@dimen/sp_32" />
</com.qmuiteam.qmui.widget.QMUITopBarLayout>
</com.qmuiteam.qmui.widget.QMUIWindowInsetLayout>

+ 59
- 5
app/src/main/res/layout/dialog/layout/layout_stir_control.xml View File

@@ -15,8 +15,6 @@
android:textColor="#BEAA6A"
android:textStyle="bold"
android:text="搅拌模组:"
android:paddingTop="@dimen/dp_20"
android:paddingBottom="@dimen/dp_20"
android:paddingLeft="@dimen/dp_20"
/>

@@ -26,7 +24,7 @@
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_marginTop="@dimen/dp_10"
android:layout_marginLeft="@dimen/dp_20"
android:text="搅拌档位"
android:textSize="@dimen/sp_36"
@@ -91,6 +89,62 @@
android:layout_marginLeft="@dimen/dp_10"
/>

<TextView
android:id="@+id/tv_time1"
android:layout_width="wrap_content"
android:layout_height="@dimen/dp_70"
app:layout_constraintTop_toBottomOf="@id/tv_fire_select"
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"
android:textColor="@color/black"
/>
<EditText
android:id="@+id/edittext_time1"
android:layout_width="@dimen/dp_200"
android:layout_height="@dimen/dp_70"
android:layout_marginLeft="5dp"
android:background="@drawable/input_bj"
android:hint="至少为3(s)"
android:inputType="number"
android:maxLines="1"
android:padding="3dp"
android:text="3"
app:layout_constraintTop_toTopOf="@id/tv_time1"
app:layout_constraintLeft_toRightOf="@id/tv_time1"
android:textSize="@dimen/sp_32" />

<TextView
android:id="@+id/tv_time2"
android:layout_width="wrap_content"
android:layout_height="@dimen/dp_70"
app:layout_constraintTop_toBottomOf="@id/tv_fire_select"
app:layout_constraintLeft_toRightOf="@id/edittext_time1"
android:layout_marginTop="@dimen/dp_20"
android:layout_marginLeft="@dimen/dp_20"
android:text="反转时间:"
android:textSize="@dimen/sp_36"
android:gravity="center"
android:textColor="@color/black"
/>
<EditText
android:id="@+id/edittext_time2"
android:layout_width="@dimen/dp_200"
android:layout_height="@dimen/dp_70"
android:layout_marginLeft="5dp"
android:background="@drawable/input_bj"
android:hint="至少为3(s)"
android:text="3"
android:inputType="number"
android:maxLines="1"
android:padding="3dp"
app:layout_constraintTop_toTopOf="@id/tv_time2"
app:layout_constraintLeft_toRightOf="@id/tv_time2"
android:textSize="@dimen/sp_32" />

<TextView
android:id="@+id/btn_stir_start"
android:layout_width="wrap_content"
@@ -101,13 +155,13 @@
android:paddingBottom="@dimen/dp_10"
android:paddingLeft="@dimen/dp_40"
android:paddingRight="@dimen/dp_40"
android:layout_marginTop="@dimen/dp_30"
android:layout_marginTop="@dimen/dp_10"
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_constraintTop_toBottomOf="@id/tv_time1"
app:layout_constraintLeft_toLeftOf="parent"
/>



+ 5
- 5
app/src/main/res/layout/dialog_with_cancel_confirm.xml View File

@@ -12,8 +12,8 @@
android:orientation="vertical"
android:layout_gravity="center"
android:padding="@dimen/dp_20"
android:layout_marginStart="@dimen/dp_50"
android:layout_marginEnd="@dimen/dp_50"
android:layout_marginStart="@dimen/dp_40"
android:layout_marginEnd="@dimen/dp_40"
>

<TextView
@@ -49,18 +49,18 @@

<TextView
android:id="@+id/tv_cancel"
android:layout_width="100dp"
android:layout_width="wrap_content"
android:layout_height="100dp"
android:textSize="@dimen/sp_38"
android:textColor="@color/blue_primary"
android:text="@string/tip_save_cancel"
android:text="取消"
android:layout_alignParentLeft="true"
android:layout_marginLeft="@dimen/dp_50"
android:gravity="center"
/>
<TextView
android:id="@+id/tv_confirm"
android:layout_width="100dp"
android:layout_width="wrap_content"
android:layout_height="100dp"
android:textSize="38sp"
android:textColor="@color/blue_primary"


+ 17
- 0
app/src/main/res/layout/fragment_home_devices.xml View File

@@ -50,4 +50,21 @@
android:textColor="@color/white"
android:background="@drawable/selector_text_click_yellow_round15"
/>

<TextView
android:id="@+id/device_record"
android:layout_width="wrap_content"
android:layout_height="@dimen/dp_90"
android:textSize="@dimen/sp_32"
android:text="使用统计"
android:paddingLeft="@dimen/dp_20"
android:paddingRight="@dimen/dp_20"
android:layout_marginEnd="@dimen/dp_20"
android:layout_gravity="bottom|end"
android:layout_marginBottom="@dimen/dp_170"
android:gravity="center"
android:clickable="true"
android:textColor="@color/white"
android:background="@drawable/selector_text_click_yellow_round15"
/>
</FrameLayout>

+ 41
- 0
app/src/main/res/layout/item/layout/item_device_record.xml View File

@@ -0,0 +1,41 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/white"
xmlns:tools="http://schemas.android.com/tools">

<LinearLayout
android:layout_width="match_parent"
android:background="@drawable/bg_bottom_line"
android:layout_height="wrap_content">
<TextView
android:id="@+id/name"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="2"
tools:text="上升次数"
android:textSize="32sp"
android:textColor="@color/black"
android:gravity="center"
/>

<TextView
android:layout_width="1dp"
android:layout_height="match_parent"
android:background="@color/color3"
/>

<TextView
android:id="@+id/value"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="2"
android:gravity="center_vertical"
android:textSize="32sp"
android:textColor="@color/black"
tools:text="100次"
android:padding="@dimen/dp_10"
/>
</LinearLayout>
</LinearLayout>

+ 5
- 5
app/src/main/res/layout/item/layout/view_layout_toast.xml View File

@@ -5,15 +5,15 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:layout_marginLeft="@dimen/dp_50"
android:layout_marginRight="@dimen/dp_50"
android:layout_marginStart="@dimen/dp_10"
android:layout_marginEnd="@dimen/dp_10"
android:background="@drawable/bg_round50_green_btn"
android:orientation="horizontal">

<ImageView
android:id="@+id/toast_icon"
android:layout_width="@dimen/dp_70"
android:layout_height="@dimen/dp_70"
android:layout_width="@dimen/dp_50"
android:layout_height="@dimen/dp_50"
android:src="@mipmap/boluo"
/>

@@ -21,7 +21,7 @@
android:id="@+id/toast_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="@dimen/sp_32"
android:textSize="@dimen/sp_26"
android:textColor="@color/white"
android:layout_toRightOf="@id/toast_icon"
android:paddingLeft="@dimen/dp_15"


+ 2
- 2
build.gradle View File

@@ -35,8 +35,8 @@ task clean(type: Delete) {

ext { // 统一版本入口
//App版本号
versionCode = 207
versionName = "2.0.7"
versionCode = 208
versionName = "2.0.8"

// 支持Android版本
buildToolsVersion = "33.0.0"


Loading…
Cancel
Save