mirror of
https://github.com/oxen-io/session-android.git
synced 2025-02-17 15:28:25 +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;
|
package org.thoughtcrime.securesms.components.emoji;
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
|
import android.graphics.drawable.Drawable.Callback;
|
||||||
import android.support.v7.widget.AppCompatEditText;
|
import android.support.v7.widget.AppCompatEditText;
|
||||||
import android.util.AttributeSet;
|
import android.util.AttributeSet;
|
||||||
|
|
||||||
|
|
||||||
public class EmojiEditText extends AppCompatEditText {
|
public class EmojiEditText extends AppCompatEditText {
|
||||||
|
private final Callback callback = new PostInvalidateCallback(this);
|
||||||
|
|
||||||
public EmojiEditText(Context context) {
|
public EmojiEditText(Context context) {
|
||||||
super(context);
|
super(context);
|
||||||
}
|
}
|
||||||
@ -31,7 +34,7 @@ public class EmojiEditText extends AppCompatEditText {
|
|||||||
final char[] chars = Character.toChars(codePoint);
|
final char[] chars = Character.toChars(codePoint);
|
||||||
final CharSequence text = EmojiProvider.getInstance(getContext()).emojify(new String(chars),
|
final CharSequence text = EmojiProvider.getInstance(getContext()).emojify(new String(chars),
|
||||||
EmojiProvider.EMOJI_SMALL,
|
EmojiProvider.EMOJI_SMALL,
|
||||||
new PostInvalidateCallback(this));
|
callback);
|
||||||
|
|
||||||
getText().replace(Math.min(start, end), Math.max(start, end), text);
|
getText().replace(Math.min(start, end), Math.max(start, end), text);
|
||||||
setSelection(end + chars.length);
|
setSelection(end + chars.length);
|
||||||
|
@ -1,10 +1,13 @@
|
|||||||
package org.thoughtcrime.securesms.components.emoji;
|
package org.thoughtcrime.securesms.components.emoji;
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
|
import android.graphics.drawable.Drawable.Callback;
|
||||||
import android.support.v7.widget.AppCompatTextView;
|
import android.support.v7.widget.AppCompatTextView;
|
||||||
import android.util.AttributeSet;
|
import android.util.AttributeSet;
|
||||||
|
|
||||||
public class EmojiTextView extends AppCompatTextView {
|
public class EmojiTextView extends AppCompatTextView {
|
||||||
|
private final Callback callback = new PostInvalidateCallback(this);
|
||||||
|
|
||||||
public EmojiTextView(Context context) {
|
public EmojiTextView(Context context) {
|
||||||
super(context);
|
super(context);
|
||||||
}
|
}
|
||||||
@ -20,7 +23,7 @@ public class EmojiTextView extends AppCompatTextView {
|
|||||||
@Override public void setText(CharSequence text, BufferType type) {
|
@Override public void setText(CharSequence text, BufferType type) {
|
||||||
super.setText(EmojiProvider.getInstance(getContext()).emojify(text,
|
super.setText(EmojiProvider.getInstance(getContext()).emojify(text,
|
||||||
EmojiProvider.EMOJI_SMALL,
|
EmojiProvider.EMOJI_SMALL,
|
||||||
new PostInvalidateCallback(this)),
|
callback),
|
||||||
BufferType.SPANNABLE);
|
BufferType.SPANNABLE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user