2018-01-04 19:52:25 +01:00
|
|
|
package jp.juggler.subwaytooter.util
|
|
|
|
|
|
|
|
import android.content.Context
|
|
|
|
import android.text.Spannable
|
|
|
|
import android.text.SpannableStringBuilder
|
|
|
|
|
|
|
|
import jp.juggler.subwaytooter.api.entity.CustomEmoji
|
|
|
|
import jp.juggler.subwaytooter.api.entity.NicoProfileEmoji
|
|
|
|
import jp.juggler.subwaytooter.api.entity.TootAttachmentLike
|
|
|
|
import jp.juggler.subwaytooter.table.HighlightWord
|
2018-01-11 10:31:25 +01:00
|
|
|
import java.util.HashMap
|
2018-01-04 19:52:25 +01:00
|
|
|
|
|
|
|
@Suppress("MemberVisibilityCanPrivate")
|
|
|
|
class DecodeOptions(
|
2018-01-10 16:47:35 +01:00
|
|
|
var short : Boolean = false,
|
2018-01-04 19:52:25 +01:00
|
|
|
var decodeEmoji : Boolean = false,
|
2018-01-10 16:47:35 +01:00
|
|
|
var attachmentList : ArrayList<TootAttachmentLike>? = null,
|
2018-01-04 19:52:25 +01:00
|
|
|
var linkTag : Any? = null,
|
2018-01-11 10:31:25 +01:00
|
|
|
var emojiMapCustom : HashMap<String, CustomEmoji>? = null,
|
|
|
|
var emojiMapProfile : HashMap<String, NicoProfileEmoji>? = null,
|
|
|
|
var highlightTrie : WordTrieTree? = null
|
2018-01-04 19:52:25 +01:00
|
|
|
) {
|
|
|
|
|
2018-01-11 10:31:25 +01:00
|
|
|
// OUTPUT: true if highlight found
|
2018-01-04 19:52:25 +01:00
|
|
|
var hasHighlight : Boolean = false
|
2018-01-10 16:47:35 +01:00
|
|
|
|
2018-01-11 10:31:25 +01:00
|
|
|
// OUTPUT: highlight found with sound
|
2018-01-04 19:52:25 +01:00
|
|
|
var highlight_sound : HighlightWord? = null
|
|
|
|
|
|
|
|
////////////////////////
|
|
|
|
// decoder
|
|
|
|
|
|
|
|
fun decodeHTML(context : Context?, lcc : LinkClickContext?, html : String?) : SpannableStringBuilder {
|
|
|
|
return HTMLDecoder.decodeHTML(context, lcc, html, this)
|
|
|
|
}
|
|
|
|
|
|
|
|
fun decodeEmoji(context : Context, s : String?) : Spannable {
|
2018-01-10 16:47:35 +01:00
|
|
|
return EmojiDecoder.decodeEmoji(context, s ?: "", this)
|
2018-01-04 19:52:25 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|