]> gitweb.stoutner.com Git - PrivacyBrowserAndroid.git/blobdiff - app/src/main/java/com/stoutner/privacybrowser/activities/MainWebViewActivity.java
Remove Privacy Browser from the recent app list when closed with back. https://redmi...
[PrivacyBrowserAndroid.git] / app / src / main / java / com / stoutner / privacybrowser / activities / MainWebViewActivity.java
index cf19d3a18480c1963f87ecf20c0a0ca528fa40ac..e8b6c0a6db5fab0e64299820eb9031af8cc7a40b 100644 (file)
@@ -1811,9 +1811,6 @@ public class MainWebViewActivity extends AppCompatActivity implements CreateBook
                     // Get the previous entry URL.
                     String previousUrl = webBackForwardList.getItemAtIndex(webBackForwardList.getCurrentIndex() - 1).getUrl();
 
-                    // Reset the current domain name so that navigation works if third-party requests are blocked.
-                    currentWebView.resetCurrentDomainName();
-
                     // Apply the domain settings.
                     applyDomainSettings(currentWebView, previousUrl, false, false);
 
@@ -1830,9 +1827,6 @@ public class MainWebViewActivity extends AppCompatActivity implements CreateBook
                     // Get the next entry URL.
                     String nextUrl = webBackForwardList.getItemAtIndex(webBackForwardList.getCurrentIndex() + 1).getUrl();
 
-                    // Reset the current domain name so that navigation works if third-party requests are blocked.
-                    currentWebView.resetCurrentDomainName();
-
                     // Apply the domain settings.
                     applyDomainSettings(currentWebView, nextUrl, false, false);
 
@@ -2861,9 +2855,6 @@ public class MainWebViewActivity extends AppCompatActivity implements CreateBook
             // Get the previous entry URL.
             String previousUrl = webBackForwardList.getItemAtIndex(webBackForwardList.getCurrentIndex() - 1).getUrl();
 
-            // Reset the current domain name so that navigation works if third-party requests are blocked.
-            currentWebView.resetCurrentDomainName();
-
             // Apply the domain settings.
             applyDomainSettings(currentWebView, previousUrl, false, false);
 
@@ -2873,8 +2864,12 @@ public class MainWebViewActivity extends AppCompatActivity implements CreateBook
             // Close the current tab.
             closeCurrentTab();
         } else {  // There isn't anything to do in Privacy Browser.
-            // Run the default commands.
-            super.onBackPressed();
+            // Close Privacy Browser.  `finishAndRemoveTask()` also removes Privacy Browser from the recent app list.
+            if (Build.VERSION.SDK_INT >= 21) {
+                finishAndRemoveTask();
+            } else {
+                finish();
+            }
 
             // Manually kill Privacy Browser.  Otherwise, it is glitchy when restarted.
             System.exit(0);
@@ -3687,9 +3682,6 @@ public class MainWebViewActivity extends AppCompatActivity implements CreateBook
 
     @Override
     public void navigateHistory(String url, int steps) {
-        // Reset the current domain name so that navigation works if third-party requests are blocked.
-        currentWebView.resetCurrentDomainName();
-
         // Apply the domain settings.
         applyDomainSettings(currentWebView, url, false, false);
 
@@ -3705,9 +3697,6 @@ public class MainWebViewActivity extends AppCompatActivity implements CreateBook
         // Get the previous entry URL.
         String previousUrl = webBackForwardList.getItemAtIndex(webBackForwardList.getCurrentIndex() - 1).getUrl();
 
-        // Reset the current domain name so that navigation works if third-party requests are blocked.
-        currentWebView.resetCurrentDomainName();
-
         // Apply the domain settings.
         applyDomainSettings(currentWebView, previousUrl, false, false);