mirror of
https://github.com/libre-tube/LibreTube.git
synced 2024-12-14 22:30:30 +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 {
|
binding.appIcon.setOnClickListener {
|
||||||
val sendIntent = Intent().apply {
|
val sendIntent = Intent(Intent.ACTION_SEND)
|
||||||
action = Intent.ACTION_SEND
|
.putExtra(Intent.EXTRA_TEXT, GITHUB_URL)
|
||||||
putExtra(Intent.EXTRA_TEXT, GITHUB_URL)
|
.setType("text/plain")
|
||||||
type = "text/plain"
|
startActivity(Intent.createChooser(sendIntent, null))
|
||||||
}
|
|
||||||
|
|
||||||
val shareIntent = Intent.createChooser(sendIntent, null)
|
|
||||||
startActivity(shareIntent)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
setupCard(binding.website, WEBSITE_URL)
|
setupCard(binding.website, WEBSITE_URL)
|
||||||
|
@ -45,9 +45,7 @@ class ShareDialog(
|
|||||||
|
|
||||||
return MaterialAlertDialogBuilder(requireContext())
|
return MaterialAlertDialogBuilder(requireContext())
|
||||||
.setTitle(context?.getString(R.string.share))
|
.setTitle(context?.getString(R.string.share))
|
||||||
.setItems(
|
.setItems(shareOptions) { _, which ->
|
||||||
shareOptions
|
|
||||||
) { _, which ->
|
|
||||||
val host = when (which) {
|
val host = when (which) {
|
||||||
0 -> PIPED_FRONTEND_URL
|
0 -> PIPED_FRONTEND_URL
|
||||||
1 -> YOUTUBE_FRONTEND_URL
|
1 -> YOUTUBE_FRONTEND_URL
|
||||||
@ -65,16 +63,12 @@ class ShareDialog(
|
|||||||
url += "&t=${binding!!.timeStamp.text}"
|
url += "&t=${binding!!.timeStamp.text}"
|
||||||
}
|
}
|
||||||
|
|
||||||
val intent = Intent()
|
val intent = Intent(Intent.ACTION_SEND)
|
||||||
intent.apply {
|
.putExtra(Intent.EXTRA_TEXT, url)
|
||||||
action = Intent.ACTION_SEND
|
.putExtra(Intent.EXTRA_SUBJECT, shareableTitle)
|
||||||
putExtra(Intent.EXTRA_TEXT, url)
|
.setType("text/plain")
|
||||||
putExtra(Intent.EXTRA_SUBJECT, shareableTitle)
|
val shareIntent = Intent.createChooser(intent, getString(R.string.shareTo))
|
||||||
type = "text/plain"
|
requireContext().startActivity(shareIntent)
|
||||||
}
|
|
||||||
context?.startActivity(
|
|
||||||
Intent.createChooser(intent, context?.getString(R.string.shareTo))
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
.setView(binding?.root)
|
.setView(binding?.root)
|
||||||
.show()
|
.show()
|
||||||
|
Loading…
Reference in New Issue
Block a user