aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSamuel Tardieu <sam@rfc1149.net>2011-10-04 23:35:15 +0200
committerSamuel Tardieu <sam@rfc1149.net>2011-10-05 11:20:21 +0200
commit01151f31230fd842e606c2d2ebef7781f84c9580 (patch)
treee41a3680f6f3ad7fbc3ef53e198decdce5d68e52
parent4905590635f06021873966d8302885d52301665c (diff)
downloadcgeo-01151f31230fd842e606c2d2ebef7781f84c9580.zip
cgeo-01151f31230fd842e606c2d2ebef7781f84c9580.tar.gz
cgeo-01151f31230fd842e606c2d2ebef7781f84c9580.tar.bz2
cgHtmlImg needs only a Context, not necessarily an Activity
-rw-r--r--main/src/cgeo/geocaching/cgHtmlImg.java12
1 files changed, 6 insertions, 6 deletions
diff --git a/main/src/cgeo/geocaching/cgHtmlImg.java b/main/src/cgeo/geocaching/cgHtmlImg.java
index 4486b21..447fec1 100644
--- a/main/src/cgeo/geocaching/cgHtmlImg.java
+++ b/main/src/cgeo/geocaching/cgHtmlImg.java
@@ -37,7 +37,7 @@ public class cgHtmlImg implements Html.ImageGetter {
"gccounter/imgcount.php",
"flagcounter.com"
};
- final private Activity activity;
+ final private Context context;
final private String geocode;
final private boolean placement;
final private int reason;
@@ -52,8 +52,8 @@ public class cgHtmlImg implements Html.ImageGetter {
this(activityIn, geocodeIn, placementIn, reasonIn, onlySaveIn, true);
}
- public cgHtmlImg(Activity activityIn, String geocodeIn, boolean placementIn, int reasonIn, boolean onlySaveIn, boolean saveIn) {
- activity = activityIn;
+ public cgHtmlImg(Context contextIn, String geocodeIn, boolean placementIn, int reasonIn, boolean onlySaveIn, boolean saveIn) {
+ context = contextIn;
geocode = geocodeIn;
placement = placementIn;
reason = reasonIn;
@@ -63,7 +63,7 @@ public class cgHtmlImg implements Html.ImageGetter {
bfOptions = new BitmapFactory.Options();
bfOptions.inTempStorage = new byte[16 * 1024];
- display = ((WindowManager) activity.getSystemService(Context.WINDOW_SERVICE)).getDefaultDisplay();
+ display = ((WindowManager) context.getSystemService(Context.WINDOW_SERVICE)).getDefaultDisplay();
maxWidth = display.getWidth() - 25;
maxHeight = display.getHeight() - 25;
}
@@ -208,9 +208,9 @@ public class cgHtmlImg implements Html.ImageGetter {
Log.d(Settings.tag, "cgHtmlImg.getDrawable: Failed to obtain image");
if (placement) {
- imagePre = BitmapFactory.decodeResource(activity.getResources(), R.drawable.image_not_loaded);
+ imagePre = BitmapFactory.decodeResource(context.getResources(), R.drawable.image_not_loaded);
} else {
- imagePre = BitmapFactory.decodeResource(activity.getResources(), R.drawable.image_no_placement);
+ imagePre = BitmapFactory.decodeResource(context.getResources(), R.drawable.image_no_placement);
}
}