From a29800606e5fe1c740e6b7c95462e97d16f22960 Mon Sep 17 00:00:00 2001 From: Bnyro Date: Sun, 29 May 2022 13:01:04 +0200 Subject: [PATCH 1/8] base --- app/src/main/AndroidManifest.xml | 205 ++++++++++-------- .../java/com/github/libretube/MainActivity.kt | 2 +- .../com/github/libretube/RouterActivity.kt | 26 +++ 3 files changed, 138 insertions(+), 95 deletions(-) create mode 100644 app/src/main/java/com/github/libretube/RouterActivity.kt diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 0db563702..d12bebc14 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -41,100 +41,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + { + if ("text/plain" == intent.type) { + handleSendText(intent) // Handle text being sent + } + } + } + } + + private fun handleSendText(intent: Intent) { + intent.getStringExtra(Intent.EXTRA_TEXT)?.let { + Log.i(it,it) + } + } + +} \ No newline at end of file From 06688c6fafb8d968d95b8f4a43fcbfa4226e6348 Mon Sep 17 00:00:00 2001 From: Bnyro Date: Sun, 29 May 2022 15:22:35 +0200 Subject: [PATCH 2/8] basic functionality restored --- .../main/java/com/github/libretube/MainActivity.kt | 7 +++++-- .../java/com/github/libretube/RouterActivity.kt | 13 ++++++++++--- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/app/src/main/java/com/github/libretube/MainActivity.kt b/app/src/main/java/com/github/libretube/MainActivity.kt index 5eee9dac2..01cf4a378 100644 --- a/app/src/main/java/com/github/libretube/MainActivity.kt +++ b/app/src/main/java/com/github/libretube/MainActivity.kt @@ -142,8 +142,7 @@ class MainActivity : AppCompatActivity() { override fun onStart() { super.onStart() - val action: String? = intent?.action - val data: Uri? = z + val data: Uri? = intent?.data Log.d(TAG, "dafaq" + data.toString()) if (data != null) { @@ -155,12 +154,15 @@ class MainActivity : AppCompatActivity() { data.path!!.contains("/c/") || data.path!!.contains("/user/") ) { + Log.i(TAG, "URI Type: Channel") var channel = data.path channel = channel!!.replace("/c/", "") channel = channel.replace("/user/", "") + Log.i(TAG, channel) val bundle = bundleOf("channel_id" to channel) navController.navigate(R.id.channel, bundle) } else if (data.path!!.contains("/playlist")) { + Log.i(TAG, "URI Type: Playlist") var playlist = data.query!! if (playlist.contains("&")) { var playlists = playlist.split("&") @@ -178,6 +180,7 @@ class MainActivity : AppCompatActivity() { data.path!!.contains("/embed/") || data.path!!.contains("/v/") ) { + Log.i(TAG, "URI Type: Video") val watch = data.path!! .replace("/shorts/", "") .replace("/v/", "") diff --git a/app/src/main/java/com/github/libretube/RouterActivity.kt b/app/src/main/java/com/github/libretube/RouterActivity.kt index 7f6768ecb..7f7d541b5 100644 --- a/app/src/main/java/com/github/libretube/RouterActivity.kt +++ b/app/src/main/java/com/github/libretube/RouterActivity.kt @@ -1,11 +1,14 @@ package com.github.libretube import android.content.Intent +import android.content.pm.PackageManager +import android.net.Uri import android.os.Bundle import android.util.Log import androidx.appcompat.app.AppCompatActivity class RouterActivity : AppCompatActivity() { + val TAG = "RouterActivity" override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) when (intent?.action) { @@ -19,8 +22,12 @@ class RouterActivity : AppCompatActivity() { private fun handleSendText(intent: Intent) { intent.getStringExtra(Intent.EXTRA_TEXT)?.let { - Log.i(it,it) + Log.i(TAG, it) + val pm: PackageManager = this.packageManager + val intent = pm.getLaunchIntentForPackage(this.packageName) + intent?.flags = Intent.FLAG_ACTIVITY_CLEAR_TASK + intent?.data = Uri.parse(it) + this.startActivity(intent) } } - -} \ No newline at end of file +} From cd47970eac2ac73484caa618171e1b613d29d55e Mon Sep 17 00:00:00 2001 From: Bnyro Date: Sun, 29 May 2022 15:57:01 +0200 Subject: [PATCH 3/8] cleanup --- app/src/main/AndroidManifest.xml | 8 +- .../java/com/github/libretube/MainActivity.kt | 201 +++++++++--------- .../com/github/libretube/RouterActivity.kt | 7 +- 3 files changed, 106 insertions(+), 110 deletions(-) diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index d12bebc14..bc653a666 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -169,13 +169,7 @@ - - - - - - - + diff --git a/app/src/main/java/com/github/libretube/MainActivity.kt b/app/src/main/java/com/github/libretube/MainActivity.kt index 01cf4a378..e887c4f6d 100644 --- a/app/src/main/java/com/github/libretube/MainActivity.kt +++ b/app/src/main/java/com/github/libretube/MainActivity.kt @@ -1,6 +1,7 @@ package com.github.libretube import android.app.Activity +import android.app.ProgressDialog.show import android.content.Context import android.content.Intent import android.content.pm.ActivityInfo @@ -33,6 +34,7 @@ import androidx.preference.PreferenceManager import com.github.libretube.util.CronetHelper import com.google.android.material.bottomnavigation.BottomNavigationView import com.google.android.material.color.DynamicColors +import kotlinx.coroutines.NonDisposableHandle.parent class MainActivity : AppCompatActivity() { val TAG = "MainActivity" @@ -142,111 +144,108 @@ class MainActivity : AppCompatActivity() { override fun onStart() { super.onStart() - val data: Uri? = intent?.data - Log.d(TAG, "dafaq" + data.toString()) + val intentData: Uri? = intent?.data + if (intentData != null && intentData.host != null && intentData.path != null) { + Log.d("intentData", "${intentData.host} ${intentData.path} ") + loadIntentData(intentData) + } + } - if (data != null) { - Log.d("dafaq", data.host + " ${data.path} ") - if (data.host != null) { - if (data.path != null) { - // channel - if (data.path!!.contains("/channel/") || - data.path!!.contains("/c/") || - data.path!!.contains("/user/") - ) { - Log.i(TAG, "URI Type: Channel") - var channel = data.path - channel = channel!!.replace("/c/", "") - channel = channel.replace("/user/", "") - Log.i(TAG, channel) - val bundle = bundleOf("channel_id" to channel) - navController.navigate(R.id.channel, bundle) - } else if (data.path!!.contains("/playlist")) { - Log.i(TAG, "URI Type: Playlist") - var playlist = data.query!! - if (playlist.contains("&")) { - var playlists = playlist.split("&") - for (v in playlists) { - if (v.contains("list=")) { - playlist = v - break - } - } - } - playlist = playlist.replace("list=", "") - val bundle = bundleOf("playlist_id" to playlist) - navController.navigate(R.id.playlistFragment, bundle) - } else if (data.path!!.contains("/shorts/") || - data.path!!.contains("/embed/") || - data.path!!.contains("/v/") - ) { - Log.i(TAG, "URI Type: Video") - val watch = data.path!! - .replace("/shorts/", "") - .replace("/v/", "") - .replace("/embed/", "") - val bundle = Bundle() - bundle.putString("videoId", watch) - val frag = PlayerFragment() - frag.arguments = bundle - supportFragmentManager.beginTransaction() - .remove(PlayerFragment()) - .commit() - supportFragmentManager.beginTransaction() - .replace(R.id.container, frag) - .commitNow() - Handler().postDelayed({ - val motionLayout = findViewById(R.id.playerMotionLayout) - motionLayout.transitionToEnd() - motionLayout.transitionToStart() - }, 100) - } else if (data.path!!.contains("/watch") && data.query != null) { - Log.d("dafaq", data.query!!) - var watch = data.query!! - if (watch.contains("&")) { - var watches = watch.split("&") - for (v in watches) { - if (v.contains("v=")) { - watch = v - break - } - } - } - var bundle = Bundle() - bundle.putString("videoId", watch.replace("v=", "")) - var frag = PlayerFragment() - frag.arguments = bundle - supportFragmentManager.beginTransaction() - .remove(PlayerFragment()) - .commit() - supportFragmentManager.beginTransaction() - .replace(R.id.container, frag) - .commitNow() - Handler().postDelayed({ - val motionLayout = findViewById(R.id.playerMotionLayout) - motionLayout.transitionToEnd() - motionLayout.transitionToStart() - }, 100) - } else { - var watch = data.path!!.replace("/", "") - var bundle = Bundle() - bundle.putString("videoId", watch) - var frag = PlayerFragment() - frag.arguments = bundle - supportFragmentManager.beginTransaction() - .remove(PlayerFragment()) - .commit() - supportFragmentManager.beginTransaction() - .replace(R.id.container, frag) - .commitNow() - Handler().postDelayed({ - val motionLayout = findViewById(R.id.playerMotionLayout) - motionLayout.transitionToEnd() - motionLayout.transitionToStart() - }, 100) + private fun loadIntentData(data: Uri) { + // channel + if (data.path!!.contains("/channel/") || + data.path!!.contains("/c/") || + data.path!!.contains("/user/") + ) { + Log.i(TAG, "URI Type: Channel") + var channel = data.path + channel = channel!!.replace("/c/", "") + channel = channel.replace("/user/", "") + val bundle = bundleOf("channel_id" to channel) + navController.navigate(R.id.channel, bundle) + } else if (data.path!!.contains("/playlist")) { + Log.i(TAG, "URI Type: Playlist") + var playlist = data.query!! + if (playlist.contains("&")) { + var playlists = playlist.split("&") + for (v in playlists) { + if (v.contains("list=")) { + playlist = v + break } } } + playlist = playlist.replace("list=", "") + val bundle = bundleOf("playlist_id" to playlist) + navController.navigate(R.id.playlistFragment, bundle) + } else if (data.path!!.contains("/shorts/") || + data.path!!.contains("/embed/") || + data.path!!.contains("/v/") + ) { + Log.i(TAG, "URI Type: Video") + val watch = data.path!! + .replace("/shorts/", "") + .replace("/v/", "") + .replace("/embed/", "") + val bundle = Bundle() + bundle.putString("videoId", watch) + val frag = PlayerFragment() + frag.arguments = bundle + supportFragmentManager.beginTransaction() + .remove(PlayerFragment()) + .commit() + supportFragmentManager.beginTransaction() + .replace(R.id.container, frag) + .commitNow() + Handler().postDelayed({ + val motionLayout = findViewById(R.id.playerMotionLayout) + motionLayout.transitionToEnd() + motionLayout.transitionToStart() + }, 100) + } else if (data.path!!.contains("/watch") && data.query != null) { + Log.d("dafaq", data.query!!) + var watch = data.query!! + if (watch.contains("&")) { + var watches = watch.split("&") + for (v in watches) { + if (v.contains("v=")) { + watch = v + break + } + } + } + var bundle = Bundle() + bundle.putString("videoId", watch.replace("v=", "")) + var frag = PlayerFragment() + frag.arguments = bundle + supportFragmentManager.beginTransaction() + .remove(PlayerFragment()) + .commit() + supportFragmentManager.beginTransaction() + .replace(R.id.container, frag) + .commitNow() + Handler().postDelayed({ + val motionLayout = findViewById(R.id.playerMotionLayout) + motionLayout.transitionToEnd() + motionLayout.transitionToStart() + }, 100) + } else { + var watch = data.path!!.replace("/", "") + var bundle = Bundle() + bundle.putString("videoId", watch) + var frag = PlayerFragment() + frag.arguments = bundle + supportFragmentManager.beginTransaction() + .remove(PlayerFragment()) + .commit() + supportFragmentManager.beginTransaction() + .replace(R.id.container, frag) + .commitNow() + Handler().postDelayed({ + val motionLayout = findViewById(R.id.playerMotionLayout) + motionLayout.transitionToEnd() + motionLayout.transitionToStart() + }, 100) } } diff --git a/app/src/main/java/com/github/libretube/RouterActivity.kt b/app/src/main/java/com/github/libretube/RouterActivity.kt index 7f7d541b5..e26c17423 100644 --- a/app/src/main/java/com/github/libretube/RouterActivity.kt +++ b/app/src/main/java/com/github/libretube/RouterActivity.kt @@ -13,8 +13,11 @@ class RouterActivity : AppCompatActivity() { super.onCreate(savedInstanceState) when (intent?.action) { Intent.ACTION_SEND -> { - if ("text/plain" == intent.type) { - handleSendText(intent) // Handle text being sent + if (intent.type == "text/plain") { + handleSendText(intent) + } else { + // start app as normal if wrong intent type + restartMainActivity(this) } } } From 7b34487079c869e1ff44879eba29215eed013475 Mon Sep 17 00:00:00 2001 From: Bnyro Date: Sun, 29 May 2022 18:07:38 +0200 Subject: [PATCH 4/8] fixes --- app/src/main/AndroidManifest.xml | 1 + app/src/main/java/com/github/libretube/PlayerFragment.kt | 4 ++-- app/src/main/java/com/github/libretube/RouterActivity.kt | 1 + 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index bc653a666..7cc95d66a 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -165,6 +165,7 @@ diff --git a/app/src/main/java/com/github/libretube/PlayerFragment.kt b/app/src/main/java/com/github/libretube/PlayerFragment.kt index ed97cc7b6..33ae6c962 100644 --- a/app/src/main/java/com/github/libretube/PlayerFragment.kt +++ b/app/src/main/java/com/github/libretube/PlayerFragment.kt @@ -69,12 +69,12 @@ import com.google.android.exoplayer2.util.RepeatModeUtil import com.google.android.material.button.MaterialButton import com.google.android.material.dialog.MaterialAlertDialogBuilder import com.squareup.picasso.Picasso +import org.chromium.net.CronetEngine +import retrofit2.HttpException import java.io.IOException import java.net.URLEncoder import java.util.concurrent.Executors import kotlin.math.abs -import org.chromium.net.CronetEngine -import retrofit2.HttpException var isFullScreen = false diff --git a/app/src/main/java/com/github/libretube/RouterActivity.kt b/app/src/main/java/com/github/libretube/RouterActivity.kt index e26c17423..fbcc273eb 100644 --- a/app/src/main/java/com/github/libretube/RouterActivity.kt +++ b/app/src/main/java/com/github/libretube/RouterActivity.kt @@ -31,6 +31,7 @@ class RouterActivity : AppCompatActivity() { intent?.flags = Intent.FLAG_ACTIVITY_CLEAR_TASK intent?.data = Uri.parse(it) this.startActivity(intent) + this.finish() } } } From 0095178c8a0ba0c7011a7d9c7398a9521d7387fd Mon Sep 17 00:00:00 2001 From: Bnyro Date: Sun, 29 May 2022 18:11:05 +0200 Subject: [PATCH 5/8] ktlint --- app/src/main/java/com/github/libretube/PlayerFragment.kt | 4 ++-- app/src/main/java/com/github/libretube/RouterActivity.kt | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/com/github/libretube/PlayerFragment.kt b/app/src/main/java/com/github/libretube/PlayerFragment.kt index 33ae6c962..ed97cc7b6 100644 --- a/app/src/main/java/com/github/libretube/PlayerFragment.kt +++ b/app/src/main/java/com/github/libretube/PlayerFragment.kt @@ -69,12 +69,12 @@ import com.google.android.exoplayer2.util.RepeatModeUtil import com.google.android.material.button.MaterialButton import com.google.android.material.dialog.MaterialAlertDialogBuilder import com.squareup.picasso.Picasso -import org.chromium.net.CronetEngine -import retrofit2.HttpException import java.io.IOException import java.net.URLEncoder import java.util.concurrent.Executors import kotlin.math.abs +import org.chromium.net.CronetEngine +import retrofit2.HttpException var isFullScreen = false diff --git a/app/src/main/java/com/github/libretube/RouterActivity.kt b/app/src/main/java/com/github/libretube/RouterActivity.kt index fbcc273eb..6eb2ae733 100644 --- a/app/src/main/java/com/github/libretube/RouterActivity.kt +++ b/app/src/main/java/com/github/libretube/RouterActivity.kt @@ -31,7 +31,7 @@ class RouterActivity : AppCompatActivity() { intent?.flags = Intent.FLAG_ACTIVITY_CLEAR_TASK intent?.data = Uri.parse(it) this.startActivity(intent) - this.finish() + this.finishAndRemoveTask() } } } From a9e426fd6a0a4c8498bf4a9cb4d8753784bfecbb Mon Sep 17 00:00:00 2001 From: Bnyro Date: Sun, 29 May 2022 18:20:01 +0200 Subject: [PATCH 6/8] removed imports --- app/src/main/java/com/github/libretube/MainActivity.kt | 2 -- 1 file changed, 2 deletions(-) diff --git a/app/src/main/java/com/github/libretube/MainActivity.kt b/app/src/main/java/com/github/libretube/MainActivity.kt index e887c4f6d..f72a1571b 100644 --- a/app/src/main/java/com/github/libretube/MainActivity.kt +++ b/app/src/main/java/com/github/libretube/MainActivity.kt @@ -1,7 +1,6 @@ package com.github.libretube import android.app.Activity -import android.app.ProgressDialog.show import android.content.Context import android.content.Intent import android.content.pm.ActivityInfo @@ -34,7 +33,6 @@ import androidx.preference.PreferenceManager import com.github.libretube.util.CronetHelper import com.google.android.material.bottomnavigation.BottomNavigationView import com.google.android.material.color.DynamicColors -import kotlinx.coroutines.NonDisposableHandle.parent class MainActivity : AppCompatActivity() { val TAG = "MainActivity" From c1ac7aa816bd6eadd822d5ac1b1703aba8900b00 Mon Sep 17 00:00:00 2001 From: Bnyro Date: Mon, 30 May 2022 14:24:50 +0200 Subject: [PATCH 7/8] hosts filter --- .../com/github/libretube/RouterActivity.kt | 10 ++++- app/src/main/res/values/array.xml | 40 +++++++++++++++++++ 2 files changed, 49 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/com/github/libretube/RouterActivity.kt b/app/src/main/java/com/github/libretube/RouterActivity.kt index 6eb2ae733..cc3d8beea 100644 --- a/app/src/main/java/com/github/libretube/RouterActivity.kt +++ b/app/src/main/java/com/github/libretube/RouterActivity.kt @@ -13,7 +13,7 @@ class RouterActivity : AppCompatActivity() { super.onCreate(savedInstanceState) when (intent?.action) { Intent.ACTION_SEND -> { - if (intent.type == "text/plain") { + if (intent.type == "text/plain" && checkHost(intent)) { handleSendText(intent) } else { // start app as normal if wrong intent type @@ -23,6 +23,14 @@ class RouterActivity : AppCompatActivity() { } } + private fun checkHost(intent: Intent): Boolean { + val hostsList = resources.getStringArray(R.array.shareHostsList) + val intentDataUri: Uri = Uri.parse(intent.getStringExtra(Intent.EXTRA_TEXT)) + val intentDataHost = intentDataUri.host + Log.d(TAG, "$intentDataHost") + return hostsList.contains(intentDataHost) + } + private fun handleSendText(intent: Intent) { intent.getStringExtra(Intent.EXTRA_TEXT)?.let { Log.i(TAG, it) diff --git a/app/src/main/res/values/array.xml b/app/src/main/res/values/array.xml index 254616997..a654935d6 100644 --- a/app/src/main/res/values/array.xml +++ b/app/src/main/res/values/array.xml @@ -14,6 +14,46 @@ https://pipedapi.moomoo.me https://pa.mint.lgbt + + youtube.com" + m.youtube.com" + www.youtube.com" + music.youtube.com" + youtu.be" + tubus.eduvid.org" + invidio.us" + dev.invidio.us" + www.invidio.us" + redirect.invidious.io" + invidious.snopyta.org" + yewtu.be" + tube.connect.cafe" + invidious.kavin.rocks" + invidious-us.kavin.rocks" + invidious.site" + vid.mint.lgbt" + invidiou.site" + invidious.fdn.fr" + invidious.048596.xyz" + invidious.zee.li" + vid.puffyan.us" + ytprivate.com" + invidious.namazso.eu" + invidious.silkky.cloud" + invidious.exonip.de" + inv.riverside.rocks" + invidious.blamefran.net" + invidious.moomoo.me" + ytb.trom.tf" + yt.cyberhost.uk" + y.com.cm" + piped.tokhmi.xyz" + piped.kavin.rocks" + piped.silkky.cloud" + piped.silkky.cloud" + piped.mint.lgbt" + il.ax" + Afghanistan Albania From a5bfa2c1bb099b9952e23b940abee2d25485d7f5 Mon Sep 17 00:00:00 2001 From: Bnyro Date: Mon, 30 May 2022 15:24:44 +0200 Subject: [PATCH 8/8] comments --- .../java/com/github/libretube/MainActivity.kt | 2 ++ .../com/github/libretube/RouterActivity.kt | 18 ++++++++++-------- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/app/src/main/java/com/github/libretube/MainActivity.kt b/app/src/main/java/com/github/libretube/MainActivity.kt index f72a1571b..4dea68660 100644 --- a/app/src/main/java/com/github/libretube/MainActivity.kt +++ b/app/src/main/java/com/github/libretube/MainActivity.kt @@ -143,8 +143,10 @@ class MainActivity : AppCompatActivity() { override fun onStart() { super.onStart() val intentData: Uri? = intent?.data + // check whether an URI got submitted over the intent data if (intentData != null && intentData.host != null && intentData.path != null) { Log.d("intentData", "${intentData.host} ${intentData.path} ") + // load the URI of the submitted link (e.g. video) loadIntentData(intentData) } } diff --git a/app/src/main/java/com/github/libretube/RouterActivity.kt b/app/src/main/java/com/github/libretube/RouterActivity.kt index cc3d8beea..2f0ee8c21 100644 --- a/app/src/main/java/com/github/libretube/RouterActivity.kt +++ b/app/src/main/java/com/github/libretube/RouterActivity.kt @@ -11,19 +11,20 @@ class RouterActivity : AppCompatActivity() { val TAG = "RouterActivity" override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) - when (intent?.action) { - Intent.ACTION_SEND -> { - if (intent.type == "text/plain" && checkHost(intent)) { - handleSendText(intent) - } else { - // start app as normal if wrong intent type - restartMainActivity(this) - } + // Check if Intent Action is ACTION_SEND + if (intent?.action == Intent.ACTION_SEND) { + if (intent.type == "text/plain" && checkHost(intent)) { + // start the main activity using the given URI as data if the host is known + handleSendText(intent) + } else { + // start app as normal if wrong intent type + restartMainActivity(this) } } } private fun checkHost(intent: Intent): Boolean { + // check whether the host is known, current solution to replace the broken intent filter val hostsList = resources.getStringArray(R.array.shareHostsList) val intentDataUri: Uri = Uri.parse(intent.getStringExtra(Intent.EXTRA_TEXT)) val intentDataHost = intentDataUri.host @@ -35,6 +36,7 @@ class RouterActivity : AppCompatActivity() { intent.getStringExtra(Intent.EXTRA_TEXT)?.let { Log.i(TAG, it) val pm: PackageManager = this.packageManager + // startIntent(this, MainActivity::class.java doesn't work for the activity aliases needed for the logo switch option val intent = pm.getLaunchIntentForPackage(this.packageName) intent?.flags = Intent.FLAG_ACTIVITY_CLEAR_TASK intent?.data = Uri.parse(it)