Apply domain settings after closing `DomainActivity` or `SettingsActivity`. Implemen...
authorSoren Stoutner <soren@stoutner.com>
Wed, 22 Mar 2017 23:57:51 +0000 (16:57 -0700)
committerSoren Stoutner <soren@stoutner.com>
Wed, 22 Mar 2017 23:57:51 +0000 (16:57 -0700)
app/src/main/java/com/stoutner/privacybrowser/activities/MainWebViewActivity.java

index e3c85f5705996074959e4fd3362d2066be6188b2..1ec9e746d7d1e61e021b7055b8d88e40b3b16593 100644 (file)
@@ -209,7 +209,7 @@ public class MainWebViewActivity extends AppCompatActivity implements Navigation
     // `proxyThroughOrbot` is used in `onCreate()` and `applySettings()`
     private boolean proxyThroughOrbot;
 
-    // `currentDomain` is used in `onCreate() and `applyDomainSettings()`.
+    // `currentDomain` is used in `onCreate(), `onNavigationItemSelected()`, and `applyDomainSettings()`.
     private String currentDomain;
 
     // `pendingUrl` is used in `onCreate()` and `applySettings()`
@@ -1271,12 +1271,18 @@ public class MainWebViewActivity extends AppCompatActivity implements Navigation
                 break;
 
             case R.id.settings:
+                // Reset `currentDomain` so that domain settings are reapplied after returning to `MainWebViewActivity`.
+                currentDomain = "";
+
                 // Launch `SettingsActivity`.
                 Intent settingsIntent = new Intent(this, SettingsActivity.class);
                 startActivity(settingsIntent);
                 break;
 
             case R.id.domains:
+                // Reset `currentDomain` so that domain settings are reapplied after returning to `MainWebViewActivity`.
+                currentDomain = "";
+
                 // Launch `DomainsActivity`.
                 Intent domainsIntent = new Intent(this, DomainsActivity.class);
                 startActivity(domainsIntent);