Call fit() instead of resize()

This commit is contained in:
daniel oeh 2014-08-11 20:09:00 +02:00
parent 4002fc4bba
commit dccbfea114
12 changed files with 14 additions and 26 deletions

View File

@ -382,6 +382,7 @@ public class AudioplayerActivity extends MediaplayerActivity implements ItemDesc
public void run() { public void run() {
PicassoProvider.getMediaMetadataPicassoInstance(AudioplayerActivity.this) PicassoProvider.getMediaMetadataPicassoInstance(AudioplayerActivity.this)
.load(media.getImageUri()) .load(media.getImageUri())
.fit()
.into(butNavLeft); .into(butNavLeft);
} }
}); });
@ -398,6 +399,7 @@ public class AudioplayerActivity extends MediaplayerActivity implements ItemDesc
public void run() { public void run() {
PicassoProvider.getMediaMetadataPicassoInstance(AudioplayerActivity.this) PicassoProvider.getMediaMetadataPicassoInstance(AudioplayerActivity.this)
.load(media.getImageUri()) .load(media.getImageUri())
.fit()
.into(butNavLeft); .into(butNavLeft);
} }

View File

@ -123,10 +123,9 @@ public class DefaultOnlineFeedViewActivity extends OnlineFeedViewActivity {
subscribeButton = (Button) header.findViewById(R.id.butSubscribe); subscribeButton = (Button) header.findViewById(R.id.butSubscribe);
if (feed.getImage() != null) { if (feed.getImage() != null) {
int imageSize = (int) getResources().getDimension(R.dimen.thumbnail_length);
PicassoProvider.getDefaultPicassoInstance(this) PicassoProvider.getDefaultPicassoInstance(this)
.load(feed.getImage().getDownload_url()) .load(feed.getImage().getDownload_url())
.resize(imageSize, imageSize) .fit()
.into(cover); .into(cover);
} }

View File

@ -80,6 +80,7 @@ public class FeedInfoActivity extends ActionBarActivity {
public void run() { public void run() {
PicassoProvider.getDefaultPicassoInstance(FeedInfoActivity.this) PicassoProvider.getDefaultPicassoInstance(FeedInfoActivity.this)
.load(feed.getImageUri()) .load(feed.getImageUri())
.fit()
.into(imgvCover); .into(imgvCover);
} }
}); });

View File

@ -89,7 +89,7 @@ public class DownloadedEpisodesListAdapter extends BaseAdapter {
PicassoProvider.getMediaMetadataPicassoInstance(context) PicassoProvider.getMediaMetadataPicassoInstance(context)
.load(item.getImageUri()) .load(item.getImageUri())
.resize(imageSize, imageSize) .fit()
.into(holder.imageView); .into(holder.imageView);
return convertView; return convertView;

View File

@ -176,7 +176,7 @@ public class ExternalEpisodesListAdapter extends BaseExpandableListAdapter {
PicassoProvider.getMediaMetadataPicassoInstance(context) PicassoProvider.getMediaMetadataPicassoInstance(context)
.load(item.getImageUri()) .load(item.getImageUri())
.resize(imageSize, imageSize) .fit()
.into(holder.feedImage); .into(holder.feedImage);
holder.butAction.setFocusable(false); holder.butAction.setFocusable(false);

View File

@ -32,8 +32,6 @@ public class NavListAdapter extends BaseAdapter {
private ItemAccess itemAccess; private ItemAccess itemAccess;
private Context context; private Context context;
private final int imageSize;
public NavListAdapter(ItemAccess itemAccess, Context context) { public NavListAdapter(ItemAccess itemAccess, Context context) {
this.itemAccess = itemAccess; this.itemAccess = itemAccess;
this.context = context; this.context = context;
@ -43,7 +41,6 @@ public class NavListAdapter extends BaseAdapter {
drawables = new Drawable[]{ta.getDrawable(0), ta.getDrawable(1), ta.getDrawable(2), drawables = new Drawable[]{ta.getDrawable(0), ta.getDrawable(1), ta.getDrawable(2),
ta.getDrawable(3), ta.getDrawable(4)}; ta.getDrawable(3), ta.getDrawable(4)};
ta.recycle(); ta.recycle();
this.imageSize = (int) context.getResources().getDimension(R.dimen.thumbnail_length_navlist);
} }
@Override @Override
@ -195,7 +192,7 @@ public class NavListAdapter extends BaseAdapter {
PicassoProvider.getDefaultPicassoInstance(context) PicassoProvider.getDefaultPicassoInstance(context)
.load(feed.getImageUri()) .load(feed.getImageUri())
.resize(imageSize, imageSize) .fit()
.into(holder.image); .into(holder.image);
return convertView; return convertView;

View File

@ -27,7 +27,6 @@ public class NewEpisodesListAdapter extends BaseAdapter {
private final ItemAccess itemAccess; private final ItemAccess itemAccess;
private final ActionButtonCallback actionButtonCallback; private final ActionButtonCallback actionButtonCallback;
private final ActionButtonUtils actionButtonUtils; private final ActionButtonUtils actionButtonUtils;
private final int imageSize;
public NewEpisodesListAdapter(Context context, ItemAccess itemAccess, ActionButtonCallback actionButtonCallback) { public NewEpisodesListAdapter(Context context, ItemAccess itemAccess, ActionButtonCallback actionButtonCallback) {
super(); super();
@ -35,7 +34,6 @@ public class NewEpisodesListAdapter extends BaseAdapter {
this.itemAccess = itemAccess; this.itemAccess = itemAccess;
this.actionButtonUtils = new ActionButtonUtils(context); this.actionButtonUtils = new ActionButtonUtils(context);
this.actionButtonCallback = actionButtonCallback; this.actionButtonCallback = actionButtonCallback;
this.imageSize = (int) context.getResources().getDimension(R.dimen.thumbnail_length_itemlist);
} }
@Override @Override
@ -133,7 +131,7 @@ public class NewEpisodesListAdapter extends BaseAdapter {
PicassoProvider.getMediaMetadataPicassoInstance(context) PicassoProvider.getMediaMetadataPicassoInstance(context)
.load(item.getImageUri()) .load(item.getImageUri())
.resize(imageSize, imageSize) .fit()
.into(holder.imageView); .into(holder.imageView);
return convertView; return convertView;

View File

@ -22,7 +22,6 @@ public class QueueListAdapter extends BaseAdapter {
private final ActionButtonCallback actionButtonCallback; private final ActionButtonCallback actionButtonCallback;
private final ActionButtonUtils actionButtonUtils; private final ActionButtonUtils actionButtonUtils;
private final int imageSize;
public QueueListAdapter(Context context, ItemAccess itemAccess, ActionButtonCallback actionButtonCallback) { public QueueListAdapter(Context context, ItemAccess itemAccess, ActionButtonCallback actionButtonCallback) {
super(); super();
@ -30,8 +29,6 @@ public class QueueListAdapter extends BaseAdapter {
this.itemAccess = itemAccess; this.itemAccess = itemAccess;
this.actionButtonUtils = new ActionButtonUtils(context); this.actionButtonUtils = new ActionButtonUtils(context);
this.actionButtonCallback = actionButtonCallback; this.actionButtonCallback = actionButtonCallback;
this.imageSize = (int) context.getResources().getDimension(R.dimen.thumbnail_length_queue_item);
} }
@Override @Override
@ -97,7 +94,7 @@ public class QueueListAdapter extends BaseAdapter {
PicassoProvider.getMediaMetadataPicassoInstance(context) PicassoProvider.getMediaMetadataPicassoInstance(context)
.load(item.getImageUri()) .load(item.getImageUri())
.resize(imageSize, imageSize) .fit()
.into(holder.imageView); .into(holder.imageView);
return convertView; return convertView;

View File

@ -23,12 +23,10 @@ public class SearchlistAdapter extends BaseAdapter {
private final Context context; private final Context context;
private final ItemAccess itemAccess; private final ItemAccess itemAccess;
private final int imageSize;
public SearchlistAdapter(Context context, ItemAccess itemAccess) { public SearchlistAdapter(Context context, ItemAccess itemAccess) {
this.context = context; this.context = context;
this.itemAccess = itemAccess; this.itemAccess = itemAccess;
this.imageSize = (int) context.getResources().getDimension(R.dimen.thumbnail_length);
} }
@Override @Override
@ -76,7 +74,7 @@ public class SearchlistAdapter extends BaseAdapter {
PicassoProvider.getDefaultPicassoInstance(context) PicassoProvider.getDefaultPicassoInstance(context)
.load(feed.getImageUri()) .load(feed.getImageUri())
.resize(imageSize, imageSize) .fit()
.into(holder.cover); .into(holder.cover);
} else if (component.getClass() == FeedItem.class) { } else if (component.getClass() == FeedItem.class) {
@ -89,7 +87,7 @@ public class SearchlistAdapter extends BaseAdapter {
PicassoProvider.getDefaultPicassoInstance(context) PicassoProvider.getDefaultPicassoInstance(context)
.load(item.getFeed().getImageUri()) .load(item.getFeed().getImageUri())
.resize(imageSize, imageSize) .fit()
.into(holder.cover); .into(holder.cover);
} }

View File

@ -18,11 +18,9 @@ import de.danoeh.antennapod.gpoddernet.model.GpodnetPodcast;
* Adapter for displaying a list of GPodnetPodcast-Objects. * Adapter for displaying a list of GPodnetPodcast-Objects.
*/ */
public class PodcastListAdapter extends ArrayAdapter<GpodnetPodcast> { public class PodcastListAdapter extends ArrayAdapter<GpodnetPodcast> {
private final int thumbnailLength;
public PodcastListAdapter(Context context, int resource, List<GpodnetPodcast> objects) { public PodcastListAdapter(Context context, int resource, List<GpodnetPodcast> objects) {
super(context, resource, objects); super(context, resource, objects);
thumbnailLength = (int) context.getResources().getDimension(R.dimen.thumbnail_length);
} }
@Override @Override
@ -52,7 +50,7 @@ public class PodcastListAdapter extends ArrayAdapter<GpodnetPodcast> {
PicassoProvider.getDefaultPicassoInstance(convertView.getContext()) PicassoProvider.getDefaultPicassoInstance(convertView.getContext())
.load(podcast.getLogoUrl()) .load(podcast.getLogoUrl())
.resize(thumbnailLength, thumbnailLength) .fit()
.into(holder.image); .into(holder.image);
return convertView; return convertView;

View File

@ -207,10 +207,9 @@ public class ExternalPlayerFragment extends Fragment {
if (media != null) { if (media != null) {
txtvTitle.setText(media.getEpisodeTitle()); txtvTitle.setText(media.getEpisodeTitle());
int imageSize = (int) getResources().getDimension(R.dimen.external_player_height);
PicassoProvider.getMediaMetadataPicassoInstance(getActivity()) PicassoProvider.getMediaMetadataPicassoInstance(getActivity())
.load(media.getImageUri()) .load(media.getImageUri())
.resize(imageSize, imageSize) .fit()
.into(imgvCover); .into(imgvCover);
fragmentLayout.setVisibility(View.VISIBLE); fragmentLayout.setVisibility(View.VISIBLE);

View File

@ -350,10 +350,9 @@ public class ItemlistFragment extends ListFragment {
txtvTitle.setText(feed.getTitle()); txtvTitle.setText(feed.getTitle());
txtvAuthor.setText(feed.getAuthor()); txtvAuthor.setText(feed.getAuthor());
int imageSize = (int) getResources().getDimension(R.dimen.thumbnail_length_onlinefeedview);
PicassoProvider.getDefaultPicassoInstance(getActivity()) PicassoProvider.getDefaultPicassoInstance(getActivity())
.load(feed.getImageUri()) .load(feed.getImageUri())
.resize(imageSize, imageSize) .fit()
.into(imgvCover); .into(imgvCover);
if (feed.getLink() == null) { if (feed.getLink() == null) {