Add EmojiCompat

This commit is contained in:
Mygod
2019-01-31 20:40:24 +08:00
parent 5999ab66d1
commit 08ab6a54ff
7 changed files with 69 additions and 11 deletions

View File

@@ -15,7 +15,6 @@ import be.mygod.vpnhotspot.room.ClientRecord
import be.mygod.vpnhotspot.room.macToString
import be.mygod.vpnhotspot.util.makeIpSpan
import be.mygod.vpnhotspot.util.makeMacSpan
import be.mygod.vpnhotspot.util.onEmpty
import java.net.InetAddress
import java.util.*
@@ -43,8 +42,10 @@ open class Client(val mac: Long, val iface: String) {
* we hijack the get title process to check if we need to perform MacLookup,
* as record might not be initialized in other more appropriate places
*/
if (record?.nickname.isNullOrEmpty() && record?.macLookupPending != false) MacLookup.perform(mac)
SpannableStringBuilder(record?.nickname.onEmpty(macIface)).apply {
SpannableStringBuilder(if (record?.nickname.isNullOrEmpty()) {
if (record?.macLookupPending != false) MacLookup.perform(mac)
macIface
} else emojize(record?.nickname)).apply {
if (record?.blocked == true) {
setSpan(StrikethroughSpan(), 0, length, Spanned.SPAN_INCLUSIVE_INCLUSIVE)
}