From f38ce1ee67e0820f5cabd8d27ce20002b1df8f7b Mon Sep 17 00:00:00 2001 From: TrillGates Date: Fri, 24 Sep 2021 10:56:28 +0800 Subject: [PATCH] fixed charge tips cover urgent call page issues. --- .../enqualcomm/support/utils/BatteryUtil.java | 17 +++++++++++++++-- .../com/ic/view/battery/ChargeTipsView.java | 2 -- 2 files changed, 15 insertions(+), 4 deletions(-) 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 3f5fd82a..0bf66552 100644 --- a/app/src/main/java/com/enqualcomm/support/utils/BatteryUtil.java +++ b/app/src/main/java/com/enqualcomm/support/utils/BatteryUtil.java @@ -24,6 +24,7 @@ import com.enqualcomm.support.provider.WarningItemProvider; import com.enqualcomm.support.service.AntiMonitorService; import com.enqualcomm.support.service.AudioService; import com.enqualcomm.support.service.Deliver; +import com.enqualcomm.support.service.SilentManager; import com.ic.protocols.protocolAPIHelper; import com.ic.protocols.protocol_s123; import com.ic.view.battery.BatteryLowLevTipsView; @@ -146,13 +147,25 @@ public class BatteryUtil { mRuntime.setHaveBatteryChange(false); mRuntime.setBatteryLow(false); } else if (batLevel < 25 && batLevel > 15) { - ChargeTipsView.getInstance().dismiss(); + //ChargeTipsView.getInstance().dismiss(); + Intent intent = new Intent(); + intent.putExtra("openOrClose", "close"); + mRuntime.getContextProxy().sendBroadcast("com.ic.action.TOAST_CHARGE_TIPS", intent); mRuntime.setBattery(String.format("%03d", batLevel)); mRuntime.setBattery(batLevel); mRuntime.setHaveBatteryChange(true); mRuntime.setBatteryLow(false); } else if (batLevel <= 15 && batLevel > 10) { - ChargeTipsView.getInstance().showDialog(); + //提示充电界面 + //ChargeTipsView.getInstance().showDialog(); + //以上由Launcher去完成,因为需要跳转到拨号,不可以为顶级弹窗,否则就盖住了 + boolean idle = SilentManager.getInstance().isIdle(mRuntime.getContextProxy().context); + Intent intent = new Intent(); + //如果是上课禁用状态,则不可以紧急拨号 + intent.putExtra("idle", idle); + intent.putExtra("openOrClose", "open"); + mRuntime.getContextProxy().sendBroadcast("com.ic.action.TOAST_CHARGE_TIPS", intent); + //以上在Launcher接收,然后弹出 BatteryLowLevTipsView.getInstance().dismiss(); ICLogger.d("on lower power please get charge..."); if (Config.LOG_TOFILE) ICLogger.logToFile("Battery", "BatteryLow less than 15%!"); diff --git a/app/src/main/java/com/ic/view/battery/ChargeTipsView.java b/app/src/main/java/com/ic/view/battery/ChargeTipsView.java index 7af0054e..c4920883 100644 --- a/app/src/main/java/com/ic/view/battery/ChargeTipsView.java +++ b/app/src/main/java/com/ic/view/battery/ChargeTipsView.java @@ -89,8 +89,6 @@ public class ChargeTipsView { btnView.setOnClickListener(v -> { //打开拨号界面 Context context = v.getContext(); - //这里有个bug,即时打开了界面,也无法进行拨号,被顶级的dialog盖住了 - //TODO:要解决这个问题 Intent targetIntent = context.getPackageManager().getLaunchIntentForPackage("com.ic.dial"); if (targetIntent != null) { targetIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); -- 2.17.1