Fix #888 Implement share card.

This commit is contained in:
Donovan Preston 2019-01-16 12:05:39 -05:00
parent 32a77180b0
commit af61434b72
3 changed files with 42 additions and 6 deletions

View file

@ -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()