EmojiCompat.Config

public static abstract class EmojiCompat.Config
extends Object

java.lang.Object
   ↳ androidx.emoji.text.EmojiCompat.Config


Configuration class for EmojiCompat. Changes to the values will be ignored after EmojiCompat.init(Config) is called.

Summary

Protected constructors

Config(EmojiCompat.MetadataRepoLoader metadataLoader)

Default constructor.

Public methods

EmojiCompat.Config registerInitCallback(EmojiCompat.InitCallback initCallback)

Registers an initialization callback.

EmojiCompat.Config setEmojiSpanIndicatorColor(int color)

Sets the color used as emoji span indicator.

EmojiCompat.Config setEmojiSpanIndicatorEnabled(boolean emojiSpanIndicatorEnabled)

Determines whether a background will be drawn for the emojis that are found and replaced by EmojiCompat.

EmojiCompat.Config setGlyphChecker(EmojiCompat.GlyphChecker glyphChecker)

The interface that is used by EmojiCompat in order to check if a given emoji can be rendered by the system.

EmojiCompat.Config setMetadataLoadStrategy(int strategy)

Determines the strategy to start loading the metadata.

EmojiCompat.Config setReplaceAll(boolean replaceAll)

Determines whether EmojiCompat should replace all the emojis it finds with the EmojiSpans.

EmojiCompat.Config setUseEmojiAsDefaultStyle(boolean useEmojiAsDefaultStyle)

Determines whether EmojiCompat should use the emoji presentation style for emojis that have text style as default.

EmojiCompat.Config setUseEmojiAsDefaultStyle(boolean useEmojiAsDefaultStyle, List<Integer> emojiAsDefaultStyleExceptions)
EmojiCompat.Config unregisterInitCallback(EmojiCompat.InitCallback initCallback)

Unregisters a callback that was added before.

Protected methods

final EmojiCompat.MetadataRepoLoader getMetadataRepoLoader()

Returns the EmojiCompat.MetadataRepoLoader.

Inherited methods

Protected constructors

Config

protected Config (EmojiCompat.MetadataRepoLoader metadataLoader)

Default constructor.

Parameters
metadataLoader EmojiCompat.MetadataRepoLoader: MetadataRepoLoader instance, cannot be null

Public methods

registerInitCallback

public EmojiCompat.Config registerInitCallback (EmojiCompat.InitCallback initCallback)

Registers an initialization callback.

Parameters
initCallback EmojiCompat.InitCallback: the initialization callback to register, cannot be null

Returns
EmojiCompat.Config EmojiCompat.Config instance

setEmojiSpanIndicatorColor

public EmojiCompat.Config setEmojiSpanIndicatorColor (int color)

Sets the color used as emoji span indicator. The default value is Color.GREEN.

Parameters
color int

Returns
EmojiCompat.Config

setEmojiSpanIndicatorEnabled

public EmojiCompat.Config setEmojiSpanIndicatorEnabled (boolean emojiSpanIndicatorEnabled)

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).

Parameters
emojiSpanIndicatorEnabled boolean: when true a background is drawn for each emoji that is replaced

Returns
EmojiCompat.Config

setGlyphChecker

public EmojiCompat.Config setGlyphChecker (EmojiCompat.GlyphChecker glyphChecker)

The interface that is used by EmojiCompat in order to check if a given emoji can be rendered by the system.

Parameters
glyphChecker EmojiCompat.GlyphChecker: EmojiCompat.GlyphChecker instance to be used.

Returns
EmojiCompat.Config

setMetadataLoadStrategy

public EmojiCompat.Config setMetadataLoadStrategy (int strategy)

Determines the strategy to start loading the metadata. By default EmojiCompat will start loading the metadata during