-
-
Notifications
You must be signed in to change notification settings - Fork 290
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
Add infrastructure to let the provider perform emoji span replacements and utilize in emoji-google-compat #198
Conversation
…ode to use the drawable. Allows providers to provide optimized / not 1:1 resource based emoji
… dependency is more explicit/obvious
…port library spanning functionality when available.
…port library spanning functionality when available.
Codecov Report
@@ Coverage Diff @@
## master #198 +/- ##
==========================================
+ Coverage 27.93% 28.04% +0.11%
==========================================
Files 22 22
Lines 809 820 +11
Branches 89 90 +1
==========================================
+ Hits 226 230 +4
- Misses 565 571 +6
- Partials 18 19 +1
Continue to review full report at Codecov.
|
I'll look at this PR shortly. I'm rather busy at the moment. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A few questions.
I really like the asList optimization
} | ||
|
||
/** | ||
* Internal fallback method. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does not really seem internal since it's public.
/** | ||
* Internal fallback method. | ||
*/ | ||
public static void replaceWithImagesImpl(final Context context, final Spannable text, final float emojiSize) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it possible to keep this internal?
import android.content.Context; | ||
import android.text.Spannable; | ||
|
||
public interface EmojiReplacer { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
some java doc what it can be used for and also that it'll be there since version 0.6.0
@@ -174,7 +174,7 @@ public void noProviderInstalled() { | |||
|
|||
final Spannable text = new SpannableString(new String(new int[] { 0x1234, 0x4321 }, 0, 1)); | |||
|
|||
EmojiManager.replaceWithImages(RuntimeEnvironment.application, text, 22); | |||
EmojiManager.replaceWithImagesImpl(RuntimeEnvironment.application, text, 22); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why the function name change?
@@ -134,7 +134,7 @@ public void noProviderInstalled() { | |||
|
|||
final Spannable text = new SpannableString(new String(new int[] { 0x1234 }, 0, 1)); | |||
|
|||
EmojiManager.replaceWithImages(RuntimeEnvironment.application, text, 22); | |||
EmojiManager.replaceWithImagesImpl(RuntimeEnvironment.application, text, 22); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why the function name change
I updated this PR for you. Is there anything that's missing in this branch now? |
@@ -32,4 +36,13 @@ public GoogleCompatEmojiProvider(@NonNull final EmojiCompat emojiCompat) { | |||
new FlagsCategory() | |||
}; | |||
} | |||
|
|||
@Override |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: same line as the method
Hi, sorry for the delay. The extra method is needed to fall back to the default after giving the manager an option to intercept. Maybe replaceWithImagesDefault would be a better name? |
Yup |
I have changed the code to avoid a public method using a fallback replacer. PTAL |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you 👍
Add an interface to enable the provider to do the spanning
Use support library spanning if available
Avoid empty array allocation
Includes fixes from PR #199, which probably should go in first.