X-Git-Url: https://gitweb.stoutner.com/?a=blobdiff_plain;f=app%2Fsrc%2Fmain%2Fjava%2Fcom%2Fstoutner%2Fprivacybrowser%2Factivities%2FMainWebViewActivity.kt;h=5235003a9ef563c51d7d4fb372ba31301fa32356;hb=de2206427ad5a8c3f68276a573a5ffe85c7c17a2;hp=2409b18b1b744c3a218f45f5af56aee1c91ecf77;hpb=cbeede13395a246b8a32adebbee3872031259f82;p=PrivacyBrowserAndroid.git diff --git a/app/src/main/java/com/stoutner/privacybrowser/activities/MainWebViewActivity.kt b/app/src/main/java/com/stoutner/privacybrowser/activities/MainWebViewActivity.kt index 2409b18b..5235003a 100644 --- a/app/src/main/java/com/stoutner/privacybrowser/activities/MainWebViewActivity.kt +++ b/app/src/main/java/com/stoutner/privacybrowser/activities/MainWebViewActivity.kt @@ -2545,6 +2545,27 @@ class MainWebViewActivity : AppCompatActivity(), CreateBookmarkDialog.CreateBook true } + // Add a Share URL entry. + contextMenu.add(R.string.share_url).setOnMenuItemClickListener { + // Create the share intent. + val shareUrlIntent = Intent(Intent.ACTION_SEND) + + // Add the URL to the intent. + shareUrlIntent.putExtra(Intent.EXTRA_TEXT, linkUrl) + + // Set the MIME type. + shareUrlIntent.type = "text/plain" + + // Set the intent to open in a new task. + shareUrlIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK) + + //Make it so. + startActivity(Intent.createChooser(shareUrlIntent, getString(R.string.share_url))) + + // Consume the event. + true + } + // Add an empty cancel entry, which by default closes the context menu. contextMenu.add(R.string.cancel) } @@ -2621,6 +2642,27 @@ class MainWebViewActivity : AppCompatActivity(), CreateBookmarkDialog.CreateBook true } + // Add a Share URL entry. + contextMenu.add(R.string.share_url).setOnMenuItemClickListener { + // Create the share intent. + val shareUrlIntent = Intent(Intent.ACTION_SEND) + + // Add the URL to the intent. + shareUrlIntent.putExtra(Intent.EXTRA_TEXT, imageUrl) + + // Set the MIME type. + shareUrlIntent.type = "text/plain" + + // Set the intent to open in a new task. + shareUrlIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK) + + //Make it so. + startActivity(Intent.createChooser(shareUrlIntent, getString(R.string.share_url))) + + // Consume the event. + true + } + // Add an empty cancel entry, which by default closes the context menu. contextMenu.add(R.string.cancel) } @@ -2711,6 +2753,27 @@ class MainWebViewActivity : AppCompatActivity(), CreateBookmarkDialog.CreateBook true } + // Add a Share Image entry. + contextMenu.add(R.string.share_image).setOnMenuItemClickListener { + // Create the share intent. + val shareUrlIntent = Intent(Intent.ACTION_SEND) + + // Add the URL to the intent. + shareUrlIntent.putExtra(Intent.EXTRA_TEXT, imageUrl) + + // Set the MIME type. + shareUrlIntent.type = "text/plain" + + // Set the intent to open in a new task. + shareUrlIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK) + + //Make it so. + startActivity(Intent.createChooser(shareUrlIntent, getString(R.string.share_url))) + + // Consume the event. + true + } + // Add a copy URL entry. contextMenu.add(R.string.copy_url).setOnMenuItemClickListener { // Save the link URL in a clip data. @@ -2735,6 +2798,27 @@ class MainWebViewActivity : AppCompatActivity(), CreateBookmarkDialog.CreateBook true } + // Add a Share URL entry. + contextMenu.add(R.string.share_url).setOnMenuItemClickListener { + // Create the share intent. + val shareUrlIntent = Intent(Intent.ACTION_SEND) + + // Add the URL to the intent. + shareUrlIntent.putExtra(Intent.EXTRA_TEXT, linkUrl) + + // Set the MIME type. + shareUrlIntent.type = "text/plain" + + // Set the intent to open in a new task. + shareUrlIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK) + + //Make it so. + startActivity(Intent.createChooser(shareUrlIntent, getString(R.string.share_url))) + + // Consume the event. + true + } + // Add an empty cancel entry, which by default closes the context menu. contextMenu.add(R.string.cancel) }