aboutsummaryrefslogtreecommitdiffstats
path: root/main/src/cgeo/geocaching/network
diff options
context:
space:
mode:
authorSamuel Tardieu <sam@rfc1149.net>2011-11-01 15:49:53 +0100
committerSamuel Tardieu <sam@rfc1149.net>2011-11-01 15:49:53 +0100
commitc23a416a47f0581db2a40cf5f43e3eb8f8d9b3b4 (patch)
treef880ef9ccc0db9674db2e4e62d40c0d91363679b /main/src/cgeo/geocaching/network
parenta4e77231246031d1614929334453c5c9299bca17 (diff)
downloadcgeo-c23a416a47f0581db2a40cf5f43e3eb8f8d9b3b4.zip
cgeo-c23a416a47f0581db2a40cf5f43e3eb8f8d9b3b4.tar.gz
cgeo-c23a416a47f0581db2a40cf5f43e3eb8f8d9b3b4.tar.bz2
Cache images systematically
See discussion in #742.
Diffstat (limited to 'main/src/cgeo/geocaching/network')
-rw-r--r--main/src/cgeo/geocaching/network/HtmlImage.java25
1 files changed, 3 insertions, 22 deletions
diff --git a/main/src/cgeo/geocaching/network/HtmlImage.java b/main/src/cgeo/geocaching/network/HtmlImage.java
index b3511e3..7f4bc1b 100644
--- a/main/src/cgeo/geocaching/network/HtmlImage.java
+++ b/main/src/cgeo/geocaching/network/HtmlImage.java
@@ -22,8 +22,6 @@ import android.view.Display;
import android.view.WindowManager;
import java.io.File;
-import java.io.IOException;
-import java.io.InputStream;
import java.util.Date;
public class HtmlImage implements Html.ImageGetter {
@@ -45,22 +43,16 @@ public class HtmlImage implements Html.ImageGetter {
final private boolean returnErrorImage;
final private int reason;
final private boolean onlySave;
- final private boolean save;
final private BitmapFactory.Options bfOptions;
final private int maxWidth;
final private int maxHeight;
- public HtmlImage(final Context context, final String geocode, final boolean returnErrorImage, final int reason, final boolean onlySave) {
- this(context, geocode, returnErrorImage, reason, onlySave, true);
- }
-
- public HtmlImage(final Context contextIn, final String geocode, final boolean returnErrorImage, final int reason, final boolean onlySave, final boolean save) {
+ public HtmlImage(final Context contextIn, final String geocode, final boolean returnErrorImage, final int reason, final boolean onlySave) {
this.context = contextIn;
this.geocode = geocode;
this.returnErrorImage = returnErrorImage;
this.reason = reason;
this.onlySave = onlySave;
- this.save = save;
bfOptions = new BitmapFactory.Options();
bfOptions.inTempStorage = new byte[16 * 1024];
@@ -100,19 +92,8 @@ public class HtmlImage implements Html.ImageGetter {
}
}
- if (save) {
- final File file = LocalStorage.getStorageFile(geocode, url, true);
- LocalStorage.saveEntityToFile(bufferedEntity, file);
- } else {
- setSampleSize(bufferedEntity.getContentLength());
- InputStream is;
- try {
- is = bufferedEntity.getContent();
- imagePre = BitmapFactory.decodeStream(is, null, bfOptions);
- } catch (IOException e) {
- Log.e(Settings.tag, "HtmlImage.getDrawable (decoding image)", e);
- }
- }
+ final File file = LocalStorage.getStorageFile(geocode, url, true);
+ LocalStorage.saveEntityToFile(bufferedEntity, file);
}
if (onlySave) {