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
3d428d0f
Commit
3d428d0f
authored
Mar 13, 2018
by
Peter Lepeska
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
use chrome custom tabs for links in rooms
parent
fccfb888
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
5 additions
and
10 deletions
+5
-10
build.gradle
app/build.gradle
+2
-0
MessageParser.kt
...src/main/java/chat/rocket/android/helper/MessageParser.kt
+3
-10
No files found.
app/build.gradle
View file @
3d428d0f
...
@@ -110,6 +110,8 @@ dependencies {
...
@@ -110,6 +110,8 @@ dependencies {
androidTestImplementation
(
libraries
.
expressoCore
,
{
androidTestImplementation
(
libraries
.
expressoCore
,
{
exclude
group:
'com.android.support'
,
module:
'support-annotations'
exclude
group:
'com.android.support'
,
module:
'support-annotations'
})
})
implementation
'com.android.support:customtabs:27.0.2'
}
}
kotlin
{
kotlin
{
...
...
app/src/main/java/chat/rocket/android/helper/MessageParser.kt
View file @
3d428d0f
...
@@ -7,6 +7,7 @@ import android.content.Intent
...
@@ -7,6 +7,7 @@ import android.content.Intent
import
android.graphics.*
import
android.graphics.*
import
android.graphics.drawable.Drawable
import
android.graphics.drawable.Drawable
import
android.net.Uri
import
android.net.Uri
import
android.support.customtabs.CustomTabsIntent
import
android.provider.Browser
import
android.provider.Browser
import
android.support.v4.content.ContextCompat
import
android.support.v4.content.ContextCompat
import
android.support.v4.content.res.ResourcesCompat
import
android.support.v4.content.res.ResourcesCompat
...
@@ -171,16 +172,8 @@ class MessageParser @Inject constructor(val context: Application, private val co
...
@@ -171,16 +172,8 @@ class MessageParser @Inject constructor(val context: Application, private val co
if
(!
link
.
startsWith
(
"@"
)
&&
link
!
in
consumed
)
{
if
(!
link
.
startsWith
(
"@"
)
&&
link
!
in
consumed
)
{
builder
.
setSpan
(
object
:
ClickableSpan
()
{
builder
.
setSpan
(
object
:
ClickableSpan
()
{
override
fun
onClick
(
view
:
View
)
{
override
fun
onClick
(
view
:
View
)
{
val
uri
=
getUri
(
link
)
val
customTabsIntent
=
CustomTabsIntent
.
Builder
().
build
()
val
context
=
view
.
context
customTabsIntent
.
launchUrl
(
view
.
context
,
getUri
(
link
))
val
intent
=
Intent
(
Intent
.
ACTION_VIEW
,
uri
)
intent
.
putExtra
(
Browser
.
EXTRA_APPLICATION_ID
,
context
.
packageName
)
try
{
context
.
startActivity
(
intent
)
}
catch
(
e
:
ActivityNotFoundException
)
{
Timber
.
e
(
"Actvity was not found for intent, $intent"
)
}
}
}
},
matcher
.
start
(
0
),
matcher
.
end
(
0
))
},
matcher
.
start
(
0
),
matcher
.
end
(
0
))
consumed
.
add
(
link
)
consumed
.
add
(
link
)
...
...
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