emojicon
emojicon copied to clipboard
Move emoji files from drawable-nodpi to internal storage cause performance problem
I'm tring to move all the emoji pngs from drawable-nodpi into internal storage, but when showing all of the emojis in a TextView, load emoji from the drawable-nodpi dir is near 10 times faster than loading from the internal storage. Here is my modified EmojiconSpan.java:
public Drawable getDrawable() {
if (mDrawable == null) {
try {
// I want to load from the file path
mDrawable = Drawable.createFromPath(mFilePath);
// load from resource
// mDrawable = mContext.getResources().getDrawable(mResourceId);
mHeight = mSize;
mWidth = mHeight * mDrawable.getIntrinsicWidth() / mDrawable.getIntrinsicHeight();
mTop = (mTextSize - mHeight) / 2;
mDrawable.setBounds(0, mTop, mWidth, mTop + mHeight);
} catch (Exception e) {
// swallow
}
}
return mDrawable;
}
I dont know why it happens? And how can I move emojis to internal storage and keep it load as fast as it was?
I want to reduce the apk size by remove the emojis(5.8M) from apk, and download background when app opened.