mirror of
https://github.com/oxen-io/session-android.git
synced 2025-01-11 16:33:39 +00:00
parent
54db79bfdd
commit
ab8593d5f3
@ -34,6 +34,8 @@ public class EmojiProvider {
|
||||
private static final ExecutorService executor = Util.newSingleThreadedLifoExecutor();
|
||||
private static volatile EmojiProvider instance = null;
|
||||
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<>();
|
||||
|
||||
@ -153,18 +155,12 @@ public class EmojiProvider {
|
||||
return drawable;
|
||||
}
|
||||
|
||||
public static class EmojiDrawable extends Drawable {
|
||||
public class EmojiDrawable extends Drawable {
|
||||
private final int index;
|
||||
private final int page;
|
||||
private final int emojiSize;
|
||||
private static final Paint paint;
|
||||
private Bitmap bmp;
|
||||
|
||||
static {
|
||||
paint = new Paint();
|
||||
paint.setFilterBitmap(true);
|
||||
}
|
||||
|
||||
public EmojiDrawable(DrawInfo info, int emojiSize) {
|
||||
this.index = info.index;
|
||||
this.page = info.page;
|
||||
@ -174,7 +170,11 @@ public class EmojiProvider {
|
||||
@Override
|
||||
public void draw(Canvas canvas) {
|
||||
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;
|
||||
}
|
||||
if (bmp == null) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user