修改了号码后下发无法拨号的问题,修改了返回按键可以退出
authorTrillGates <williamtrillgates@gmail.com>
Wed, 27 Oct 2021 02:12:34 +0000 (10:12 +0800)
committerTrillGates <williamtrillgates@gmail.com>
Wed, 27 Oct 2021 02:12:34 +0000 (10:12 +0800)
app/release/ICSOS_V6_2110270942_release.apk [moved from app/release/ICSOS_V5_2110261955_release.apk with 58% similarity]
app/release/output-metadata.json
app/src/main/java/com/ic/sos/MainActivity.java
app/src/main/java/com/ic/sos/SOSPresenter.java
app/version_code.properties

similarity index 58%
rename from app/release/ICSOS_V5_2110261955_release.apk
rename to app/release/ICSOS_V6_2110270942_release.apk
index 69d7d5f..abc3fc1 100644 (file)
Binary files a/app/release/ICSOS_V5_2110261955_release.apk and b/app/release/ICSOS_V6_2110270942_release.apk differ
index 40641ea..3a88a99 100644 (file)
@@ -12,7 +12,7 @@
       "filters": [],
       "versionCode": 1,
       "versionName": "1.0",
-      "outputFile": "ICSOS_V5_2110261955_release.apk"
+      "outputFile": "ICSOS_V6_2110270942_release.apk"
     }
   ]
 }
\ No newline at end of file
index 7070d2b..5d2ce21 100644 (file)
@@ -64,7 +64,7 @@ public class MainActivity extends AppCompatActivity {
 
     @Override
     public void onBackPressed() {
-        //把返回键屏蔽掉
+        super.onBackPressed();
     }
 
     private void initObserver() {
index ea998c1..fbae97e 100644 (file)
@@ -2,9 +2,11 @@ package com.ic.sos;
 
 import android.annotation.SuppressLint;
 import android.content.BroadcastReceiver;
+import android.content.ContentResolver;
 import android.content.Context;
 import android.content.Intent;
 import android.content.IntentFilter;
+import android.database.ContentObserver;
 import android.database.Cursor;
 import android.net.Uri;
 import android.os.Handler;
@@ -53,6 +55,7 @@ public class SOSPresenter {
         HandlerThread handlerThread = new HandlerThread("IC:SOS");
         handlerThread.start();
         handler = new Handler(handlerThread.getLooper());
+        initContentObserver();
         //获取配置数据
         initLoopTime();
         initCallWays();
@@ -61,6 +64,24 @@ public class SOSPresenter {
         handler.post(this::sosTask);
     }
 
+    /**
+     * 观察SOS号码的变化
+     */
+    private void initContentObserver() {
+        ContentResolver contentResolver = mContext.getContentResolver();
+        contentResolver.registerContentObserver(Uri.parse(MEMBERS), true,
+                contentObserver);
+    }
+
+    private final ContentObserver contentObserver = new ContentObserver(null) {
+        @Override
+        public void onChange(boolean selfChange) {
+            handler.post(() -> {
+                sosTask();
+            });
+        }
+    };
+
 
     //是否有接听
     private boolean hasRemoteAnswer = false;
@@ -167,6 +188,11 @@ public class SOSPresenter {
      * 以下内容都在子线程执行了,注意安全
      */
     private void sosTask() {
+        //重置数据
+        this.currentCallIndex = 0;
+        this.currentLoopGroupTime = 0;
+        this.hasRemoteAnswer = false;
+        this.hasFirstCall = false;
         boolean hasSim = this.checkHasSim();
         ICLogger.d("hasSim ==> " + hasSim);
         if (hasSim) {
@@ -351,5 +377,6 @@ public class SOSPresenter {
         hasFirstCall = false;
         phoneNumList.clear();
         mContext.unregisterReceiver(stateReceiver);
+        mContext.getContentResolver().unregisterContentObserver(contentObserver);
     }
 }
index 5135324..db72ccb 100644 (file)
@@ -1,2 +1,2 @@
-#Tue Oct 26 19:55:59 CST 2021
-VERSION_CODE=5
+#Wed Oct 27 09:42:49 CST 2021
+VERSION_CODE=6