/*
- * 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>.
*
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.
// 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.
// 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);
}
// 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);
}
}
}
@Override
- public boolean onOptionsItemSelected(MenuItem menuItem) {
+ public boolean onOptionsItemSelected(@NonNull MenuItem menuItem) {
// Get a handle for the about alert dialog.
DialogFragment aboutDialogFragment = new AboutViewSourceDialog();