X-Git-Url: https://gitweb.stoutner.com/?p=PrivacyBrowserAndroid.git;a=blobdiff_plain;f=app%2Fsrc%2Fmain%2Fjava%2Fcom%2Fstoutner%2Fprivacybrowser%2Fasynctasks%2FSaveUrl.java;h=2096e13907350100b73661efbb4ac4d16efd5ccb;hp=10a956091a6586e12b2e869ead094677d348d8bb;hb=39380e8e8bdb3b9e29569a263277c9c3112b44ac;hpb=86e63c8ed007311ab392d4beb7dd7ba64b9c3c70 diff --git a/app/src/main/java/com/stoutner/privacybrowser/asynctasks/SaveUrl.java b/app/src/main/java/com/stoutner/privacybrowser/asynctasks/SaveUrl.java index 10a95609..2096e139 100644 --- a/app/src/main/java/com/stoutner/privacybrowser/asynctasks/SaveUrl.java +++ b/app/src/main/java/com/stoutner/privacybrowser/asynctasks/SaveUrl.java @@ -51,16 +51,16 @@ import java.text.NumberFormat; public class SaveUrl extends AsyncTask { // Define a weak references. - private WeakReference contextWeakReference; - private WeakReference activityWeakReference; + private final WeakReference contextWeakReference; + private final WeakReference activityWeakReference; // Define a success string constant. private final String SUCCESS = "Success"; // Define the class variables. - private String filePathString; - private String userAgent; - private boolean cookiesEnabled; + private final String filePathString; + private final String userAgent; + private final boolean cookiesEnabled; private Snackbar savingFileSnackbar; // The public constructor. @@ -225,20 +225,20 @@ public class SaveUrl extends AsyncTask { // Close the file output stream. fileOutputStream.close(); - - // Create a media scanner intent, which adds items like pictures to Android's recent file list. - Intent mediaScannerIntent = new Intent(Intent.ACTION_MEDIA_SCANNER_SCAN_FILE); - - // Add the URI to the media scanner intent. - mediaScannerIntent.setData(Uri.fromFile(file)); - - // Make it so. - activity.sendBroadcast(mediaScannerIntent); } finally { // Disconnect the HTTP URL connection. httpUrlConnection.disconnect(); } } + + // Create a media scanner intent, which adds items like pictures to Android's recent file list. + Intent mediaScannerIntent = new Intent(Intent.ACTION_MEDIA_SCANNER_SCAN_FILE); + + // Add the URI to the media scanner intent. + mediaScannerIntent.setData(Uri.fromFile(file)); + + // Make it so. + activity.sendBroadcast(mediaScannerIntent); } catch (Exception exception) { // Store the error in the save disposition string. saveDisposition = exception.toString();