diff options
author | Bobby Georgescu <georgescu@google.com> | 2012-10-04 14:04:13 -0700 |
---|---|---|
committer | Bobby Georgescu <georgescu@google.com> | 2012-10-05 15:28:08 -0700 |
commit | 3ea0bfbcbea64276595029878d37f25bf4fbb881 (patch) | |
tree | 7b524ac3eb773ff3ac8a1bc011c657122808d19f /src/com/android/gallery3d/util | |
parent | e29fc4a51b99f12f7fae13fae272858df2e1af36 (diff) | |
download | android_packages_apps_Gallery2-3ea0bfbcbea64276595029878d37f25bf4fbb881.tar.gz android_packages_apps_Gallery2-3ea0bfbcbea64276595029878d37f25bf4fbb881.tar.bz2 android_packages_apps_Gallery2-3ea0bfbcbea64276595029878d37f25bf4fbb881.zip |
Set the thumbnail/screennail sizes based on screensize
Bug: 7232758
Prior to this CL, the thumbnail and screennail sizes were
hardcoded which resulted in mediocre image quality when
using the Gallery in general and the camera filmstrip.
Now, we set the size of these items based on the resolution
of the display. Because high-resolution devices tend to
have higher-performance graphics to drive their large
displays, we expect that this will not introduce any
significant performance impact.
Change-Id: I90e08f7aca670e275c913fd9e21e4459c8bf9fcf
Diffstat (limited to 'src/com/android/gallery3d/util')
-rw-r--r-- | src/com/android/gallery3d/util/GalleryUtils.java | 23 |
1 files changed, 16 insertions, 7 deletions
diff --git a/src/com/android/gallery3d/util/GalleryUtils.java b/src/com/android/gallery3d/util/GalleryUtils.java index efa06149f..05bd3dea6 100644 --- a/src/com/android/gallery3d/util/GalleryUtils.java +++ b/src/com/android/gallery3d/util/GalleryUtils.java @@ -75,16 +75,25 @@ public class GalleryUtils { private static boolean sCameraAvailable; public static void initialize(Context context) { - if (sPixelDensity < 0) { - DisplayMetrics metrics = new DisplayMetrics(); - WindowManager wm = (WindowManager) - context.getSystemService(Context.WINDOW_SERVICE); - wm.getDefaultDisplay().getMetrics(metrics); - sPixelDensity = metrics.density; - } + DisplayMetrics metrics = new DisplayMetrics(); + WindowManager wm = (WindowManager) + context.getSystemService(Context.WINDOW_SERVICE); + wm.getDefaultDisplay().getMetrics(metrics); + sPixelDensity = metrics.density; Resources r = context.getResources(); BitmapScreenNail.setPlaceholderColor(r.getColor( R.color.bitmap_screennail_placeholder)); + initializeThumbnailSizes(metrics, r); + } + + private static void initializeThumbnailSizes(DisplayMetrics metrics, Resources r) { + int minRows = Math.min(r.getInteger(R.integer.album_rows_land), + r.getInteger(R.integer.albumset_rows_land)); + int maxDimensionPixels = Math.max(metrics.heightPixels, metrics.widthPixels); + // Never need to completely fill the screen + maxDimensionPixels = maxDimensionPixels * 3/4; + MediaItem.setThumbnailSizes(maxDimensionPixels, maxDimensionPixels / minRows); + BitmapScreenNail.setMaxSide(maxDimensionPixels); } public static boolean isHighResolution(Context context) { |