add a dialog for msg toast.
authorTrillGates <williamtrillgates@gmail.com>
Tue, 30 Mar 2021 12:11:53 +0000 (20:11 +0800)
committerTrillGates <williamtrillgates@gmail.com>
Tue, 30 Mar 2021 12:11:53 +0000 (20:11 +0800)
15 files changed:
app/src/main/java/com/enqualcomm/support/Config.java
app/src/main/java/com/enqualcomm/support/utils/ContextProxy.java
app/src/main/java/com/ic/protocols/protocol_fzd.java
app/src/main/java/com/ic/protocols/protocol_ic.java
app/src/main/java/com/ic/view/NoScrollViewPager.java [new file with mode: 0644]
app/src/main/java/com/ic/view/msg/MessageAdapter.java [new file with mode: 0644]
app/src/main/java/com/ic/view/msg/MsgMustReadDialog.java [new file with mode: 0644]
app/src/main/res/drawable/selector_next_step.xml [new file with mode: 0644]
app/src/main/res/drawable/shape_dialog_bg.xml [new file with mode: 0644]
app/src/main/res/drawable/shape_next_step_normal.xml [new file with mode: 0644]
app/src/main/res/drawable/shape_next_step_press.xml [new file with mode: 0644]
app/src/main/res/layout/msg_dialog_layout.xml [new file with mode: 0644]
app/src/main/res/layout/msg_item_end_layout.xml [new file with mode: 0644]
app/src/main/res/layout/msg_item_layout.xml [new file with mode: 0644]
app/src/main/res/values/strings.xml

index e9763cd..043da9d 100644 (file)
@@ -23,831 +23,852 @@ import java.util.HashMap;
 import static com.enqualcomm.support.utils.Util.getSystemProperties;
 
 public class Config {
-  public static final boolean LOG_TOFILE=true;
-  public static int antioff = 0;
-  public static int heart_rate = 0;
-  private static String json;
-  public static int defaultHeartbeatCycle=5;
-  public static int sw_release_no = -1;
-
-
-  //如果重试都失败,则丢弃命令不进行盲点续传
-  public static boolean discard_cmd_after_retryfailed=true;
-
-  public static boolean forceMoveCheck=true;
-  public static boolean forceWearCheck=true;
-
-  private static final String KEYDurationOfVibration = "DurationVib";
-  private static final String KeyMasterVolume = "MasterVolume";
-
-  public static final String DefaultLogFtpServer="icfota.snicker.com.cn";
-  public static final String DefaultLogFtpUser="ftpuser";
-  public static final String DefaultLogFtpPWD="iclog";
-
-
-  public static final String DefaultWiFiSSID="Xplay6";
-  public static final String DefaultWiFiPWD="87654321";
-  public static final String DefaultWiFiEncryptType="psk";
-
-  public static final int GPSLocationTimeoutInSeconds=50;
-  public static final int WiFiLocationTimeoutInSeconds=12;
+    public static final boolean LOG_TOFILE = true;
+    public static int antioff = 0;
+    public static int heart_rate = 0;
+    private static String json;
+    public static int defaultHeartbeatCycle = 5;
+    public static int sw_release_no = -1;
 
-  public static final boolean sendSOSAtOnce=Util.getSystemProperties("persist.sys.sos_at_once","false").equals("true");
-  public static String c43_branch_name="none";
-  public static String custom_name="none";
 
-  //配置是否广播提示框信息给外部应用显示
-  public static boolean noBroadCastSMSNotify=false;
-  public static boolean noBroadCastPushTxtNotify=false;
+    //如果重试都失败,则丢弃命令不进行盲点续传
+    public static boolean discard_cmd_after_retryfailed = true;
 
+    public static boolean forceMoveCheck = true;
+    public static boolean forceWearCheck = true;
 
-  //protocol内部Dialog配置,true表示用外部提示窗,false表示用协议内部提示窗
-  public static boolean noSMSNotifyDialog=false;
-  public static boolean noPushTxtNotifyDialog=false;
-  public static boolean noVoiceNotifyDialog=false;
+    private static final String KEYDurationOfVibration = "DurationVib";
+    private static final String KeyMasterVolume = "MasterVolume";
 
-  //是否SOS拨号的开关,false表示只发送系统sosalarm,不发起SOS拨号
-  public static boolean SOSNoNeedDial=false;
+    public static final String DefaultLogFtpServer = "icfota.snicker.com.cn";
+    public static final String DefaultLogFtpUser = "ftpuser";
+    public static final String DefaultLogFtpPWD = "iclog";
 
-  //ic68只有体温没有腕温,它开启代表原来的腕温函数取出的就是体温,不需要再进行换算了。
-  public static boolean disableWristTemp=false;
-  //配置是否有温度传感器
-  public static boolean noTempSensor=false;
-  //配置是否有心率传感器
-  public static boolean noPPGSensor=false;
-  //配置脱腕报警是否需要弹出脱腕提示 默认关闭,所有项目目前都不希望显示弹窗
-  public static boolean needBroadcastAntiAlarm=false;
-  //配置脱腕报警是否需要弹出剪断提示 默认开启
-  public static boolean needBroadcastCutoffAlarm=true;
 
+    public static final String DefaultWiFiSSID = "Xplay6";
+    public static final String DefaultWiFiPWD = "87654321";
+    public static final String DefaultWiFiEncryptType = "psk";
 
-  //定位是否使用wifi的配置。
-  public static boolean disableWiFiScan=false;
+    public static final int GPSLocationTimeoutInSeconds = 50;
+    public static final int WiFiLocationTimeoutInSeconds = 12;
 
-  public static int BLEScanProtocol=0; /** 0 代表扫描beacon后 自行判断是否在指定区域,需要协议绑定beacon地址。
-                                        *  1  代表扫描beacon后,直接把扫描结果上报即可。
-                                        **/
+    public static final boolean sendSOSAtOnce = Util.getSystemProperties("persist.sys.sos_at_once", "false").equals("true");
+    public static String c43_branch_name = "none";
+    public static String custom_name = "none";
 
-  public static boolean UsePolingCheckWeared=false;
+    //配置是否广播提示框信息给外部应用显示
+    public static boolean noBroadCastSMSNotify = false;
+    public static boolean noBroadCastPushTxtNotify = false;
 
-  static  {
-    disableWiFiScan=Util.getSystemProperties("persist.sys.disableWiFiLocation","false").equals("true");
-    disableWristTemp=Util.getSystemProperties("persist.sys.disableWristTemp","false").equals("true");
-    BLEScanProtocol=Util.getSystemPropertiesInt("persist.sys.BLEScanProtocol",0);
-    UsePolingCheckWeared=Util.getSystemProperties("persist.sys.PolingCheckAnti","false").equals("true");
-  }
-  
-  private static String make() {
-    try {
-      return (new JSONStringer()).object()
-              .key("cmd").value("Init")
-              .key("sw_version").value("eiot_V1.0.0")
-              .key("protocol_version").value("2.0")
-              .key("product").value(2L)
-              .key("swReleaseNo").value(sw_release_no)
-              .endObject().toString();
-    } catch (JSONException jSONException) {
-      jSONException.printStackTrace();
-      return "";
-    } 
-  }
-  
-  public static String toJson() {
-    if (TextUtils.isEmpty(json))
-      json = make(); 
-    return json;
-  }
 
+    //protocol内部Dialog配置,true表示用外部提示窗,false表示用协议内部提示窗
+    public static boolean noSMSNotifyDialog = false;
+    public static boolean noPushTxtNotifyDialog = false;
+    public static boolean noVoiceNotifyDialog = false;
 
-  public final static boolean isL03Tracker=getIsL03tracker();
-  public final  static boolean upload_logs_via_ftp=false;
-  final static String KeyProtocolServerIP="ProtocolServerIP";
-  final static String KeyProtocolServerHOST="ProtocolServerHOST";
-  final static String KeyProtocolServerPort="ProtoclServerPort";;
-  final static String KeyLogServerIP="LogServerIP";
-  final static String KeyLogServerPort="LogServerPort";
-  final static String KeyFotaServerUrl="FotaServerUrl";
+    //是否SOS拨号的开关,false表示只发送系统sosalarm,不发起SOS拨号
+    public static boolean SOSNoNeedDial = false;
 
+    //ic68只有体温没有腕温,它开启代表原来的腕温函数取出的就是体温,不需要再进行换算了。
+    public static boolean disableWristTemp = false;
+    //配置是否有温度传感器
+    public static boolean noTempSensor = false;
+    //配置是否有心率传感器
+    public static boolean noPPGSensor = false;
+    //配置脱腕报警是否需要弹出脱腕提示 默认关闭,所有项目目前都不希望显示弹窗
+    public static boolean needBroadcastAntiAlarm = false;
+    //配置脱腕报警是否需要弹出剪断提示 默认开启
+    public static boolean needBroadcastCutoffAlarm = true;
 
-  final static String KeyPpgTestCycle="PPGTestCycle";
-  final static String KeyLocationCycle="LocationCycle";
-  final static String  KeyLocationMode="LocationMode";;
 
-  final static String KeyAlarmCycle="HeartBeatCycle";
+    //定位是否使用wifi的配置。
+    public static boolean disableWiFiScan = false;
 
-  final static String  KeyContactsList="ContactsList";
-  final static String  KeySOSNumbersList="SOSNumbersList";
+    public static int BLEScanProtocol = 0;
+    /**
+     * 0 代表扫描beacon后 自行判断是否在指定区域,需要协议绑定beacon地址。
+     * 1  代表扫描beacon后,直接把扫描结果上报即可。
+     **/
 
-  final static String KeyIMEI = "persist.sys.protocol_IMEI";
-  public final static String KeyQRURIFILE = "persist.sys.qrUriFile";
+    public static boolean UsePolingCheckWeared = false;
 
-  final static String KeyPractiseState = "persist.sys.practising";
+    static {
+        disableWiFiScan = Util.getSystemProperties("persist.sys.disableWiFiLocation", "false").equals("true");
+        disableWristTemp = Util.getSystemProperties("persist.sys.disableWristTemp", "false").equals("true");
+        BLEScanProtocol = Util.getSystemPropertiesInt("persist.sys.BLEScanProtocol", 0);
+        UsePolingCheckWeared = Util.getSystemProperties("persist.sys.PolingCheckAnti", "false").equals("true");
+    }
+
+    private static String make() {
+        try {
+            return (new JSONStringer()).object()
+                    .key("cmd").value("Init")
+                    .key("sw_version").value("eiot_V1.0.0")
+                    .key("protocol_version").value("2.0")
+                    .key("product").value(2L)
+                    .key("swReleaseNo").value(sw_release_no)
+                    .endObject().toString();
+        } catch (JSONException jSONException) {
+            jSONException.printStackTrace();
+            return "";
+        }
+    }
+
+    public static String toJson() {
+        if (TextUtils.isEmpty(json))
+            json = make();
+        return json;
+    }
 
-  final static String KeyHeartBeatCycle="ServerHeartBeatCycle";
 
+    public final static boolean isL03Tracker = getIsL03tracker();
+    public final static boolean upload_logs_via_ftp = false;
+    final static String KeyProtocolServerIP = "ProtocolServerIP";
+    final static String KeyProtocolServerHOST = "ProtocolServerHOST";
+    final static String KeyProtocolServerPort = "ProtoclServerPort";
+    ;
+    final static String KeyLogServerIP = "LogServerIP";
+    final static String KeyLogServerPort = "LogServerPort";
+    final static String KeyFotaServerUrl = "FotaServerUrl";
 
-  final static String KeyLogFtpServer="FtpServerHost";
-  final static String KeyLogFtpUser="FtpServerUser";
-  final static String KeyLogFtpPWD="FtpServerPWD";
 
+    final static String KeyPpgTestCycle = "PPGTestCycle";
+    final static String KeyLocationCycle = "LocationCycle";
+    final static String KeyLocationMode = "LocationMode";
+    ;
 
-  final static String KeyWiFiSSID="WiFiSSID";
-  final static String KeyWiFiPasswd="WiFiPWD";
-  final static String KeyWiFiEncyptType="WiFiEncryptType";
+    final static String KeyAlarmCycle = "HeartBeatCycle";
 
-  final static String KeySMSPassword="SMSPWD";
-  final static String DefaultSMSPassword="non";
+    final static String KeyContactsList = "ContactsList";
+    final static String KeySOSNumbersList = "SOSNumbersList";
 
-  final static String KeyTempTestCycle="TempTestCycle";
+    final static String KeyIMEI = "persist.sys.protocol_IMEI";
+    public final static String KeyQRURIFILE = "persist.sys.qrUriFile";
 
+    final static String KeyPractiseState = "persist.sys.practising";
 
-  final static String KeyPPGadust="KeyPPGAdjust";
-  final static String KeyBPHadust="KeyBPHAdjust";
-  final static String KeyBPLadust="KeyBPLAdjust";
-  final static String KeySPo2adust="KeySPo2Adjust";
+    final static String KeyHeartBeatCycle = "ServerHeartBeatCycle";
 
-  final static String KeyBleScanCycle="BleScanCycle";
 
-  final static String KeyLastUnReadMessage="UnreadMsg";
-
-
-  public static void setDurationOfVibration(Context context, int cycle){
-    SharPreferenceUtil.setPrefInt(context,KEYDurationOfVibration,cycle);
-  }
+    final static String KeyLogFtpServer = "FtpServerHost";
+    final static String KeyLogFtpUser = "FtpServerUser";
+    final static String KeyLogFtpPWD = "FtpServerPWD";
 
-  public static int getDurationOfVibration(Context context){
-    return SharPreferenceUtil.getPrefInt(context,KEYDurationOfVibration,1);
-  }
 
-  public static void setMasterVolume(Context context, int cycle){
-    SharPreferenceUtil.setPrefInt(context,KeyMasterVolume,cycle);
-  }
+    final static String KeyWiFiSSID = "WiFiSSID";
+    final static String KeyWiFiPasswd = "WiFiPWD";
+    final static String KeyWiFiEncyptType = "WiFiEncryptType";
 
-  public static int getMasterVolume(Context context){
-    return SharPreferenceUtil.getPrefInt(context,KeyMasterVolume,15);
-  }
+    final static String KeySMSPassword = "SMSPWD";
+    final static String DefaultSMSPassword = "non";
 
-  public static void setBleScanCycle(Context context, int cycle){
-    SharPreferenceUtil.setPrefInt(context,KeyBleScanCycle,cycle);
-  }
-
-  public static int getBleScanCycle(Context context){
-    return SharPreferenceUtil.getPrefInt(context,KeyBleScanCycle,0);
-  }
+    final static String KeyTempTestCycle = "TempTestCycle";
 
-  public static String getLastUnReadMessage(Context context){
-    return SharPreferenceUtil.getPrefString(context,KeyLastUnReadMessage,"");
-  }
 
-  public static void setLastUnReadMessage(Context context,String smsPWD){
-    SharPreferenceUtil.setPrefString(context,KeyLastUnReadMessage,smsPWD);
-  }
+    final static String KeyPPGadust = "KeyPPGAdjust";
+    final static String KeyBPHadust = "KeyBPHAdjust";
+    final static String KeyBPLadust = "KeyBPLAdjust";
+    final static String KeySPo2adust = "KeySPo2Adjust";
+
+    final static String KeyBleScanCycle = "BleScanCycle";
+
+    final static String KeyLastUnReadMessage = "UnreadMsg";
+
+
+    public static void setDurationOfVibration(Context context, int cycle) {
+        SharPreferenceUtil.setPrefInt(context, KEYDurationOfVibration, cycle);
+    }
 
-  public static String getSMSPwd(Context context){
-    return SharPreferenceUtil.getPrefString(context,KeySMSPassword,DefaultSMSPassword);
-  }
+    public static int getDurationOfVibration(Context context) {
+        return SharPreferenceUtil.getPrefInt(context, KEYDurationOfVibration, 1);
+    }
 
-  public static void setSMSPwd(Context context,String smsPWD){
-    SharPreferenceUtil.setPrefString(context,KeySMSPassword,smsPWD);
-  }
-  public static boolean getIsL03tracker(){
-    boolean ret=getSystemProperties("persist.sys.isL03tracker").toLowerCase().equals("true");
-    return ret;
-  }
-  public static String getWiFiSSID(Context context){
-    return SharPreferenceUtil.getPrefString(context,KeyWiFiSSID,DefaultWiFiSSID);
-  }
+    public static void setMasterVolume(Context context, int cycle) {
+        SharPreferenceUtil.setPrefInt(context, KeyMasterVolume, cycle);
+    }
 
-  public static void setWiFiSSID(Context context,String ssid){
-    SharPreferenceUtil.setPrefString(context,KeyWiFiSSID,ssid);
-  }
+    public static int getMasterVolume(Context context) {
+        return SharPreferenceUtil.getPrefInt(context, KeyMasterVolume, 15);
+    }
 
-  public static String getWiFiPasswd(Context context){
-    return SharPreferenceUtil.getPrefString(context,KeyWiFiPasswd,DefaultWiFiPWD);
-  }
+    public static void setBleScanCycle(Context context, int cycle) {
+        SharPreferenceUtil.setPrefInt(context, KeyBleScanCycle, cycle);
+    }
 
-  public static void setWiFiPasswd(Context context,String pwd){
-    SharPreferenceUtil.setPrefString(context,KeyWiFiPasswd,pwd);
-  }
+    public static int getBleScanCycle(Context context) {
+        return SharPreferenceUtil.getPrefInt(context, KeyBleScanCycle, 0);
+    }
 
-    public static String getWiFiEncryptType(Context context){
-        return SharPreferenceUtil.getPrefString(context,KeyWiFiEncyptType,DefaultWiFiEncryptType);
+    public static String getLastUnReadMessage(Context context) {
+        return SharPreferenceUtil.getPrefString(context, KeyLastUnReadMessage, "");
     }
 
-    public static void setWiFiEncryptType(Context context,String type){
-        SharPreferenceUtil.setPrefString(context,KeyWiFiEncyptType,type);
+    public static void setLastUnReadMessage(Context context, String smsPWD) {
+        SharPreferenceUtil.setPrefString(context, KeyLastUnReadMessage, smsPWD);
     }
 
-  public static String getFotaServerUrl(Context context){
-    return SharPreferenceUtil.getPrefString(context,KeyFotaServerUrl,"");
-  }
+    public static String getSMSPwd(Context context) {
+        return SharPreferenceUtil.getPrefString(context, KeySMSPassword, DefaultSMSPassword);
+    }
 
-  public static void setFotaServerUrl(Context context,String url){
-    SharPreferenceUtil.setPrefString(context,KeyFotaServerUrl,url);
-  }
-    public static String getFtpUser(Context context){
-    return SharPreferenceUtil.getPrefString(context,KeyLogFtpUser,DefaultLogFtpUser);
-  }
+    public static void setSMSPwd(Context context, String smsPWD) {
+        SharPreferenceUtil.setPrefString(context, KeySMSPassword, smsPWD);
+    }
 
-  public static void setFtpUser(Context context,String user){
-    SharPreferenceUtil.setPrefString(context,KeyLogFtpUser,user);
-  }
+    public static boolean getIsL03tracker() {
+        boolean ret = getSystemProperties("persist.sys.isL03tracker").toLowerCase().equals("true");
+        return ret;
+    }
 
-  public static String getFtpServer(Context context){
-    return SharPreferenceUtil.getPrefString(context,KeyLogFtpServer,DefaultLogFtpServer);
-  }
+    public static String getWiFiSSID(Context context) {
+        return SharPreferenceUtil.getPrefString(context, KeyWiFiSSID, DefaultWiFiSSID);
+    }
 
-  public static void setFtpServer(Context context,String host){
-    SharPreferenceUtil.setPrefString(context,KeyLogFtpServer,host);
-  }
+    public static void setWiFiSSID(Context context, String ssid) {
+        SharPreferenceUtil.setPrefString(context, KeyWiFiSSID, ssid);
+    }
 
-  public static String getFtpPWD(Context context){
-    return SharPreferenceUtil.getPrefString(context,KeyLogFtpPWD,DefaultLogFtpPWD);
-  }
-  public static void setFtpPWD(Context context,String PWD){
-    SharPreferenceUtil.setPrefString(context,KeyLogFtpPWD,PWD);
-  }
+    public static String getWiFiPasswd(Context context) {
+        return SharPreferenceUtil.getPrefString(context, KeyWiFiPasswd, DefaultWiFiPWD);
+    }
 
-  public static void setAlarmCycle(Context context, int cycle){
-    SharPreferenceUtil.setPrefInt(context,KeyAlarmCycle,cycle);
-  }
-
-  //默认3分钟,刚刚wakeup的时候1分钟
-  public static int getAlarmCycle(Context context){
-    return SharPreferenceUtil.getPrefInt(context,KeyAlarmCycle,3);
-  }
-
-  public static void setProtocolServerPort(Context context, int serverPort){
+    public static void setWiFiPasswd(Context context, String pwd) {
+        SharPreferenceUtil.setPrefString(context, KeyWiFiPasswd, pwd);
+    }
+
+    public static String getWiFiEncryptType(Context context) {
+        return SharPreferenceUtil.getPrefString(context, KeyWiFiEncyptType, DefaultWiFiEncryptType);
+    }
+
+    public static void setWiFiEncryptType(Context context, String type) {
+        SharPreferenceUtil.setPrefString(context, KeyWiFiEncyptType, type);
+    }
+
+    public static String getFotaServerUrl(Context context) {
+        return SharPreferenceUtil.getPrefString(context, KeyFotaServerUrl, "");
+    }
+
+    public static void setFotaServerUrl(Context context, String url) {
+        SharPreferenceUtil.setPrefString(context, KeyFotaServerUrl, url);
+    }
+
+    public static String getFtpUser(Context context) {
+        return SharPreferenceUtil.getPrefString(context, KeyLogFtpUser, DefaultLogFtpUser);
+    }
+
+    public static void setFtpUser(Context context, String user) {
+        SharPreferenceUtil.setPrefString(context, KeyLogFtpUser, user);
+    }
+
+    public static String getFtpServer(Context context) {
+        return SharPreferenceUtil.getPrefString(context, KeyLogFtpServer, DefaultLogFtpServer);
+    }
+
+    public static void setFtpServer(Context context, String host) {
+        SharPreferenceUtil.setPrefString(context, KeyLogFtpServer, host);
+    }
+
+    public static String getFtpPWD(Context context) {
+        return SharPreferenceUtil.getPrefString(context, KeyLogFtpPWD, DefaultLogFtpPWD);
+    }
+
+    public static void setFtpPWD(Context context, String PWD) {
+        SharPreferenceUtil.setPrefString(context, KeyLogFtpPWD, PWD);
+    }
+
+    public static void setAlarmCycle(Context context, int cycle) {
+        SharPreferenceUtil.setPrefInt(context, KeyAlarmCycle, cycle);
+    }
+
+    //默认3分钟,刚刚wakeup的时候1分钟
+    public static int getAlarmCycle(Context context) {
+        return SharPreferenceUtil.getPrefInt(context, KeyAlarmCycle, 3);
+    }
+
+    public static void setProtocolServerPort(Context context, int serverPort) {
 //    SharPreferenceUtil.setPrefString(context,KeyProtocolServerIP,serverIP);
-    SharPreferenceUtil.setPrefInt(context,KeyProtocolServerPort,serverPort);
-  }
-
-  public static void setProtocolServerHost(Context context,String host){
-    SharPreferenceUtil.setPrefString(context,KeyProtocolServerHOST,host);
-  }
-  //public static String getProtocolServerIP(Context context){
- //   return SharPreferenceUtil.getPrefString(context,KeyProtocolServerIP,"118.178.155.223");
- // }
+        SharPreferenceUtil.setPrefInt(context, KeyProtocolServerPort, serverPort);
+    }
 
-  public static void loadModCycleSettings(Runtime runtime){
-    Context context=runtime.getContextProxy().context;
-    ICLogger.i("current Cycles PPG "+ runtime.getPpgTestCycle()+" , LocationCycle "+runtime.getLocationInstance().getLocation_cycle()+" LocationMode "+runtime.getLocationInstance().getWorkingMod());
-    runtime.setPpgTestCycle(Config.getPPGTestCycle(context));
-    runtime.getLocationInstance().setLocation_cycle(Config.getLocationCycle(context));
-    runtime.getLocationInstance().setWorkingMod(Config.getLocationMode(context));
-    ICLogger.i("current Cycles PPG "+ runtime.getPpgTestCycle()+" , LocationCycle "+runtime.getLocationInstance().getLocation_cycle()+" LocationMode "+runtime.getLocationInstance().getWorkingMod());
+    public static void setProtocolServerHost(Context context, String host) {
+        SharPreferenceUtil.setPrefString(context, KeyProtocolServerHOST, host);
+    }
+    //public static String getProtocolServerIP(Context context){
+    //   return SharPreferenceUtil.getPrefString(context,KeyProtocolServerIP,"118.178.155.223");
+    // }
 
-    int mastervolume = getMasterVolume(context);
-    ICAudioManager.setMasterVolumn(context,mastervolume);
+    public static void loadModCycleSettings(Runtime runtime) {
+        Context context = runtime.getContextProxy().context;
+        ICLogger.i("current Cycles PPG " + runtime.getPpgTestCycle() + " , LocationCycle " + runtime.getLocationInstance().getLocation_cycle() + " LocationMode " + runtime.getLocationInstance().getWorkingMod());
+        runtime.setPpgTestCycle(Config.getPPGTestCycle(context));
+        runtime.getLocationInstance().setLocation_cycle(Config.getLocationCycle(context));
+        runtime.getLocationInstance().setWorkingMod(Config.getLocationMode(context));
+        ICLogger.i("current Cycles PPG " + runtime.getPpgTestCycle() + " , LocationCycle " + runtime.getLocationInstance().getLocation_cycle() + " LocationMode " + runtime.getLocationInstance().getWorkingMod());
 
-    int duration= getDurationOfVibration(context);
-    VibrateUtil.setVibPattern(duration*1000);
+        int mastervolume = getMasterVolume(context);
+        ICAudioManager.setMasterVolumn(context, mastervolume);
 
-  }
+        int duration = getDurationOfVibration(context);
+        VibrateUtil.setVibPattern(duration * 1000);
 
-  public static void loadHearBeatSetting(Runtime runtime){
-    runtime.setHeartBeatCycle(Config.getHeartBeatCycle(runtime.getContextProxy().context));
-  }
-  public static void loadServerSettings(Runtime runtime){
-    runtime.setHostAndPort(Config.getProtocolServerHost(runtime.getContextProxy().context),Config.getProtocolServerPort(runtime.getContextProxy().context));
-  }
+    }
 
-  public static void setIMEI(Context context, String imei){
-    Util.setSystemProperties(KeyIMEI,imei);
-  }
+    public static void loadHearBeatSetting(Runtime runtime) {
+        runtime.setHeartBeatCycle(Config.getHeartBeatCycle(runtime.getContextProxy().context));
+    }
 
-  public static String getIMEI(Context context){
-    return Util.getSystemProperties(KeyIMEI,"");
-  }
+    public static void loadServerSettings(Runtime runtime) {
+        runtime.setHostAndPort(Config.getProtocolServerHost(runtime.getContextProxy().context), Config.getProtocolServerPort(runtime.getContextProxy().context));
+    }
 
-  public static String getProtocolServerHost(Context context){
-    String host;
-    host= SharPreferenceUtil.getPrefString(context,KeyProtocolServerHOST,protocolAPIHelper.getDefaultServerIP());
-    return host;
-   }
+    public static void setIMEI(Context context, String imei) {
+        Util.setSystemProperties(KeyIMEI, imei);
+    }
 
+    public static String getIMEI(Context context) {
+        return Util.getSystemProperties(KeyIMEI, "");
+    }
+
+    public static String getProtocolServerHost(Context context) {
+        String host;
+        host = SharPreferenceUtil.getPrefString(context, KeyProtocolServerHOST, protocolAPIHelper.getDefaultServerIP());
+        return host;
+    }
+
+
+    public static int getProtocolServerPort(Context context) {
+        int port;
+        port = SharPreferenceUtil.getPrefInt(context, KeyProtocolServerPort, protocolAPIHelper.getDefaultServerPort());
+        return port;
+    }
+
+    public static void setConfigInitFlag(Context context, int flag) {
+        SharPreferenceUtil.setPrefInt(context, "ConfigInitFlag", flag);
+    }
+
+    public static int getConfigInitFlag(Context context) {
+        return SharPreferenceUtil.getPrefInt(context, "ConfigInitFlag", 0);
+    }
 
-  public static int getProtocolServerPort(Context context){
-      int port;
-      port= SharPreferenceUtil.getPrefInt(context,KeyProtocolServerPort,protocolAPIHelper.getDefaultServerPort());
-      return port;
-  }
+    public static void setLogServerIP(Context context, String serverIP, int serverPort) {
 
-  public static void setConfigInitFlag(Context context,int flag){
-    SharPreferenceUtil.setPrefInt(context,"ConfigInitFlag",flag);
-  }
+        SharPreferenceUtil.setPrefString(context, KeyLogServerIP, serverIP);
+        SharPreferenceUtil.setPrefInt(context, KeyLogServerPort, serverPort);
 
-  public static int getConfigInitFlag(Context context){
-    return SharPreferenceUtil.getPrefInt(context,"ConfigInitFlag",0);
-  }
-  public static void setLogServerIP(Context context,String serverIP,int serverPort){
+    }
 
-    SharPreferenceUtil.setPrefString(context,KeyLogServerIP,serverIP);
-    SharPreferenceUtil.setPrefInt(context,KeyLogServerPort,serverPort);
+    public static String getLogServerIP(Context context) {
+        return SharPreferenceUtil.getPrefString(context, KeyLogServerIP, "http://icfota.snicker.com.cn:8089/UploadFile.jsp");
+    }
 
-  }
-  public static String getLogServerIP(Context context){
-    return SharPreferenceUtil.getPrefString(context,KeyLogServerIP,"http://icfota.snicker.com.cn:8089/UploadFile.jsp");
-  }
+    public static int getLogServerPort(Context context) {
+        return SharPreferenceUtil.getPrefInt(context, KeyLogServerPort, 8089);
+    }
 
-  public static int getLogServerPort(Context context){
-    return SharPreferenceUtil.getPrefInt(context,KeyLogServerPort,8089);
-  }
 
+    public static void setPPGTestCycle(Context context, int cycle_ninutes) {
+        SharPreferenceUtil.setPrefInt(context, KeyPpgTestCycle, cycle_ninutes);
+    }
 
-  public static void setPPGTestCycle(Context context,int cycle_ninutes){
-    SharPreferenceUtil.setPrefInt(context,KeyPpgTestCycle,cycle_ninutes);
-  }
+    public static int getPPGTestCycle(Context context) {
+        return SharPreferenceUtil.getPrefInt(context, KeyPpgTestCycle, 0);
+    }
 
-  public static int getPPGTestCycle(Context context){
-    return SharPreferenceUtil.getPrefInt(context,KeyPpgTestCycle,0);
-  }
 
+    public static int getHeartBeatCycle(Context context) {
+        return SharPreferenceUtil.getPrefInt(context, KeyHeartBeatCycle, 5);
+    }
 
-  public static int getHeartBeatCycle(Context context){
-    return SharPreferenceUtil.getPrefInt(context,KeyHeartBeatCycle,5);
-  }
+    public static void setHeartBeatCycle(Context context, int cycle) {
+        SharPreferenceUtil.setPrefInt(context, KeyHeartBeatCycle, cycle);
+    }
 
-  public static void setHeartBeatCycle(Context context,int cycle){
-    SharPreferenceUtil.setPrefInt(context,KeyHeartBeatCycle,cycle);
-  }
-  public static void setLocationCycle(Context context,int cycle_second){
-    SharPreferenceUtil.setPrefInt(context,KeyLocationCycle,cycle_second);
-  }
+    public static void setLocationCycle(Context context, int cycle_second) {
+        SharPreferenceUtil.setPrefInt(context, KeyLocationCycle, cycle_second);
+    }
 
-  public static int getLocationCycle(Context context){
-    return SharPreferenceUtil.getPrefInt(context,KeyLocationCycle,900);
-  }
+    public static int getLocationCycle(Context context) {
+        return SharPreferenceUtil.getPrefInt(context, KeyLocationCycle, 900);
+    }
 
-  public static void setLocationMode(Context context,int mode){
-    ICLogger.i("setLocationMode "+mode);
-    SharPreferenceUtil.setPrefInt(context,KeyLocationMode,mode);
-  }
+    public static void setLocationMode(Context context, int mode) {
+        ICLogger.i("setLocationMode " + mode);
+        SharPreferenceUtil.setPrefInt(context, KeyLocationMode, mode);
+    }
 
 
-  public static int getLocationMode(Context context){
-    return SharPreferenceUtil.getPrefInt(context,KeyLocationMode, ICLocation.NORMAL_MOD);
-  }
+    public static int getLocationMode(Context context) {
+        return SharPreferenceUtil.getPrefInt(context, KeyLocationMode, ICLocation.NORMAL_MOD);
+    }
 
     private static final String KeyBootUpDate = "bootupdate";
-  public static boolean logBootDate(Context context){
-  //如果时间和最后一次时间不同,则重置,否则启动次数+1
-    if (isFirstBootToday(context)) {
-      SharPreferenceUtil.setPrefString(context, KeyBootUpDate, TimeUtil.getSystemTime4());
-      return true;
-    }else{
-      return false;
-    }
-  }
-
-  private static String getLastBootupDate(Context context){
-    return SharPreferenceUtil.getPrefString(context,KeyBootUpDate,"");
-  }
-  private static boolean isFirstBootToday(Context context){
-      //第一次启动记录的日期,当前日期只要相同,就认为有启动过。
-      //如果手表一直没有重启过,则每次resetStepCount的时候把启动时间更新到当天,
-      //从而解决第二天重启就会被重置的问题!
-    String currentDate=TimeUtil.getSystemTime4();
-    String lastDate=getLastBootupDate(context);
-    boolean ret=false;
-    if (currentDate.equals(lastDate)) {
-      ret= false;
-    }else
-    {
-      ret= true;
-    }
-    ICLogger.i("Current BootDate="+currentDate+", Last BootDate="+lastDate+", ret="+ret);
-    return ret;
-  }
-
-  //收到语音微聊广播消息给外部窗口
-  public static boolean do_broadCast_message=false;
-
-  //每次心跳时都检测逃逸并报警
-  public static boolean needAllwaysAlarmFenceOut=false;
-  //每次心跳时都检测剪断并报警,只报警
-  public static boolean needAllwaysAlarmCutOff=false;
-
-  //体温非正常报警
-  public static boolean needTemperature_abnormal_alarm=false;
-  public static boolean A9_noBroadCastActionStrip=false;
-  public static boolean C5_noBroadCastActionStrip=false;
-  public static boolean L004_BroadCastActionStrip=false;
-
-  //停止系统NTP时钟同步标志
-  public static boolean disable_ntp_server=false;
-
-  //需要系统发送已阅读消息的标志
-  public static boolean noPushTxtReadReply=true;
-  //蓝牙定位扫描 协议0模式,扫到beacon信标时,如果属于第一次扫到的进入状态(解除逃逸状态),发送服务器的标志位,主要由于C5客户只要逃逸,不要解除逃逸消息。
-  public static boolean noBLE_RelaseEscapeAlarm=true;
-
-  public static void enable_NTP_Server(Context context,boolean enable){
-    try {
-      int autotime = Settings.Global.getInt(context.getContentResolver(),Settings.Global.AUTO_TIME);
-      int autotimezone = Settings.Global.getInt(context.getContentResolver(),Settings.Global.AUTO_TIME_ZONE);
-
-      ICLogger.i("get NTP Settings AutoTime "+autotime+" AutoTimeZone "+autotimezone);
-
-      if(enable)
-      {
-        Settings.Global.putInt(context.getContentResolver(), Settings.Global.AUTO_TIME_ZONE, 1);
-        Settings.Global.putInt(context.getContentResolver(), Settings.Global.AUTO_TIME, 1);
-      }else {
-        Settings.Global.putInt(context.getContentResolver(), Settings.Global.AUTO_TIME_ZONE, 0);
-        Settings.Global.putInt(context.getContentResolver(), Settings.Global.AUTO_TIME, 0);
-      }
-      autotime = Settings.Global.getInt(context.getContentResolver(),Settings.Global.AUTO_TIME);
-      autotimezone = Settings.Global.getInt(context.getContentResolver(),Settings.Global.AUTO_TIME_ZONE);
-      ICLogger.i("get NTP Settings AutoTime "+autotime+" AutoTimeZone "+autotimezone);
-    } catch (Settings.SettingNotFoundException e) {
-      e.printStackTrace();
-      ICLogger.e(e.getMessage(),e);
-    }
-  }
-  public static void LoadMessageConfigs(){
-
-    String tmp=Util.getSystemProperties("persist.sys.doBroadcastMSG");
-    boolean ret=false;
-    if (tmp.equals("true"))
-      ret=true;
-
-    do_broadCast_message = ret;
-
-    noPPGSensor=(ICJniUtils.isPPGavailable()==0);
-    noTempSensor=(ICJniUtils.isTemperatureDevAvailable()==0);
-
-    //默认关闭NTP
-    disable_ntp_server=Util.getSystemProperties("persist.sys.disableNTP","false").equals("true");
-
-    c43_branch_name=Util.getSystemProperties("persist.sys.c43.branch");
-
-    if ((c43_branch_name.equals("l03")) ||(c43_branch_name.equals("l05"))){
-        noPushTxtNotifyDialog=true;
-        noSMSNotifyDialog=true;
-        noVoiceNotifyDialog=true;
-        noTempSensor=true;
-        if (c43_branch_name.equals("l05")) {
-          SOSNoNeedDial=true;//采用新写的SOS,协议只需要发送消息,无需控制拨号。
-          noPPGSensor=false;
-        }else{
-          noPPGSensor=true;
+
+    public static boolean logBootDate(Context context) {
+        //如果时间和最后一次时间不同,则重置,否则启动次数+1
+        if (isFirstBootToday(context)) {
+            SharPreferenceUtil.setPrefString(context, KeyBootUpDate, TimeUtil.getSystemTime4());
+            return true;
+        } else {
+            return false;
+        }
+    }
+
+    private static String getLastBootupDate(Context context) {
+        return SharPreferenceUtil.getPrefString(context, KeyBootUpDate, "");
+    }
+
+    private static boolean isFirstBootToday(Context context) {
+        //第一次启动记录的日期,当前日期只要相同,就认为有启动过。
+        //如果手表一直没有重启过,则每次resetStepCount的时候把启动时间更新到当天,
+        //从而解决第二天重启就会被重置的问题!
+        String currentDate = TimeUtil.getSystemTime4();
+        String lastDate = getLastBootupDate(context);
+        boolean ret = false;
+        if (currentDate.equals(lastDate)) {
+            ret = false;
+        } else {
+            ret = true;
+        }
+        ICLogger.i("Current BootDate=" + currentDate + ", Last BootDate=" + lastDate + ", ret=" + ret);
+        return ret;
+    }
+
+    //收到语音微聊广播消息给外部窗口
+    public static boolean do_broadCast_message = false;
+
+    //每次心跳时都检测逃逸并报警
+    public static boolean needAllwaysAlarmFenceOut = false;
+    //每次心跳时都检测剪断并报警,只报警
+    public static boolean needAllwaysAlarmCutOff = false;
+
+    //体温非正常报警
+    public static boolean needTemperature_abnormal_alarm = false;
+    public static boolean A9_noBroadCastActionStrip = false;
+    public static boolean C5_noBroadCastActionStrip = false;
+    public static boolean L004_BroadCastActionStrip = false;
+
+    //停止系统NTP时钟同步标志
+    public static boolean disable_ntp_server = false;
+
+    //需要系统发送已阅读消息的标志
+    public static boolean noPushTxtReadReply = true;
+    //蓝牙定位扫描 协议0模式,扫到beacon信标时,如果属于第一次扫到的进入状态(解除逃逸状态),发送服务器的标志位,主要由于C5客户只要逃逸,不要解除逃逸消息。
+    public static boolean noBLE_RelaseEscapeAlarm = true;
+
+    public static void enable_NTP_Server(Context context, boolean enable) {
+        try {
+            int autotime = Settings.Global.getInt(context.getContentResolver(), Settings.Global.AUTO_TIME);
+            int autotimezone = Settings.Global.getInt(context.getContentResolver(), Settings.Global.AUTO_TIME_ZONE);
+
+            ICLogger.i("get NTP Settings AutoTime " + autotime + " AutoTimeZone " + autotimezone);
+
+            if (enable) {
+                Settings.Global.putInt(context.getContentResolver(), Settings.Global.AUTO_TIME_ZONE, 1);
+                Settings.Global.putInt(context.getContentResolver(), Settings.Global.AUTO_TIME, 1);
+            } else {
+                Settings.Global.putInt(context.getContentResolver(), Settings.Global.AUTO_TIME_ZONE, 0);
+                Settings.Global.putInt(context.getContentResolver(), Settings.Global.AUTO_TIME, 0);
+            }
+            autotime = Settings.Global.getInt(context.getContentResolver(), Settings.Global.AUTO_TIME);
+            autotimezone = Settings.Global.getInt(context.getContentResolver(), Settings.Global.AUTO_TIME_ZONE);
+            ICLogger.i("get NTP Settings AutoTime " + autotime + " AutoTimeZone " + autotimezone);
+        } catch (Settings.SettingNotFoundException e) {
+            e.printStackTrace();
+            ICLogger.e(e.getMessage(), e);
+        }
+    }
+
+    public static void LoadMessageConfigs() {
+
+        String tmp = Util.getSystemProperties("persist.sys.doBroadcastMSG");
+        boolean ret = false;
+        if (tmp.equals("true"))
+            ret = true;
+
+        do_broadCast_message = ret;
+
+        noPPGSensor = (ICJniUtils.isPPGavailable() == 0);
+        noTempSensor = (ICJniUtils.isTemperatureDevAvailable() == 0);
+
+        //默认关闭NTP
+        disable_ntp_server = Util.getSystemProperties("persist.sys.disableNTP", "false").equals("true");
+
+        c43_branch_name = Util.getSystemProperties("persist.sys.c43.branch");
+
+        if ((c43_branch_name.equals("l03")) || (c43_branch_name.equals("l05"))) {
+            noPushTxtNotifyDialog = true;
+            noSMSNotifyDialog = true;
+            noVoiceNotifyDialog = true;
+            noTempSensor = true;
+            if (c43_branch_name.equals("l05")) {
+                SOSNoNeedDial = true;//采用新写的SOS,协议只需要发送消息,无需控制拨号。
+                noPPGSensor = false;
+            } else {
+                noPPGSensor = true;
+            }
+        }
+        custom_name = Util.getSystemProperties("persist.sys.customname");
+        ICLogger.i("get CUSTOMNAME " + custom_name);
+        if (custom_name.equals("H88") || custom_name.equals("H88A")) {
+            noPushTxtNotifyDialog = true;
+            noSMSNotifyDialog = false;
+            noVoiceNotifyDialog = false;
+            noPPGSensor = false;
+            noTempSensor = false;
+            needBroadcastAntiAlarm = false;
+        } else if ((custom_name.equals("AK"))) {
+            noPushTxtNotifyDialog = true;
+            noSMSNotifyDialog = true;
+            noVoiceNotifyDialog = true;
+            noPPGSensor = false;
+            noTempSensor = true;
+            SOSNoNeedDial = true; //采用新写的SOS,协议只需要发送消息,无需控制拨号。
+        } else if ((custom_name.equals("YT"))) {
+            noPushTxtNotifyDialog = false;
+            noSMSNotifyDialog = false;
+            noVoiceNotifyDialog = false;
+            noPPGSensor = false;
+            noTempSensor = true;
+        } else if ((custom_name.equals("l004"))) {
+            noPushTxtNotifyDialog = true;
+            noSMSNotifyDialog = true;
+            noVoiceNotifyDialog = true;
+            needBroadcastAntiAlarm = false;
+            needBroadcastCutoffAlarm = true;
+            needAllwaysAlarmCutOff = false;
+            needAllwaysAlarmFenceOut = false;
+            needTemperature_abnormal_alarm = false;
+            noPPGSensor = false;
+            noTempSensor = false;
+            L004_BroadCastActionStrip = true;
+        } else if (custom_name.equals("YQ") || custom_name.equals("YQ_EN")) { //A9-YQ
+            noPushTxtNotifyDialog = false;
+            noSMSNotifyDialog = true;
+            noVoiceNotifyDialog = true;
+            noBroadCastPushTxtNotify = true;
+            noBroadCastSMSNotify = true;
+            needBroadcastAntiAlarm = false;
+            needBroadcastCutoffAlarm = true;
+            needAllwaysAlarmCutOff = true;
+            needAllwaysAlarmFenceOut = true;
+            needTemperature_abnormal_alarm = true;
+            noPushTxtReadReply = false;//A9需要阅读反馈
+            noPPGSensor = false;
+            noTempSensor = false;
+            A9_noBroadCastActionStrip = true;
+        } else if (custom_name.equals("SGL")) {
+            noPushTxtNotifyDialog = false;
+            noSMSNotifyDialog = false;
+            noVoiceNotifyDialog = true;
+            needBroadcastAntiAlarm = false;
+            needBroadcastCutoffAlarm = true;
+            needAllwaysAlarmCutOff = true;
+            needAllwaysAlarmFenceOut = false;
+            needTemperature_abnormal_alarm = false;
+            noPPGSensor = false;
+            noTempSensor = false;
+            C5_noBroadCastActionStrip = true;
+        } else if (custom_name.equals("L02")) {
+            noPushTxtReadReply = false;//即爱需要阅读反馈
+        } else {
+            noBroadCastPushTxtNotify = true;
         }
+
+
+    }
+
+    public static void loadTemperatureSettings(Runtime runtime) {
+        runtime.temp_test_Cycle_Seconds = SharPreferenceUtil.getPrefInt(runtime.getContextProxy().context, KeyTempTestCycle, 60 * 60);
+    }
+
+    public static void setTemperatureTestCycle(Runtime runtime, int cycle_seconds) {
+        SharPreferenceUtil.setPrefInt(runtime.getContextProxy().context, KeyTempTestCycle, cycle_seconds);
+        loadTemperatureSettings(runtime);
+    }
+
+    public static boolean isUsingCustomServer = false;
+
+    public static void setCustomServer(Context context, boolean isusingCutomerServer, String serverip, int serverport) {
+
+        if (isusingCutomerServer)
+            Util.setSystemProperties("persist.sys.UsingCustomServer", "true");
+        else
+            Util.setSystemProperties("persist.sys.UsingCustomServer", "false");
+
+
+        Util.setSystemProperties("persist.sys.customserverip", serverip);
+        Util.setSystemProperties("persist.sys.customserverport", String.valueOf(serverport));
+        setProtocolServerHost(context, serverip);
+        setProtocolServerPort(context, serverport);
+
+        loadCustomServerAddr(context);
+
+    }
+
+    public static void loadCustomServerAddr(Context context) {
+        String tmp = Util.getSystemProperties("persist.sys.UsingCustomServer");
+        ICLogger.d("UsingCustomServer == > " + tmp);
+        boolean ret = false;
+        if (tmp.equals("true")) {
+            ret = true;
+        }
+
+        isUsingCustomServer = ret;
+
+        String serverip = "";
+        int serverport = 0;
+        if (isUsingCustomServer) {
+            serverip = Util.getSystemProperties("persist.sys.customserverip");
+            serverport = Integer.valueOf(Util.getSystemProperties("persist.sys.customserverport"));
+            setProtocolServerHost(context, serverip);
+            setProtocolServerPort(context, serverport);
+        } else {
+            setProtocolServerHost(context, protocolAPIHelper.getDefaultServerIP());
+            setProtocolServerPort(context, protocolAPIHelper.getDefaultServerPort());
+        }
+        ICLogger.i("current protocol_no=" + protocol_no + " , isUsingCustomServier=" + isUsingCustomServer + ", server host=" +
+                getProtocolServerHost(context) + ", server port=" + getProtocolServerPort(context));
+    }
+
+    public static boolean noLocationCycle = getNoLocationCycleFlag();
+
+    public static boolean getNoLocationCycleFlag() {
+        String tmp = Util.getSystemProperties("persist.sys.NoLocationCycle");
+        boolean ret = false;
+        if (tmp.equals("true"))
+            ret = true;
+
+        noLocationCycle = ret;
+        return ret;
+    }
+
+    public static final int PROTOCOL_JIAI = 0;
+    public static final int PROTOCOL_BEEHOME = 1;
+    public static final int PROTOCOL_IC = 2;
+    public static final int PROTOCOL_FZD = 3;
+    public static final int PROTOCOL_MQTT = 4;
+
+    public static int protocol_no = getProtocolNumber();
+
+    public static int getProtocolNumber() {
+        String tmp = Util.getSystemProperties("persist.sys.protocol_no");
+        int ret = 0;
+        if (tmp != null && !tmp.isEmpty() && Util.isNumeric(tmp)) {
+            ret = Integer.parseInt(tmp);
+            switch (ret) {
+                case PROTOCOL_JIAI:
+                    ICLogger.i("协议 JIAI");
+                    break;
+                case PROTOCOL_BEEHOME:
+                    ICLogger.i("协议 BEEHOME");
+                    break;
+                case PROTOCOL_IC:
+                    ICLogger.i("协议 IC");
+                    break;
+                case PROTOCOL_FZD:
+                    ICLogger.i("协议 FZD");
+                    break;
+                case PROTOCOL_MQTT:
+                    ICLogger.i("协议 MQTT");
+                    break;
+                default:
+                    ICLogger.i("协议版本 目前支持0,1,2,3,4 。");
+                    break;
+            }
+        } else {
+            ICLogger.i("协议版本要是数字,目前支持0,1,2,3,4 。");
+        }
+        protocol_no = ret;
+        return ret;
+    }
+
+
+    public static void setPPGAdjust(Context context, int adjust) {
+        SharPreferenceUtil.setPrefInt(context, KeyPPGadust, adjust);
+    }
+
+
+    public static int getPPGAdjust(Context context) {
+        return SharPreferenceUtil.getPrefInt(context, KeyPPGadust, 0);
+    }
+
+    public static void setBPHAdjust(Context context, int adjust) {
+        SharPreferenceUtil.setPrefInt(context, KeyBPHadust, adjust);
     }
-    custom_name=Util.getSystemProperties("persist.sys.customname");
-    ICLogger.i("get CUSTOMNAME "+custom_name);
-    if (custom_name.equals("H88")||custom_name.equals("H88A") ){
-      noPushTxtNotifyDialog=true;
-      noSMSNotifyDialog=false;
-      noVoiceNotifyDialog=false;
-      noPPGSensor=false;
-      noTempSensor=false;
-      needBroadcastAntiAlarm=false;
-    }else if  ((custom_name.equals("AK")) ){
-        noPushTxtNotifyDialog=true;
-        noSMSNotifyDialog=true;
-        noVoiceNotifyDialog=true;
-      noPPGSensor=false;
-      noTempSensor=true;
-      SOSNoNeedDial=true; //采用新写的SOS,协议只需要发送消息,无需控制拨号。
-    }else if  ((custom_name.equals("YT")) ){
-      noPushTxtNotifyDialog=false;
-      noSMSNotifyDialog=false;
-      noVoiceNotifyDialog=false;
-      noPPGSensor=false;
-      noTempSensor=true;
-    }else if ((custom_name.equals("l004")) ) {
-      noPushTxtNotifyDialog=true;
-      noSMSNotifyDialog=true;
-      noVoiceNotifyDialog=true;
-      needBroadcastAntiAlarm=false;
-      needBroadcastCutoffAlarm=true;
-      needAllwaysAlarmCutOff=false;
-      needAllwaysAlarmFenceOut=false;
-      needTemperature_abnormal_alarm=false;
-      noPPGSensor=false;
-      noTempSensor=false;
-      L004_BroadCastActionStrip=true;
-    }else if (custom_name.equals("YQ") ||custom_name.equals("YQ_EN")  ) { //A9-YQ
-      noPushTxtNotifyDialog=false;
-      noSMSNotifyDialog=true;
-      noVoiceNotifyDialog=true;
-      noBroadCastPushTxtNotify=true;
-      noBroadCastSMSNotify=true;
-      needBroadcastAntiAlarm=false;
-      needBroadcastCutoffAlarm=true;
-      needAllwaysAlarmCutOff=true;
-      needAllwaysAlarmFenceOut=true;
-      needTemperature_abnormal_alarm=true;
-      noPushTxtReadReply=false;//A9需要阅读反馈
-      noPPGSensor=false;
-      noTempSensor=false;
-      A9_noBroadCastActionStrip=true;
-    }else if (custom_name.equals("SGL"))
-    {
-      noPushTxtNotifyDialog=false;
-      noSMSNotifyDialog=false;
-      noVoiceNotifyDialog=true;
-      needBroadcastAntiAlarm=false;
-      needBroadcastCutoffAlarm=true;
-      needAllwaysAlarmCutOff=true;
-      needAllwaysAlarmFenceOut=false;
-      needTemperature_abnormal_alarm=false;
-      noPPGSensor=false;
-      noTempSensor=false;
-      C5_noBroadCastActionStrip=true;
-    }else if(custom_name.equals("L02")){
-      noPushTxtReadReply=false;//即爱需要阅读反馈
-    }else{
-      noBroadCastPushTxtNotify=true;
-    }
-
-
-  }
-
-  public static void loadTemperatureSettings(Runtime runtime){
-    runtime.temp_test_Cycle_Seconds = SharPreferenceUtil.getPrefInt(runtime.getContextProxy().context, KeyTempTestCycle, 60*60);
-  }
-
-  public static void setTemperatureTestCycle(Runtime runtime,int cycle_seconds) {
-    SharPreferenceUtil.setPrefInt(runtime.getContextProxy().context,KeyTempTestCycle,cycle_seconds);
-    loadTemperatureSettings(runtime);
-  }
-    public static boolean isUsingCustomServer=false;
-
-  public static void setCustomServer(Context context,boolean isusingCutomerServer,String serverip,int serverport) {
-
-      if (isusingCutomerServer)
-          Util.setSystemProperties("persist.sys.UsingCustomServer","true");
-      else
-          Util.setSystemProperties("persist.sys.UsingCustomServer","false");
-
-
-    Util.setSystemProperties("persist.sys.customserverip",serverip);
-    Util.setSystemProperties("persist.sys.customserverport",String.valueOf(serverport));
-    setProtocolServerHost(context,serverip);
-    setProtocolServerPort(context,serverport);
-
-    loadCustomServerAddr(context);
-
-  }
-  public static void loadCustomServerAddr(Context context){
-    String tmp=Util.getSystemProperties("persist.sys.UsingCustomServer");
-    boolean ret=false;
-    if (tmp.equals("true"))
-      ret=true;
-
-    isUsingCustomServer=ret;
-
-    String serverip="";
-    int serverport=0;
-    if(isUsingCustomServer){
-      serverip= Util.getSystemProperties("persist.sys.customserverip");
-      serverport= Integer.valueOf(Util.getSystemProperties("persist.sys.customserverport"));
-      setProtocolServerHost(context,serverip);
-      setProtocolServerPort(context,serverport);
-
-    }else{
-      setProtocolServerHost(context, protocolAPIHelper.getDefaultServerIP());
-      setProtocolServerPort(context,protocolAPIHelper.getDefaultServerPort());
-    }
-    ICLogger.i("current protocol_no="+protocol_no+" , isUsingCustomServier="+isUsingCustomServer+", server host="+
-            getProtocolServerHost(context)+", server port="+getProtocolServerPort(context));
-  }
-
-  public static boolean noLocationCycle=getNoLocationCycleFlag();
-  public static boolean getNoLocationCycleFlag(){
-      String tmp=Util.getSystemProperties("persist.sys.NoLocationCycle");
-      boolean ret=false;
-      if (tmp.equals("true"))
-          ret=true;
-
-      noLocationCycle=ret;
-     return ret;
-  }
-
-  public static final int PROTOCOL_JIAI=0;
-  public static final int PROTOCOL_BEEHOME=1;
-  public static final int PROTOCOL_IC=2;
-  public static final int PROTOCOL_FZD=3;
-  public static final int PROTOCOL_MQTT=4;
-
-  public static int protocol_no=getProtocolNumber();
-  public static int getProtocolNumber(){
-    String tmp=Util.getSystemProperties("persist.sys.protocol_no");
-    int ret=0;
-    if (tmp!=null && !tmp.isEmpty()&& Util.isNumeric(tmp)) {
-      ret = Integer.parseInt(tmp);
-      switch(ret){
-        case PROTOCOL_JIAI:
-          ICLogger.i("协议 JIAI");
-          break;
-        case PROTOCOL_BEEHOME:
-          ICLogger.i("协议 BEEHOME");
-          break;
-        case PROTOCOL_IC:
-          ICLogger.i("协议 IC");
-          break;
-        case PROTOCOL_FZD:
-          ICLogger.i("协议 FZD");
-          break;
-        case PROTOCOL_MQTT:
-          ICLogger.i("协议 MQTT");
-          break;
-        default:
-          ICLogger.i("协议版本 目前支持0,1,2,3,4 。");
-          break;
-      }
-    }else{
-      ICLogger.i("协议版本要是数字,目前支持0,1,2,3,4 。");
-    }
-    protocol_no=ret;
-    return ret;
-  }
-
-
-  public static void setPPGAdjust(Context context,int adjust){
-    SharPreferenceUtil.setPrefInt(context,KeyPPGadust,adjust);
-  }
-
-
-  public static int getPPGAdjust(Context context){
-    return SharPreferenceUtil.getPrefInt(context,KeyPPGadust, 0);
-  }
-
-  public static void setBPHAdjust(Context context,int adjust){
-    SharPreferenceUtil.setPrefInt(context,KeyBPHadust,adjust);
-  }
-
-
-  public static int getBPHAdjust(Context context){
-    return SharPreferenceUtil.getPrefInt(context,KeyBPHadust, 0);
-  }
-
-
-
-  public static int getBPLAdjust(Context context){
-    return SharPreferenceUtil.getPrefInt(context,KeyBPLadust, 0);
-  }
-
-  public static void setBPLAdjust(Context context,int adjust){
-    SharPreferenceUtil.setPrefInt(context,KeyBPLadust,adjust);
-  }
-
-  public static void setSPo2Adjust(Context context,int adjust){
-    SharPreferenceUtil.setPrefInt(context,KeySPo2adust,adjust);
-  }
-
-  public static int getSPo2Adjust(Context context){
-    return SharPreferenceUtil.getPrefInt(context,KeySPo2adust, 0);
-  }
-
-  public static void loadPPG_BPH_BPL_SPO2_adjustvalue(Context context,Runtime runtime){
-    int ppgadj,bphadj,bpladj,spo2adj;
-    ppgadj=getPPGAdjust(context);
-    bphadj=getBPHAdjust(context);
-    bpladj=getBPLAdjust(context);
-    spo2adj=getSPo2Adjust(context);
-    runtime.getHRS().setAdjust(ppgadj,bphadj,bpladj,spo2adj);
-    ICLogger.i("Load Health adjust value  ppg "+ppgadj+", bph "+bphadj+", bpl "+bpladj+", spo2 "+spo2adj);
-  }
-
-
-
-  //心率血压血氧校准值
-  public static String getPPG_ECG_adjustValue(){
-    return Util.getSystemProperties("persist.sys."+Constants.SHAREKEY_SETTING_PPG_ECG_ADJUST,"0,0,0,0");
-  }
-
-  public static void setPPG_ECG_adjustValue(String adjvalue){
-    Util.setSystemProperties("persist.sys."+Constants.SHAREKEY_SETTING_PPG_ECG_ADJUST,adjvalue);
-  }
-
-  //久坐时间获取
-  public static int getKeepSitRangeInMinutes(Context context ){
-    return Util.getSystemPropertiesInt("persist.sys."+Constants.SHAREKEY_SETTING_SIT_ALARM_RANGE_IN_MINUTES,0);
+
+
+    public static int getBPHAdjust(Context context) {
+        return SharPreferenceUtil.getPrefInt(context, KeyBPHadust, 0);
+    }
+
+
+    public static int getBPLAdjust(Context context) {
+        return SharPreferenceUtil.getPrefInt(context, KeyBPLadust, 0);
+    }
+
+    public static void setBPLAdjust(Context context, int adjust) {
+        SharPreferenceUtil.setPrefInt(context, KeyBPLadust, adjust);
+    }
+
+    public static void setSPo2Adjust(Context context, int adjust) {
+        SharPreferenceUtil.setPrefInt(context, KeySPo2adust, adjust);
+    }
+
+    public static int getSPo2Adjust(Context context) {
+        return SharPreferenceUtil.getPrefInt(context, KeySPo2adust, 0);
+    }
+
+    public static void loadPPG_BPH_BPL_SPO2_adjustvalue(Context context, Runtime runtime) {
+        int ppgadj, bphadj, bpladj, spo2adj;
+        ppgadj = getPPGAdjust(context);
+        bphadj = getBPHAdjust(context);
+        bpladj = getBPLAdjust(context);
+        spo2adj = getSPo2Adjust(context);
+        runtime.getHRS().setAdjust(ppgadj, bphadj, bpladj, spo2adj);
+        ICLogger.i("Load Health adjust value  ppg " + ppgadj + ", bph " + bphadj + ", bpl " + bpladj + ", spo2 " + spo2adj);
+    }
+
+
+    //心率血压血氧校准值
+    public static String getPPG_ECG_adjustValue() {
+        return Util.getSystemProperties("persist.sys." + Constants.SHAREKEY_SETTING_PPG_ECG_ADJUST, "0,0,0,0");
+    }
+
+    public static void setPPG_ECG_adjustValue(String adjvalue) {
+        Util.setSystemProperties("persist.sys." + Constants.SHAREKEY_SETTING_PPG_ECG_ADJUST, adjvalue);
+    }
+
+    //久坐时间获取
+    public static int getKeepSitRangeInMinutes(Context context) {
+        return Util.getSystemPropertiesInt("persist.sys." + Constants.SHAREKEY_SETTING_SIT_ALARM_RANGE_IN_MINUTES, 0);
 //    return SharPreferenceUtil.getPrefIntPublic(context,Constants.SHAREKEY_SETTING_SIT_ALARM_RANGE_IN_MINUTES,0);
-  }
+    }
 
-  //久坐时间设置
-  public static void setKeepSitRangeInMinutes(Context context, int RangeInMinutes){
-      Util.setSystemProperties("persist.sys."+Constants.SHAREKEY_SETTING_SIT_ALARM_RANGE_IN_MINUTES,RangeInMinutes);
+    //久坐时间设置
+    public static void setKeepSitRangeInMinutes(Context context, int RangeInMinutes) {
+        Util.setSystemProperties("persist.sys." + Constants.SHAREKEY_SETTING_SIT_ALARM_RANGE_IN_MINUTES, RangeInMinutes);
 //    SharPreferenceUtil.setPrefIntPublic(context,Constants.SHAREKEY_SETTING_SIT_ALARM_RANGE_IN_MINUTES,RangeInMinutes);
-  }
+    }
 
-  public static void setSleepDate(Context context,String dateyyyyMMddHHmmss){
-    Util.setSystemProperties("persist.sys."+Constants.SHAREKEY_SETTING_SLEEP_SCORE_DATE,dateyyyyMMddHHmmss);
+    public static void setSleepDate(Context context, String dateyyyyMMddHHmmss) {
+        Util.setSystemProperties("persist.sys." + Constants.SHAREKEY_SETTING_SLEEP_SCORE_DATE, dateyyyyMMddHHmmss);
 //    SharPreferenceUtil.setPrefStringPublic(context,Constants.SHAREKEY_SETTING_SLEEP_SCORE_DATE,dateyyyyMMddHHmmss);
-  }
+    }
 
 
-  public static void setSleepScore(Context context,int score){
+    public static void setSleepScore(Context context, int score) {
 //    SharPreferenceUtil.setPrefIntPublic(context,Constants.SHAREKEY_SETTING_SLEEP_SCORE,score);
-    Util.setSystemProperties("persist.sys."+Constants.SHAREKEY_SETTING_SLEEP_SCORE,score);
+        Util.setSystemProperties("persist.sys." + Constants.SHAREKEY_SETTING_SLEEP_SCORE, score);
 
-  }
+    }
 
-    public static String getSleepDate(Context context){
-        return Util.getSystemProperties("persist.sys."+Constants.SHAREKEY_SETTING_SLEEP_SCORE_DATE,"");
+    public static String getSleepDate(Context context) {
+        return Util.getSystemProperties("persist.sys." + Constants.SHAREKEY_SETTING_SLEEP_SCORE_DATE, "");
     }
 
 
-    public static int getSleepScore(Context context){
+    public static int getSleepScore(Context context) {
 
-        return Util.getSystemPropertiesInt("persist.sys."+Constants.SHAREKEY_SETTING_SLEEP_SCORE,0);
+        return Util.getSystemPropertiesInt("persist.sys." + Constants.SHAREKEY_SETTING_SLEEP_SCORE, 0);
 
     }
-  public static void setNeedCutOff(Context context,boolean enAnti){
-    SharPreferenceUtil.setPrefBoolean(context,"NeedCutOff",enAnti);
-  }
 
-  public static boolean getNeedCutOff(Context context){
-    return SharPreferenceUtil.getPrefBoolean(context,"NeedCutOff", false);
-  }
-    public static void setNeedAntiOff(Context context,boolean enAnti){
-      SharPreferenceUtil.setPrefBoolean(context,"NeedAntiOff",enAnti);
+    public static void setNeedCutOff(Context context, boolean enAnti) {
+        SharPreferenceUtil.setPrefBoolean(context, "NeedCutOff", enAnti);
     }
 
-    public static boolean getNeedAntiOff(Context context){
-      return SharPreferenceUtil.getPrefBoolean(context,"NeedAntiOff", false);
+    public static boolean getNeedCutOff(Context context) {
+        return SharPreferenceUtil.getPrefBoolean(context, "NeedCutOff", false);
     }
-    public static boolean enableSleep=false;
-  /**
-   * 参考数据,平均每分钟步数来判断,大于 KeepSitJudgementRefValue 认为没有坐着。小于等于这个值认为坐着。
-   */
-  public static int  KeepSitJudgementRefValue=30;
 
-  /***
-   * persist.sys.alarmConfig=ALARM_SOS,ALARM_LOWBATTERY,ALARM_ANTIOFF,ALARM_WEARED,ALARM_CUTOFF,ALARM_FALL,ALARM_ABNORMAL_HEART_RATE,ALARM_HEART_RATE_HIGH,ALARM_HEART_RATE_LOW,ALARM_BPH_HIGH,ALARM_BPH_LOW,ALARM_BPL_HIGH,ALARM_BPL_LOW,ALARM_SEDENTARY,ALARM_ILLEGAL_CUTOFF,ALARM_LOCK_WATCH,ALARM_TEMP_HIGH,ALARM_TEMP_LOW,ALARM_POWER_OFF,ALARM_ESCAPE,ALARM_NONE
-   * 配在里面的表示开启,没配的表示关闭。 默认ALARM_SOS,ALARM_LOWBATTERY,ALARM_POWER_OFF开启
-   * ALARM_ILLEGAL_CUTOFF,ALARM_FALL,ALARM_ABNORMAL_HEART_RATE 没有使用,设置了也没有用
-   */
-  public static void loadAlarmConfig(){
-    String configvalues=Util.getSystemProperties("persist.sys.alarmConfig","");
-    String[] values=configvalues.split(",");
-    if (values.length>0){
-      for (int i=0; i< values.length;i++)
-      {
-        for (Runtime.AlarmType at: Runtime.AlarmType.values()) {
-          if (values[i].trim().equals(at.name())){
-            ConfigAlarm(at,true);
-            break;
-          }
+    public static void setNeedAntiOff(Context context, boolean enAnti) {
+        SharPreferenceUtil.setPrefBoolean(context, "NeedAntiOff", enAnti);
+    }
+
+    public static boolean getNeedAntiOff(Context context) {
+        return SharPreferenceUtil.getPrefBoolean(context, "NeedAntiOff", false);
+    }
+
+    public static boolean enableSleep = false;
+    /**
+     * 参考数据,平均每分钟步数来判断,大于 KeepSitJudgementRefValue 认为没有坐着。小于等于这个值认为坐着。
+     */
+    public static int KeepSitJudgementRefValue = 30;
+
+    /***
+     * persist.sys.alarmConfig=ALARM_SOS,ALARM_LOWBATTERY,ALARM_ANTIOFF,ALARM_WEARED,ALARM_CUTOFF,ALARM_FALL,ALARM_ABNORMAL_HEART_RATE,ALARM_HEART_RATE_HIGH,ALARM_HEART_RATE_LOW,ALARM_BPH_HIGH,ALARM_BPH_LOW,ALARM_BPL_HIGH,ALARM_BPL_LOW,ALARM_SEDENTARY,ALARM_ILLEGAL_CUTOFF,ALARM_LOCK_WATCH,ALARM_TEMP_HIGH,ALARM_TEMP_LOW,ALARM_POWER_OFF,ALARM_ESCAPE,ALARM_NONE
+     * 配在里面的表示开启,没配的表示关闭。 默认ALARM_SOS,ALARM_LOWBATTERY,ALARM_POWER_OFF开启
+     * ALARM_ILLEGAL_CUTOFF,ALARM_FALL,ALARM_ABNORMAL_HEART_RATE 没有使用,设置了也没有用
+     */
+    public static void loadAlarmConfig() {
+        String configvalues = Util.getSystemProperties("persist.sys.alarmConfig", "");
+        String[] values = configvalues.split(",");
+        if (values.length > 0) {
+            for (int i = 0; i < values.length; i++) {
+                for (Runtime.AlarmType at : Runtime.AlarmType.values()) {
+                    if (values[i].trim().equals(at.name())) {
+                        ConfigAlarm(at, true);
+                        break;
+                    }
+                }
+            }
         }
-      }
-    }
-    dumpAlarmConfig();
-  }
-
-  public static void ConfigAlarm(Runtime.AlarmType alarmType,boolean enabled){
-    AlarmConfiglist.put(alarmType.ordinal(),enabled);
-  }
-  public static void dumpAlarmConfig(){
-    for (int i=0;i<AlarmConfiglist.size();i++) {
-      ICLogger.i(Runtime.AlarmType.values()[i].name()+" "+AlarmConfiglist.get(i));
-    }
-  }
-  private static HashMap<Integer,Boolean> AlarmConfiglist;
-  static {
-    AlarmConfiglist=new HashMap<Integer,Boolean>();
-    AlarmConfiglist.put(Runtime.AlarmType.ALARM_SOS.ordinal(),true);
-    AlarmConfiglist.put(Runtime.AlarmType.ALARM_LOWBATTERY.ordinal(),true);
-    AlarmConfiglist.put(Runtime.AlarmType.ALARM_ANTIOFF.ordinal(),false);
-    AlarmConfiglist.put(Runtime.AlarmType.ALARM_WEARED.ordinal(),false);
-    AlarmConfiglist.put(Runtime.AlarmType.ALARM_CUTOFF.ordinal(),false);
-    AlarmConfiglist.put(Runtime.AlarmType.ALARM_FALL.ordinal(),false);
-    AlarmConfiglist.put(Runtime.AlarmType.ALARM_ABNORMAL_HEART_RATE.ordinal(),false);
-    AlarmConfiglist.put(Runtime.AlarmType.ALARM_HEART_RATE_HIGH.ordinal(),false);
-    AlarmConfiglist.put(Runtime.AlarmType.ALARM_HEART_RATE_LOW.ordinal(),false);
-    AlarmConfiglist.put(Runtime.AlarmType.ALARM_BPH_HIGH.ordinal(),false);
-    AlarmConfiglist.put(Runtime.AlarmType.ALARM_BPH_LOW.ordinal(),false);
-    AlarmConfiglist.put(Runtime.AlarmType.ALARM_BPL_HIGH.ordinal(),false);
-    AlarmConfiglist.put(Runtime.AlarmType.ALARM_BPL_LOW.ordinal(),false);
-    AlarmConfiglist.put(Runtime.AlarmType.ALARM_SEDENTARY.ordinal(),false);
-    AlarmConfiglist.put(Runtime.AlarmType.ALARM_ILLEGAL_CUTOFF.ordinal(),false);
-    AlarmConfiglist.put(Runtime.AlarmType.ALARM_LOCK_WATCH.ordinal(),false);
-    AlarmConfiglist.put(Runtime.AlarmType.ALARM_TEMP_HIGH.ordinal(),false);
-    AlarmConfiglist.put(Runtime.AlarmType.ALARM_TEMP_LOW.ordinal(),false);
-    AlarmConfiglist.put(Runtime.AlarmType.ALARM_POWER_OFF.ordinal(),true);
-    AlarmConfiglist.put(Runtime.AlarmType.ALARM_ESCAPE.ordinal(),false);
-    AlarmConfiglist.put(Runtime.AlarmType.ALARM_NONE.ordinal(),false);
-    AlarmConfiglist.put(Runtime.AlarmType.ALARM_REMOVE_SOS.ordinal(),true);
-  }
-
-  public static boolean isAlarmTypeEnabled(Runtime.AlarmType alarmType){
-
-    boolean en=false;
-    if (AlarmConfiglist.containsKey(alarmType.ordinal())){
-      en=AlarmConfiglist.get(alarmType.ordinal());
-    }
-    return en;
-  }
-  public static boolean needWaterMark(){
-    String customname=getSystemProperties("persist.sys.needWaterMark","true");
-    if(customname.trim().equals("true")){
-      return true;
-    }else
-      return false;
-  }
+        dumpAlarmConfig();
+    }
+
+    public static void ConfigAlarm(Runtime.AlarmType alarmType, boolean enabled) {
+        AlarmConfiglist.put(alarmType.ordinal(), enabled);
+    }
+
+    public static void dumpAlarmConfig() {
+        for (int i = 0; i < AlarmConfiglist.size(); i++) {
+            ICLogger.i(Runtime.AlarmType.values()[i].name() + " " + AlarmConfiglist.get(i));
+        }
+    }
+
+    private static HashMap<Integer, Boolean> AlarmConfiglist;
+
+    static {
+        AlarmConfiglist = new HashMap<Integer, Boolean>();
+        AlarmConfiglist.put(Runtime.AlarmType.ALARM_SOS.ordinal(), true);
+        AlarmConfiglist.put(Runtime.AlarmType.ALARM_LOWBATTERY.ordinal(), true);
+        AlarmConfiglist.put(Runtime.AlarmType.ALARM_ANTIOFF.ordinal(), false);
+        AlarmConfiglist.put(Runtime.AlarmType.ALARM_WEARED.ordinal(), false);
+        AlarmConfiglist.put(Runtime.AlarmType.ALARM_CUTOFF.ordinal(), false);
+        AlarmConfiglist.put(Runtime.AlarmType.ALARM_FALL.ordinal(), false);
+        AlarmConfiglist.put(Runtime.AlarmType.ALARM_ABNORMAL_HEART_RATE.ordinal(), false);
+        AlarmConfiglist.put(Runtime.AlarmType.ALARM_HEART_RATE_HIGH.ordinal(), false);
+        AlarmConfiglist.put(Runtime.AlarmType.ALARM_HEART_RATE_LOW.ordinal(), false);
+        AlarmConfiglist.put(Runtime.AlarmType.ALARM_BPH_HIGH.ordinal(), false);
+        AlarmConfiglist.put(Runtime.AlarmType.ALARM_BPH_LOW.ordinal(), false);
+        AlarmConfiglist.put(Runtime.AlarmType.ALARM_BPL_HIGH.ordinal(), false);
+        AlarmConfiglist.put(Runtime.AlarmType.ALARM_BPL_LOW.ordinal(), false);
+        AlarmConfiglist.put(Runtime.AlarmType.ALARM_SEDENTARY.ordinal(), false);
+        AlarmConfiglist.put(Runtime.AlarmType.ALARM_ILLEGAL_CUTOFF.ordinal(), false);
+        AlarmConfiglist.put(Runtime.AlarmType.ALARM_LOCK_WATCH.ordinal(), false);
+        AlarmConfiglist.put(Runtime.AlarmType.ALARM_TEMP_HIGH.ordinal(), false);
+        AlarmConfiglist.put(Runtime.AlarmType.ALARM_TEMP_LOW.ordinal(), false);
+        AlarmConfiglist.put(Runtime.AlarmType.ALARM_POWER_OFF.ordinal(), true);
+        AlarmConfiglist.put(Runtime.AlarmType.ALARM_ESCAPE.ordinal(), false);
+        AlarmConfiglist.put(Runtime.AlarmType.ALARM_NONE.ordinal(), false);
+        AlarmConfiglist.put(Runtime.AlarmType.ALARM_REMOVE_SOS.ordinal(), true);
+    }
+
+    public static boolean isAlarmTypeEnabled(Runtime.AlarmType alarmType) {
+
+        boolean en = false;
+        if (AlarmConfiglist.containsKey(alarmType.ordinal())) {
+            en = AlarmConfiglist.get(alarmType.ordinal());
+        }
+        return en;
+    }
+
+    public static boolean needWaterMark() {
+        String customname = getSystemProperties("persist.sys.needWaterMark", "true");
+        if (customname.trim().equals("true")) {
+            return true;
+        } else
+            return false;
+    }
 }
 
index 3e56a1f..e945164 100644 (file)
@@ -388,7 +388,7 @@ public class ContextProxy {
                 @Override
                 public void run() {
                     //本应用弹出消息框
-                    if (Config.noPushTxtNotifyDialog == false) {
+                    if (!Config.noPushTxtNotifyDialog) {
                         Intent intent = new Intent();
                         intent.setAction(DIALOG_ACTION);
                         intent.putExtra("pushtxt", msg);
@@ -400,7 +400,7 @@ public class ContextProxy {
                         Util.mSleep(2000);
                     }
                     //launcher 弹出消息
-                    if (Config.noBroadCastPushTxtNotify == false) {
+                    if (!Config.noBroadCastPushTxtNotify) {
                         Intent intent = new Intent(ActionSrvPushTxt);
                         intent.putExtra("msgType", msgType); //0 代表 server下发消息,1代表 SMS消息
                         intent.putExtra("txtMsg", msg);
index 1739618..6bc56d2 100644 (file)
@@ -43,6 +43,14 @@ import static java.lang.Math.abs;
 //import android.content.IClipboard;
 //import com.android.internal.telephony.uicc.RuimFileHandler;
 
+/**
+ * 防走丢的协议:
+ * 端口号:9000
+ * 协议号:
+ * 地址:
+ *  - 测试地址:fzd.xcloudtech.com
+ *  - 正式地址:api.xcloudtech.com
+ */
 public class protocol_fzd {
     private static final String TAG = "ICSrv." + protocol_fzd.class.getSimpleName();
     private static final String PrivKEY = "XMQcHi0lGIdru6xzW7lygBwBT8N0c09P";
index f5a0c4f..ed1bce1 100644 (file)
@@ -30,6 +30,7 @@ import com.enqualcomm.support.utils.TimeUtil;
 import com.enqualcomm.support.utils.Util;
 import com.enqualcomm.support.utils.VibrateUtil;
 import com.enqualcomm.support.utils.WakeLockUtil;
+import com.ic.view.msg.MsgMustReadDialog;
 
 import java.io.File;
 import java.io.FileOutputStream;
@@ -38,15 +39,25 @@ import java.util.Date;
 import java.util.HashMap;
 import java.util.Locale;
 
-import static android.content.Intent.FLAG_ACTIVITY_NEW_TASK;
-import static android.content.Intent.FLAG_INCLUDE_STOPPED_PACKAGES;
-import static com.enqualcomm.support.Constants.ACTION_HEATR_RATE_START;
 import static com.enqualcomm.support.Constants.DIALOG_ACTION;
 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;
 
+/**
+ * IC协议
+ * 默认地址:watch.jiai.pro
+ * 默认端口:8090
+ * <p>
+ * S123走的配置文件中是自定义的:UsingCustomServer=true
+ * 国内服务器:判断条件:TARGET_APP_PACKAGES=zh(后台地址:http://cn.map20000.com/)
+ * customserverip=120.79.160.23
+ * customserverport=32000
+ * 国外服务器:判断条件:TARGET_APP_PACKAGES=zh以外的
+ * customserverip=47.74.9.33
+ * customserverport=8083
+ */
 public class protocol_ic {
     private static final String TAG = "ICSrv." + protocol_ic.class.getSimpleName();
 
@@ -464,10 +475,10 @@ public class protocol_ic {
                 int timezone = Integer.parseInt(msg[2]);
                 if (datetime != null) {
                     ICLogger.i("===" + TimeUtil.getDefaultTimeZone());
-                    TimeUtil.setTimeZone(runtime.getContextProxy().context,timezone);
+                    TimeUtil.setTimeZone(runtime.getContextProxy().context, timezone);
 
                     ICLogger.i("===" + TimeUtil.getDefaultTimeZone());
-                    TimeUtil.setSysDateTime(runtime.getContextProxy().context, datetime, timezone,true);
+                    TimeUtil.setSysDateTime(runtime.getContextProxy().context, datetime, timezone, true);
                     ICLogger.i("===" + TimeUtil.getDefaultTimeZone());
 
                 }
@@ -1274,8 +1285,16 @@ public class protocol_ic {
                 Config.setLastUnReadMessage(runtime.getContextProxy().context, sb.toString());
                 runtime.getContextProxy().sendMsgBroadcast(txtmsg, 3);//msgType 3需要回复,0不需要回复
             } else {
-                runtime.getContextProxy().sendMsgBroadcast(txtmsg, 0);//msgType 3需要回复,0不需要回复
+                //判断产品类型,如果是S123的,那么就不发广播了
+                //加一个
+                ICLogger.d("custom_name == > " + Config.custom_name);
+                if ("VitracK".equals(Config.custom_name)) {
+                    MsgMustReadDialog msgMustReadDialog = new MsgMustReadDialog();
+                    msgMustReadDialog.showMsgDialog();
+                }
+                //runtime.getContextProxy().sendMsgBroadcast(txtmsg, 0);//msgType 3需要回复,0不需要回复
             }
+            //保存到数据库里
             runtime.getContextProxy().saveMstToSMSDB(txtmsg);
         } else {
             ICLogger.i("BP40 format error!");
diff --git a/app/src/main/java/com/ic/view/NoScrollViewPager.java b/app/src/main/java/com/ic/view/NoScrollViewPager.java
new file mode 100644 (file)
index 0000000..de5cbea
--- /dev/null
@@ -0,0 +1,67 @@
+package com.ic.view;
+
+import android.content.Context;
+import android.support.v4.view.ViewPager;
+import android.util.AttributeSet;
+import android.view.MotionEvent;
+
+public class NoScrollViewPager extends ViewPager {
+    private boolean isScroll;
+
+    public NoScrollViewPager(Context context, AttributeSet attrs) {
+        super(context, attrs);
+    }
+
+    public NoScrollViewPager(Context context) {
+        super(context);
+    }
+
+    /**
+     * 1.dispatchTouchEvent一般情况不做处理
+     * ,如果修改了默认的返回值,子孩子都无法收到事件
+     */
+    @Override
+    public boolean dispatchTouchEvent(MotionEvent ev) {
+        return super.dispatchTouchEvent(ev);   // return true;不行
+    }
+
+    /**
+     * 是否拦截
+     * 拦截:会走到自己的onTouchEvent方法里面来
+     * 不拦截:事件传递给子孩子
+     */
+    @Override
+    public boolean onInterceptTouchEvent(MotionEvent ev) {
+        // return false;//可行,不拦截事件,
+        // return true;//不行,孩子无法处理事件
+        //return super.onInterceptTouchEvent(ev);//不行,会有细微移动
+        if (isScroll) {
+            return super.onInterceptTouchEvent(ev);
+        } else {
+            return false;
+        }
+    }
+
+    /**
+     * 是否消费事件
+     * 消费:事件就结束
+     * 不消费:往父控件传
+     */
+    @Override
+    public boolean onTouchEvent(MotionEvent ev) {
+        //return false;// 可行,不消费,传给父控件
+        //return true;// 可行,消费,拦截事件
+        //super.onTouchEvent(ev); //不行,
+        //虽然onInterceptTouchEvent中拦截了,
+        //但是如果viewpage里面子控件不是viewgroup,还是会调用这个方法.
+        if (isScroll) {
+            return super.onTouchEvent(ev);
+        } else {
+            return true;// 可行,消费,拦截事件
+        }
+    }
+
+    public void setScroll(boolean scroll) {
+        isScroll = scroll;
+    }
+}
diff --git a/app/src/main/java/com/ic/view/msg/MessageAdapter.java b/app/src/main/java/com/ic/view/msg/MessageAdapter.java
new file mode 100644 (file)
index 0000000..92f55e0
--- /dev/null
@@ -0,0 +1,79 @@
+package com.ic.view.msg;
+
+import android.support.v4.view.PagerAdapter;
+import android.view.View;
+import android.view.ViewGroup;
+import android.widget.TextView;
+
+import com.enqualcomm.support.R;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public class MessageAdapter extends PagerAdapter {
+
+
+    private List<String> msgData = new ArrayList<>();
+
+    @Override
+    public Object instantiateItem(ViewGroup container, int position) {
+        //根据位置来加载内容
+        View item;
+        if (position == msgData.size()) {
+            item = View.inflate(container.getContext(), R.layout.msg_item_end_layout, null);
+            item.findViewById(R.id.end_page_btn).setOnClickListener(v -> {
+                if (mListener != null) {
+                    mListener.onEndClick();
+                }
+            });
+        } else {
+            item = View.inflate(container.getContext(), R.layout.msg_item_layout, null);
+            //设置数据
+            TextView msgView = (TextView) item.findViewById(R.id.msg_text_tv);
+            item.findViewById(R.id.next_btn).setOnClickListener(v -> {
+                if (mListener != null) {
+                    mListener.onNextClick();
+                }
+            });
+            msgView.setText(msgData.get(position));
+        }
+        container.addView(item);
+        return item;
+    }
+
+    @Override
+    public void destroyItem(ViewGroup container, int position, Object object) {
+        container.removeView((View) object);
+    }
+
+    @Override
+    public int getCount() {
+        return msgData.size() + 1;
+    }
+
+    @Override
+    public boolean isViewFromObject(View view, Object object) {
+        return view == object;
+    }
+
+    public void setData(List<String> data) {
+        //更新UI数据
+        msgData.clear();
+        msgData.addAll(data);
+        notifyDataSetChanged();
+    }
+
+    private OnClickListener mListener = null;
+
+
+    public void setOnClickListener(OnClickListener listener) {
+        this.mListener = listener;
+    }
+
+    public interface OnClickListener {
+
+        void onNextClick();
+
+        void onEndClick();
+    }
+}
diff --git a/app/src/main/java/com/ic/view/msg/MsgMustReadDialog.java b/app/src/main/java/com/ic/view/msg/MsgMustReadDialog.java
new file mode 100644 (file)
index 0000000..cdf87f2
--- /dev/null
@@ -0,0 +1,77 @@
+package com.ic.view.msg;
+
+import android.content.Context;
+import android.support.v4.view.ViewPager;
+import android.view.Gravity;
+import android.view.View;
+import android.view.WindowManager;
+
+import com.enqualcomm.support.ICApplication;
+import com.enqualcomm.support.R;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * 云消息&短信弹窗
+ * 直接塞到Window里
+ * 要求:不阅读完,不可以关闭
+ * 交互:阅读完,有下一页的按钮,最后一页才有关闭按钮。
+ */
+public class MsgMustReadDialog {
+
+    private WindowManager windowManager;
+    private MessageAdapter messageAdapter;
+    private ViewPager msgPage;
+
+    public void showMsgDialog() {
+        Context context = ICApplication.sContext;
+        windowManager = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE);
+        //设置属性
+        WindowManager.LayoutParams layoutParams = new WindowManager.LayoutParams();
+        layoutParams.type = WindowManager.LayoutParams.TYPE_SYSTEM_ALERT;
+        layoutParams.height = 180;
+        layoutParams.width = 180;
+        layoutParams.packageName = context.getPackageName();
+        layoutParams.gravity = Gravity.CENTER;
+        //加载布局
+        View view = View.inflate(context, R.layout.msg_dialog_layout, null);
+        //设置适配器
+        initView(view);
+        //准备数据
+        initData();
+        //添加到Window里
+        windowManager.addView(view, layoutParams);
+    }
+
+    private void initData() {
+        List<String> data = new ArrayList<>();
+        data.add("这是第一条信息...");
+        data.add("这是第二条信息...很长,长到我要写很多废话,你觉得呢!快来吧,收到这个短信就回家吃饭去吧!相信你是最胖的哇!");
+        data.add("这是最后一条消息了,看完这条消息就可以按下一页去结束这个dialog了。");
+        messageAdapter.setData(data);
+    }
+
+    private void initView(final View view) {
+        msgPage = (ViewPager) view.findViewById(R.id.msg_pager);
+        //设置适配器
+        messageAdapter = new MessageAdapter();
+        msgPage.setAdapter(messageAdapter);
+        messageAdapter.setOnClickListener(new MessageAdapter.OnClickListener() {
+            @Override
+            public void onNextClick() {
+                //切换到下一条数据
+                int currentItem = msgPage.getCurrentItem();
+                currentItem++;
+                msgPage.setCurrentItem(currentItem, false);
+            }
+
+            @Override
+            public void onEndClick() {
+                windowManager.removeView(view);
+            }
+        });
+    }
+
+
+}
\ No newline at end of file
diff --git a/app/src/main/res/drawable/selector_next_step.xml b/app/src/main/res/drawable/selector_next_step.xml
new file mode 100644 (file)
index 0000000..43d038b
--- /dev/null
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="utf-8"?>
+<selector xmlns:android="http://schemas.android.com/apk/res/android">
+
+    <item android:drawable="@drawable/shape_next_step_press" android:state_pressed="true" />
+    <item android:drawable="@drawable/shape_next_step_normal" />
+
+</selector>
\ No newline at end of file
diff --git a/app/src/main/res/drawable/shape_dialog_bg.xml b/app/src/main/res/drawable/shape_dialog_bg.xml
new file mode 100644 (file)
index 0000000..a8d76a2
--- /dev/null
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="utf-8"?>
+<shape xmlns:android="http://schemas.android.com/apk/res/android"
+    android:shape="rectangle">
+
+    <solid android:color="#fff" />
+    <corners android:radius="10dp" />
+
+</shape>
\ No newline at end of file
diff --git a/app/src/main/res/drawable/shape_next_step_normal.xml b/app/src/main/res/drawable/shape_next_step_normal.xml
new file mode 100644 (file)
index 0000000..ccb8dc3
--- /dev/null
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="utf-8"?>
+<shape xmlns:android="http://schemas.android.com/apk/res/android"
+    android:shape="rectangle">
+
+    <corners android:radius="10dp" />
+
+    <size
+        android:width="100dp"
+        android:height="60dp" />
+
+    <solid android:color="#62CB34" />
+
+</shape>
\ No newline at end of file
diff --git a/app/src/main/res/drawable/shape_next_step_press.xml b/app/src/main/res/drawable/shape_next_step_press.xml
new file mode 100644 (file)
index 0000000..adae809
--- /dev/null
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="utf-8"?>
+<shape xmlns:android="http://schemas.android.com/apk/res/android"
+    android:shape="rectangle">
+
+    <corners android:radius="10dp" />
+
+    <size
+        android:width="100dp"
+        android:height="60dp" />
+
+    <solid android:color="#56A832" />
+
+</shape>
\ No newline at end of file
diff --git a/app/src/main/res/layout/msg_dialog_layout.xml b/app/src/main/res/layout/msg_dialog_layout.xml
new file mode 100644 (file)
index 0000000..a9c1cb3
--- /dev/null
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="utf-8"?>
+<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    android:layout_width="match_parent"
+    android:layout_height="match_parent"
+    android:background="@drawable/shape_dialog_bg">
+
+    <com.ic.view.NoScrollViewPager
+        android:id="@+id/msg_pager"
+        android:layout_width="match_parent"
+        android:layout_height="match_parent"
+        android:background="@drawable/shape_dialog_bg"
+        android:overScrollMode="never" />
+
+</android.support.constraint.ConstraintLayout>
\ No newline at end of file
diff --git a/app/src/main/res/layout/msg_item_end_layout.xml b/app/src/main/res/layout/msg_item_end_layout.xml
new file mode 100644 (file)
index 0000000..482e306
--- /dev/null
@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="utf-8"?>
+<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_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"
+        app:layout_constraintBottom_toBottomOf="parent"
+        app:layout_constraintLeft_toLeftOf="parent"
+        app:layout_constraintRight_toRightOf="parent" />
+
+</android.support.constraint.ConstraintLayout>
\ No newline at end of file
diff --git a/app/src/main/res/layout/msg_item_layout.xml b/app/src/main/res/layout/msg_item_layout.xml
new file mode 100644 (file)
index 0000000..f0e2fea
--- /dev/null
@@ -0,0 +1,42 @@
+<?xml version="1.0" encoding="utf-8"?>
+<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    android:layout_width="match_parent"
+    android:layout_height="match_parent"
+    android:background="@drawable/shape_dialog_bg">
+
+    <ScrollView
+        android:layout_width="match_parent"
+        android:layout_height="match_parent"
+        android:fillViewport="true"
+        android:orientation="vertical"
+        android:overScrollMode="never"
+        android:padding="20dp"
+        android:scrollbars="none">
+
+        <RelativeLayout
+            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:textColor="#000"
+                android:textSize="22sp" />
+
+            <TextView
+                android:id="@+id/next_btn"
+                android:layout_width="match_parent"
+                android:layout_height="70dp"
+                android:layout_alignParentBottom="true"
+                android:background="@drawable/selector_next_step"
+                android:gravity="center"
+                android:text="@string/next_msg_tips_text"
+                android:textColor="#fff" />
+
+        </RelativeLayout>
+    </ScrollView>
+
+</android.support.constraint.ConstraintLayout>
\ No newline at end of file
index 54a0de9..d33199b 100644 (file)
     <string name="hotline">HotLine</string>
 
 
-
     <string name="notification_title">通知消息</string>
     <string name="notification_button_str">知道了</string>
     <string name="dialog_notification_title">消息提醒</string>
     <string name="sedentary_name">久坐提醒</string>
     <string name="sedentary_msg">Sedentary reminder !</string>
 
-
+    <string name="next_msg_tips_text">下一条</string>
+    <string name="read_end_tips_text">我看完了</string>
 
     <string name="en">English</string>
     <string name="ja">日本語</string>