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
a2ded271
Commit
a2ded271
authored
May 04, 2018
by
Filipe de Lima Brito
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'develop' of github.com:RocketChat/Rocket.Chat.Android into new/send-typing-status
parents
cf77e234
d9242c67
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
30 additions
and
11 deletions
+30
-11
build.gradle
app/build.gradle
+1
-1
UrlPreviewViewHolder.kt
...t/rocket/android/chatroom/adapter/UrlPreviewViewHolder.kt
+11
-3
MessageParser.kt
...src/main/java/chat/rocket/android/helper/MessageParser.kt
+2
-7
View.kt
...src/main/java/chat/rocket/android/util/extensions/View.kt
+16
-0
No files found.
app/build.gradle
View file @
a2ded271
...
...
@@ -13,7 +13,7 @@ android {
applicationId
"chat.rocket.android"
minSdkVersion
21
targetSdkVersion
versions
.
targetSdk
versionCode
20
19
versionCode
20
20
versionName
"2.2.0"
testInstrumentationRunner
"android.support.test.runner.AndroidJUnitRunner"
multiDexEnabled
true
...
...
app/src/main/java/chat/rocket/android/chatroom/adapter/UrlPreviewViewHolder.kt
View file @
a2ded271
...
...
@@ -5,6 +5,7 @@ import android.net.Uri
import
android.view.View
import
chat.rocket.android.chatroom.viewmodel.UrlPreviewViewModel
import
chat.rocket.android.util.extensions.content
import
chat.rocket.android.util.extensions.openTabbedUrl
import
chat.rocket.android.util.extensions.setVisible
import
chat.rocket.android.widget.emoji.EmojiReactionListener
import
kotlinx.android.synthetic.main.message_url_preview.view.*
...
...
@@ -32,10 +33,17 @@ class UrlPreviewViewHolder(itemView: View,
text_title
.
content
=
data
.
title
text_description
.
content
=
data
.
description
?:
""
url_preview_layout
.
setOnClickListener
{
view
->
view
.
context
.
startActivity
(
Intent
(
Intent
.
ACTION_VIEW
,
Uri
.
parse
(
data
.
rawData
.
url
)))
}
url_preview_layout
.
setOnClickListener
(
onClickListener
)
text_host
.
setOnClickListener
(
onClickListener
)
text_title
.
setOnClickListener
(
onClickListener
)
image_preview
.
setOnClickListener
(
onClickListener
)
text_description
.
setOnClickListener
(
onClickListener
)
}
}
private
val
onClickListener
=
{
view
:
View
->
if
(
data
!=
null
)
{
view
.
openTabbedUrl
(
Uri
.
parse
(
data
!!
.
rawData
.
url
))
}
}
}
\ No newline at end of file
app/src/main/java/chat/rocket/android/helper/MessageParser.kt
View file @
a2ded271
...
...
@@ -6,7 +6,6 @@ import android.graphics.Canvas
import
android.graphics.Paint
import
android.graphics.RectF
import
android.net.Uri
import
android.support.customtabs.CustomTabsIntent
import
android.support.v4.content.res.ResourcesCompat
import
android.text.Spanned
import
android.text.style.ClickableSpan
...
...
@@ -16,6 +15,7 @@ import android.view.View
import
chat.rocket.android.R
import
chat.rocket.android.server.domain.PublicSettings
import
chat.rocket.android.server.domain.useRealName
import
chat.rocket.android.util.extensions.openTabbedUrl
import
chat.rocket.android.widget.emoji.EmojiParser
import
chat.rocket.android.widget.emoji.EmojiRepository
import
chat.rocket.android.widget.emoji.EmojiTypefaceSpan
...
...
@@ -151,12 +151,7 @@ class MessageParser @Inject constructor(
if
(!
link
.
startsWith
(
"@"
)
&&
link
!
in
consumed
)
{
builder
.
setSpan
(
object
:
ClickableSpan
()
{
override
fun
onClick
(
view
:
View
)
{
with
(
view
)
{
val
tabsbuilder
=
CustomTabsIntent
.
Builder
()
tabsbuilder
.
setToolbarColor
(
ResourcesCompat
.
getColor
(
context
.
resources
,
R
.
color
.
colorPrimary
,
context
.
theme
))
val
customTabsIntent
=
tabsbuilder
.
build
()
customTabsIntent
.
launchUrl
(
context
,
getUri
(
link
))
}
view
.
openTabbedUrl
(
getUri
(
link
))
}
},
matcher
.
start
(
0
),
matcher
.
end
(
0
))
consumed
.
add
(
link
)
...
...
app/src/main/java/chat/rocket/android/util/extensions/View.kt
0 → 100644
View file @
a2ded271
package
chat.rocket.android.util.extensions
import
android.net.Uri
import
android.support.customtabs.CustomTabsIntent
import
android.support.v4.content.res.ResourcesCompat
import
android.view.View
import
chat.rocket.android.R
fun
View
.
openTabbedUrl
(
url
:
Uri
)
{
with
(
this
)
{
val
tabsbuilder
=
CustomTabsIntent
.
Builder
()
tabsbuilder
.
setToolbarColor
(
ResourcesCompat
.
getColor
(
context
.
resources
,
R
.
color
.
colorPrimary
,
context
.
theme
))
val
customTabsIntent
=
tabsbuilder
.
build
()
customTabsIntent
.
launchUrl
(
context
,
url
)
}
}
\ No newline at end of file
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