adjust sms dialog ui.
authorTrillGates <williamtrillgates@gmail.com>
Sat, 17 Jul 2021 11:37:37 +0000 (19:37 +0800)
committerTrillGates <williamtrillgates@gmail.com>
Sat, 17 Jul 2021 11:37:37 +0000 (19:37 +0800)
19 files changed:
app/src/main/java/com/enqualcomm/support/Config.java
app/src/main/java/com/enqualcomm/support/ICSmsManager.java
app/src/main/java/com/enqualcomm/support/provider/ICDatabaseHelper.java
app/src/main/java/com/enqualcomm/support/utils/ContextProxy.java
app/src/main/java/com/enqualcomm/support/utils/TemperatureUtil.java
app/src/main/java/com/ic/protocols/protocol_s123.java
app/src/main/res/drawable/shape_dialog_bg.xml
app/src/main/res/drawable/shape_dialog_top_title_bg.xml [new file with mode: 0644]
app/src/main/res/drawable/shape_next_step_normal.xml
app/src/main/res/drawable/shape_next_step_press.xml
app/src/main/res/layout/msg_item_end_layout.xml
app/src/main/res/layout/msg_item_layout.xml
app/src/main/res/values-de-rCH/strings.xml
app/src/main/res/values-fr-rCH/strings.xml
app/src/main/res/values-it-rCH/strings.xml
app/src/main/res/values-ja/strings.xml
app/src/main/res/values-w820dp/strings.xml
app/src/main/res/values-zh-rCN/strings.xml
app/src/main/res/values/strings.xml

index f2c6ca0..9f0b00b 100644 (file)
@@ -513,11 +513,6 @@ public class Config {
         }
     }
 
-    public static void LoadMessageConfigs() {
-
-
-    }
-
     public static void loadTemperatureSettings(Runtime runtime) {
         runtime.temp_test_Cycle_Seconds = SharePreferenceUtil.getPrefInt(runtime.getContextProxy().context, KeyTempTestCycle, 60 * 60);
     }
@@ -1044,7 +1039,9 @@ public class Config {
             noTempSensor = false;
             C5_noBroadCastActionStrip = true;
 
-        } else if (Config.custom_name.equals("L02") || Config.custom_name.equals("L03") || Config.custom_name.equals("L05")) { //L02
+        } else if (Config.custom_name.equals("L02") ||
+                Config.custom_name.equals("L03") ||
+                Config.custom_name.equals("L05")) { //L02
             Config.forceMoveCheck = false; //即爱对gps不进行运动检测,此变量专门为了给其他协议进行强制运动检测用的。
             DefaultLocationMode = NORMAL_MOD;
             DefaultLocationCycle = 900;
index 14ebfa5..7e668a8 100644 (file)
@@ -122,15 +122,12 @@ public class ICSmsManager extends BroadcastReceiver {
             String forceReadMsg = Util.getSystemProperties("persist.sys.forcereadmsg");
             ICLogger.d("forceReadMsg == > " + forceReadMsg);
             if (handleSMS_CMD(from, message) == false) {
-
                 //说明不是sms命令,提示短信接收。
                 if (!TextUtils.isEmpty(forceReadMsg)) {
-
                     WakeLockUtil.ScreenOnWakeLockTemperary(context);
                     ContextProxy.play_waning_notify(context);
                     VibrateUtil.getInstance(context).VibrateOnOnce(true);
                     Util.mSleep(2000);
-
                     MsgMustReadDialog instance = MsgMustReadDialog.getInstance();
                     instance.showMsgDialog();
                     List<String> list = new ArrayList<>();
index ad72b6c..5a3b60d 100644 (file)
@@ -286,7 +286,6 @@ public class ICDatabaseHelper extends SQLiteOpenHelper {
     public static final String warning_msg_has_read = "has_read";
     public static final String warning_msg_create_time = "create_time";
 
-
     //通知数据库
     public static final String tb_notification = "notification";
     public static final String notification_id = "_id";
index 190fe0e..fd1dec3 100644 (file)
@@ -369,7 +369,6 @@ public class ContextProxy {
         Intent intent = new Intent();
         intent.setAction(ActionReceivePushTxt);
         intent.putExtra("txtMsg", msg);
-        intent.addFlags(FLAG_ACTIVITY_NEW_TASK);
         this.context.sendBroadcast(intent);
     }
 
index 3fa9fc1..f2dc3cd 100644 (file)
@@ -1,17 +1,23 @@
 package com.enqualcomm.support.utils;
 
 import android.content.ComponentName;
+import android.content.ContentResolver;
+import android.content.ContentValues;
 import android.content.Context;
 import android.content.Intent;
 import android.content.ServiceConnection;
+import android.net.Uri;
 import android.os.IBinder;
 
 import com.enqualcomm.support.Config;
 import com.enqualcomm.support.CoreService;
 import com.enqualcomm.support.ICApplication;
 import com.enqualcomm.support.LocationClient;
+import com.enqualcomm.support.R;
 import com.enqualcomm.support.bean.Runtime;
 import com.enqualcomm.support.bean.StringMessage;
+import com.enqualcomm.support.provider.ICDatabaseHelper;
+import com.enqualcomm.support.provider.ICNotificationProvider;
 import com.enqualcomm.support.service.Deliver;
 import com.ic.protocols.protocolAPIHelper;
 import com.ic.work.ITempSensorCallback;
@@ -97,6 +103,7 @@ public class TemperatureUtil {
         if (temperature == null) {
             return;
         }
+
         //结果处理
         if (Runtime.practising) {
             ICLogger.i("自由锻炼中,设置测量体温!" + String.format("%.1f", temperature.getBodyTemp()));
@@ -112,21 +119,18 @@ public class TemperatureUtil {
         runtime.tempInfo.setTemp(temperature.getBodyTemp(),
                 temperature.getWristTemp(),
                 temperature.getEnvTemp());
-
-
         //体温异常报警检测开启的会进行异常报警
         if (Config.needTemperature_abnormal_alarm) {
-            switch (runtime.tempInfo.isBodyTempAbnormal()) {
-                case 0:
-                    break;
-                case 1:
+            int resultCode = runtime.tempInfo.isBodyTempAbnormal();
+            switch (resultCode) {
+                case 1://温度过高
                     if (runtime.setAlarmType(Runtime.AlarmType.ALARM_TEMP_HIGH)) {
                         //trigger AP10 报警定位
                         ICLogger.i("triggerSOSLocationProcess ");
                         LocationClient.getInstance().triggerSOSLocationProcess();
                     }
                     break;
-                case 2:
+                case 2://温度过低
                     if (runtime.setAlarmType(Runtime.AlarmType.ALARM_TEMP_LOW)) {
                         //trigger AP10 报警定位
                         ICLogger.i("triggerSOSLocationProcess ");
@@ -134,9 +138,30 @@ public class TemperatureUtil {
                     }
                     break;
             }
+            if (resultCode == 1 || resultCode == 2) {
+                //创建警告信息
+                createWarningNotification(
+                        CoreService.getInstance().getRuntime().getContextProxy().context
+                                .getString(R.string.body_temperature_exception_tips_text)
+                                + temperature.getBodyTemp() + "℃)", "body_temperature");
+            }
         }
     }
 
+    private void createWarningNotification(String title, String type) {
+        ContentValues contentValues = new ContentValues();
+        //分类是心率的包名
+        contentValues.put(ICDatabaseHelper.notification_category, "com.ic.temperature");
+        contentValues.put(ICDatabaseHelper.notification_title, title);
+        contentValues.put(ICDatabaseHelper.notification_type, type);
+        contentValues.put(ICDatabaseHelper.notification_date, System.currentTimeMillis());
+        contentValues.put(ICDatabaseHelper.notification_order, 0);
+        contentValues.put(ICDatabaseHelper.notification_create_time, System.currentTimeMillis());
+        ContentResolver resolver = CoreService.getInstance().getRuntime().getContextProxy().getResolver();
+        resolver.insert(Uri.parse(ICNotificationProvider.NOTIFICATIONS), contentValues);
+    }
+
+
     private static TemperatureUtil sInstance = null;
 
     public static TemperatureUtil getInstance() {
index 7b269e2..c063f15 100644 (file)
@@ -27,6 +27,7 @@ import com.enqualcomm.support.provider.ICAlarmProvider;
 import com.enqualcomm.support.provider.ICDatabaseHelper;
 import com.enqualcomm.support.provider.ICGlobalSettingsProvider;
 import com.enqualcomm.support.provider.ICMembersProvider;
+import com.enqualcomm.support.provider.WebSmsProvider;
 import com.enqualcomm.support.service.HeartRateManager;
 import com.enqualcomm.support.utils.CameraUtil;
 import com.enqualcomm.support.utils.Connection;
@@ -54,8 +55,6 @@ import static com.enqualcomm.support.Constants.FROM_SERVER;
 import static com.enqualcomm.support.LocationClient.LOCATION_MODE;
 import static com.enqualcomm.support.bean.Contact.GROUP_ALL;
 import static java.lang.Math.abs;
-import static java.lang.Math.max;
-import static java.lang.Math.min;
 
 /**
  * IC协议
@@ -1333,22 +1332,31 @@ public class protocol_s123 {
                 Config.setLastUnReadMessage(runtime.getContextProxy().context, sb.toString());
                 runtime.getContextProxy().sendMsgBroadcast(txtmsg, 3);//msgType 3需要回复,0不需要回复
             } else {
-                //判断产品类型,如果是S123的,那么就不发广播了
-                //读取一个变量值,判断是否弹窗
+                //读取一个变量值,判断是否强制弹窗
                 String forceReadMsg = Util.getSystemProperties("persist.sys.forcereadmsg");
                 ICLogger.d("forceReadMsg == > " + forceReadMsg);
                 if (!TextUtils.isEmpty(forceReadMsg)) {
+                    //强制阅读的话,弹窗显示
                     MsgMustReadDialog instance = MsgMustReadDialog.getInstance();
                     instance.showMsgDialog();
                     List<String> list = new ArrayList<>();
                     list.add(txtmsg);
                     instance.addData(list);
                 } else {
-                    runtime.getContextProxy().sendMsgBroadcast(txtmsg, 0);//msgType 3需要回复,0不需要回复
+                    //msgType 3需要回复,0不需要回复
+                    runtime.getContextProxy().sendMsgBroadcast(txtmsg, 0);
                 }
             }
-            //保存到数据库里
-            runtime.getContextProxy().saveMstToSMSDB(txtmsg);
+            //保存到云短信的库里
+            ContentResolver resolver = runtime.getContextProxy().getResolver();
+            ContentValues contentValues = new ContentValues();
+            contentValues.put(ICDatabaseHelper.web_sms_content, txtmsg);
+            //弹窗表示已阅读了
+            contentValues.put(ICDatabaseHelper.web_sms_has_read, 1);
+            contentValues.put(ICDatabaseHelper.web_sms_create_time, System.currentTimeMillis());
+            resolver.insert(Uri.parse(WebSmsProvider.WEB_MSG), contentValues);
+            //保存到数据库里,以下是原来的做法
+            //runtime.getContextProxy().saveMstToSMSDB(txtmsg);
         } else {
             ICLogger.i("BP40 format error!");
         }
index a8d76a2..e607fd0 100644 (file)
@@ -3,6 +3,8 @@
     android:shape="rectangle">
 
     <solid android:color="#fff" />
-    <corners android:radius="10dp" />
+    <corners
+        android:bottomLeftRadius="10dp"
+        android:bottomRightRadius="10dp" />
 
 </shape>
\ No newline at end of file
diff --git a/app/src/main/res/drawable/shape_dialog_top_title_bg.xml b/app/src/main/res/drawable/shape_dialog_top_title_bg.xml
new file mode 100644 (file)
index 0000000..8c4050c
--- /dev/null
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="utf-8"?>
+<shape xmlns:android="http://schemas.android.com/apk/res/android"
+    android:shape="rectangle">
+
+    <solid android:color="#117CFD" />
+    <corners
+        android:topLeftRadius="10dp"
+        android:topRightRadius="10dp" />
+
+</shape>
\ No newline at end of file
index ccb8dc3..92bc005 100644 (file)
@@ -8,6 +8,6 @@
         android:width="100dp"
         android:height="60dp" />
 
-    <solid android:color="#62CB34" />
+    <solid android:color="#117CFD" />
 
 </shape>
\ No newline at end of file
index adae809..fadf10c 100644 (file)
@@ -8,6 +8,6 @@
         android:width="100dp"
         android:height="60dp" />
 
-    <solid android:color="#56A832" />
+    <solid android:color="#0F5DBC" />
 
 </shape>
\ No newline at end of file
index 482e306..82a88c1 100644 (file)
@@ -2,34 +2,59 @@
 <android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
     xmlns:app="http://schemas.android.com/apk/res-auto"
     android:layout_width="match_parent"
-    android:layout_height="match_parent"
-    android:background="@drawable/shape_dialog_bg">
-
-
-    <TextView
-        android:layout_width="wrap_content"
-        android:layout_height="wrap_content"
-        android:layout_marginTop="70dp"
-        android:text="@string/read_end_tips_text"
-        android:textColor="#000"
-        android:textSize="28sp"
-        app:layout_constraintLeft_toLeftOf="parent"
-        app:layout_constraintRight_toRightOf="parent"
-        app:layout_constraintTop_toTopOf="parent" />
-
-    <TextView
-        android:id="@+id/end_page_btn"
+    android:layout_height="match_parent">
+
+
+    <LinearLayout
+        android:id="@+id/container"
         android:layout_width="match_parent"
-        android:layout_height="70dp"
-        android:layout_alignParentBottom="true"
-        android:layout_margin="20dp"
-        android:layout_marginTop="40dp"
-        android:background="@drawable/selector_next_step"
-        android:gravity="center"
-        android:text="@string/read_end_tips_text"
-        android:textColor="#fff"
+        android:layout_height="match_parent"
+        android:background="#ffffff"
+        android:orientation="vertical"
         app:layout_constraintBottom_toBottomOf="parent"
-        app:layout_constraintLeft_toLeftOf="parent"
-        app:layout_constraintRight_toRightOf="parent" />
+        app:layout_constraintTop_toTopOf="parent">
+
+        <TextView
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"
+            android:background="#117CFD"
+            android:gravity="center_horizontal"
+            android:padding="10dp"
+            android:text="@string/web_sms_title_text"
+            android:textColor="@android:color/black"
+            android:textSize="20sp"
+            app:layout_constraintBottom_toTopOf="@id/container" />
+
+
+        <TextView
+            android:layout_width="wrap_content"
+            android:layout_height="0dp"
+            android:layout_gravity="center_horizontal"
+            android:layout_marginTop="20dp"
+            android:layout_marginBottom="20dp"
+            android:layout_weight="1"
+            android:gravity="center"
+            android:text="@string/read_end_tips_text"
+            android:textColor="#000"
+            android:textSize="38sp"
+            app:layout_constraintLeft_toLeftOf="parent"
+            app:layout_constraintRight_toRightOf="parent"
+            app:layout_constraintTop_toTopOf="parent" />
+
+        <TextView
+            android:id="@+id/end_page_btn"
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"
+            android:layout_alignParentBottom="true"
+            android:layout_margin="10dp"
+            android:background="@drawable/selector_next_step"
+            android:gravity="center"
+            android:text="@string/close_tips_text"
+            android:textColor="#fff"
+            android:textSize="20sp"
+            android:textStyle="bold" />
+
+    </LinearLayout>
+
 
 </android.support.constraint.ConstraintLayout>
\ No newline at end of file
index f0e2fea..0346e26 100644 (file)
@@ -1,19 +1,32 @@
 <?xml version="1.0" encoding="utf-8"?>
-<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    xmlns:app="http://schemas.android.com/apk/res-auto"
     android:layout_width="match_parent"
     android:layout_height="match_parent"
-    android:background="@drawable/shape_dialog_bg">
+    android:orientation="vertical">
+
+    <TextView
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content"
+        android:background="#117CFD"
+        android:gravity="center_horizontal"
+        android:paddingTop="10dp"
+        android:paddingBottom="10dp"
+        android:text="@string/web_sms_title_text"
+        android:textColor="@android:color/black"
+        android:textSize="20sp"
+        app:layout_constraintTop_toTopOf="parent" />
 
     <ScrollView
         android:layout_width="match_parent"
         android:layout_height="match_parent"
+        android:background="@drawable/shape_dialog_bg"
         android:fillViewport="true"
         android:orientation="vertical"
         android:overScrollMode="never"
-        android:padding="20dp"
         android:scrollbars="none">
 
-        <RelativeLayout
+        <LinearLayout
             android:layout_width="match_parent"
             android:layout_height="match_parent"
             android:orientation="vertical">
             <TextView
                 android:id="@+id/msg_text_tv"
                 android:layout_width="match_parent"
-                android:layout_height="match_parent"
-                android:layout_marginBottom="80dp"
+                android:layout_height="0dp"
+                android:layout_weight="1"
+                android:padding="10dp"
                 android:textColor="#000"
                 android:textSize="22sp" />
 
             <TextView
                 android:id="@+id/next_btn"
                 android:layout_width="match_parent"
-                android:layout_height="70dp"
+                android:layout_height="wrap_content"
                 android:layout_alignParentBottom="true"
+                android:layout_margin="10dp"
                 android:background="@drawable/selector_next_step"
                 android:gravity="center"
+                android:padding="10dp"
                 android:text="@string/next_msg_tips_text"
-                android:textColor="#fff" />
+                android:textColor="#fff"
+                android:textSize="20sp"
+                android:textStyle="bold" />
 
-        </RelativeLayout>
+        </LinearLayout>
     </ScrollView>
 
-</android.support.constraint.ConstraintLayout>
\ No newline at end of file
+</LinearLayout>
\ No newline at end of file
index 9da45ae..e4efc02 100644 (file)
     <string name="oxygen_exception_tips_text">血氧异常(</string>\r
     <string name="heart_rate_exception_tips_text">心率异常(BPM</string>\r
     <string name="blood_presure_exception_tips_text">血压异常(</string>\r
+    <string name="body_temperature_exception_tips_text">体温异常(</string>\r
+    <string name="web_sms_title_text">Web短信提醒</string>\r
+    <string name="close_tips_text">关闭</string>\r
     <!--    法语,德语,意大利-->\r
 </resources>\r
index 9da45ae..e4efc02 100644 (file)
     <string name="oxygen_exception_tips_text">血氧异常(</string>\r
     <string name="heart_rate_exception_tips_text">心率异常(BPM</string>\r
     <string name="blood_presure_exception_tips_text">血压异常(</string>\r
+    <string name="body_temperature_exception_tips_text">体温异常(</string>\r
+    <string name="web_sms_title_text">Web短信提醒</string>\r
+    <string name="close_tips_text">关闭</string>\r
     <!--    法语,德语,意大利-->\r
 </resources>\r
index 9da45ae..e4efc02 100644 (file)
     <string name="oxygen_exception_tips_text">血氧异常(</string>\r
     <string name="heart_rate_exception_tips_text">心率异常(BPM</string>\r
     <string name="blood_presure_exception_tips_text">血压异常(</string>\r
+    <string name="body_temperature_exception_tips_text">体温异常(</string>\r
+    <string name="web_sms_title_text">Web短信提醒</string>\r
+    <string name="close_tips_text">关闭</string>\r
     <!--    法语,德语,意大利-->\r
 </resources>\r
index d6d5bc9..cd96a3a 100644 (file)
     <string name="sedentary_msg">久坐提醒</string>
 
 
-
     <string name="en">English</string>
     <string name="ja">日本語</string>
     <string name="th">ภาษาไทย</string>
     <string name="oxygen_exception_tips_text">血氧异常(</string>
     <string name="heart_rate_exception_tips_text">心率异常(BPM</string>
     <string name="blood_presure_exception_tips_text">血压异常(</string>
+    <string name="body_temperature_exception_tips_text">体温异常(</string>
+    <string name="web_sms_title_text">Web短信提醒</string>
+    <string name="close_tips_text">关闭</string>
 
 </resources>
index 4f58501..23da7e5 100644 (file)
@@ -1,6 +1,4 @@
 <?xml version="1.0" encoding="utf-8"?>
 <resources>
-    <string name="oxygen_exception_tips_text">血氧异常(</string>
-    <string name="heart_rate_exception_tips_text">心率异常(BPM</string>
-    <string name="blood_presure_exception_tips_text">血压异常(</string>
+    <string name="close_tips_text">关闭</string>
 </resources>
\ No newline at end of file
index e6da334..2e7e740 100644 (file)
     <string name="oxygen_exception_tips_text">血氧异常(</string>
     <string name="heart_rate_exception_tips_text">心率异常(BPM</string>
     <string name="blood_presure_exception_tips_text">血压异常(</string>
+    <string name="body_temperature_exception_tips_text">体温异常(</string>
+    <string name="web_sms_title_text">Web短信提醒</string>
+    <string name="close_tips_text">关闭</string>
 </resources>
index 6f3ae5b..29de5c0 100644 (file)
     <string name="sedentary_msg">Sedentary reminder !</string>
 
     <string name="next_msg_tips_text">Next</string>
-    <string name="read_end_tips_text">Done</string>
+    <string name="read_end_tips_text">That is all!</string>
 
     <string name="en">English</string>
     <string name="ja">日本語</string>
     <string name="oxygen_exception_tips_text">血氧异常(</string>
     <string name="heart_rate_exception_tips_text">心率异常(BPM</string>
     <string name="blood_presure_exception_tips_text">血压异常(</string>
+    <string name="body_temperature_exception_tips_text">体温异常(</string>
+    <string name="web_sms_title_text">Web短信提醒</string>
+    <string name="close_tips_text">关闭</string>
     <!--    法语,德语,意大利-->
 </resources>