]> gitweb.stoutner.com Git - PrivacyBrowserAndroid.git/blobdiff - app/src/main/java/com/stoutner/privacybrowser/activities/MainWebViewActivity.java
Fix "Web search" from the text selection context menu. https://redmine.stoutner...
[PrivacyBrowserAndroid.git] / app / src / main / java / com / stoutner / privacybrowser / activities / MainWebViewActivity.java
index 205331fddfc958cf93c6d01aa92480b7546d4658..50f6a2cca239d85c35f75f280371f151ca58c8be 100644 (file)
@@ -810,8 +810,11 @@ public class MainWebViewActivity extends AppCompatActivity implements CreateBook
         String intentAction = intent.getAction();
         Uri intentUriData = intent.getData();
 
-        // Only process the URI if it contains data.  If the user pressed the desktop icon after the app was already running the URI will be null.
-        if (intentUriData != null) {
+        // Determine if this is a web search.
+        boolean isWebSearch = ((intentAction != null) && intentAction.equals(Intent.ACTION_WEB_SEARCH));
+
+        // Only process the URI if it contains data or it is a web search.  If the user pressed the desktop icon after the app was already running the URI will be null.
+        if (intentUriData != null || isWebSearch) {
             // Get the shared preferences.
             SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(this);
 
@@ -828,7 +831,7 @@ public class MainWebViewActivity extends AppCompatActivity implements CreateBook
             String url;
 
             // If the intent action is a web search, perform the search.
-            if ((intentAction != null) && intentAction.equals(Intent.ACTION_WEB_SEARCH)) {
+            if (isWebSearch) {
                 // Create an encoded URL string.
                 String encodedUrlString;