Download File
Download Project
Settings
Line Wrap
Themes
default
ambiance
bespin
dracula
eclipse
material
mbo
mdn-like
neat
solarized dark
ttcn
zenburn
EmojiCompatApplication.java
/* * Copyright (C) 2017 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.example.android.emojicompat; import android.app.Application; import android.support.annotation.Nullable; import android.support.text.emoji.EmojiCompat; import android.support.text.emoji.FontRequestEmojiCompatConfig; import android.support.text.emoji.bundled.BundledEmojiCompatConfig; import android.support.v4.provider.FontRequest; import android.util.Log; /** * This application uses EmojiCompat. */ public class EmojiCompatApplication extends Application { private static final String TAG = "EmojiCompatApplication"; /** Change this to {@code false} when you want to use the downloadable Emoji font. */ private static final boolean USE_BUNDLED_EMOJI = true; @Override public void onCreate() { super.onCreate(); final EmojiCompat.Config config; if (USE_BUNDLED_EMOJI) { // Use the bundled font for EmojiCompat config = new BundledEmojiCompatConfig(getApplicationContext()); } else { // Use a downloadable font for EmojiCompat final FontRequest fontRequest = new FontRequest( "com.google.android.gms.fonts", "com.google.android.gms", "Noto Color Emoji Compat", R.array.com_google_android_gms_fonts_certs); config = new FontRequestEmojiCompatConfig(getApplicationContext(), fontRequest) .setReplaceAll(true) .registerInitCallback(new EmojiCompat.InitCallback() { @Override public void onInitialized() { Log.i(TAG, "EmojiCompat initialized"); } @Override public void onFailed(@Nullable Throwable throwable) { Log.e(TAG, "EmojiCompat initialization failed", throwable); } }); } EmojiCompat.init(config); } }