diff options
author | daniel oeh <daniel.oeh@gmail.com> | 2012-08-26 21:53:34 +0200 |
---|---|---|
committer | daniel oeh <daniel.oeh@gmail.com> | 2012-08-26 21:53:34 +0200 |
commit | 616c247d84288c2d5924087a37e05a21ca036c43 (patch) | |
tree | 85e59afb3d2a94f9ec64451dcae3e80ed005ac9d /src/de/danoeh/antennapod/asynctask/BitmapDecodeWorkerTask.java | |
parent | 40e0950c23e57bfcacce6b84b2b9389005843a8f (diff) | |
download | AntennaPod-616c247d84288c2d5924087a37e05a21ca036c43.zip |
Cached bitmaps will now have the same size as their ImageViews
Diffstat (limited to 'src/de/danoeh/antennapod/asynctask/BitmapDecodeWorkerTask.java')
-rw-r--r-- | src/de/danoeh/antennapod/asynctask/BitmapDecodeWorkerTask.java | 21 |
1 files changed, 8 insertions, 13 deletions
diff --git a/src/de/danoeh/antennapod/asynctask/BitmapDecodeWorkerTask.java b/src/de/danoeh/antennapod/asynctask/BitmapDecodeWorkerTask.java index c18763d48..66341dfde 100644 --- a/src/de/danoeh/antennapod/asynctask/BitmapDecodeWorkerTask.java +++ b/src/de/danoeh/antennapod/asynctask/BitmapDecodeWorkerTask.java @@ -17,32 +17,27 @@ import de.danoeh.antennapod.util.BitmapDecoder; public abstract class BitmapDecodeWorkerTask extends Thread { protected int PREFERRED_LENGTH; - - public static final int LENGTH_BASE_COVER = 200; - public static final int LENGTH_BASE_THUMBNAIL = 100; + + /** Can be thumbnail or cover */ + protected int imageType; private static final String TAG = "BitmapDecodeWorkerTask"; private ImageView target; protected Bitmap bitmap; private Bitmap decodedBitmap; - protected int baseLength; - protected String fileUrl; private Handler handler; public BitmapDecodeWorkerTask(Handler handler, ImageView target, - String fileUrl, int length) { + String fileUrl, int length, int imageType) { super(); this.handler = handler; this.target = target; this.fileUrl = fileUrl; - this.baseLength = length; - this.PREFERRED_LENGTH = (int) (length * PodcastApp.getLogicalDensity() + 0.5f); - if (PodcastApp.getInstance().isLargeScreen()) { - this.PREFERRED_LENGTH *= 2.0; - } + this.PREFERRED_LENGTH = length; + this.imageType = imageType; } /** @@ -108,9 +103,9 @@ public abstract class BitmapDecodeWorkerTask extends Thread { protected void storeBitmapInCache(Bitmap bitmap) { FeedImageLoader loader = FeedImageLoader.getInstance(); - if (baseLength == LENGTH_BASE_COVER) { + if (imageType == FeedImageLoader.IMAGE_TYPE_COVER) { loader.addBitmapToCoverCache(fileUrl, bitmap); - } else if (baseLength == LENGTH_BASE_THUMBNAIL) { + } else if (imageType == FeedImageLoader.IMAGE_TYPE_THUMBNAIL) { loader.addBitmapToThumbnailCache(fileUrl, bitmap); } } |