Fix #888 Implement share card.
This commit is contained in:
parent
32a77180b0
commit
af61434b72
3 changed files with 42 additions and 6 deletions
|
@ -35,6 +35,11 @@ class WebAppInterface(private val mContext: MainActivity) {
|
|||
fun beginOAuthFlow() {
|
||||
mContext.beginOAuthFlow();
|
||||
}
|
||||
|
||||
@JavascriptInterface
|
||||
fun shareUrl(url: String) {
|
||||
mContext.shareUrl(url)
|
||||
}
|
||||
}
|
||||
|
||||
class MainActivity : AppCompatActivity(), AdvancedWebView.Listener {
|
||||
|
@ -94,6 +99,14 @@ class MainActivity : AppCompatActivity(), AdvancedWebView.Listener {
|
|||
})
|
||||
}
|
||||
|
||||
fun shareUrl(url: String) {
|
||||
val shareIntent = Intent()
|
||||
shareIntent.action = Intent.ACTION_SEND
|
||||
shareIntent.type = "text/plain"
|
||||
shareIntent.putExtra(Intent.EXTRA_TEXT, url);
|
||||
startActivity(Intent.createChooser(shareIntent, ""))
|
||||
}
|
||||
|
||||
@SuppressLint("NewApi")
|
||||
override fun onResume() {
|
||||
super.onResume()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue