Main class to keep Android devices up to date with the newest emojis by adding EmojiSpans to a given CharSequence. By default, EmojiCompat is initialized by EmojiCompatInitializer, which performs deferred font loading to avoid potential app startup delays. The default be
| 104 | |
| 105 | */ |
| 106 | @AnyThread |
| 107 | public class EmojiCompat { |
| 108 | /** |
| 109 | * Key in {@link EditorInfo#extras} that represents the emoji metadata version used by the |
| 110 | * widget. The existence of the value means that the widget is using EmojiCompat. |
| 111 | * <p/> |
| 112 | * If exists, the value for the key is an {@code int} and can be used to query EmojiCompat to |
| 113 | * see whether the widget has the ability to display a certain emoji using |
| 114 | * {@link #hasEmojiGlyph(CharSequence, int)}. |
| 115 | */ |
| 116 | public static final String EDITOR_INFO_METAVERSION_KEY = |
| 117 | "android.support.text.emoji.emojiCompat_metadataVersion"; |
| 118 | |
| 119 | /** |
| 120 | * Key in {@link EditorInfo#extras} that represents {@link |
| 121 | * EmojiCompat.Config#setReplaceAll(boolean)} configuration parameter. The key is added only if |
| 122 | * EmojiCompat is used by the widget. If exists, the value is a boolean. |
| 123 | */ |
| 124 | public static final String EDITOR_INFO_REPLACE_ALL_KEY = |
| 125 | "android.support.text.emoji.emojiCompat_replaceAll"; |
| 126 | |
| 127 | /** |
| 128 | * EmojiCompat instance is constructed, however the initialization did not start yet. |
| 129 | * |
| 130 | * @see #getLoadState() |
| 131 | */ |
| 132 | public static final int LOAD_STATE_DEFAULT = 3; |
| 133 | |
| 134 | /** |
| 135 | * EmojiCompat is initializing. |
| 136 | * |
| 137 | * @see #getLoadState() |
| 138 | */ |
| 139 | // note: this may be returned as the value of mLoadState before constructor finishes due to |
| 140 | // double-check lock |
| 141 | public static final int LOAD_STATE_LOADING = 0; |
| 142 | |
| 143 | /** |
| 144 | * EmojiCompat successfully initialized. |
| 145 | * |
| 146 | * @see #getLoadState() |
| 147 | */ |
| 148 | public static final int LOAD_STATE_SUCCEEDED = 1; |
| 149 | |
| 150 | /** |
| 151 | * An unrecoverable error occurred during initialization of EmojiCompat. Calls to functions |
| 152 | * such as {@link #process(CharSequence)} will fail. |
| 153 | * |
| 154 | * @see #getLoadState() |
| 155 | */ |
| 156 | public static final int LOAD_STATE_FAILED = 2; |
| 157 | |
| 158 | /** |
| 159 | */ |
| 160 | @RestrictTo(LIBRARY) |
| 161 | @IntDef({LOAD_STATE_DEFAULT, LOAD_STATE_LOADING, LOAD_STATE_SUCCEEDED, LOAD_STATE_FAILED}) |
| 162 | @Retention(RetentionPolicy.SOURCE) |
| 163 | private @interface LoadState { |
nothing calls this directly
no outgoing calls
no test coverage detected