mirror of
https://github.com/tachiyomiorg/tachiyomi.git
synced 2024-11-17 23:39:20 +01:00
Add support's library custom tabs
This commit is contained in:
parent
a4b6003e58
commit
bc3d5dc863
@ -110,6 +110,7 @@ dependencies {
|
||||
compile "com.android.support:support-annotations:$SUPPORT_LIBRARY_VERSION"
|
||||
compile "com.android.support:preference-v7:$SUPPORT_LIBRARY_VERSION"
|
||||
compile "com.android.support:preference-v14:$SUPPORT_LIBRARY_VERSION"
|
||||
compile "com.android.support:customtabs:$SUPPORT_LIBRARY_VERSION"
|
||||
|
||||
// ReactiveX
|
||||
compile 'io.reactivex:rxandroid:1.2.0'
|
||||
|
@ -1,8 +1,8 @@
|
||||
package eu.kanade.tachiyomi.ui.manga.info
|
||||
|
||||
import android.content.Intent
|
||||
import android.net.Uri
|
||||
import android.os.Bundle
|
||||
import android.support.customtabs.CustomTabsIntent
|
||||
import android.view.*
|
||||
import com.bumptech.glide.Glide
|
||||
import com.bumptech.glide.load.engine.DiskCacheStrategy
|
||||
@ -10,6 +10,7 @@ import eu.kanade.tachiyomi.R
|
||||
import eu.kanade.tachiyomi.data.database.models.Manga
|
||||
import eu.kanade.tachiyomi.data.source.base.Source
|
||||
import eu.kanade.tachiyomi.ui.base.fragment.BaseRxFragment
|
||||
import eu.kanade.tachiyomi.util.getResourceColor
|
||||
import eu.kanade.tachiyomi.util.toast
|
||||
import kotlinx.android.synthetic.main.fragment_manga_info.*
|
||||
import nucleus.factory.RequiresPresenter
|
||||
@ -140,8 +141,11 @@ class MangaInfoFragment : BaseRxFragment<MangaInfoPresenter>() {
|
||||
*/
|
||||
fun openInBrowser() {
|
||||
try {
|
||||
val url = presenter.source.baseUrl + presenter.manga.url
|
||||
startActivity(Intent(Intent.ACTION_VIEW, Uri.parse(url)))
|
||||
val url = Uri.parse(presenter.source.baseUrl + presenter.manga.url)
|
||||
val intent = CustomTabsIntent.Builder()
|
||||
.setToolbarColor(context.theme.getResourceColor(R.attr.colorPrimary))
|
||||
.build()
|
||||
intent.launchUrl(activity, url)
|
||||
} catch (e: Exception) {
|
||||
context.toast(e.message)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user