mirror of
https://github.com/oxen-io/session-android.git
synced 2025-05-06 20:16:51 +00:00
parent
54db79bfdd
commit
ab8593d5f3
@ -34,6 +34,8 @@ public class EmojiProvider {
|
|||||||
private static final ExecutorService executor = Util.newSingleThreadedLifoExecutor();
|
private static final ExecutorService executor = Util.newSingleThreadedLifoExecutor();
|
||||||
private static volatile EmojiProvider instance = null;
|
private static volatile EmojiProvider instance = null;
|
||||||
private static final SparseArray<SoftReference<Bitmap>> bitmaps = new SparseArray<>();
|
private static final SparseArray<SoftReference<Bitmap>> bitmaps = new SparseArray<>();
|
||||||
|
private static final Paint paint = new Paint();
|
||||||
|
static { paint.setFilterBitmap(true); }
|
||||||
|
|
||||||
private final SparseArray<DrawInfo> offsets = new SparseArray<>();
|
private final SparseArray<DrawInfo> offsets = new SparseArray<>();
|
||||||
|
|
||||||
@ -153,18 +155,12 @@ public class EmojiProvider {
|
|||||||
return drawable;
|
return drawable;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class EmojiDrawable extends Drawable {
|
public class EmojiDrawable extends Drawable {
|
||||||
private final int index;
|
private final int index;
|
||||||
private final int page;
|
private final int page;
|
||||||
private final int emojiSize;
|
private final int emojiSize;
|
||||||
private static final Paint paint;
|
|
||||||
private Bitmap bmp;
|
private Bitmap bmp;
|
||||||
|
|
||||||
static {
|
|
||||||
paint = new Paint();
|
|
||||||
paint.setFilterBitmap(true);
|
|
||||||
}
|
|
||||||
|
|
||||||
public EmojiDrawable(DrawInfo info, int emojiSize) {
|
public EmojiDrawable(DrawInfo info, int emojiSize) {
|
||||||
this.index = info.index;
|
this.index = info.index;
|
||||||
this.page = info.page;
|
this.page = info.page;
|
||||||
@ -174,7 +170,11 @@ public class EmojiProvider {
|
|||||||
@Override
|
@Override
|
||||||
public void draw(Canvas canvas) {
|
public void draw(Canvas canvas) {
|
||||||
if (bitmaps.get(page) == null || bitmaps.get(page).get() == null) {
|
if (bitmaps.get(page) == null || bitmaps.get(page).get() == null) {
|
||||||
Log.w(TAG, "bitmap for this page was null");
|
preloadPage(page, new PageLoadedListener() {
|
||||||
|
@Override public void onPageLoaded() {
|
||||||
|
invalidateSelf();
|
||||||
|
}
|
||||||
|
});
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (bmp == null) {
|
if (bmp == null) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user