- 「アプリ設定/見た目/アプリ内蔵のUnicode絵文字を使う」を削除
- 「アプリ設定/見た目/Twemoji絵文字を使う」を追加 - Unicode絵文字を表示する場所でTwemojiとNotoColorEmojiCompatの使い分け - 依存関係の追加/更新 androidx.annotation:annotation androidx.appcompat:appcompat androidx.emoji2:emoji2 androidx.emoji2:emoji2-bundled androidx.emoji2:emoji2-views androidx.emoji2:emoji2-views-helper com.google.android.exoplayer:exoplayer
This commit is contained in:
parent
e9eab2b7fb
commit
ed3d8a66b9
|
@ -137,9 +137,14 @@ dependencies {
|
||||||
implementation project(':emoji')
|
implementation project(':emoji')
|
||||||
implementation project(':apng_android')
|
implementation project(':apng_android')
|
||||||
|
|
||||||
|
|
||||||
implementation "androidx.appcompat:appcompat:$appcompat_version"
|
implementation "androidx.appcompat:appcompat:$appcompat_version"
|
||||||
|
|
||||||
|
def emojiVersion = "1.0.0-rc01"
|
||||||
|
implementation "androidx.emoji2:emoji2:$emojiVersion"
|
||||||
|
implementation "androidx.emoji2:emoji2-bundled:$emojiVersion"
|
||||||
|
implementation "androidx.emoji2:emoji2-views:$emojiVersion"
|
||||||
|
implementation "androidx.emoji2:emoji2-views-helper:$emojiVersion"
|
||||||
|
|
||||||
// DrawerLayout
|
// DrawerLayout
|
||||||
implementation "androidx.drawerlayout:drawerlayout:1.1.1"
|
implementation "androidx.drawerlayout:drawerlayout:1.1.1"
|
||||||
|
|
||||||
|
@ -157,7 +162,7 @@ dependencies {
|
||||||
// Recyclerview
|
// Recyclerview
|
||||||
implementation "androidx.recyclerview:recyclerview:1.2.1"
|
implementation "androidx.recyclerview:recyclerview:1.2.1"
|
||||||
|
|
||||||
kapt 'androidx.annotation:annotation:1.2.0'
|
kapt 'androidx.annotation:annotation:1.3.0'
|
||||||
|
|
||||||
// https://firebase.google.com/support/release-notes/android
|
// https://firebase.google.com/support/release-notes/android
|
||||||
implementation "com.google.firebase:firebase-messaging:23.0.0"
|
implementation "com.google.firebase:firebase-messaging:23.0.0"
|
||||||
|
@ -228,7 +233,7 @@ dependencies {
|
||||||
|
|
||||||
implementation 'com.astuetz:pagerslidingtabstrip:1.0.1'
|
implementation 'com.astuetz:pagerslidingtabstrip:1.0.1'
|
||||||
|
|
||||||
implementation 'com.google.android.exoplayer:exoplayer:2.15.1'
|
implementation 'com.google.android.exoplayer:exoplayer:2.16.0'
|
||||||
/*
|
/*
|
||||||
WARNING: [Processor] Library '…\exoplayer-ui-2.12.0.aar' contains references to both AndroidX and old support library. This seems like the library is partially migrated. Jetifier will try to rewrite the library anyway.
|
WARNING: [Processor] Library '…\exoplayer-ui-2.12.0.aar' contains references to both AndroidX and old support library. This seems like the library is partially migrated. Jetifier will try to rewrite the library anyway.
|
||||||
Example of androidX reference: 'androidx/core/app/NotificationCompat$Builder'
|
Example of androidX reference: 'androidx/core/app/NotificationCompat$Builder'
|
||||||
|
|
|
@ -343,7 +343,7 @@ class ActMain : AppCompatActivity(),
|
||||||
density = appState.density
|
density = appState.density
|
||||||
completionHelper = CompletionHelper(this, pref, appState.handler)
|
completionHelper = CompletionHelper(this, pref, appState.handler)
|
||||||
|
|
||||||
EmojiDecoder.handleUnicodeEmoji = PrefB.bpInAppUnicodeEmoji(pref)
|
EmojiDecoder.useTwemoji = PrefB.bpUseTwemoji(pref)
|
||||||
|
|
||||||
acctPadLr = (0.5f + 4f * density).toInt()
|
acctPadLr = (0.5f + 4f * density).toInt()
|
||||||
reloadTextSize()
|
reloadTextSize()
|
||||||
|
|
|
@ -12,9 +12,10 @@ import android.widget.ImageButton
|
||||||
import android.widget.ImageView
|
import android.widget.ImageView
|
||||||
import androidx.annotation.DrawableRes
|
import androidx.annotation.DrawableRes
|
||||||
import androidx.core.content.ContextCompat
|
import androidx.core.content.ContextCompat
|
||||||
import jp.juggler.subwaytooter.emoji.EmojiMap
|
|
||||||
import jp.juggler.subwaytooter.api.entity.TootAccount
|
import jp.juggler.subwaytooter.api.entity.TootAccount
|
||||||
import jp.juggler.subwaytooter.api.entity.TootVisibility
|
import jp.juggler.subwaytooter.api.entity.TootVisibility
|
||||||
|
import jp.juggler.subwaytooter.emoji.EmojiMap
|
||||||
|
import jp.juggler.subwaytooter.pref.PrefB
|
||||||
import jp.juggler.subwaytooter.pref.PrefI
|
import jp.juggler.subwaytooter.pref.PrefI
|
||||||
import jp.juggler.subwaytooter.pref.pref
|
import jp.juggler.subwaytooter.pref.pref
|
||||||
import jp.juggler.subwaytooter.span.EmojiImageSpan
|
import jp.juggler.subwaytooter.span.EmojiImageSpan
|
||||||
|
@ -384,14 +385,24 @@ fun SpannableStringBuilder.appendMisskeyReaction(
|
||||||
emojiUtf16: String,
|
emojiUtf16: String,
|
||||||
text: String
|
text: String
|
||||||
): SpannableStringBuilder {
|
): SpannableStringBuilder {
|
||||||
val start = this.length
|
|
||||||
this.append(text)
|
|
||||||
val end = this.length
|
|
||||||
|
|
||||||
|
val emoji = EmojiMap.unicodeMap[emojiUtf16]
|
||||||
|
when {
|
||||||
|
emoji == null ->
|
||||||
|
append("text")
|
||||||
|
|
||||||
|
PrefB.bpUseTwemoji(context) -> {
|
||||||
|
val start = this.length
|
||||||
|
append(text)
|
||||||
|
val end = this.length
|
||||||
this.setSpan(
|
this.setSpan(
|
||||||
EmojiMap.unicodeMap[emojiUtf16]!!.createSpan(context),
|
emoji.createSpan(context),
|
||||||
start, end,
|
start, end,
|
||||||
Spanned.SPAN_EXCLUSIVE_EXCLUSIVE
|
Spanned.SPAN_EXCLUSIVE_EXCLUSIVE
|
||||||
)
|
)
|
||||||
|
}
|
||||||
|
else ->
|
||||||
|
this.append(emoji.unifiedCode)
|
||||||
|
}
|
||||||
return this
|
return this
|
||||||
}
|
}
|
||||||
|
|
|
@ -784,7 +784,7 @@ val appSettingRoot = AppSettingItem(null, SettingType.Section, R.string.app_sett
|
||||||
sw(PrefB.bpEmojioneShortcode, R.string.emojione_shortcode_support) {
|
sw(PrefB.bpEmojioneShortcode, R.string.emojione_shortcode_support) {
|
||||||
desc = R.string.emojione_shortcode_support_desc
|
desc = R.string.emojione_shortcode_support_desc
|
||||||
}
|
}
|
||||||
sw(PrefB.bpInAppUnicodeEmoji, R.string.in_app_unicode_emoji)
|
sw(PrefB.bpUseTwemoji, R.string.use_twemoji_emoji)
|
||||||
|
|
||||||
sw(PrefB.bpKeepReactionSpace, R.string.keep_reaction_space)
|
sw(PrefB.bpKeepReactionSpace, R.string.keep_reaction_space)
|
||||||
}
|
}
|
||||||
|
|
|
@ -568,36 +568,47 @@ internal class ViewHolderHeaderProfile(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun encodeAcctText(who: TootAccount, whoDetail: TootAccount?) = SpannableStringBuilder().apply {
|
private fun encodeAcctText(who: TootAccount, whoDetail: TootAccount?) =
|
||||||
|
SpannableStringBuilder().apply {
|
||||||
append("@")
|
append("@")
|
||||||
append(accessInfo.getFullAcct(who).pretty)
|
append(accessInfo.getFullAcct(who).pretty)
|
||||||
if (whoDetail?.locked ?: who.locked) {
|
if (whoDetail?.locked ?: who.locked) {
|
||||||
append(" ")
|
append(" ")
|
||||||
val emoji = EmojiMap.shortNameMap["lock"]
|
val emoji = EmojiMap.shortNameMap["lock"]
|
||||||
if (emoji != null) {
|
when {
|
||||||
appendSpan("locked", emoji.createSpan(activity))
|
emoji == null ->
|
||||||
} else {
|
|
||||||
append("locked")
|
append("locked")
|
||||||
|
PrefB.bpUseTwemoji(App1.pref) ->
|
||||||
|
appendSpan("locked", emoji.createSpan(activity))
|
||||||
|
else ->
|
||||||
|
append(emoji.unifiedCode)
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (who.bot) {
|
if (who.bot) {
|
||||||
append(" ")
|
append(" ")
|
||||||
val emoji = EmojiMap.shortNameMap["robot_face"]
|
val emoji = EmojiMap.shortNameMap["robot_face"]
|
||||||
if (emoji != null) {
|
when {
|
||||||
appendSpan("bot", emoji.createSpan(activity))
|
emoji == null ->
|
||||||
} else {
|
|
||||||
append("bot")
|
append("bot")
|
||||||
|
PrefB.bpUseTwemoji(App1.pref) ->
|
||||||
|
appendSpan("bot", emoji.createSpan(activity))
|
||||||
|
else ->
|
||||||
|
append(emoji.unifiedCode)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (who.suspended) {
|
if (who.suspended) {
|
||||||
append(" ")
|
append(" ")
|
||||||
val emoji = EmojiMap.shortNameMap["cross_mark"]
|
val emoji = EmojiMap.shortNameMap["cross_mark"]
|
||||||
if (emoji != null) {
|
when {
|
||||||
appendSpan("suspended", emoji.createSpan(activity))
|
emoji == null ->
|
||||||
} else {
|
|
||||||
append("suspended")
|
append("suspended")
|
||||||
|
PrefB.bpUseTwemoji(App1.pref) ->
|
||||||
|
appendSpan("suspended", emoji.createSpan(activity))
|
||||||
|
else ->
|
||||||
|
append(emoji.unifiedCode)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,6 +6,7 @@ import android.app.Dialog
|
||||||
import android.graphics.Typeface
|
import android.graphics.Typeface
|
||||||
import android.graphics.drawable.PictureDrawable
|
import android.graphics.drawable.PictureDrawable
|
||||||
import android.util.SparseArray
|
import android.util.SparseArray
|
||||||
|
import android.util.TypedValue
|
||||||
import android.view.*
|
import android.view.*
|
||||||
import android.widget.*
|
import android.widget.*
|
||||||
import androidx.annotation.StringRes
|
import androidx.annotation.StringRes
|
||||||
|
@ -463,8 +464,13 @@ class EmojiPicker(
|
||||||
val view: View
|
val view: View
|
||||||
val item = page.emojiList[position]
|
val item = page.emojiList[position]
|
||||||
var unicodeEmoji = item.unicodeEmoji
|
var unicodeEmoji = item.unicodeEmoji
|
||||||
if (unicodeEmoji != null) {
|
if (unicodeEmoji == null) {
|
||||||
|
view = viewOld ?: NetworkEmojiView(activity).apply {
|
||||||
|
layoutParams = AbsListView.LayoutParams(wh, wh)
|
||||||
|
}
|
||||||
|
view.setTag(R.id.btnAbout, item)
|
||||||
|
(view as? NetworkEmojiView)?.setEmoji(customEmojiMap[item.name]?.url)
|
||||||
|
} else if(PrefB.bpUseTwemoji(App1.pref)){
|
||||||
view = viewOld
|
view = viewOld
|
||||||
?: ImageView(activity).apply {
|
?: ImageView(activity).apply {
|
||||||
layoutParams = AbsListView.LayoutParams(wh, wh)
|
layoutParams = AbsListView.LayoutParams(wh, wh)
|
||||||
|
@ -486,12 +492,22 @@ class EmojiPicker(
|
||||||
.into(view)
|
.into(view)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
}else{
|
||||||
view = viewOld ?: NetworkEmojiView(activity).apply {
|
view = viewOld
|
||||||
|
?: TextView(activity).apply {
|
||||||
layoutParams = AbsListView.LayoutParams(wh, wh)
|
layoutParams = AbsListView.LayoutParams(wh, wh)
|
||||||
}
|
}
|
||||||
|
|
||||||
view.setTag(R.id.btnAbout, item)
|
view.setTag(R.id.btnAbout, item)
|
||||||
(view as? NetworkEmojiView)?.setEmoji(customEmojiMap[item.name]?.url)
|
|
||||||
|
if (view is TextView && view.activity?.isDestroyed == false) {
|
||||||
|
if (page.hasSkinTone) unicodeEmoji = applySkinTone(unicodeEmoji)
|
||||||
|
|
||||||
|
view.text = unicodeEmoji.unifiedCode
|
||||||
|
view.gravity = Gravity.CENTER
|
||||||
|
view.setLineSpacing(0f,0f)
|
||||||
|
view.setTextSize(TypedValue.COMPLEX_UNIT_PX, wh.toFloat()*0.7f)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return view
|
return view
|
||||||
|
|
|
@ -319,9 +319,9 @@ object PrefB {
|
||||||
false
|
false
|
||||||
)
|
)
|
||||||
|
|
||||||
val bpInAppUnicodeEmoji = BooleanPref(
|
val bpUseTwemoji = BooleanPref(
|
||||||
"InAppUnicodeEmoji",
|
"UseTwemoji",
|
||||||
true
|
false
|
||||||
)
|
)
|
||||||
|
|
||||||
val bpKeepReactionSpace = BooleanPref(
|
val bpKeepReactionSpace = BooleanPref(
|
||||||
|
|
|
@ -8,14 +8,16 @@ import android.text.style.ReplacementSpan
|
||||||
import androidx.annotation.IntRange
|
import androidx.annotation.IntRange
|
||||||
import com.caverock.androidsvg.SVG
|
import com.caverock.androidsvg.SVG
|
||||||
import jp.juggler.subwaytooter.emoji.UnicodeEmoji
|
import jp.juggler.subwaytooter.emoji.UnicodeEmoji
|
||||||
|
import jp.juggler.subwaytooter.pref.PrefB
|
||||||
import jp.juggler.util.LogCategory
|
import jp.juggler.util.LogCategory
|
||||||
|
|
||||||
// 絵文字リソースの種類によって異なるスパンを作る
|
// 絵文字リソースの種類によって異なるスパンを作る
|
||||||
fun UnicodeEmoji.createSpan(context: Context, scale: Float = 1f) = if (isSvg) {
|
fun UnicodeEmoji.createSpan(context: Context, scale: Float = 1f) =
|
||||||
|
if (isSvg) {
|
||||||
SvgEmojiSpan(context, assetsName!!, scale = scale)
|
SvgEmojiSpan(context, assetsName!!, scale = scale)
|
||||||
} else {
|
} else {
|
||||||
EmojiImageSpan(context, drawableId, scale = scale)
|
EmojiImageSpan(context, drawableId, scale = scale)
|
||||||
}
|
}
|
||||||
|
|
||||||
// SVG絵文字スパン
|
// SVG絵文字スパン
|
||||||
class SvgEmojiSpan internal constructor(
|
class SvgEmojiSpan internal constructor(
|
||||||
|
|
|
@ -7,11 +7,11 @@ import android.text.Spanned
|
||||||
import android.util.SparseBooleanArray
|
import android.util.SparseBooleanArray
|
||||||
import androidx.annotation.DrawableRes
|
import androidx.annotation.DrawableRes
|
||||||
import jp.juggler.subwaytooter.App1
|
import jp.juggler.subwaytooter.App1
|
||||||
import jp.juggler.subwaytooter.pref.PrefB
|
|
||||||
import jp.juggler.subwaytooter.R
|
import jp.juggler.subwaytooter.R
|
||||||
import jp.juggler.subwaytooter.emoji.CustomEmoji
|
import jp.juggler.subwaytooter.emoji.CustomEmoji
|
||||||
import jp.juggler.subwaytooter.emoji.EmojiMap
|
import jp.juggler.subwaytooter.emoji.EmojiMap
|
||||||
import jp.juggler.subwaytooter.emoji.UnicodeEmoji
|
import jp.juggler.subwaytooter.emoji.UnicodeEmoji
|
||||||
|
import jp.juggler.subwaytooter.pref.PrefB
|
||||||
import jp.juggler.subwaytooter.pref.pref
|
import jp.juggler.subwaytooter.pref.pref
|
||||||
import jp.juggler.subwaytooter.span.EmojiImageSpan
|
import jp.juggler.subwaytooter.span.EmojiImageSpan
|
||||||
import jp.juggler.subwaytooter.span.HighlightSpan
|
import jp.juggler.subwaytooter.span.HighlightSpan
|
||||||
|
@ -32,9 +32,10 @@ object EmojiDecoder {
|
||||||
|
|
||||||
private const val cpZwsp = '\u200B'.code
|
private const val cpZwsp = '\u200B'.code
|
||||||
|
|
||||||
var handleUnicodeEmoji = true
|
var useTwemoji = true
|
||||||
|
|
||||||
fun customEmojiSeparator(pref: SharedPreferences) = if (PrefB.bpCustomEmojiSeparatorZwsp(pref)) {
|
fun customEmojiSeparator(pref: SharedPreferences) =
|
||||||
|
if (PrefB.bpCustomEmojiSeparatorZwsp(pref)) {
|
||||||
'\u200B'
|
'\u200B'
|
||||||
} else {
|
} else {
|
||||||
' '
|
' '
|
||||||
|
@ -168,10 +169,12 @@ object EmojiDecoder {
|
||||||
|
|
||||||
fun addImageSpan(text: String, emoji: UnicodeEmoji) {
|
fun addImageSpan(text: String, emoji: UnicodeEmoji) {
|
||||||
val context = options.context
|
val context = options.context
|
||||||
if (context == null) {
|
when {
|
||||||
|
context == null -> {
|
||||||
openNormalText()
|
openNormalText()
|
||||||
sb.append(text)
|
sb.append(text)
|
||||||
} else {
|
}
|
||||||
|
PrefB.bpUseTwemoji(context) -> {
|
||||||
closeNormalText()
|
closeNormalText()
|
||||||
val start = sb.length
|
val start = sb.length
|
||||||
sb.append(text)
|
sb.append(text)
|
||||||
|
@ -183,11 +186,16 @@ object EmojiDecoder {
|
||||||
Spanned.SPAN_EXCLUSIVE_EXCLUSIVE
|
Spanned.SPAN_EXCLUSIVE_EXCLUSIVE
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
else -> {
|
||||||
|
openNormalText()
|
||||||
|
sb.append(emoji.unifiedCode)
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fun addUnicodeString(s: String) {
|
fun addUnicodeString(s: String) {
|
||||||
|
|
||||||
if (!handleUnicodeEmoji) {
|
if (!useTwemoji) {
|
||||||
openNormalText()
|
openNormalText()
|
||||||
sb.append(s)
|
sb.append(s)
|
||||||
return
|
return
|
||||||
|
@ -466,6 +474,8 @@ object EmojiDecoder {
|
||||||
val emoji = EmojiMap.shortNameMap[shortCode] ?: continue
|
val emoji = EmojiMap.shortNameMap[shortCode] ?: continue
|
||||||
|
|
||||||
val sb = SpannableStringBuilder()
|
val sb = SpannableStringBuilder()
|
||||||
|
|
||||||
|
if(PrefB.bpUseTwemoji(context)){
|
||||||
val start = 0
|
val start = 0
|
||||||
sb.append(' ')
|
sb.append(' ')
|
||||||
val end = sb.length
|
val end = sb.length
|
||||||
|
@ -476,6 +486,9 @@ object EmojiDecoder {
|
||||||
end,
|
end,
|
||||||
Spanned.SPAN_EXCLUSIVE_EXCLUSIVE
|
Spanned.SPAN_EXCLUSIVE_EXCLUSIVE
|
||||||
)
|
)
|
||||||
|
}else{
|
||||||
|
sb.append(emoji.unifiedCode)
|
||||||
|
}
|
||||||
|
|
||||||
sb.append(' ')
|
sb.append(' ')
|
||||||
.append(':')
|
.append(':')
|
||||||
|
|
|
@ -1101,4 +1101,5 @@
|
||||||
<string name="mfm_show_unsupported_markup">(Misskey)未対応のマークアップを表示する</string>
|
<string name="mfm_show_unsupported_markup">(Misskey)未対応のマークアップを表示する</string>
|
||||||
<string name="show_media_description">添付メディアの説明文を表示する</string>
|
<string name="show_media_description">添付メディアの説明文を表示する</string>
|
||||||
<string name="background_pattern">背景パターン</string>
|
<string name="background_pattern">背景パターン</string>
|
||||||
|
<string name="use_twemoji_emoji">Twemoji絵文字を使う</string>
|
||||||
</resources>
|
</resources>
|
||||||
|
|
|
@ -1112,4 +1112,5 @@
|
||||||
<string name="mfm_show_unsupported_markup">(Misskey)Show unsupported markups</string>
|
<string name="mfm_show_unsupported_markup">(Misskey)Show unsupported markups</string>
|
||||||
<string name="show_media_description">Show media description</string>
|
<string name="show_media_description">Show media description</string>
|
||||||
<string name="background_pattern">Background pattern</string>
|
<string name="background_pattern">Background pattern</string>
|
||||||
|
<string name="use_twemoji_emoji">Use Twemoji emoji</string>
|
||||||
</resources>
|
</resources>
|
||||||
|
|
|
@ -6,7 +6,7 @@ buildscript {
|
||||||
ext.target_sdk_version = 31
|
ext.target_sdk_version = 31
|
||||||
ext.compile_sdk_version = 31
|
ext.compile_sdk_version = 31
|
||||||
|
|
||||||
ext.appcompat_version = '1.3.1'
|
ext.appcompat_version = '1.4.0-rc01'
|
||||||
ext.lifecycle_version = "2.4.0"
|
ext.lifecycle_version = "2.4.0"
|
||||||
ext.arch_version = "2.1.0"
|
ext.arch_version = "2.1.0"
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue