lightbulb_outline Help shape the future of the Google Play Console, Android Studio, and Firebase. Start survey
added in version 26.1.0
belongs to Maven artifact com.android.support:support-emoji:28.0.0-alpha1

EmojiCompat.Config

public static abstract class EmojiCompat.Config
extends Object

java.lang.Object
   ↳ android.support.text.emoji.EmojiCompat.Config
Known Direct Subclasses


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

Summary

Protected constructors

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

From class java.lang.Object

Protected constructors

EmojiCompat.Config

added in version 26.1.0
EmojiCompat.Config (EmojiCompat.MetadataRepoLoader metadataLoader)

Default constructor.

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

Public methods

registerInitCallback

added in version 26.1.0
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

added in version 26.1.0
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

added in version 26.1.0
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

setReplaceAll

added in version 26.1.0
EmojiCompat.Config setReplaceAll (boolean replaceAll)

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.

Parameters
replaceAll boolean: replace all emojis found with EmojiSpans

Returns
EmojiCompat.Config EmojiCompat.Config instance

setUseEmojiAsDefaultStyle

added in version 27.1.0
EmojiCompat.Config setUseEmojiAsDefaultStyle (boolean useEmojiAsDefaultStyle)

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.

Parameters
useEmojiAsDefaultStyle boolean: whether to use the emoji style presentation for all emojis that would be presented as text style by default

Returns
EmojiCompat.Config

setUseEmojiAsDefaultStyle

added in version 27.1.0
EmojiCompat.Config setUseEmojiAsDefaultStyle (boolean useEmojiAsDefaultStyle, 
                List<Integer> emojiAsDefaultStyleExceptions)

Parameters
useEmojiAsDefaultStyle boolean

emojiAsDefaultStyleExceptions List: Contains the exception emojis which will be still presented as text style even if the useEmojiAsDefaultStyle flag is set to true. This list will be ignored if useEmojiAsDefaultStyle is false. Note that emojis with default emoji style presentation will remain emoji style regardless the value of useEmojiAsDefaultStyle or whether they are included in the exceptions list or not. When no exception is wanted, the method setUseEmojiAsDefaultStyle(boolean) should be used instead.

Returns
EmojiCompat.Config

unregisterInitCallback

added in version 26.1.0
EmojiCompat.Config unregisterInitCallback (EmojiCompat.InitCallback initCallback)

Unregisters a callback that was added before.

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

Returns
EmojiCompat.Config EmojiCompat.Config instance

Protected methods

getMetadataRepoLoader

added in version 26.1.0
EmojiCompat.MetadataRepoLoader getMetadataRepoLoader ()

Returns the EmojiCompat.MetadataRepoLoader.

Returns
EmojiCompat.MetadataRepoLoader