diff --git a/README.md b/README.md index e2af55a70..e80885db4 100644 --- a/README.md +++ b/README.md @@ -13,7 +13,8 @@ Another thing is that this emoji set includes some emojis and ZWJ-sequences whic Please note that I did not create most of the emojis. You can find an overview of the changes I made in the file CHANGES.txt -Most information on this fork will be included in the [Wiki](https://github.com/C1710/blobmoji/wiki). There you'll find more detailed build instructions and other helpful information on how to use this font and much more. +Most information on this fork will be included in the [Wiki](https://github.com/C1710/blobmoji/wiki). There you'll find more detailed build instructions and other helpful information on how to use this font and much more. +If you want to use this font - there's a [Wiki page](https://github.com/C1710/blobmoji/wiki/Installation-Usage) :D (_[Emojipedia®](https://emojipedia.org) is a registered trademark of Emojipedia Pty Ltd_) diff --git a/emojicompat/FileMojiCompat/filemojicompat/build.gradle b/emojicompat/FileMojiCompat/filemojicompat/build.gradle index 0dcd5af55..e53adb7b1 100644 --- a/emojicompat/FileMojiCompat/filemojicompat/build.gradle +++ b/emojicompat/FileMojiCompat/filemojicompat/build.gradle @@ -5,7 +5,7 @@ buildscript { google() } dependencies { - classpath 'com.android.tools.build:gradle:3.1.2' + classpath 'com.android.tools.build:gradle:3.1.3' } } @@ -18,7 +18,7 @@ ext { libraryDescription = 'An EmojiCompat implementation using files from a local file or a file inside your assets directory' siteUrl = 'https://github.com/c1710/blobmoji' gitUrl = 'https://github.com/c1710/blobmoji.git' - libraryVersion = '1.0.7' + libraryVersion = '1.0.11' developerId = 'c1710' developerName = 'Constantin A.' developerEmail = 'c1710.apps@outlook.com' @@ -33,8 +33,8 @@ android { defaultConfig { minSdkVersion 14 targetSdkVersion 27 - versionCode 7 - versionName "1.0.7" + versionCode 12 + versionName "1.0.12" } @@ -47,7 +47,6 @@ android { dependencies { implementation fileTree(dir: 'libs', include: ['*.jar']) implementation 'com.android.support:support-emoji:27.1.1' - } apply from: 'https://raw.githubusercontent.com/numetriclabz/jcenter/master/installv.gradle' diff --git a/emojicompat/FileMojiCompat/filemojicompat/src/main/assets/NoEmojiCompat.ttf b/emojicompat/FileMojiCompat/filemojicompat/src/main/assets/NoEmojiCompat.ttf index 8decd7bf8..72c9e7160 100644 Binary files a/emojicompat/FileMojiCompat/filemojicompat/src/main/assets/NoEmojiCompat.ttf and b/emojicompat/FileMojiCompat/filemojicompat/src/main/assets/NoEmojiCompat.ttf differ diff --git a/emojicompat/FileMojiCompat/filemojicompat/src/main/java/de/c1710/filemojicompat/AssetEmojiCompatConfig.java b/emojicompat/FileMojiCompat/filemojicompat/src/main/java/de/c1710/filemojicompat/AssetEmojiCompatConfig.java index ddf85e2b1..803df987d 100644 --- a/emojicompat/FileMojiCompat/filemojicompat/src/main/java/de/c1710/filemojicompat/AssetEmojiCompatConfig.java +++ b/emojicompat/FileMojiCompat/filemojicompat/src/main/java/de/c1710/filemojicompat/AssetEmojiCompatConfig.java @@ -23,15 +23,16 @@ import android.support.annotation.NonNull; import android.support.annotation.RequiresApi; import android.support.text.emoji.EmojiCompat; import android.support.text.emoji.MetadataRepo; -import android.util.Log; -import android.support.v4.util.Preconditions; /** * A simple implementation of EmojiCompat.Config using typeface assets. * Based on: * https://android.googlesource.com/platform/frameworks/support/+/master/emoji/bundled/src/main/java/android/support/text/emoji/bundled/BundledEmojiCompatConfig.java * Changes are marked with comments. Formatting and other simple changes are not always marked. + * @deprecated Please use {@link FileEmojiCompatConfig#createFromAsset(Context, String)} instead + * for greater flexibility. */ +@Deprecated public class AssetEmojiCompatConfig extends EmojiCompat.Config { // The class name is obviously changed from the original file diff --git a/emojicompat/FileMojiCompat/filemojicompat/src/main/java/de/c1710/filemojicompat/FileEmojiCompatConfig.java b/emojicompat/FileMojiCompat/filemojicompat/src/main/java/de/c1710/filemojicompat/FileEmojiCompatConfig.java index 97b72385a..8ce3e60bb 100644 --- a/emojicompat/FileMojiCompat/filemojicompat/src/main/java/de/c1710/filemojicompat/FileEmojiCompatConfig.java +++ b/emojicompat/FileMojiCompat/filemojicompat/src/main/java/de/c1710/filemojicompat/FileEmojiCompatConfig.java @@ -55,6 +55,52 @@ public class FileEmojiCompatConfig extends EmojiCompat.Config { */ private static final String FONT_FALLBACK = "NoEmojiCompat.ttf"; + /** + * Creates a new FileEmojiCompatConfig based on an asset. + *
+ * This means that you can have the flexibility of {@link AssetEmojiCompatConfig} + * while giving your users the choice to optionally override the font. + * + * The default location for a substituting font is + * {@code /sdcard/Android/data/your.apps.package/files/EmojiCompat.ttf}. + * + * @param context The app's context is needed for several tasks + * @param assetPath The path inside the {@code assets} folder for the default font file + * @return A FileEmojiCompatConfig which will use the given font by default + */ + public FileEmojiCompatConfig createFromAsset(@NonNull Context context, + @Nullable String assetPath) { + if (assetPath != null) { + FileEmojiCompatConfig config = new FileEmojiCompatConfig(context, + new File(context.getExternalFilesDir(null), "EmojiCompat.ttf"), + assetPath); + config.replaceAllOnFallback = true; + return config; + } else { + return createFromAsset(context); + } + } + + /** + * Creates a new FileEmojiCompatConfig based on an asset. + * + * This means that you can have the flexibility of {@link AssetEmojiCompatConfig} + * while giving your users the choice to optionally override the font. + * + * The default location for a substituting font is + * {@code /sdcard/Android/data/your.apps.package/files/EmojiCompat.ttf}. + * + * The default name for the Assets font is {@code NoEmojiCompat.ttf}. + * If you wish to use a different name for this font, please use + * {@link #createFromAsset(Context, String)}. + * + * @param context The app's context is needed for several tasks + * @return A FileEmojiCompatConfig which will use the given font by default + */ + public FileEmojiCompatConfig createFromAsset(@NonNull Context context) { + return createFromAsset(context, FONT_FALLBACK); + } + /** * Create a new configuration for this EmojiCompat * @param path The file name/path of the requested font @@ -238,6 +284,7 @@ public class FileEmojiCompatConfig extends EmojiCompat.Config { MetadataRepo.create(assetManager, FONT_FALLBACK); loaderCallback.onLoaded(resourceIndex); } catch (Throwable t2) { + Log.e(TAG, "Even the fallback font couldn't be loaded", t2); loaderCallback.onFailed(t); } }