diff --git a/app/src/main/java/com/github/libretube/ui/activities/AboutActivity.kt b/app/src/main/java/com/github/libretube/ui/activities/AboutActivity.kt index c9e2aecc9..719a99fff 100644 --- a/app/src/main/java/com/github/libretube/ui/activities/AboutActivity.kt +++ b/app/src/main/java/com/github/libretube/ui/activities/AboutActivity.kt @@ -33,14 +33,10 @@ class AboutActivity : BaseActivity() { } binding.appIcon.setOnClickListener { - val sendIntent = Intent().apply { - action = Intent.ACTION_SEND - putExtra(Intent.EXTRA_TEXT, GITHUB_URL) - type = "text/plain" - } - - val shareIntent = Intent.createChooser(sendIntent, null) - startActivity(shareIntent) + val sendIntent = Intent(Intent.ACTION_SEND) + .putExtra(Intent.EXTRA_TEXT, GITHUB_URL) + .setType("text/plain") + startActivity(Intent.createChooser(sendIntent, null)) } setupCard(binding.website, WEBSITE_URL) diff --git a/app/src/main/java/com/github/libretube/ui/dialogs/ShareDialog.kt b/app/src/main/java/com/github/libretube/ui/dialogs/ShareDialog.kt index 44a2c1641..4196b9919 100644 --- a/app/src/main/java/com/github/libretube/ui/dialogs/ShareDialog.kt +++ b/app/src/main/java/com/github/libretube/ui/dialogs/ShareDialog.kt @@ -45,9 +45,7 @@ class ShareDialog( return MaterialAlertDialogBuilder(requireContext()) .setTitle(context?.getString(R.string.share)) - .setItems( - shareOptions - ) { _, which -> + .setItems(shareOptions) { _, which -> val host = when (which) { 0 -> PIPED_FRONTEND_URL 1 -> YOUTUBE_FRONTEND_URL @@ -65,16 +63,12 @@ class ShareDialog( url += "&t=${binding!!.timeStamp.text}" } - val intent = Intent() - intent.apply { - action = Intent.ACTION_SEND - putExtra(Intent.EXTRA_TEXT, url) - putExtra(Intent.EXTRA_SUBJECT, shareableTitle) - type = "text/plain" - } - context?.startActivity( - Intent.createChooser(intent, context?.getString(R.string.shareTo)) - ) + val intent = Intent(Intent.ACTION_SEND) + .putExtra(Intent.EXTRA_TEXT, url) + .putExtra(Intent.EXTRA_SUBJECT, shareableTitle) + .setType("text/plain") + val shareIntent = Intent.createChooser(intent, getString(R.string.shareTo)) + requireContext().startActivity(shareIntent) } .setView(binding?.root) .show()