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
7547473f
Commit
7547473f
authored
Jul 31, 2018
by
Leonardo Aramaki
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Properly configure glide lib with kapt
parent
7d61df3b
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
28 additions
and
10 deletions
+28
-10
dependencies.gradle
dependencies.gradle
+1
-1
build.gradle
emoji/build.gradle
+2
-1
EmojiParser.kt
emoji/src/main/java/chat/rocket/android/emoji/EmojiParser.kt
+6
-7
EmojiGlideModule.kt
...va/chat/rocket/android/emoji/internal/EmojiGlideModule.kt
+15
-0
EmojiPagerAdapter.kt
...a/chat/rocket/android/emoji/internal/EmojiPagerAdapter.kt
+4
-1
No files found.
dependencies.gradle
View file @
7547473f
...
@@ -46,7 +46,7 @@ ext {
...
@@ -46,7 +46,7 @@ ext {
frescoImageViewer
:
'0.5.1'
,
frescoImageViewer
:
'0.5.1'
,
markwon
:
'1.0.6'
,
markwon
:
'1.0.6'
,
aVLoadingIndicatorView:
'2.1.3'
,
aVLoadingIndicatorView:
'2.1.3'
,
glide
:
'4.
7.1
'
,
glide
:
'4.
8.0-SNAPSHOT
'
,
// For wearable
// For wearable
wear
:
'2.3.0'
,
wear
:
'2.3.0'
,
...
...
emoji/build.gradle
View file @
7547473f
apply
plugin:
'com.android.library'
apply
plugin:
'com.android.library'
apply
plugin:
'kotlin-android'
apply
plugin:
'kotlin-android'
apply
plugin:
'kotlin-android-extensions'
apply
plugin:
'kotlin-android-extensions'
apply
plugin:
'kotlin-kapt'
android
{
android
{
compileSdkVersion
versions
.
compileSdk
compileSdkVersion
versions
.
compileSdk
...
@@ -35,7 +36,7 @@ dependencies {
...
@@ -35,7 +36,7 @@ dependencies {
implementation
libraries
.
recyclerview
implementation
libraries
.
recyclerview
implementation
libraries
.
material
implementation
libraries
.
material
implementation
libraries
.
glide
implementation
libraries
.
glide
annotationProcessor
libraries
.
glideProcessor
kapt
libraries
.
glideProcessor
}
}
kotlin
{
kotlin
{
...
...
emoji/src/main/java/chat/rocket/android/emoji/EmojiParser.kt
View file @
7547473f
...
@@ -8,6 +8,7 @@ import android.text.SpannableString
...
@@ -8,6 +8,7 @@ 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
android.util.Log
import
chat.rocket.android.emoji.internal.GlideApp
import
com.bumptech.glide.Glide
import
com.bumptech.glide.Glide
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
...
@@ -73,7 +74,7 @@ class EmojiParser {
...
@@ -73,7 +74,7 @@ class EmojiParser {
val
customEmojis
=
EmojiRepository
.
getCustomEmojis
()
val
customEmojis
=
EmojiRepository
.
getCustomEmojis
()
val
density
=
context
.
resources
.
displayMetrics
.
density
val
density
=
context
.
resources
.
displayMetrics
.
density
val
px
=
(
2
4
*
density
).
toInt
()
val
px
=
(
2
2
*
density
).
toInt
()
return
spannable
.
also
{
return
spannable
.
also
{
regex
.
findAll
(
spannable
).
iterator
().
forEach
{
match
->
regex
.
findAll
(
spannable
).
iterator
().
forEach
{
match
->
...
@@ -81,15 +82,13 @@ class EmojiParser {
...
@@ -81,15 +82,13 @@ class EmojiParser {
it
.
url
?.
let
{
url
->
it
.
url
?.
let
{
url
->
try
{
try
{
val
glideRequest
=
if
(
url
.
endsWith
(
"gif"
,
true
))
{
val
glideRequest
=
if
(
url
.
endsWith
(
"gif"
,
true
))
{
Glide
.
with
(
context
).
asGif
()
Glide
App
.
with
(
context
).
asGif
()
}
else
{
}
else
{
Glide
.
with
(
context
).
asBitmap
()
Glide
App
.
with
(
context
).
asBitmap
()
}
}
val
futureTarget
=
glideRequest
val
futureTarget
=
glideRequest
.
apply
(
RequestOptions
()
.
diskCacheStrategy
(
DiskCacheStrategy
.
ALL
)
.
diskCacheStrategy
(
DiskCacheStrategy
.
ALL
)
.
onlyRetrieveFromCache
(
true
))
.
load
(
url
)
.
load
(
url
)
.
submit
(
px
,
px
)
.
submit
(
px
,
px
)
...
@@ -99,7 +98,7 @@ class EmojiParser {
...
@@ -99,7 +98,7 @@ class EmojiParser {
spannable
.
setSpan
(
ImageSpan
(
context
,
image
),
range
.
start
,
spannable
.
setSpan
(
ImageSpan
(
context
,
image
),
range
.
start
,
range
.
endInclusive
+
1
,
Spanned
.
SPAN_EXCLUSIVE_EXCLUSIVE
)
range
.
endInclusive
+
1
,
Spanned
.
SPAN_EXCLUSIVE_EXCLUSIVE
)
}
else
if
(
image
is
GifDrawable
)
{
}
else
if
(
image
is
GifDrawable
)
{
image
.
setBounds
(
0
,
0
,
px
,
px
)
image
.
setBounds
(
0
,
0
,
image
.
intrinsicWidth
,
image
.
intrinsicHeight
)
spannable
.
setSpan
(
ImageSpan
(
image
),
range
.
start
,
spannable
.
setSpan
(
ImageSpan
(
image
),
range
.
start
,
range
.
endInclusive
+
1
,
Spanned
.
SPAN_EXCLUSIVE_EXCLUSIVE
)
range
.
endInclusive
+
1
,
Spanned
.
SPAN_EXCLUSIVE_EXCLUSIVE
)
}
}
...
...
emoji/src/main/java/chat/rocket/android/emoji/internal/EmojiGlideModule.kt
0 → 100644
View file @
7547473f
package
chat.rocket.android.emoji.internal
import
android.content.Context
import
com.bumptech.glide.GlideBuilder
import
com.bumptech.glide.annotation.GlideModule
import
com.bumptech.glide.load.engine.cache.ExternalPreferredCacheDiskCacheFactory
import
com.bumptech.glide.module.AppGlideModule
@GlideModule
class
EmojiGlideModule
:
AppGlideModule
()
{
override
fun
applyOptions
(
context
:
Context
,
builder
:
GlideBuilder
)
{
builder
.
setDiskCache
(
ExternalPreferredCacheDiskCacheFactory
(
context
))
}
}
emoji/src/main/java/chat/rocket/android/emoji/internal/EmojiPagerAdapter.kt
View file @
7547473f
...
@@ -15,6 +15,8 @@ import chat.rocket.android.emoji.EmojiRepository
...
@@ -15,6 +15,8 @@ import chat.rocket.android.emoji.EmojiRepository
import
chat.rocket.android.emoji.Fitzpatrick
import
chat.rocket.android.emoji.Fitzpatrick
import
chat.rocket.android.emoji.R
import
chat.rocket.android.emoji.R
import
com.bumptech.glide.Glide
import
com.bumptech.glide.Glide
import
com.bumptech.glide.load.engine.DiskCacheStrategy
import
com.bumptech.glide.load.engine.cache.ExternalPreferredCacheDiskCacheFactory
import
com.bumptech.glide.request.RequestOptions
import
com.bumptech.glide.request.RequestOptions
import
kotlinx.android.synthetic.main.emoji_category_layout.view.*
import
kotlinx.android.synthetic.main.emoji_category_layout.view.*
import
kotlinx.android.synthetic.main.emoji_image_row_item.view.*
import
kotlinx.android.synthetic.main.emoji_image_row_item.view.*
...
@@ -159,8 +161,9 @@ internal class EmojiPagerAdapter(private val listener: EmojiKeyboardListener) :
...
@@ -159,8 +161,9 @@ internal class EmojiPagerAdapter(private val listener: EmojiKeyboardListener) :
parsedUnicode
parsedUnicode
}
}
}
else
{
}
else
{
Glide
.
with
(
context
)
Glide
App
.
with
(
context
)
.
load
(
emoji
.
url
)
.
load
(
emoji
.
url
)
.
diskCacheStrategy
(
DiskCacheStrategy
.
ALL
)
.
into
(
emoji_image_view
)
.
into
(
emoji_image_view
)
}
}
...
...
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