forked from mirror/monocles_chat_clean
Allow placing sticker at cursors position
This commit is contained in:
parent
2043e4bea5
commit
2028797f7b
1 changed files with 5 additions and 5 deletions
|
@ -2013,7 +2013,10 @@ public class ConversationFragment extends XmppFragment
|
|||
Matcher lastColonMatcher = lastColonPattern.matcher(s);
|
||||
int lastColon = 0;
|
||||
while(lastColonMatcher.find()) lastColon = lastColonMatcher.end();
|
||||
if (lastColon >= 0) s.replace(lastColon, s.length(), toInsert, 0, toInsert.length());
|
||||
if (lastColon >= 0) {
|
||||
int start = binding.textinput.getSelectionStart(); //this is to get the the cursor position
|
||||
binding.textinput.getText().insert(start, toInsert); //this will get the text and insert the emoji into the current position
|
||||
}
|
||||
});
|
||||
|
||||
setupEmojiSearch();
|
||||
|
@ -2082,10 +2085,7 @@ public class ConversationFragment extends XmppFragment
|
|||
Matcher lastColonMatcher = lastColonPattern.matcher(s);
|
||||
int lastColon = 0;
|
||||
while(lastColonMatcher.find()) lastColon = lastColonMatcher.end();
|
||||
if (lastColon < 0) {
|
||||
binding.stickersview.setVisibility(GONE);
|
||||
return;
|
||||
}
|
||||
|
||||
final String q = s.toString().substring(lastColon);
|
||||
EmojiSearch.EmojiSearchAdapter adapter = ((EmojiSearch.EmojiSearchAdapter) binding.stickersview.getAdapter());
|
||||
if (adapter != null) {
|
||||
|
|
Loading…
Reference in a new issue