mirror of
https://github.com/moparisthebest/Conversations
synced 2024-11-30 12:42:16 -05:00
don't show quoted text in message preview
This commit is contained in:
parent
e5fff42b10
commit
b011d46ff2
@ -180,10 +180,7 @@ public class UIHelper {
|
|||||||
return new Pair<>(getFileDescriptionString(context,message),true);
|
return new Pair<>(getFileDescriptionString(context,message),true);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
String body = message.getBody();
|
final String body = message.getBody();
|
||||||
if (body.length() > 256) {
|
|
||||||
body = body.substring(0,256);
|
|
||||||
}
|
|
||||||
if (body.startsWith(Message.ME_COMMAND)) {
|
if (body.startsWith(Message.ME_COMMAND)) {
|
||||||
return new Pair<>(body.replaceAll("^" + Message.ME_COMMAND,
|
return new Pair<>(body.replaceAll("^" + Message.ME_COMMAND,
|
||||||
UIHelper.getMessageDisplayName(message) + " "), false);
|
UIHelper.getMessageDisplayName(message) + " "), false);
|
||||||
@ -197,7 +194,28 @@ public class UIHelper {
|
|||||||
return new Pair<>(context.getString(R.string.x_file_offered_for_download,
|
return new Pair<>(context.getString(R.string.x_file_offered_for_download,
|
||||||
getFileDescriptionString(context,message)),true);
|
getFileDescriptionString(context,message)),true);
|
||||||
} else {
|
} else {
|
||||||
return new Pair<>(body.trim(), false);
|
String[] lines = body.split("\n");
|
||||||
|
StringBuilder builder = new StringBuilder();
|
||||||
|
for(String l : lines) {
|
||||||
|
if (l.length() > 0) {
|
||||||
|
char first = l.charAt(0);
|
||||||
|
if (first != '>' && first != '\u00bb') {
|
||||||
|
String line = l.trim();
|
||||||
|
char last = line.charAt(line.length()-1);
|
||||||
|
if (builder.length() != 0) {
|
||||||
|
builder.append(' ');
|
||||||
|
}
|
||||||
|
builder.append(line);
|
||||||
|
if (last != '.' && last != '!' && last != '?' && last != ',') {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (builder.length() == 0) {
|
||||||
|
builder.append(body.trim());
|
||||||
|
}
|
||||||
|
return new Pair<>(builder.length() > 256 ? builder.substring(0,256) : builder.toString(), false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user