fixed out temperature warning issues.
authorTrillGates <williamtrillgates@gmail.com>
Thu, 19 Aug 2021 06:43:41 +0000 (14:43 +0800)
committerTrillGates <williamtrillgates@gmail.com>
Thu, 19 Aug 2021 06:43:41 +0000 (14:43 +0800)
app/src/main/java/com/enqualcomm/support/utils/TemperatureUtil.java

index 530821b..7a784ac 100644 (file)
@@ -146,24 +146,27 @@ public class TemperatureUtil {
                 createWarningNotification(
                         CoreService.getInstance().getRuntime().getContextProxy().context
                                 .getString(R.string.body_temperature_exception_tips_text)
-                                + temperature.getBodyTemp() + "℃)", "body_temperature");
+                                + temperature.getBodyTemp() + "℃)", "body_temperature",
+                        Constants.WARNING_MSG_TYPE_BODY_TEMP);
             } else if (resultCode == 3) {
                 //创建警告信息
                 createWarningNotification(
                         CoreService.getInstance().getRuntime().getContextProxy().context
                                 .getString(R.string.out_temp_too_high_text)
-                                + temperature.getBodyTemp() + "℃)", "body_temperature");
+                                + temperature.getBodyTemp() + "℃)", "body_temperature",
+                        Constants.WARNING_MSG_TYPE_ENV_TEMP);
             } else if (resultCode == 4) {
                 //创建警告信息
                 createWarningNotification(
                         CoreService.getInstance().getRuntime().getContextProxy().context
                                 .getString(R.string.out_temp_too_low_text)
-                                + temperature.getBodyTemp() + "℃)", "body_temperature");
+                                + temperature.getBodyTemp() + "℃)", "body_temperature",
+                        Constants.WARNING_MSG_TYPE_ENV_TEMP);
             }
         }
     }
 
-    private void createWarningNotification(String title, String type) {
+    private void createWarningNotification(String title, String type, int contentType) {
         ContentValues contentValues = new ContentValues();
         //分类是心率的包名
         contentValues.put(ICDatabaseHelper.notification_category, "com.ic.temperature");
@@ -178,7 +181,7 @@ public class TemperatureUtil {
 
         ContentValues warningMsgValues = new ContentValues();
         //设置数据
-        warningMsgValues.put(ICDatabaseHelper.warning_msg_type, Constants.WARNING_MSG_TYPE_BODY_TEMP);
+        warningMsgValues.put(ICDatabaseHelper.warning_msg_type, contentType);
         warningMsgValues.put(ICDatabaseHelper.warning_msg_title, title);
         warningMsgValues.put(ICDatabaseHelper.warning_msg_has_read, 1);
         warningMsgValues.put(ICDatabaseHelper.warning_msg_create_time, System.currentTimeMillis());