Skip to content

Commit

Permalink
Hide more APIs in emoji module.
Browse files Browse the repository at this point in the history
  • Loading branch information
vanniktech committed May 4, 2022
1 parent 79f3218 commit 7c84e62
Showing 5 changed files with 11 additions and 10 deletions.
Original file line number Diff line number Diff line change
@@ -20,15 +20,15 @@ import android.content.Context
import android.graphics.drawable.Drawable
import com.vanniktech.emoji.emoji.Emoji

class GoogleCompatEmoji : Emoji {
constructor(
internal class GoogleCompatEmoji : Emoji {
internal constructor(
ints: IntArray,
shortcodes: Array<String>,
isDuplicate: Boolean,
vararg emojis: Emoji
) : super(ints, shortcodes, -1, isDuplicate, *emojis)

constructor(
internal constructor(
codePoint: Int,
shortcodes: Array<String>,
isDuplicate: Boolean,
Original file line number Diff line number Diff line change
@@ -33,7 +33,7 @@ import com.vanniktech.emoji.googlecompat.category.SymbolsCategory
import com.vanniktech.emoji.googlecompat.category.TravelAndPlacesCategory

class GoogleCompatEmojiProvider(
@Suppress("unused") val emojiCompat: EmojiCompat,
@Suppress("unused") private val emojiCompat: EmojiCompat,
) : EmojiProvider, EmojiReplacer {
override val categories: Array<EmojiCategory>
get() = arrayOf(
7 changes: 4 additions & 3 deletions emoji/src/main/kotlin/com/vanniktech/emoji/EmojiManager.kt
Original file line number Diff line number Diff line change
@@ -26,18 +26,19 @@ import java.util.Collections
import java.util.LinkedHashMap
import java.util.regex.Pattern

private const val GUESSED_UNICODE_AMOUNT = 3000
private const val GUESSED_TOTAL_PATTERN_LENGTH = GUESSED_UNICODE_AMOUNT * 4

/**
* EmojiManager where an EmojiProvider can be installed for further usage.
*/
object EmojiManager {
private const val GUESSED_UNICODE_AMOUNT = 3000
private const val GUESSED_TOTAL_PATTERN_LENGTH = GUESSED_UNICODE_AMOUNT * 4

private val emojiMap: MutableMap<String, Emoji> = LinkedHashMap(GUESSED_UNICODE_AMOUNT)
private var categories: Array<EmojiCategory>? = null
private var emojiPattern: Pattern? = null
internal var emojiRepetitivePattern: Pattern? = null
private var emojiReplacer: EmojiReplacer? = null

fun replaceWithImages(context: Context?, text: Spannable?, emojiSize: Float) {
verifyInstalled()
emojiReplacer!!.replaceWithImages(context!!, text!!, emojiSize, DEFAULT_EMOJI_REPLACER)
Original file line number Diff line number Diff line change
@@ -174,7 +174,7 @@ internal class EmojiViewHolder(parent: ViewGroup) : RecyclerView.ViewHolder(Layo
val shortCodes: TextView by lazy(LazyThreadSafetyMode.NONE) { itemView.findViewById(R.id.shortCodes) }
}

class DiffUtilHelper<T>(
internal class DiffUtilHelper<T>(
private val old: List<T>,
private val new: List<T>,
private val id: (T) -> Int
Original file line number Diff line number Diff line change
@@ -106,7 +106,7 @@ class RecentEmojiManager(
private const val TIME_DELIMITER = ";"
private const val EMOJI_DELIMITER = "~"
private const val RECENT_EMOJIS = "recent-emojis"
const val EMOJI_GUESS_SIZE = 5
const val MAX_RECENTS = 40
internal const val EMOJI_GUESS_SIZE = 5
internal const val MAX_RECENTS = 40
}
}

0 comments on commit 7c84e62

Please sign in to comment.