Merge pull request #160 from ostajic/dev

Fix links intent
This commit is contained in:
Zoran Ostojic 2020-09-19 12:37:57 +02:00 committed by GitHub
commit 23e70513e8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 1 deletions

View File

@ -20,9 +20,10 @@ object InternetTools {
val builder = CustomTabsIntent.Builder()
builder.setToolbarColor(ContextCompat.getColor(context, color))
val customTabsIntent = builder.build()
customTabsIntent.intent.flags = Intent.FLAG_ACTIVITY_NEW_TASK
customTabsIntent.launchUrl(context, Uri.parse(Url))
} else
context.startActivity(Intent(Intent.ACTION_VIEW, Uri.parse(Url)))
context.startActivity(Intent(Intent.ACTION_VIEW, Uri.parse(Url)).setFlags(Intent.FLAG_ACTIVITY_NEW_TASK))
}
fun getFileNameFromUrl(url: String) = url.substring(url.lastIndexOf('/')+1, url.length)