import com.stoutner.privacybrowser.helpers.DomainsDatabaseHelper;
import com.stoutner.privacybrowser.helpers.ProxyHelper;
import com.stoutner.privacybrowser.helpers.SanitizeUrlHelper;
+import com.stoutner.privacybrowser.helpers.UrlHelper;
import com.stoutner.privacybrowser.views.NestedScrollWebView;
import java.io.ByteArrayInputStream;
private BookmarksDatabaseHelper bookmarksDatabaseHelper;
private DomainsDatabaseHelper domainsDatabaseHelper;
private ProxyHelper proxyHelper;
- private SanitizeUrlHelper sanitizeUrlHelper;
// Declare the class variables
private boolean bookmarksDrawerPinned;
bookmarksDatabaseHelper = new BookmarksDatabaseHelper(this);
domainsDatabaseHelper = new DomainsDatabaseHelper(this);
proxyHelper = new ProxyHelper();
- sanitizeUrlHelper = new SanitizeUrlHelper();
// Update the bookmarks drawer pinned image view.
updateBookmarksDrawerPinnedImageView();
private String sanitizeUrl(String url) {
// Sanitize tracking queries.
if (sanitizeTrackingQueries)
- url = sanitizeUrlHelper.sanitizeTrackingQueries(url);
+ url = SanitizeUrlHelper.sanitizeTrackingQueries(url);
// Sanitize AMP redirects.
if (sanitizeAmpRedirects)
- url = sanitizeUrlHelper.sanitizeAmpRedirects(url);
+ url = SanitizeUrlHelper.sanitizeAmpRedirects(url);
// Return the sanitized URL.
return url;
}
// Get the file name from the content disposition.
- String fileNameString = PrepareSaveDialogCoroutine.getFileNameFromHeaders(this, contentDisposition, mimetype, downloadUrl);
+ String fileNameString = UrlHelper.getFileName(this, contentDisposition, mimetype, downloadUrl);
// Instantiate the save dialog.
- DialogFragment saveDialogFragment = SaveDialog.saveUrl(downloadUrl, formattedFileSizeString, fileNameString, userAgent,
+ DialogFragment saveDialogFragment = SaveDialog.saveUrl(downloadUrl, fileNameString, formattedFileSizeString, userAgent,
nestedScrollWebView.getAcceptCookies());
// Try to show the dialog. The download listener continues to function even when the WebView is paused. Attempting to display a dialog in that state leads to a crash.
// Set the favorite icon when it changes.
@Override
public void onReceivedIcon(WebView view, Bitmap icon) {
- // Only update the favorite icon if the website has finished loading and the new favorite icon height is greater than the current favorite icon height. This prevents low resolution icons from replacing high resolution one.
+ // Only update the favorite icon if the website has finished loading and the new favorite icon height is greater than the current favorite icon height.
+ // This prevents low resolution icons from replacing high resolution one.
+ // The check for the visibility of the progress bar can possibly be removed once https://redmine.stoutner.com/issues/747 is fixed.
if ((progressBar.getVisibility() == View.GONE) && (icon.getHeight() > nestedScrollWebView.getFavoriteIconHeight())) {
// Store the new favorite icon.
nestedScrollWebView.setFavoriteIcon(icon);