diff --git a/emoji-facebook/api/current.txt b/emoji-facebook/api/current.txt index 098ed27b76..7957278bc0 100644 --- a/emoji-facebook/api/current.txt +++ b/emoji-facebook/api/current.txt @@ -1,7 +1,7 @@ // Signature format: 4.0 package com.vanniktech.emoji.facebook { - public final class FacebookEmojiProvider implements com.vanniktech.emoji.EmojiDrawableProvider com.vanniktech.emoji.EmojiProvider { + public final class FacebookEmojiProvider implements com.vanniktech.emoji.EmojiAndroidProvider com.vanniktech.emoji.EmojiProvider { ctor public FacebookEmojiProvider(); method public com.vanniktech.emoji.EmojiCategory![] getCategories(); method public android.graphics.drawable.Drawable getDrawable(com.vanniktech.emoji.Emoji emoji, android.content.Context context); diff --git a/emoji-facebook/src/androidMain/kotlin/com/vanniktech/emoji/facebook/FacebookEmojiProvider.kt b/emoji-facebook/src/androidMain/kotlin/com/vanniktech/emoji/facebook/FacebookEmojiProvider.kt index 5d4046d3eb..4fbe50704a 100644 --- a/emoji-facebook/src/androidMain/kotlin/com/vanniktech/emoji/facebook/FacebookEmojiProvider.kt +++ b/emoji-facebook/src/androidMain/kotlin/com/vanniktech/emoji/facebook/FacebookEmojiProvider.kt @@ -24,8 +24,8 @@ import android.graphics.drawable.BitmapDrawable import android.graphics.drawable.Drawable import android.util.LruCache import com.vanniktech.emoji.Emoji +import com.vanniktech.emoji.EmojiAndroidProvider import com.vanniktech.emoji.EmojiCategory -import com.vanniktech.emoji.EmojiDrawableProvider import com.vanniktech.emoji.EmojiProvider import com.vanniktech.emoji.facebook.category.ActivitiesCategory import com.vanniktech.emoji.facebook.category.AnimalsAndNatureCategory @@ -37,7 +37,7 @@ import com.vanniktech.emoji.facebook.category.SymbolsCategory import com.vanniktech.emoji.facebook.category.TravelAndPlacesCategory import java.lang.ref.SoftReference -class FacebookEmojiProvider : EmojiProvider, EmojiDrawableProvider { +class FacebookEmojiProvider : EmojiProvider, EmojiAndroidProvider { override val categories: Array get() = arrayOf( SmileysAndPeopleCategory(), diff --git a/emoji-google-compat/api/current.txt b/emoji-google-compat/api/current.txt index a3c026d4aa..28bac8090d 100644 --- a/emoji-google-compat/api/current.txt +++ b/emoji-google-compat/api/current.txt @@ -1,7 +1,7 @@ // Signature format: 4.0 package com.vanniktech.emoji.googlecompat { - public final class GoogleCompatEmojiProvider implements com.vanniktech.emoji.EmojiDrawableProvider com.vanniktech.emoji.EmojiProvider com.vanniktech.emoji.EmojiReplacer { + public final class GoogleCompatEmojiProvider implements com.vanniktech.emoji.EmojiAndroidProvider com.vanniktech.emoji.EmojiProvider com.vanniktech.emoji.EmojiReplacer { ctor public GoogleCompatEmojiProvider(androidx.emoji.text.EmojiCompat emojiCompat); method public com.vanniktech.emoji.EmojiCategory![] getCategories(); method public android.graphics.drawable.Drawable getDrawable(com.vanniktech.emoji.Emoji emoji, android.content.Context context); diff --git a/emoji-google-compat/src/androidMain/kotlin/com/vanniktech/emoji/googlecompat/GoogleCompatEmojiProvider.kt b/emoji-google-compat/src/androidMain/kotlin/com/vanniktech/emoji/googlecompat/GoogleCompatEmojiProvider.kt index e06ad0faa3..2f86082fc0 100644 --- a/emoji-google-compat/src/androidMain/kotlin/com/vanniktech/emoji/googlecompat/GoogleCompatEmojiProvider.kt +++ b/emoji-google-compat/src/androidMain/kotlin/com/vanniktech/emoji/googlecompat/GoogleCompatEmojiProvider.kt @@ -21,8 +21,8 @@ import android.graphics.drawable.Drawable import android.text.Spannable import androidx.emoji.text.EmojiCompat import com.vanniktech.emoji.Emoji +import com.vanniktech.emoji.EmojiAndroidProvider import com.vanniktech.emoji.EmojiCategory -import com.vanniktech.emoji.EmojiDrawableProvider import com.vanniktech.emoji.EmojiProvider import com.vanniktech.emoji.EmojiReplacer import com.vanniktech.emoji.googlecompat.category.ActivitiesCategory @@ -36,7 +36,7 @@ import com.vanniktech.emoji.googlecompat.category.TravelAndPlacesCategory class GoogleCompatEmojiProvider( @Suppress("unused") private val emojiCompat: EmojiCompat, -) : EmojiProvider, EmojiDrawableProvider, EmojiReplacer { +) : EmojiProvider, EmojiAndroidProvider, EmojiReplacer { override val categories: Array get() = arrayOf( SmileysAndPeopleCategory(), diff --git a/emoji-google/api/current.txt b/emoji-google/api/current.txt index e14ddf2b08..918f363541 100644 --- a/emoji-google/api/current.txt +++ b/emoji-google/api/current.txt @@ -1,7 +1,7 @@ // Signature format: 4.0 package com.vanniktech.emoji.google { - public final class GoogleEmojiProvider implements com.vanniktech.emoji.EmojiDrawableProvider com.vanniktech.emoji.EmojiProvider { + public final class GoogleEmojiProvider implements com.vanniktech.emoji.EmojiAndroidProvider com.vanniktech.emoji.EmojiProvider { ctor public GoogleEmojiProvider(); method public com.vanniktech.emoji.EmojiCategory![] getCategories(); method public android.graphics.drawable.Drawable getDrawable(com.vanniktech.emoji.Emoji emoji, android.content.Context context); diff --git a/emoji-google/src/androidMain/kotlin/com/vanniktech/emoji/google/GoogleEmojiProvider.kt b/emoji-google/src/androidMain/kotlin/com/vanniktech/emoji/google/GoogleEmojiProvider.kt index 6ea7be875e..fcb48ead94 100644 --- a/emoji-google/src/androidMain/kotlin/com/vanniktech/emoji/google/GoogleEmojiProvider.kt +++ b/emoji-google/src/androidMain/kotlin/com/vanniktech/emoji/google/GoogleEmojiProvider.kt @@ -24,8 +24,8 @@ import android.graphics.drawable.BitmapDrawable import android.graphics.drawable.Drawable import android.util.LruCache import com.vanniktech.emoji.Emoji +import com.vanniktech.emoji.EmojiAndroidProvider import com.vanniktech.emoji.EmojiCategory -import com.vanniktech.emoji.EmojiDrawableProvider import com.vanniktech.emoji.EmojiProvider import com.vanniktech.emoji.google.category.ActivitiesCategory import com.vanniktech.emoji.google.category.AnimalsAndNatureCategory @@ -37,7 +37,7 @@ import com.vanniktech.emoji.google.category.SymbolsCategory import com.vanniktech.emoji.google.category.TravelAndPlacesCategory import java.lang.ref.SoftReference -class GoogleEmojiProvider : EmojiProvider, EmojiDrawableProvider { +class GoogleEmojiProvider : EmojiProvider, EmojiAndroidProvider { override val categories: Array get() = arrayOf( SmileysAndPeopleCategory(), diff --git a/emoji-ios/api/current.txt b/emoji-ios/api/current.txt index c2d0ac72f1..85bcc401f8 100644 --- a/emoji-ios/api/current.txt +++ b/emoji-ios/api/current.txt @@ -1,7 +1,7 @@ // Signature format: 4.0 package com.vanniktech.emoji.ios { - public final class IosEmojiProvider implements com.vanniktech.emoji.EmojiDrawableProvider com.vanniktech.emoji.EmojiProvider { + public final class IosEmojiProvider implements com.vanniktech.emoji.EmojiAndroidProvider com.vanniktech.emoji.EmojiProvider { ctor public IosEmojiProvider(); method public com.vanniktech.emoji.EmojiCategory![] getCategories(); method public android.graphics.drawable.Drawable getDrawable(com.vanniktech.emoji.Emoji emoji, android.content.Context context); diff --git a/emoji-ios/src/androidMain/kotlin/com/vanniktech/emoji/ios/IosEmojiProvider.kt b/emoji-ios/src/androidMain/kotlin/com/vanniktech/emoji/ios/IosEmojiProvider.kt index b9427fc62e..10569526a3 100644 --- a/emoji-ios/src/androidMain/kotlin/com/vanniktech/emoji/ios/IosEmojiProvider.kt +++ b/emoji-ios/src/androidMain/kotlin/com/vanniktech/emoji/ios/IosEmojiProvider.kt @@ -24,8 +24,8 @@ import android.graphics.drawable.BitmapDrawable import android.graphics.drawable.Drawable import android.util.LruCache import com.vanniktech.emoji.Emoji +import com.vanniktech.emoji.EmojiAndroidProvider import com.vanniktech.emoji.EmojiCategory -import com.vanniktech.emoji.EmojiDrawableProvider import com.vanniktech.emoji.EmojiProvider import com.vanniktech.emoji.ios.category.ActivitiesCategory import com.vanniktech.emoji.ios.category.AnimalsAndNatureCategory @@ -37,7 +37,7 @@ import com.vanniktech.emoji.ios.category.SymbolsCategory import com.vanniktech.emoji.ios.category.TravelAndPlacesCategory import java.lang.ref.SoftReference -class IosEmojiProvider : EmojiProvider, EmojiDrawableProvider { +class IosEmojiProvider : EmojiProvider, EmojiAndroidProvider { override val categories: Array get() = arrayOf( SmileysAndPeopleCategory(), diff --git a/emoji-twitter/api/current.txt b/emoji-twitter/api/current.txt index a0ea0987d7..82d35f3e0d 100644 --- a/emoji-twitter/api/current.txt +++ b/emoji-twitter/api/current.txt @@ -1,7 +1,7 @@ // Signature format: 4.0 package com.vanniktech.emoji.twitter { - public final class TwitterEmojiProvider implements com.vanniktech.emoji.EmojiDrawableProvider com.vanniktech.emoji.EmojiProvider { + public final class TwitterEmojiProvider implements com.vanniktech.emoji.EmojiAndroidProvider com.vanniktech.emoji.EmojiProvider { ctor public TwitterEmojiProvider(); method public com.vanniktech.emoji.EmojiCategory![] getCategories(); method public android.graphics.drawable.Drawable getDrawable(com.vanniktech.emoji.Emoji emoji, android.content.Context context); diff --git a/emoji-twitter/src/androidMain/kotlin/com/vanniktech/emoji/twitter/TwitterEmojiProvider.kt b/emoji-twitter/src/androidMain/kotlin/com/vanniktech/emoji/twitter/TwitterEmojiProvider.kt index ad006f67e4..c742cf1083 100644 --- a/emoji-twitter/src/androidMain/kotlin/com/vanniktech/emoji/twitter/TwitterEmojiProvider.kt +++ b/emoji-twitter/src/androidMain/kotlin/com/vanniktech/emoji/twitter/TwitterEmojiProvider.kt @@ -24,8 +24,8 @@ import android.graphics.drawable.BitmapDrawable import android.graphics.drawable.Drawable import android.util.LruCache import com.vanniktech.emoji.Emoji +import com.vanniktech.emoji.EmojiAndroidProvider import com.vanniktech.emoji.EmojiCategory -import com.vanniktech.emoji.EmojiDrawableProvider import com.vanniktech.emoji.EmojiProvider import com.vanniktech.emoji.twitter.category.ActivitiesCategory import com.vanniktech.emoji.twitter.category.AnimalsAndNatureCategory @@ -37,7 +37,7 @@ import com.vanniktech.emoji.twitter.category.SymbolsCategory import com.vanniktech.emoji.twitter.category.TravelAndPlacesCategory import java.lang.ref.SoftReference -class TwitterEmojiProvider : EmojiProvider, EmojiDrawableProvider { +class TwitterEmojiProvider : EmojiProvider, EmojiAndroidProvider { override val categories: Array get() = arrayOf( SmileysAndPeopleCategory(), diff --git a/emoji/api/current.txt b/emoji/api/current.txt index 62dd2783f8..5cd67be36c 100644 --- a/emoji/api/current.txt +++ b/emoji/api/current.txt @@ -17,6 +17,11 @@ package com.vanniktech.emoji { property public abstract java.util.List variants; } + public interface EmojiAndroidProvider extends com.vanniktech.emoji.EmojiProvider { + method public android.graphics.drawable.Drawable getDrawable(com.vanniktech.emoji.Emoji emoji, android.content.Context context); + method @DrawableRes public int getIcon(com.vanniktech.emoji.EmojiCategory emojiCategory); + } + public class EmojiAutoCompleteTextView extends androidx.appcompat.widget.AppCompatAutoCompleteTextView implements com.vanniktech.emoji.EmojiDisplayable { ctor public EmojiAutoCompleteTextView(android.content.Context context, optional android.util.AttributeSet? attrs); ctor public EmojiAutoCompleteTextView(android.content.Context context); @@ -62,11 +67,6 @@ package com.vanniktech.emoji { method public void setEmojiSizeRes(@DimenRes int res, boolean shouldInvalidate); } - public interface EmojiDrawableProvider { - method public android.graphics.drawable.Drawable getDrawable(com.vanniktech.emoji.Emoji emoji, android.content.Context context); - method @DrawableRes public int getIcon(com.vanniktech.emoji.EmojiCategory emojiCategory); - } - public class EmojiEditText extends androidx.appcompat.widget.AppCompatEditText implements com.vanniktech.emoji.EmojiDisplayable { ctor public EmojiEditText(android.content.Context context, optional android.util.AttributeSet? attrs); ctor public EmojiEditText(android.content.Context context); diff --git a/emoji/src/androidMain/kotlin/com/vanniktech/emoji/EmojiDrawableProvider.kt b/emoji/src/androidMain/kotlin/com/vanniktech/emoji/EmojiAndroidProvider.kt similarity index 94% rename from emoji/src/androidMain/kotlin/com/vanniktech/emoji/EmojiDrawableProvider.kt rename to emoji/src/androidMain/kotlin/com/vanniktech/emoji/EmojiAndroidProvider.kt index 723d15054f..41e52f3981 100644 --- a/emoji/src/androidMain/kotlin/com/vanniktech/emoji/EmojiDrawableProvider.kt +++ b/emoji/src/androidMain/kotlin/com/vanniktech/emoji/EmojiAndroidProvider.kt @@ -20,7 +20,7 @@ import android.content.Context import android.graphics.drawable.Drawable import androidx.annotation.DrawableRes -interface EmojiDrawableProvider { +interface EmojiAndroidProvider : EmojiProvider { @DrawableRes fun getIcon(emojiCategory: EmojiCategory): Int fun getDrawable(emoji: Emoji, context: Context): Drawable } diff --git a/emoji/src/androidMain/kotlin/com/vanniktech/emoji/internal/Utils.kt b/emoji/src/androidMain/kotlin/com/vanniktech/emoji/internal/Utils.kt index 255db2c3a9..17e384cdb9 100644 --- a/emoji/src/androidMain/kotlin/com/vanniktech/emoji/internal/Utils.kt +++ b/emoji/src/androidMain/kotlin/com/vanniktech/emoji/internal/Utils.kt @@ -32,7 +32,7 @@ import androidx.annotation.AttrRes import androidx.annotation.ColorInt import androidx.annotation.ColorRes import androidx.core.content.ContextCompat -import com.vanniktech.emoji.EmojiDrawableProvider +import com.vanniktech.emoji.EmojiAndroidProvider import com.vanniktech.emoji.EmojiManager import kotlin.math.roundToInt @@ -147,8 +147,8 @@ internal fun EditText.hideKeyboardAndFocus() { } } -internal fun EmojiManager.emojiDrawableProvider(): EmojiDrawableProvider { +internal fun EmojiManager.emojiDrawableProvider(): EmojiAndroidProvider { val emojiProvider = emojiProvider() - require(emojiProvider is EmojiDrawableProvider) { "Your provider needs to implement EmojiDrawableProvider" } + require(emojiProvider is EmojiAndroidProvider) { "Your provider needs to implement EmojiDrawableProvider" } return emojiProvider } diff --git a/generator/index.js b/generator/index.js index 1b034a1f32..18e1be978f 100644 --- a/generator/index.js +++ b/generator/index.js @@ -388,7 +388,7 @@ async function generateCode(map, targets) { const emojiCompatTemplate = await fs.readFile("template/EmojiCompat.kt", "utf-8"); const categoryTemplate = await fs.readFile("template/Category.kt", "utf-8"); const categoryChunkTemplate = await fs.readFile("template/CategoryChunk.kt", "utf-8"); - const emojiProviderTemplate = await fs.readFile("template/EmojiProvider.kt", "utf-8"); + const emojiProviderAndroid = await fs.readFile("template/EmojiProviderAndroid.kt", "utf-8"); const emojiProviderCompatTemplate = await fs.readFile("template/EmojiProviderCompat.kt", "utf-8"); const emojiProviderJvm = await fs.readFile("template/EmojiProviderJvm.kt", "utf-8"); @@ -456,7 +456,7 @@ async function generateCode(map, targets) { }) if (target.module !== "google-compat") { - await fs.writeFile(`${srcDir}/${target.name}Provider.kt`, template(emojiProviderTemplate)({ + await fs.writeFile(`${srcDir}/${target.name}Provider.kt`, template(emojiProviderAndroid)({ package: target.package, imports: imports, name: target.name, diff --git a/generator/template/EmojiProvider.kt b/generator/template/EmojiProviderAndroid.kt similarity index 96% rename from generator/template/EmojiProvider.kt rename to generator/template/EmojiProviderAndroid.kt index 844356c5a2..90a52cbb65 100644 --- a/generator/template/EmojiProvider.kt +++ b/generator/template/EmojiProviderAndroid.kt @@ -24,13 +24,13 @@ import android.graphics.drawable.BitmapDrawable import android.graphics.drawable.Drawable import android.util.LruCache import com.vanniktech.emoji.Emoji +import com.vanniktech.emoji.EmojiAndroidProvider import com.vanniktech.emoji.EmojiCategory -import com.vanniktech.emoji.EmojiDrawableProvider import com.vanniktech.emoji.EmojiProvider <%= imports %> import java.lang.ref.SoftReference -class <%= name %>Provider : EmojiProvider, EmojiDrawableProvider { +class <%= name %>Provider : EmojiProvider, EmojiAndroidProvider { override val categories: Array get() = arrayOf(<% categories.forEach(function(category) { %> <%= category.name %>(),<% }); %> diff --git a/generator/template/EmojiProviderCompat.kt b/generator/template/EmojiProviderCompat.kt index 6de96c8a4b..3d9639a3da 100644 --- a/generator/template/EmojiProviderCompat.kt +++ b/generator/template/EmojiProviderCompat.kt @@ -21,15 +21,15 @@ import android.graphics.drawable.Drawable import android.text.Spannable import androidx.emoji.text.EmojiCompat import com.vanniktech.emoji.Emoji +import com.vanniktech.emoji.EmojiAndroidProvider import com.vanniktech.emoji.EmojiCategory -import com.vanniktech.emoji.EmojiDrawableProvider import com.vanniktech.emoji.EmojiProvider import com.vanniktech.emoji.EmojiReplacer <%= imports %> class <%= name %>Provider( @Suppress("unused") private val emojiCompat: EmojiCompat, -) : EmojiProvider, EmojiDrawableProvider, EmojiReplacer { +) : EmojiProvider, EmojiAndroidProvider, EmojiReplacer { override val categories: Array get() = arrayOf(<% categories.forEach(function(category) { %> <%= category.name %>(),<% }); %>