From: TrillGates Date: Sat, 14 Aug 2021 02:44:44 +0000 (+0800) Subject: add default wifi. X-Git-Url: http://git.snicker.com.cn/?a=commitdiff_plain;h=e1489337efcb7965d25e60dd1d4d34c8cccfdcd9;p=icsupport.git add default wifi. --- diff --git a/app/release/ICSer_V911_2108111805_release.apk b/app/release/ICSer_V912_2108131507_release.apk similarity index 78% rename from app/release/ICSer_V911_2108111805_release.apk rename to app/release/ICSer_V912_2108131507_release.apk index d6ac4967..6b67368e 100644 Binary files a/app/release/ICSer_V911_2108111805_release.apk and b/app/release/ICSer_V912_2108131507_release.apk differ diff --git a/app/release/output.json b/app/release/output.json index 8e8806f5..c9fcc883 100644 --- a/app/release/output.json +++ b/app/release/output.json @@ -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 diff --git a/app/src/main/java/com/enqualcomm/support/service/Deliver.java b/app/src/main/java/com/enqualcomm/support/service/Deliver.java index 81568e5b..e195cde2 100644 --- a/app/src/main/java/com/enqualcomm/support/service/Deliver.java +++ b/app/src/main/java/com/enqualcomm/support/service/Deliver.java @@ -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) { diff --git a/app/src/main/java/com/enqualcomm/support/utils/SharePreferenceUtil.java b/app/src/main/java/com/enqualcomm/support/utils/SharePreferenceUtil.java index fe78e798..8bebbce9 100644 --- a/app/src/main/java/com/enqualcomm/support/utils/SharePreferenceUtil.java +++ b/app/src/main/java/com/enqualcomm/support/utils/SharePreferenceUtil.java @@ -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(); diff --git a/app/src/main/java/com/enqualcomm/support/utils/Util.java b/app/src/main/java/com/enqualcomm/support/utils/Util.java index a7a4bae7..99f7051d 100644 --- a/app/src/main/java/com/enqualcomm/support/utils/Util.java +++ b/app/src/main/java/com/enqualcomm/support/utils/Util.java @@ -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) { diff --git a/app/src/main/java/com/ic/protocols/protocol_gator.java b/app/src/main/java/com/ic/protocols/protocol_gator.java index 803cbb7f..30dd6631 100644 --- a/app/src/main/java/com/ic/protocols/protocol_gator.java +++ b/app/src/main/java/com/ic/protocols/protocol_gator.java @@ -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!"); diff --git a/app/src/main/java/com/ic/protocols/protocol_s123.java b/app/src/main/java/com/ic/protocols/protocol_s123.java index 0938981c..832925a2 100644 --- a/app/src/main/java/com/ic/protocols/protocol_s123.java +++ b/app/src/main/java/com/ic/protocols/protocol_s123.java @@ -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 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,否则断网 diff --git a/app/src/main/res/values-de-rCH/strings.xml b/app/src/main/res/values-de-rCH/strings.xml index c6629cf6..30658c27 100644 --- a/app/src/main/res/values-de-rCH/strings.xml +++ b/app/src/main/res/values-de-rCH/strings.xml @@ -166,4 +166,8 @@ 返回 发送 We talk msg. + 吃药提醒 + 喝水提醒 + 久坐提醒 + 闹钟 diff --git a/app/src/main/res/values-fr-rCH/strings.xml b/app/src/main/res/values-fr-rCH/strings.xml index 80d7cbce..a075e28b 100644 --- a/app/src/main/res/values-fr-rCH/strings.xml +++ b/app/src/main/res/values-fr-rCH/strings.xml @@ -166,4 +166,8 @@ 返回 发送 收到微聊消息. + 吃药提醒 + 喝水提醒 + 久坐提醒 + 闹钟 diff --git a/app/src/main/res/values-it-rCH/strings.xml b/app/src/main/res/values-it-rCH/strings.xml index c5ce2965..044fe06d 100644 --- a/app/src/main/res/values-it-rCH/strings.xml +++ b/app/src/main/res/values-it-rCH/strings.xml @@ -164,4 +164,8 @@ 返回 发送 收到微聊消息. + 吃药提醒 + 喝水提醒 + 久坐提醒 + 闹钟 diff --git a/app/src/main/res/values-ja/strings.xml b/app/src/main/res/values-ja/strings.xml index 3723f866..b283dd5f 100644 --- a/app/src/main/res/values-ja/strings.xml +++ b/app/src/main/res/values-ja/strings.xml @@ -167,5 +167,9 @@ 戻る 送信 チャットメッセージが届く. + 吃药提醒 + 喝水提醒 + 久坐提醒 + 闹钟 diff --git a/app/src/main/res/values-w820dp/strings.xml b/app/src/main/res/values-w820dp/strings.xml new file mode 100644 index 00000000..631d7434 --- /dev/null +++ b/app/src/main/res/values-w820dp/strings.xml @@ -0,0 +1,7 @@ + + + 吃药提醒 + 喝水提醒 + 久坐提醒 + 闹钟 + \ No newline at end of file diff --git a/app/src/main/res/values-zh-rCN/strings.xml b/app/src/main/res/values-zh-rCN/strings.xml index 4196c29d..114e8808 100644 --- a/app/src/main/res/values-zh-rCN/strings.xml +++ b/app/src/main/res/values-zh-rCN/strings.xml @@ -194,4 +194,8 @@ 返回 发送 收到微聊消息. + 吃药提醒 + 喝水提醒 + 久坐提醒 + 闹钟 diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 34a4762c..07492996 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -197,5 +197,9 @@ 返回 发送 We talk msg. + 吃药提醒 + 喝水提醒 + 久坐提醒 + 闹钟 diff --git a/app/version_code.properties b/app/version_code.properties index 80633694..b9d6f331 100644 --- a/app/version_code.properties +++ b/app/version_code.properties @@ -1,2 +1,2 @@ -#Wed Aug 11 18:05:32 CST 2021 -VERSION_CODE=911 +#Fri Aug 13 15:07:13 CST 2021 +VERSION_CODE=912