This repository was archived by the owner on Aug 22, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +18
-0
lines changed
src/main/java/com/hossainkhan/android/demo/layoutpositioning Expand file tree Collapse file tree 2 files changed +18
-0
lines changed Original file line number Diff line number Diff line change @@ -54,6 +54,9 @@ dependencies {
5454 // https://developer.android.com/topic/libraries/architecture/adding-components
5555 implementation " android.arch.lifecycle:extensions:$rootProject . archComponentVersion "
5656
57+ // https://developer.chrome.com/multidevice/android/customtabs
58+ compile " com.android.support:customtabs:$rootProject . supportLibraryVersion "
59+
5760 // ========================================================
5861 // 3rd party libraries
5962 // ========================================================
Original file line number Diff line number Diff line change @@ -18,8 +18,10 @@ package com.hossainkhan.android.demo.layoutpositioning
1818
1919import android.content.Context
2020import android.content.Intent
21+ import android.net.Uri
2122import android.os.Bundle
2223import android.support.annotation.LayoutRes
24+ import android.support.customtabs.CustomTabsIntent
2325import android.support.v7.app.AppCompatActivity
2426import android.view.Menu
2527import android.view.MenuItem
@@ -94,6 +96,7 @@ class LayoutPositioningDemoActivity : AppCompatActivity() {
9496 override fun onActionTapped (bar : Flashbar ) {
9597 Timber .d(" Loading the XML for " )
9698 bar.dismiss()
99+ loadLayoutUrl()
97100 }
98101 })
99102 .negativeActionTapListener(object : Flashbar .OnActionTapListener {
@@ -110,6 +113,18 @@ class LayoutPositioningDemoActivity : AppCompatActivity() {
110113 }
111114 }
112115
116+ /* *
117+ * Loads currently running layout from Github into chrome web view.
118+ */
119+ fun loadLayoutUrl () {
120+ val layoutUrl = appDataStore.layoutStore.getLayoutUrl(layoutInformation.layoutResourceId)
121+ val builder = CustomTabsIntent .Builder ()
122+ builder.setShowTitle(false )
123+ .addDefaultShareMenuItem()
124+ val customTabsIntent = builder.build()
125+ customTabsIntent.launchUrl(this , Uri .parse(layoutUrl))
126+ }
127+
113128
114129 //
115130 // Setup menu item on the action bar.
You can’t perform that action at this time.
0 commit comments