Bitmap of FeedImage is now saved globally

This commit is contained in:
Daniel Oeh 2012-04-14 15:30:14 +02:00
parent b85543ff25
commit efe638fa87
3 changed files with 13 additions and 2 deletions

View File

@ -65,7 +65,7 @@ public class ItemviewActivity extends SherlockActivity {
txtvPublished.setText(item.getPubDate());
txtvTitle.setText(item.getTitle());
if(item.getFeed().getImage() != null) {
imgvImage.setImageBitmap(BitmapFactory.decodeFile(item.getFeed().getImage().getFile_url()));
imgvImage.setImageBitmap(item.getFeed().getImage().getImageBitmap());
}
}
}

View File

@ -47,7 +47,7 @@ public class FeedlistAdapter extends ArrayAdapter<Feed> {
holder.title.setText(feed.getTitle());
if(feed.getImage() != null) {
holder.image.setImageBitmap(BitmapFactory.decodeFile(feed.getImage().getFile_url())); // TODO select default picture when no image downloaded
holder.image.setImageBitmap(feed.getImage().getImageBitmap()); // TODO select default picture when no image downloaded
}
// TODO find new Episodes txtvNewEpisodes.setText(feed)
return convertView;

View File

@ -1,7 +1,11 @@
package de.podfetcher.feed;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
public class FeedImage extends FeedFile {
protected String title;
protected Bitmap image_bitmap;
public FeedImage(String download_url, String title) {
super();
@ -24,6 +28,13 @@ public class FeedImage extends FeedFile {
return title;
}
public Bitmap getImageBitmap() {
if(image_bitmap == null) {
image_bitmap = BitmapFactory.decodeFile(getFile_url());
}
return image_bitmap;
}