mirror of
https://github.com/oxen-io/session-android.git
synced 2024-11-23 18:15:22 +00:00
prevent early callback death
android is so dumb. Fixes #3255 Closes #3260 // FREEBIE
This commit is contained in:
parent
624c7dbf9d
commit
1a7c4a2869
@ -1,11 +1,14 @@
|
||||
package org.thoughtcrime.securesms.components.emoji;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.drawable.Drawable.Callback;
|
||||
import android.support.v7.widget.AppCompatEditText;
|
||||
import android.util.AttributeSet;
|
||||
|
||||
|
||||
public class EmojiEditText extends AppCompatEditText {
|
||||
private final Callback callback = new PostInvalidateCallback(this);
|
||||
|
||||
public EmojiEditText(Context context) {
|
||||
super(context);
|
||||
}
|
||||
@ -31,7 +34,7 @@ public class EmojiEditText extends AppCompatEditText {
|
||||
final char[] chars = Character.toChars(codePoint);
|
||||
final CharSequence text = EmojiProvider.getInstance(getContext()).emojify(new String(chars),
|
||||
EmojiProvider.EMOJI_SMALL,
|
||||
new PostInvalidateCallback(this));
|
||||
callback);
|
||||
|
||||
getText().replace(Math.min(start, end), Math.max(start, end), text);
|
||||
setSelection(end + chars.length);
|
||||
|
@ -1,10 +1,13 @@
|
||||
package org.thoughtcrime.securesms.components.emoji;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.drawable.Drawable.Callback;
|
||||
import android.support.v7.widget.AppCompatTextView;
|
||||
import android.util.AttributeSet;
|
||||
|
||||
public class EmojiTextView extends AppCompatTextView {
|
||||
private final Callback callback = new PostInvalidateCallback(this);
|
||||
|
||||
public EmojiTextView(Context context) {
|
||||
super(context);
|
||||
}
|
||||
@ -20,7 +23,7 @@ public class EmojiTextView extends AppCompatTextView {
|
||||
@Override public void setText(CharSequence text, BufferType type) {
|
||||
super.setText(EmojiProvider.getInstance(getContext()).emojify(text,
|
||||
EmojiProvider.EMOJI_SMALL,
|
||||
new PostInvalidateCallback(this)),
|
||||
callback),
|
||||
BufferType.SPANNABLE);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user