]> gitweb.stoutner.com Git - PrivacyBrowserAndroid.git/blobdiff - app/src/main/java/com/stoutner/privacybrowser/activities/ViewSourceActivity.java
Respect proxies when getting source and saving URLs. https://redmine.stoutner.com...
[PrivacyBrowserAndroid.git] / app / src / main / java / com / stoutner / privacybrowser / activities / ViewSourceActivity.java
index 905e91ee32d33adfdb21e60c9362337aba929fb7..a0f51d14b7a2853f31fd5df68ab08d151f42079b 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright © 2017-2019 Soren Stoutner <soren@stoutner.com>.
+ * Copyright © 2017-2020 Soren Stoutner <soren@stoutner.com>.
  *
  * This file is part of Privacy Browser <https://www.stoutner.com/privacy-browser>.
  *
@@ -35,6 +35,7 @@ import android.view.WindowManager;
 import android.view.inputmethod.InputMethodManager;
 import android.widget.EditText;
 
+import androidx.annotation.NonNull;
 import androidx.appcompat.app.ActionBar;
 import androidx.appcompat.app.AppCompatActivity;
 import androidx.appcompat.widget.Toolbar;  // The AndroidX toolbar must be used until the minimum API is >= 21.
@@ -160,7 +161,7 @@ public class ViewSourceActivity extends AppCompatActivity {
 
                 // Get new source data for the current URL if it beings with `http`.
                 if (url.startsWith("http")) {
-                    new GetSource(this, userAgent).execute(url);
+                    new GetSource(this, this, userAgent).execute(url);
                 }
 
                 // Consume the key press.
@@ -181,7 +182,7 @@ public class ViewSourceActivity extends AppCompatActivity {
 
             // Get new source data for the URL if it begins with `http`.
             if (url.startsWith("http")) {
-                new GetSource(this, userAgent).execute(url);
+                new GetSource(this, this, userAgent).execute(url);
             } else {
                 // Stop the refresh animation.
                 swipeRefreshLayout.setRefreshing(false);
@@ -197,8 +198,8 @@ public class ViewSourceActivity extends AppCompatActivity {
         }
 
         // Get the source using an AsyncTask if the URL begins with `http`.
-        if (currentUrl.startsWith("http")) {
-            new GetSource(this, userAgent).execute(currentUrl);
+        if ((currentUrl != null) && currentUrl.startsWith("http")) {
+            new GetSource(this, this, userAgent).execute(currentUrl);
         }
     }
 
@@ -212,7 +213,7 @@ public class ViewSourceActivity extends AppCompatActivity {
     }
 
     @Override
-    public boolean onOptionsItemSelected(MenuItem menuItem) {
+    public boolean onOptionsItemSelected(@NonNull MenuItem menuItem) {
         // Get a handle for the about alert dialog.
         DialogFragment aboutDialogFragment = new AboutViewSourceDialog();