Created
June 3, 2020 22:44
-
-
Save jtmuller5/48bb1fba30fd3e4906bd09bb40f93cbb to your computer and use it in GitHub Desktop.
Simple Custom Chrome Tabs Implementation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class SimpleTabsFragment : Fragment() { | |
private lateinit var dashboardViewModel: DashboardViewModel | |
var builder = CustomTabsIntent.Builder() | |
override fun onCreateView(inflater: LayoutInflater,container: ViewGroup?, savedInstanceState: Bundle?): View? { | |
dashboardViewModel = ViewModelProviders.of(this).get(DashboardViewModel::class.java) | |
val root = inflater.inflate(R.layout.fragment_simple_tabs, container, false) | |
return root | |
} | |
override fun onViewCreated(view: View, savedInstanceState: Bundle?) { | |
super.onViewCreated(view, savedInstanceState) | |
simple_tabs_button.setOnClickListener { | |
var url = "www.google.com" | |
var customTabsIntent :CustomTabsIntent = builder.build(); | |
customTabsIntent.launchUrl(requireContext(), Uri.parse(url)) | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment