Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
JasonQS committed Apr 16, 2018
1 parent c9ba16d commit 944400d
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 25 deletions.
7 changes: 4 additions & 3 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand All @@ -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')
Expand Down
19 changes: 13 additions & 6 deletions app/src/main/java/com/qsboy/antirecall/access/Client.java
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ private void findRecallByContext(ArrayList<Integer> prevList, ArrayList<Integer>

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) {
Expand All @@ -157,8 +157,8 @@ private void findRecallByContext(ArrayList<Integer> prevList, ArrayList<Integer>
}
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)
Expand Down Expand Up @@ -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;
}
Expand Down Expand Up @@ -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;
//是群消息
Expand Down
14 changes: 7 additions & 7 deletions app/src/main/java/com/qsboy/antirecall/access/QQClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}


Expand Down
15 changes: 6 additions & 9 deletions app/src/main/java/com/qsboy/antirecall/access/TimClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down

0 comments on commit 944400d

Please sign in to comment.