BundledEmojiCompatConfig
open class BundledEmojiCompatConfig : EmojiCompat.Config
EmojiCompat.Config
implementation that loads the metadata using AssetManager and bundled resources.
<code>EmojiCompat.init(new BundledEmojiCompatConfig(context));</code>
Summary
Public constructors |
Default constructor.
|
Inherited functions |
From class Config
EmojiCompat.MetadataRepoLoader! |
getMetadataRepoLoader()
Returns the MetadataRepoLoader .
|
EmojiCompat.Config! |
registerInitCallback(@NonNull initCallback: EmojiCompat.InitCallback)
Registers an initialization callback.
|
EmojiCompat.Config! |
setEmojiSpanIndicatorColor(@ColorInt color: Int)
Sets the color used as emoji span indicator. The default value is Color.GREEN .
|
EmojiCompat.Config! |
setEmojiSpanIndicatorEnabled(emojiSpanIndicatorEnabled: Boolean)
Determines whether a background will be drawn for the emojis that are found and replaced by EmojiCompat. Should be used only for debugging purposes. The indicator color can be set using setEmojiSpanIndicatorColor(int) .
|
EmojiCompat.Config! |
setMetadataLoadStrategy(strategy: Int)
Determines the strategy to start loading the metadata. By default will start loading the metadata during . When set to , you should call
Default implementations of EmojiCompat.MetadataRepoLoader start a thread during their EmojiCompat.MetadataRepoLoader#load functions. Just instantiating and starting a thread might take time especially in older devices. Since EmojiCompat#init(Config) has to be called before any EmojiCompat widgets are inflated, this results in time spent either on your Application.onCreate or Activity .onCreate. If you'd like to gain more control on when to start loading the metadata and be able to call EmojiCompat#init(Config) with absolute minimum time cost you can use EmojiCompat#LOAD_STRATEGY_MANUAL .
When set to EmojiCompat#LOAD_STRATEGY_MANUAL , EmojiCompat will wait for load() to be called by the developer in order to start loading metadata, therefore you should call EmojiCompat#load() to initiate metadata loading. load() can be called from any thread.
EmojiCompat.Config config = new FontRequestEmojiCompatConfig(context, fontRequest)
.setMetadataLoadStrategy(EmojiCompat.LOAD_STRATEGY_MANUAL);
// EmojiCompat will not start loading metadata and MetadataRepoLoader#load(...)
// will not be called
EmojiCompat.init(config);
// At any time (i.e. idle time or executorService is ready)
// call EmojiCompat#load() to start loading metadata.
executorService.execute(() -> EmojiCompat.get().load());
|
EmojiCompat.Config! |
setReplaceAll(replaceAll: Boolean)
Determines whether EmojiCompat should replace all the emojis it finds with the EmojiSpans. By default EmojiCompat tries its best to understand if the system already can render an emoji and do not replace those emojis.
|
EmojiCompat.Config! |
setUseEmojiAsDefaultStyle(useEmojiAsDefaultStyle: Boolean)
Determines whether EmojiCompat should use the emoji presentation style for emojis that have text style as default. By default, the text style would be used, unless these are followed by the U+FE0F variation selector. Details about emoji presentation and text presentation styles can be found here: http://unicode.org/reports/tr51/#Presentation_Style If useEmojiAsDefaultStyle is true, the emoji presentation style will be used for all emojis, including potentially unexpected ones (such as digits or other keycap emojis). If this is not the expected behaviour, method setUseEmojiAsDefaultStyle(boolean, List) can be used to specify the exception emojis that should be still presented as text style.
|
EmojiCompat.Config! |
setUseEmojiAsDefaultStyle(useEmojiAsDefaultStyle: Boolean, @Nullable emojiAsDefaultStyleExceptions: MutableList<Int!>?)
|
EmojiCompat.Config! |
unregisterInitCallback(@NonNull initCallback: EmojiCompat.InitCallback)
Unregisters a callback that was added before.
|
|
Public constructors
<init>
BundledEmojiCompatConfig(@NonNull context: Context)
Default constructor.
Parameters |
context |
Context: Context instance |