diff --git a/app/build.gradle b/app/build.gradle index 17ce47f..2d8e3ed 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -12,8 +12,8 @@ android { applicationId "com.qsboy.antirecall" minSdkVersion 19 targetSdkVersion 26 - versionCode 1 - versionName '5.0' + versionCode 3 + versionName '5.0.2' testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" vectorDrawables.useSupportLibrary = true } @@ -40,7 +40,8 @@ android { dependencies { implementation 'com.github.CymChad:BaseRecyclerViewAdapterHelper:2.9.36' implementation 'com.ramotion.foldingcell:folding-cell:1.2.1' - implementation 'com.github.PhilJay:MPAndroidChart:v3.0.3' +// implementation 'devlight.io:navigationtabbar:1.2.5' +// implementation 'com.github.PhilJay:MPAndroidChart:v3.0.3' // implementation 'com.squareup.okhttp3:okhttp:3.9.1' implementation project(':utils') implementation fileTree(include: ['*.jar'], dir: 'libs') diff --git a/app/src/main/java/com/qsboy/antirecall/access/Client.java b/app/src/main/java/com/qsboy/antirecall/access/Client.java index 18247a3..0bdc942 100644 --- a/app/src/main/java/com/qsboy/antirecall/access/Client.java +++ b/app/src/main/java/com/qsboy/antirecall/access/Client.java @@ -144,7 +144,7 @@ private void findRecallByContext(ArrayList prevList, ArrayList for (int i = 0, j = 0, k = 0; k < 10; k++) { String subName = subNameArray.get(i); - Log.i(TAG, "findRecallByContext: [" + i + " " + j + "] - " + subName); + Log.i(TAG, "findRecallByContext: [" + i + " " + j + "] - " + " [" + (prevPos + i) + " " + (nextPos - j) + "]" + subName); Messages msgPrev = findNext(prevPos + i, subName); Messages msgNext = findNext(nextPos - j, subName); if (msgPrev != null) { @@ -157,8 +157,8 @@ private void findRecallByContext(ArrayList prevList, ArrayList } if (msgNext != null) { int index = unknownRecalls - j; - if (list.size() <= index || list.get(index) != null) - list.add(index, msgNext); + if (list.size() <= index - 1 || list.get(index) != null) + list.add(index - 1, msgNext); j++; Log.i(TAG, "list: " + list); if (j == unknownRecalls) @@ -204,7 +204,7 @@ private Messages findNext(int prevPos, String subName) { int maxID = dao.getMaxID(title, isWX); for (int i = 0; i < 20; i++) { prevPos++; - if (prevPos >= maxID) { + if (prevPos > maxID) { Log.i(TAG, "findNext: to the end: " + maxID); return null; } @@ -360,14 +360,21 @@ public void onNotificationChanged(AccessibilityEvent event) { if (string.equals("你的帐号在电脑登录")) return; + StringBuilder builder = new StringBuilder(string); + int i1 = string.indexOf("[特别关注]"); + int i2 = string.indexOf("[有新回复]"); + if (i1 != -1 && i1 + 6 < string.length()) + builder.delete(i1, i1 + 6); + if (i2 != -1 && i2 + 6 < string.length()) + builder.delete(i2, i2 + 6); + string = builder.toString(); + int i = string.indexOf(':'); if (i < 1) { Log.d(TAG, "Notification does not contains ':'"); return; } title = string.substring(0, i); - if (title.startsWith("[特别关心]")) - title = title.substring(title.indexOf("[特别关心]") + 6); message = string.substring(i + 2); subName = title; //是群消息 diff --git a/app/src/main/java/com/qsboy/antirecall/access/QQClient.java b/app/src/main/java/com/qsboy/antirecall/access/QQClient.java index 23f63e2..3895e99 100644 --- a/app/src/main/java/com/qsboy/antirecall/access/QQClient.java +++ b/app/src/main/java/com/qsboy/antirecall/access/QQClient.java @@ -180,13 +180,13 @@ else if ("你".equals(subName)) } } } - //2人聊天 头像在消息右边 - if ("".equals(subName)) - if (messagePos < headIconPos) - subName = "我"; - else - subName = title; - Log.i(TAG, subName + " : " + message); + if (messagePos < headIconPos) + // 消息在头像左边 + subName = "我"; + else if ("".equals(subName)) + // 两人聊天时 没有subName + subName = title; + Log.d(TAG, "parser: " + title + " - " + subName + " : " + message); } diff --git a/app/src/main/java/com/qsboy/antirecall/access/TimClient.java b/app/src/main/java/com/qsboy/antirecall/access/TimClient.java index a4d285f..37c9b81 100644 --- a/app/src/main/java/com/qsboy/antirecall/access/TimClient.java +++ b/app/src/main/java/com/qsboy/antirecall/access/TimClient.java @@ -198,15 +198,12 @@ else if ("你".equals(subName)) } } - //2人聊天 头像在消息右边 - if ("".equals(subName)) - if (messagePos < headIconPos) - subName = "我"; - else { - subName = title; - } - - + if (messagePos < headIconPos) + // 消息在头像左边 + subName = "我"; + else if ("".equals(subName)) + // 两人聊天时 没有subName + subName = title; Log.d(TAG, "parser: " + title + " - " + subName + " : " + message); }