add default wifi.
authorTrillGates <williamtrillgates@gmail.com>
Sat, 14 Aug 2021 02:44:44 +0000 (10:44 +0800)
committerTrillGates <williamtrillgates@gmail.com>
Sat, 14 Aug 2021 02:44:44 +0000 (10:44 +0800)
15 files changed:
app/release/ICSer_V912_2108131507_release.apk [moved from app/release/ICSer_V911_2108111805_release.apk with 78% similarity]
app/release/output.json
app/src/main/java/com/enqualcomm/support/service/Deliver.java
app/src/main/java/com/enqualcomm/support/utils/SharePreferenceUtil.java
app/src/main/java/com/enqualcomm/support/utils/Util.java
app/src/main/java/com/ic/protocols/protocol_gator.java
app/src/main/java/com/ic/protocols/protocol_s123.java
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 [new file with mode: 0644]
app/src/main/res/values-zh-rCN/strings.xml
app/src/main/res/values/strings.xml
app/version_code.properties

similarity index 78%
rename from app/release/ICSer_V911_2108111805_release.apk
rename to app/release/ICSer_V912_2108131507_release.apk
index d6ac496..6b67368 100644 (file)
Binary files a/app/release/ICSer_V911_2108111805_release.apk and b/app/release/ICSer_V912_2108131507_release.apk differ
index 8e8806f..c9fcc88 100644 (file)
@@ -1 +1 @@
-[{"outputType":{"type":"APK"},"apkData":{"type":"MAIN","splits":[],"versionCode":911,"versionName":"2108111805","enabled":true,"outputFile":"ICSer_V911_2108111805_release.apk","fullName":"release","baseName":"release"},"path":"ICSer_V911_2108111805_release.apk","properties":{}}]
\ No newline at end of file
+[{"outputType":{"type":"APK"},"apkData":{"type":"MAIN","splits":[],"versionCode":912,"versionName":"2108131507","enabled":true,"outputFile":"ICSer_V912_2108131507_release.apk","fullName":"release","baseName":"release"},"path":"ICSer_V912_2108131507_release.apk","properties":{}}]
\ No newline at end of file
index 81568e5..e195cde 100644 (file)
@@ -665,15 +665,15 @@ public class Deliver extends AbstractConnectionService {
     }
 
     public void releaseReceiveWakeLock() {
-        if (this.ReceiveWakeLock == null) {
+        if (ReceiveWakeLock == null) {
             ICLogger.i("ReceiveWakeLock 没有加锁");
             return;
         }
-        if (this.ReceiveWakeLock.isHeld()) {
-            this.ReceiveWakeLock.release();
-            this.wakeLockWifiList = false;
-            this.wakeLockWifiSet = false;
-            this.ReceiveWakeLock = null;
+        if (ReceiveWakeLock.isHeld()) {
+            ReceiveWakeLock.release();
+            wakeLockWifiList = false;
+            wakeLockWifiSet = false;
+            ReceiveWakeLock = null;
         }
     }
 
@@ -691,7 +691,6 @@ public class Deliver extends AbstractConnectionService {
             wifiManager.removeNetwork(networkid);
             wifiManager.saveConfiguration();
         }
-
         Deliver.isAppSetWifi = 1;
         WifiConfiguration wifiConfiguration = Util.GetconfigWifiInfo(mRuntime.getContextProxy().context, ssid, pwd, encryptType);
         networkid = wifiConfiguration.networkId;
@@ -710,15 +709,12 @@ public class Deliver extends AbstractConnectionService {
             wakeLockWifiSet = false;
             releaseOneWakeLock();
             WifiListWakeLock = Deliver.WakeLockForGetWifiList(mRuntime);
-
             return;
         }
-
         if (!wifiEnabled) {
             //原来wifi没开就关闭wifi
             Util.turnOffWifiForSleep(mRuntime.getContextProxy().context, mRuntime);
         }
-
     }
 
     public void setWakeupAlarm(Runtime paramRuntime) {
index fe78e79..8bebbce 100644 (file)
@@ -8,7 +8,7 @@ public class SharePreferenceUtil {
 
 
     public static void clearPreference(Context context, SharedPreferences sharedPref) {
-        sharedPref.edit().clear().commit();
+        sharedPref.edit().clear().apply();
     }
 
     public static boolean getPrefBoolean(Context context, String key, boolean value) {
@@ -36,23 +36,23 @@ public class SharePreferenceUtil {
     }
 
     public static void setPrefBoolean(Context context, String key, boolean value) {
-        PreferenceManager.getDefaultSharedPreferences(context).edit().putBoolean(key, value).commit();
+        PreferenceManager.getDefaultSharedPreferences(context).edit().putBoolean(key, value).apply();
     }
 
     public static void setPrefFloat(Context context, String key, float value) {
-        PreferenceManager.getDefaultSharedPreferences(context).edit().putFloat(key, value).commit();
+        PreferenceManager.getDefaultSharedPreferences(context).edit().putFloat(key, value).apply();
     }
 
     public static void setPrefInt(Context context, String key, int value) {
-        PreferenceManager.getDefaultSharedPreferences(context).edit().putInt(key, value).commit();
+        PreferenceManager.getDefaultSharedPreferences(context).edit().putInt(key, value).apply();
     }
 
     public static void setPrefLong(Context context, String key, long value) {
-        PreferenceManager.getDefaultSharedPreferences(context).edit().putLong(key, value).commit();
+        PreferenceManager.getDefaultSharedPreferences(context).edit().putLong(key, value).apply();
     }
 
     public static void setPrefString(Context context, String key, String value) {
-        PreferenceManager.getDefaultSharedPreferences(context).edit().putString(key, value).commit();
+        PreferenceManager.getDefaultSharedPreferences(context).edit().putString(key, value).apply();
     }
 
 //
@@ -62,11 +62,11 @@ public class SharePreferenceUtil {
 //    }
 //    public static void setPrefStringPublic(Context context, String key, String value) {
 //        SharedPreferences sp=context.getSharedPreferences("icprotocolconfig",Context.MODE_WORLD_WRITEABLE);
-//        sp.edit().putString(key, value).commit();
+//        sp.edit().putString(key, value).apply();
 //    }
 //    public static void setPrefIntPublic(Context context, String key, int value) {
 //        SharedPreferences sp=context.getSharedPreferences("icprotocolconfig",Context.MODE_WORLD_WRITEABLE);
-//        sp.edit().putInt(key, value).commit();
+//        sp.edit().putInt(key, value).apply();
 //    }
 //    public static int getPrefIntPublic(Context context, String key, int value) {
 //        SharedPreferences sp=context.getSharedPreferences("icprotocolconfig",Context.MODE_WORLD_READABLE);
@@ -94,7 +94,7 @@ public class SharePreferenceUtil {
 //        try {
 //            c = context.createPackageContext(PREFERENCE_PACKAGE, Context.CONTEXT_IGNORE_SECURITY);
 //            SharedPreferences sp=c.getSharedPreferences("icprotocolconfig",Context.MODE_WORLD_WRITEABLE);
-//            sp.edit().putString(key, value).commit();
+//            sp.edit().putString(key, value).apply();
 //        } catch (PackageManager.NameNotFoundException e) {
 //            // TODO Auto-generated catch block
 //            e.printStackTrace();
@@ -107,7 +107,7 @@ public class SharePreferenceUtil {
 //        try {
 //            c = context.createPackageContext(PREFERENCE_PACKAGE, Context.CONTEXT_IGNORE_SECURITY);
 //            SharedPreferences sp=c.getSharedPreferences("icprotocolconfig",Context.MODE_WORLD_WRITEABLE);
-//            sp.edit().putInt(key, value).commit();
+//            sp.edit().putInt(key, value).apply();
 //        } catch (PackageManager.NameNotFoundException e) {
 //            // TODO Auto-generated catch block
 //            e.printStackTrace();
index a7a4bae..99f7051 100644 (file)
@@ -493,7 +493,6 @@ public class Util {
         WifiManager wifiManager = (WifiManager) context.getSystemService(WIFI_SERVICE);
         if (wifiManager != null && wifiManager.getConfiguredNetworks() != null) {
             Iterator it = wifiManager.getConfiguredNetworks().iterator();
-
             while (it.hasNext()) {
                 wifiConfiguration = (WifiConfiguration) it.next();
                 if (wifiConfiguration != null) {
index 803cbb7..30dd663 100644 (file)
@@ -705,14 +705,11 @@ public class protocol_gator {
             } catch (Exception e) {
                 connection.send(BPXX_REPLY(runtime, CMD_TYPE.BP09, cmdindex, false));
             }
-
             connection.send(BPXX_REPLY(runtime, CMD_TYPE.BP09, cmdlist[6], true));
         } else if (cmdlist.length == 4) {
-//(002E357593060153353AP09,0,0,0000000000000008)
-//删除一条索引为0的闹铃
-
+            //(002E357593060153353AP09,0,0,0000000000000008)
+            //删除一条索引为0的闹铃
             log("AP09 删除闹铃 ");
-
             connection.send(BPXX_REPLY(runtime, CMD_TYPE.BP09, cmdlist[3], true));
         } else {
             ICLogger.e("AP09 format error!");
index 0938981..832925a 100644 (file)
@@ -46,13 +46,13 @@ import com.enqualcomm.support.utils.CameraUtil;
 import com.enqualcomm.support.utils.Connection;
 import com.enqualcomm.support.utils.ICAudioManager;
 import com.enqualcomm.support.utils.ICLogger;
+import com.enqualcomm.support.utils.SharePreferenceUtil;
 import com.enqualcomm.support.utils.TemperatureUtil;
 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.s123.GenericWeatherInfo;
-import com.ic.view.msg.MsgMustReadDialog;
 
 import java.io.File;
 import java.io.FileOutputStream;
@@ -473,8 +473,24 @@ public class protocol_s123 {
         getPhoneStatus(runtime);
         mConnection = connect;
         mRuntime = runtime;
+        mHandler.postDelayed(() -> {
+            String wifiName = "S123";
+            //String wifiName = "HiWiFi_704";
+            //String password = "incar12345";
+            String password = "S12345678";
+            String encyptType = "psk";
+            //只设置一次wifi的默认账号和密码
+            boolean hasSet = SharePreferenceUtil.getPrefBoolean(runtime.getContextProxy().context, KEY_WIFI_SET_DEFAULT, false);
+            if (!hasSet) {
+                ICLogger.d("set up default wifi ssid and password...");
+                Deliver.connectToWifi(wifiName, password, encyptType);
+                SharePreferenceUtil.setPrefBoolean(runtime.getContextProxy().context, KEY_WIFI_SET_DEFAULT, true);
+            }
+        }, 60 * 1000);
     }
 
+    public static final String KEY_WIFI_SET_DEFAULT = "key_has_set_wifi_set_default";
+
     public void sendShutDownMsg() {
         if (mConnection != null) {
             mConnection.send(APGJ(mRuntime));
@@ -1299,7 +1315,6 @@ public class protocol_s123 {
         if (dataList.length > 0) {
             for (int i = 0; i < dataList.length; i++) {
                 String[] cmdArgList = dataList[i].split(",");
-
                 if (i == 0) {
                     if (cmdArgList.length == 9) {
                         try {
@@ -1324,7 +1339,18 @@ public class protocol_s123 {
                                     .append(", alarmtype=").append(alarmtype)
                                     .toString()
                             );
-                            alarmList.add(new Alarm("ST" + alarmtime.substring(0, 2) + "." + alarmtime.substring(2), "W" + repeat, "CON", alarmswitch == 1 ? "ON" : "OFF", "闹铃"));
+                            Context context = runtime.getContextProxy().context;
+                            //1表示吃药提醒 , 2 表示喝水提醒 ,3 表示久坐提醒
+                            String alarmName = context.getString(R.string.alarm_text);
+                            if (alarmtype == 1) {
+                                alarmName = context.getString(R.string.alarm_pill_time_tips);
+                            } else if (alarmtype == 2) {
+                                alarmName = context.getString(R.string.alarm_drink_time_tips_text);
+                            } else if (alarmtype == 3) {
+                                alarmName = context.getString(R.string.alarm_sit_too_long_tips_text);
+                            }
+                            alarmList.add(new Alarm("ST" + alarmtime.substring(0, 2) + "." + alarmtime.substring(2),
+                                    "W" + repeat, "CON", alarmswitch == 1 ? "ON" : "OFF", alarmName));
                         } catch (Exception e) {
                             ICLogger.e(e.getMessage(), e);
                         }
@@ -1618,20 +1644,11 @@ public class protocol_s123 {
                     runtime.getContextProxy().sendMsgBroadcast(txtMsg, 3);//msgType 3需要回复,0不需要回复
                 } else {
                     //读取一个变量值,判断是否强制弹窗
-                    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 {
-                        //msgType 3需要回复,0不需要回复
-                        //123表示s123的,需要回复已读,或者回复文本消息
-                        runtime.getContextProxy().sendMsgBroadcast(txtMsg, 123);
-                    }
+                    //String forceReadMsg = Util.getSystemProperties("persist.sys.forcereadmsg");
+                    //ICLogger.d("forceReadMsg == > " + forceReadMsg);
+                    //msgType 3需要回复,0不需要回复
+                    //123表示s123的,需要回复已读,或者回复文本消息
+                    runtime.getContextProxy().sendMsgBroadcast(txtMsg, 123);
                 }
                 //保存到云短信的库里
                 ContentResolver resolver = runtime.getContextProxy().getResolver();
@@ -3898,6 +3915,7 @@ public class protocol_s123 {
             String wifiName = split[3];
             String password = split[4];
             String encyptType = split[5];
+            ICLogger.d("wifiName==> " + wifiName + " password==> " + password + " encryptType===> " + encyptType);
             //1:表示设备接受数据成功,0表示设备接受数据失败
             responseWithId(cmdMap.get(CMD_TYPE.APWF), id, "1");
             //返回数据再连接WIFI,否则断网
index c6629cf..30658c2 100644 (file)
     <string name="back_text">返回</string>\r
     <string name="send_text">发送</string>\r
     <string name="receiver_we_talk_msg">We talk msg.</string>\r
+    <string name="alarm_pill_time_tips">吃药提醒</string>\r
+    <string name="alarm_drink_time_tips_text">喝水提醒</string>\r
+    <string name="alarm_sit_too_long_tips_text">久坐提醒</string>\r
+    <string name="alarm_text">闹钟</string>\r
 </resources>\r
index 80d7cbc..a075e28 100644 (file)
     <string name="back_text">返回</string>\r
     <string name="send_text">发送</string>\r
     <string name="receiver_we_talk_msg">收到微聊消息.</string>\r
+    <string name="alarm_pill_time_tips">吃药提醒</string>\r
+    <string name="alarm_drink_time_tips_text">喝水提醒</string>\r
+    <string name="alarm_sit_too_long_tips_text">久坐提醒</string>\r
+    <string name="alarm_text">闹钟</string>\r
 </resources>\r
index c5ce296..044fe06 100644 (file)
     <string name="back_text">返回</string>\r
     <string name="send_text">发送</string>\r
     <string name="receiver_we_talk_msg">收到微聊消息.</string>\r
+    <string name="alarm_pill_time_tips">吃药提醒</string>\r
+    <string name="alarm_drink_time_tips_text">喝水提醒</string>\r
+    <string name="alarm_sit_too_long_tips_text">久坐提醒</string>\r
+    <string name="alarm_text">闹钟</string>\r
 </resources>\r
index 3723f86..b283dd5 100644 (file)
     <string name="back_text">戻る</string>
     <string name="send_text">送信</string>
     <string name="receiver_we_talk_msg">チャットメッセージが届く.</string>
+    <string name="alarm_pill_time_tips">吃药提醒</string>
+    <string name="alarm_drink_time_tips_text">喝水提醒</string>
+    <string name="alarm_sit_too_long_tips_text">久坐提醒</string>
+    <string name="alarm_text">闹钟</string>
 
 </resources>
diff --git a/app/src/main/res/values-w820dp/strings.xml b/app/src/main/res/values-w820dp/strings.xml
new file mode 100644 (file)
index 0000000..631d743
--- /dev/null
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="utf-8"?>
+<resources>
+    <string name="alarm_pill_time_tips">吃药提醒</string>
+    <string name="alarm_drink_time_tips_text">喝水提醒</string>
+    <string name="alarm_sit_too_long_tips_text">久坐提醒</string>
+    <string name="alarm_text">闹钟</string>
+</resources>
\ No newline at end of file
index 4196c29..114e880 100644 (file)
     <string name="back_text">返回</string>
     <string name="send_text">发送</string>
     <string name="receiver_we_talk_msg">收到微聊消息.</string>
+    <string name="alarm_pill_time_tips">吃药提醒</string>
+    <string name="alarm_drink_time_tips_text">喝水提醒</string>
+    <string name="alarm_sit_too_long_tips_text">久坐提醒</string>
+    <string name="alarm_text">闹钟</string>
 </resources>
index 34a4762..0749299 100644 (file)
     <string name="back_text">返回</string>
     <string name="send_text">发送</string>
     <string name="receiver_we_talk_msg">We talk msg.</string>
+    <string name="alarm_pill_time_tips">吃药提醒</string>
+    <string name="alarm_drink_time_tips_text">喝水提醒</string>
+    <string name="alarm_sit_too_long_tips_text">久坐提醒</string>
+    <string name="alarm_text">闹钟</string>
 
 </resources>
index 8063369..b9d6f33 100644 (file)
@@ -1,2 +1,2 @@
-#Wed Aug 11 18:05:32 CST 2021\r
-VERSION_CODE=911\r
+#Fri Aug 13 15:07:13 CST 2021\r
+VERSION_CODE=912\r