Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added base context for launching url and added new activity flag #1

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package com.werockstar.dagger2demo.view.fragment


import android.content.Context
import android.content.Intent
import android.net.Uri
import android.os.Bundle
import androidx.browser.customtabs.CustomTabsIntent
Expand All @@ -24,6 +25,7 @@ class RepoFragment : Fragment(), RepoPresenter.View {

@Inject
lateinit var customTabsIntent: CustomTabsIntent

@Inject
lateinit var presenter: RepoPresenter

Expand Down Expand Up @@ -77,7 +79,8 @@ class RepoFragment : Fragment(), RepoPresenter.View {

override fun showRepo(repos: List<Repo>) {
val didTap: (Repo) -> Unit = { repo ->
customTabsIntent.launchUrl(activity, Uri.parse(repo.htmlUrl))
customTabsIntent.intent.flags = Intent.FLAG_ACTIVITY_NEW_TASK
customTabsIntent.launchUrl(activity!!.baseContext, Uri.parse(repo.htmlUrl))
}
githubAdapter = RepoAdapter(repos, didTap)
githubAdapter.notifyDataSetChanged()
Expand Down