X-Git-Url: https://gitweb.stoutner.com/?p=PrivacyBrowserAndroid.git;a=blobdiff_plain;f=app%2Fsrc%2Fmain%2Fjava%2Fcom%2Fstoutner%2Fprivacybrowser%2Factivities%2FViewSourceActivity.java;h=a0f51d14b7a2853f31fd5df68ab08d151f42079b;hp=905e91ee32d33adfdb21e60c9362337aba929fb7;hb=4d51aa9acb8daaec1326f14e5025fde6d1f0dcd8;hpb=f0393ca22075be3e5fe9199c7db87381256236fa diff --git a/app/src/main/java/com/stoutner/privacybrowser/activities/ViewSourceActivity.java b/app/src/main/java/com/stoutner/privacybrowser/activities/ViewSourceActivity.java index 905e91ee..a0f51d14 100644 --- a/app/src/main/java/com/stoutner/privacybrowser/activities/ViewSourceActivity.java +++ b/app/src/main/java/com/stoutner/privacybrowser/activities/ViewSourceActivity.java @@ -1,5 +1,5 @@ /* - * Copyright © 2017-2019 Soren Stoutner . + * Copyright © 2017-2020 Soren Stoutner . * * This file is part of 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();