mirror of
https://github.com/libre-tube/LibreTube.git
synced 2024-12-14 06:10:31 +05:30
Merge pull request #3183 from Isira-Seneviratne/Intent_method_chaining
Use Intent method chaining.
This commit is contained in:
commit
8e603464d4
@ -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)
|
||||
|
@ -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()
|
||||
|
Loading…
Reference in New Issue
Block a user