Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move emoji files from drawable-nodpi to internal storage cause performance problem #173

Open
missmess opened this issue Nov 30, 2017 · 1 comment

Comments

@missmess
Copy link

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?

@missmess
Copy link
Author

I want to reduce the apk size by remove the emojis(5.8M) from apk, and download background when app opened.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant