FeedImage bitmap size is now calculated based on the pixel density of
the device
This commit is contained in:
parent
452b6c9642
commit
cd65cb7e4f
|
@ -28,7 +28,7 @@
|
|||
|
||||
<LinearLayout
|
||||
android:id="@+id/cover_layout"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:layout_alignParentLeft="true"
|
||||
|
@ -39,9 +39,13 @@
|
|||
|
||||
<ImageView
|
||||
android:id="@+id/imgvCover"
|
||||
android:layout_width="200dp"
|
||||
android:layout_height="200dp"
|
||||
android:layout_margin="8dp"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="0dp"
|
||||
android:layout_gravity="center"
|
||||
android:layout_weight="1"
|
||||
android:scaleType="centerInside" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</RelativeLayout>
|
|
@ -27,6 +27,8 @@ public class PodcastApp extends Application implements
|
|||
public static final String PREF_DOWNLOAD_MEDIA_ON_WIFI_ONLY = "prefDownloadMediaOnWifiOnly";
|
||||
public static final String PREF_UPDATE_INTERVALL = "prefAutoUpdateIntervall";
|
||||
public static final String PREF_MOBILE_UPDATE = "prefMobileUpdate";
|
||||
|
||||
private static float LOGICAL_DENSITY;
|
||||
|
||||
private static PodcastApp singleton;
|
||||
|
||||
|
@ -38,6 +40,7 @@ public class PodcastApp extends Application implements
|
|||
public void onCreate() {
|
||||
super.onCreate();
|
||||
singleton = this;
|
||||
LOGICAL_DENSITY = getResources().getDisplayMetrics().density;
|
||||
SharedPreferences prefs = PreferenceManager
|
||||
.getDefaultSharedPreferences(this);
|
||||
prefs.registerOnSharedPreferenceChangeListener(this);
|
||||
|
@ -75,4 +78,8 @@ public class PodcastApp extends Application implements
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static float getLogicalDensity() {
|
||||
return LOGICAL_DENSITY;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -58,6 +58,7 @@ public class FeedImageLoader {
|
|||
return singleton;
|
||||
}
|
||||
|
||||
@SuppressLint("NewApi")
|
||||
public void loadBitmap(FeedImage image, ImageView target) {
|
||||
if (image != null) {
|
||||
Bitmap bitmap = getBitmapFromCache(image.getId());
|
||||
|
@ -95,7 +96,8 @@ public class FeedImageLoader {
|
|||
|
||||
class BitmapWorkerTask extends AsyncTask<FeedImage, Void, Void> {
|
||||
/** The preferred width and height of a bitmap. */
|
||||
private static final int PREFERRED_LENGTH = 300;
|
||||
private static final int LENGTH_BASE_VALUE = 200;
|
||||
private int PREFERRED_LENGTH;
|
||||
|
||||
private static final String TAG = "BitmapWorkerTask";
|
||||
private ImageView target;
|
||||
|
@ -105,6 +107,7 @@ public class FeedImageLoader {
|
|||
public BitmapWorkerTask(ImageView target) {
|
||||
super();
|
||||
this.target = target;
|
||||
this.PREFERRED_LENGTH = (int) (LENGTH_BASE_VALUE * PodcastApp.getLogicalDensity());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
Loading…
Reference in New Issue