Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
A
AloqaIM-Android
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
AloqaIM-Android
Commits
28ce73af
Commit
28ce73af
authored
Feb 02, 2019
by
dev-ritik
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixes custom emoji alias issue
parent
cf7ffd51
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
3 deletions
+17
-3
build.gradle
emoji/build.gradle
+1
-0
EmojiParser.kt
emoji/src/main/java/chat/rocket/android/emoji/EmojiParser.kt
+16
-3
No files found.
emoji/build.gradle
View file @
28ce73af
...
@@ -41,6 +41,7 @@ dependencies {
...
@@ -41,6 +41,7 @@ dependencies {
implementation
libraries
.
recyclerview
implementation
libraries
.
recyclerview
implementation
libraries
.
material
implementation
libraries
.
material
implementation
libraries
.
glide
implementation
libraries
.
glide
implementation
libraries
.
timber
kapt
libraries
.
glideProcessor
kapt
libraries
.
glideProcessor
implementation
libraries
.
room
implementation
libraries
.
room
kapt
libraries
.
roomProcessor
kapt
libraries
.
roomProcessor
...
...
emoji/src/main/java/chat/rocket/android/emoji/EmojiParser.kt
View file @
28ce73af
...
@@ -7,13 +7,13 @@ import android.text.Spannable
...
@@ -7,13 +7,13 @@ import android.text.Spannable
import
android.text.SpannableString
import
android.text.SpannableString
import
android.text.Spanned
import
android.text.Spanned
import
android.text.style.ImageSpan
import
android.text.style.ImageSpan
import
android.util.Log
import
chat.rocket.android.emoji.internal.GlideApp
import
chat.rocket.android.emoji.internal.GlideApp
import
com.bumptech.glide.load.engine.DiskCacheStrategy
import
com.bumptech.glide.load.engine.DiskCacheStrategy
import
com.bumptech.glide.load.resource.gif.GifDrawable
import
com.bumptech.glide.load.resource.gif.GifDrawable
import
kotlinx.coroutines.experimental.CommonPool
import
kotlinx.coroutines.experimental.CommonPool
import
kotlinx.coroutines.experimental.Deferred
import
kotlinx.coroutines.experimental.Deferred
import
kotlinx.coroutines.experimental.async
import
kotlinx.coroutines.experimental.async
import
timber.log.Timber
class
EmojiParser
{
class
EmojiParser
{
...
@@ -81,7 +81,7 @@ class EmojiParser {
...
@@ -81,7 +81,7 @@ class EmojiParser {
return
spannable
.
also
{
sp
->
return
spannable
.
also
{
sp
->
regex
.
findAll
(
spannable
).
iterator
().
forEach
{
match
->
regex
.
findAll
(
spannable
).
iterator
().
forEach
{
match
->
customEmojis
.
find
{
it
.
shortname
.
toLowerCase
()
==
match
.
value
.
toLowerCase
(
)
}
?.
let
{
emoji
->
customEmojis
.
find
{
matchEmoji
(
it
,
match
.
value
)
}
?.
let
{
emoji
->
emoji
.
url
?.
let
{
url
->
emoji
.
url
?.
let
{
url
->
try
{
try
{
val
glideRequest
=
if
(
url
.
endsWith
(
"gif"
,
true
))
{
val
glideRequest
=
if
(
url
.
endsWith
(
"gif"
,
true
))
{
...
@@ -107,7 +107,7 @@ class EmojiParser {
...
@@ -107,7 +107,7 @@ class EmojiParser {
}
}
}
}
}
catch
(
ex
:
Throwable
)
{
}
catch
(
ex
:
Throwable
)
{
Log
.
e
(
"EmojiParser"
,
""
,
ex
)
Timber
.
e
(
ex
)
}
}
}
}
}
}
...
@@ -115,6 +115,19 @@ class EmojiParser {
...
@@ -115,6 +115,19 @@ class EmojiParser {
}
}
}
}
private
fun
matchEmoji
(
it
:
Emoji
,
text
:
String
):
Boolean
{
if
(
it
.
shortname
==
text
)
{
return
true
}
else
{
it
.
shortnameAlternates
.
forEach
{
if
(
":$it:"
==
text
)
{
return
true
}
}
return
false
}
}
fun
parseAsync
(
fun
parseAsync
(
context
:
Context
,
context
:
Context
,
text
:
CharSequence
,
text
:
CharSequence
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment