aboutsummaryrefslogtreecommitdiffstats
path: root/main/src/cgeo/geocaching/ui/DirectionImage.java
diff options
context:
space:
mode:
authorBananeweizen <bananeweizen@gmx.de>2012-01-14 15:02:15 +0100
committerBananeweizen <bananeweizen@gmx.de>2012-01-14 15:02:15 +0100
commite61a40fc8a4a3d5ab5a59346eddd1c43bcc4857e (patch)
treea2a8aec422fde537c500cf90ad70e606ba416121 /main/src/cgeo/geocaching/ui/DirectionImage.java
parent77a8bc851569ae7a82f76a0913b39006074ac56a (diff)
downloadcgeo-e61a40fc8a4a3d5ab5a59346eddd1c43bcc4857e.zip
cgeo-e61a40fc8a4a3d5ab5a59346eddd1c43bcc4857e.tar.gz
cgeo-e61a40fc8a4a3d5ab5a59346eddd1c43bcc4857e.tar.bz2
refactoring: move more widget related classes into own package
Diffstat (limited to 'main/src/cgeo/geocaching/ui/DirectionImage.java')
-rw-r--r--main/src/cgeo/geocaching/ui/DirectionImage.java30
1 files changed, 30 insertions, 0 deletions
diff --git a/main/src/cgeo/geocaching/ui/DirectionImage.java b/main/src/cgeo/geocaching/ui/DirectionImage.java
new file mode 100644
index 0000000..17c253a
--- /dev/null
+++ b/main/src/cgeo/geocaching/ui/DirectionImage.java
@@ -0,0 +1,30 @@
+package cgeo.geocaching.ui;
+
+import cgeo.geocaching.Parameters;
+import cgeo.geocaching.cgBase;
+import cgeo.geocaching.files.LocalStorage;
+
+import org.apache.commons.lang3.StringUtils;
+import org.apache.http.HttpResponse;
+
+import java.io.File;
+
+public class DirectionImage {
+
+ public static void getDrawable(final String geocode, final String code) {
+ if (StringUtils.isBlank(geocode) || StringUtils.isBlank(code)) {
+ return;
+ }
+
+ final HttpResponse httpResponse =
+ cgBase.request("http://www.geocaching.com/ImgGen/seek/CacheDir.ashx", new Parameters("k", code), false);
+ if (httpResponse != null) {
+ LocalStorage.saveEntityToFile(httpResponse.getEntity(), getDirectionFile(geocode, true));
+ }
+ }
+
+ public static File getDirectionFile(final String geocode, final boolean createDirs) {
+ return LocalStorage.getStorageFile(geocode, "direction.png", false, createDirs);
+ }
+
+} \ No newline at end of file