From: TrillGates Date: Mon, 6 Dec 2021 07:53:11 +0000 (+0800) Subject: 修改了电池的低电提示 X-Git-Url: http://git.snicker.com.cn/?a=commitdiff_plain;h=324f5453417912fc9a34a46ca488df73b1b8ce2e;p=icsupport.git 修改了电池的低电提示 --- diff --git a/app/src/main/java/com/enqualcomm/support/utils/BatteryUtil.java b/app/src/main/java/com/enqualcomm/support/utils/BatteryUtil.java index 0bf66552..f889cbde 100644 --- a/app/src/main/java/com/enqualcomm/support/utils/BatteryUtil.java +++ b/app/src/main/java/com/enqualcomm/support/utils/BatteryUtil.java @@ -136,6 +136,11 @@ public class BatteryUtil { //根据电池电压进行低电报警等状态处理 public void process_battery_level(Context param1Context, int batLevel) { + //只要是充电了 + if (mRuntime.getHaveBatteryChange()) { + ICLogger.d("充电了,隐藏低电提示."); + BatteryLowLevTipsView.getInstance().dismiss(); + } if (batLevel >= 100) { mRuntime.setBattery(String.format("%03d", 100)); mRuntime.setBattery(100); @@ -166,6 +171,7 @@ public class BatteryUtil { intent.putExtra("openOrClose", "open"); mRuntime.getContextProxy().sendBroadcast("com.ic.action.TOAST_CHARGE_TIPS", intent); //以上在Launcher接收,然后弹出 + ICLogger.d("电量大于10%了,可以隐藏低电提示了."); BatteryLowLevTipsView.getInstance().dismiss(); ICLogger.d("on lower power please get charge..."); if (Config.LOG_TOFILE) ICLogger.logToFile("Battery", "BatteryLow less than 15%!"); @@ -182,11 +188,15 @@ public class BatteryUtil { mRuntime.setHaveBatteryChange(true); mRuntime.setBatteryLow(true); } else { - ChargeTipsView.getInstance().dismiss(); - BatteryLowLevTipsView.getInstance().showDialog(); - //这里则会显示可能会关机 - ICLogger.d("on lower then 5 percent..." + batLevel); - if (Config.LOG_TOFILE) ICLogger.logToFile("Battery", "BatteryLow less than 5% !"); + //ChargeTipsView.getInstance().dismiss(); + //如果不有充电,那么就显示 + //如果已经插上电了就不显示了 + if (!mRuntime.getHaveBatteryChange()) { + BatteryLowLevTipsView.getInstance().showDialog(); + //这里则会显示可能会关机 + ICLogger.d("on lower then 5 percent..." + batLevel); + if (Config.LOG_TOFILE) ICLogger.logToFile("Battery", "BatteryLow less than 5% !"); + } checkAndSendBatteryEvent(param1Context, mRuntime); mRuntime.setBattery(String.format("%03d", batLevel)); mRuntime.setBattery(batLevel); @@ -211,7 +221,6 @@ public class BatteryUtil { warningMsgValues.put(ICDatabaseHelper.warning_msg_create_time, System.currentTimeMillis()); runtime.getContextProxy().getResolver().insert(Uri.parse(WarningItemProvider.WARNING_MSG), warningMsgValues); - //TODO:低电的通知 } //add by TrillGates======end ICLogger.d("runtime.getBatteryLevel()==> " + runtime.getBatteryLevel()); diff --git a/app/src/main/java/com/ic/protocols/protocol_s123.java b/app/src/main/java/com/ic/protocols/protocol_s123.java index 38ac2c91..41e29cc8 100644 --- a/app/src/main/java/com/ic/protocols/protocol_s123.java +++ b/app/src/main/java/com/ic/protocols/protocol_s123.java @@ -162,7 +162,7 @@ public class protocol_s123 { .append(CMDSPLIT).append(mRuntime.getS123GpsData()) .append(CMDSPLIT).append("wgs84")//原始经纬度 .append(CMDSPLIT).append(mRuntime.getSignalStrength()) - .append(CMDSPLIT).append(mRuntime.getBatteryLevel()) + .append(CMDSPLIT).append(batteryLev) .append(CMDSPLIT).append(mRuntime.getLBSData()) .append(CMDSPLIT).append(mRuntime.getWifiInfo()) .append(CMDEND).toString()); diff --git a/app/src/main/java/com/ic/view/battery/BatteryLowLevTipsView.java b/app/src/main/java/com/ic/view/battery/BatteryLowLevTipsView.java index 5bac70ae..586a756e 100644 --- a/app/src/main/java/com/ic/view/battery/BatteryLowLevTipsView.java +++ b/app/src/main/java/com/ic/view/battery/BatteryLowLevTipsView.java @@ -56,6 +56,9 @@ public class BatteryLowLevTipsView { public void dismiss() { + if (!this.isShow) { + return; + } this.isShow = false; if (windowManager != null) { windowManager.removeView(view);