Fixed imageview size

This commit is contained in:
daniel oeh 2012-08-11 17:34:17 +02:00
parent 522d61577b
commit 0044e0f91f
5 changed files with 19 additions and 12 deletions

View File

@ -23,12 +23,11 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_alignParentLeft="true" android:layout_alignParentLeft="true"
android:layout_below="@+id/txtvTitle" android:layout_below="@+id/txtvTitle"
android:layout_marginBottom="8dp"
android:gravity="center_horizontal" /> android:gravity="center_horizontal" />
<LinearLayout <LinearLayout
android:id="@+id/cover_layout" android:id="@+id/cover_layout"
android:layout_width="match_parent" android:layout_width="0dp"
android:layout_height="0dp" android:layout_height="0dp"
android:layout_alignParentBottom="true" android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true" android:layout_alignParentLeft="true"
@ -39,12 +38,16 @@
<ImageView <ImageView
android:id="@+id/imgvCover" android:id="@+id/imgvCover"
android:layout_margin="8dp" android:layout_marginLeft="55dp"
android:layout_width="wrap_content" android:layout_marginRight="55dp"
android:layout_marginTop="8dp"
android:layout_marginBottom="8dp"
android:layout_width="match_parent"
android:layout_height="0dp" android:layout_height="0dp"
android:layout_gravity="center" android:layout_gravity="center"
android:layout_weight="1" android:layout_weight="1"
android:scaleType="centerInside" /> android:adjustViewBounds="true"
android:scaleType="centerCrop" />
</LinearLayout> </LinearLayout>

View File

@ -5,8 +5,8 @@
<ImageView <ImageView
android:id="@+id/imgvFeedimage" android:id="@+id/imgvFeedimage"
android:layout_width="160dip" android:layout_width="200dip"
android:layout_height="160dip" android:layout_height="200dip"
android:layout_alignParentTop="true" android:layout_alignParentTop="true"
android:layout_centerHorizontal="true" android:layout_centerHorizontal="true"
android:layout_margin="8dp" android:layout_margin="8dp"

View File

@ -94,11 +94,12 @@ public class FeedlistAdapter extends ArrayAdapter<Feed> {
holder.newEpisodes.setVisibility(View.INVISIBLE); holder.newEpisodes.setVisibility(View.INVISIBLE);
} }
holder.image.setTag(feed.getImage()); holder.image.setTag(feed.getImage());
if (PodcastApp.getInstance().isLargeScreen()) { /*if (PodcastApp.getInstance().isLargeScreen()) {
imageLoader.loadCoverBitmap(feed.getImage(), holder.image); imageLoader.loadCoverBitmap(feed.getImage(), holder.image);
} else {
} else {*/
imageLoader.loadThumbnailBitmap(feed.getImage(), holder.image); imageLoader.loadThumbnailBitmap(feed.getImage(), holder.image);
} //}
return convertView; return convertView;
} }

View File

@ -40,6 +40,9 @@ public abstract class BitmapDecodeWorkerTask extends Thread {
this.fileUrl = fileUrl; this.fileUrl = fileUrl;
this.baseLength = length; this.baseLength = length;
this.PREFERRED_LENGTH = (int) (length * PodcastApp.getLogicalDensity() + 0.5f); this.PREFERRED_LENGTH = (int) (length * PodcastApp.getLogicalDensity() + 0.5f);
if (PodcastApp.getInstance().isLargeScreen()) {
this.PREFERRED_LENGTH *= 2.0;
}
} }
/** /**

View File

@ -25,7 +25,7 @@ public class FeedImageLoader {
private static final String TAG = "FeedImageLoader"; private static final String TAG = "FeedImageLoader";
private static FeedImageLoader singleton; private static FeedImageLoader singleton;
public static final int LENGTH_BASE_COVER = 200; public static final int LENGTH_BASE_COVER = 300;
public static final int LENGTH_BASE_THUMBNAIL = 100; public static final int LENGTH_BASE_THUMBNAIL = 100;
private static final String CACHE_DIR = "miroguide_thumbnails"; private static final String CACHE_DIR = "miroguide_thumbnails";
@ -44,7 +44,7 @@ public class FeedImageLoader {
.getSystemService(Context.ACTIVITY_SERVICE)).getMemoryClass(); .getSystemService(Context.ACTIVITY_SERVICE)).getMemoryClass();
// Use 1/8th of the available memory for this memory cache. // Use 1/8th of the available memory for this memory cache.
final int coverCacheSize = 1024 * 1024 * memClass / 10; final int coverCacheSize = 1024 * 1024 * memClass / 8;
final int thumbnailCacheSize = 1024 * 1024 * memClass / 6; final int thumbnailCacheSize = 1024 * 1024 * memClass / 6;
private LruCache<String, Bitmap> coverCache; private LruCache<String, Bitmap> coverCache;