mirror of
https://github.com/oxen-io/session-android.git
synced 2024-11-27 20:15:21 +00:00
Debug
This commit is contained in:
parent
7ea349ff00
commit
18eb3449ca
@ -2626,7 +2626,7 @@ public class ConversationActivity extends PassphraseRequiredActionBarActivity
|
||||
private void silentlySetComposeText(String text) {
|
||||
typingTextWatcher.setEnabled(false);
|
||||
composeText.setText(text);
|
||||
clearMentions();
|
||||
if (text.isEmpty()) clearMentions();
|
||||
typingTextWatcher.setEnabled(true);
|
||||
}
|
||||
|
||||
@ -2774,6 +2774,9 @@ public class ConversationActivity extends PassphraseRequiredActionBarActivity
|
||||
}
|
||||
}
|
||||
} else if (text.length() > 0) {
|
||||
if (currentMentionStartIndex > text.length()) {
|
||||
clearMentions(); // Should never occur
|
||||
}
|
||||
int currentEndIndex = text.length() - 1;
|
||||
char lastCharacter = text.charAt(currentEndIndex);
|
||||
LokiUserDatabase userDatabase = DatabaseFactory.getLokiUserDatabase(ConversationActivity.this);
|
||||
|
@ -780,10 +780,10 @@ public class ConversationItem extends LinearLayout
|
||||
Pattern pattern = Pattern.compile("@[0-9a-fA-F]*");
|
||||
Matcher matcher = pattern.matcher(text);
|
||||
ArrayList<Range<Integer>> mentions = new ArrayList<>();
|
||||
if (matcher.find() && isGroupThread) {
|
||||
int startIndex = 0;
|
||||
if (matcher.find(startIndex) && isGroupThread) {
|
||||
while (true) {
|
||||
CharSequence userID = text.subSequence(matcher.start() + 1, matcher.end()); // +1 to get rid of the @
|
||||
Integer matchEnd;
|
||||
String userDisplayName;
|
||||
if (userID.equals(TextSecurePreferences.getLocalNumber(context))) {
|
||||
userDisplayName = TextSecurePreferences.getProfileName(context);
|
||||
@ -792,14 +792,15 @@ public class ConversationItem extends LinearLayout
|
||||
userDisplayName = DatabaseFactory.getLokiUserDatabase(context).getServerDisplayName(publicChatID, userID.toString());
|
||||
}
|
||||
if (userDisplayName != null) {
|
||||
text = text.subSequence(0, matcher.start()) + "@" + userDisplayName + text.subSequence(matcher.end(), Math.max(text.length(), matcher.end()));
|
||||
matchEnd = matcher.start() + 1 + userDisplayName.length();
|
||||
mentions.add(Range.create(matcher.start(), matchEnd));
|
||||
text = text.subSequence(0, matcher.start()) + "@" + userDisplayName + text.subSequence(matcher.end(), text.length());
|
||||
int endIndex = matcher.start() + 1 + userDisplayName.length();
|
||||
startIndex = endIndex;
|
||||
mentions.add(Range.create(matcher.start(), endIndex));
|
||||
} else {
|
||||
matchEnd = matcher.end();
|
||||
startIndex = matcher.end();
|
||||
}
|
||||
matcher = pattern.matcher(text.subSequence(matchEnd, Math.max(text.length(), matchEnd)));
|
||||
if (!matcher.find()) { break; }
|
||||
matcher = pattern.matcher(text);
|
||||
if (!matcher.find(startIndex)) { break; }
|
||||
}
|
||||
}
|
||||
SpannableString result = new SpannableString(text);
|
||||
|
Loading…
Reference in New Issue
Block a user