Merge "Add scale factor / quality parameters in filters" into gb-ub-photos-arches
diff --git a/res/values-cs/strings.xml b/res/values-cs/strings.xml
index 3dd08d3..9b84386 100644
--- a/res/values-cs/strings.xml
+++ b/res/values-cs/strings.xml
@@ -181,7 +181,7 @@
<string name="no_external_storage" msgid="95726173164068417">"Žádné externí úložiště není k dispozici"</string>
<string name="switch_photo_filmstrip" msgid="991949386967109493">"Filmový pás"</string>
<string name="switch_photo_grid" msgid="6533267664294518167">"Mřížka"</string>
- <string name="trimming" msgid="9122385768369143997">"Zkrácení"</string>
+ <string name="trimming" msgid="9122385768369143997">"Zkracování"</string>
<string name="please_wait" msgid="7296066089146487366">"Čekejte prosím"</string>
<string name="save_into" msgid="6688364520925473396">"Uložit zkrácené video do"</string>
<string name="trim_too_short" msgid="751593965620665326">"Zkrácení nelze provést: výsledné video je příliš krátké"</string>
diff --git a/res/values-ms/strings.xml b/res/values-ms/strings.xml
index f90cfd1..8c13731 100644
--- a/res/values-ms/strings.xml
+++ b/res/values-ms/strings.xml
@@ -181,14 +181,9 @@
<string name="no_external_storage" msgid="95726173164068417">"Tiada storan luar tersedia"</string>
<string name="switch_photo_filmstrip" msgid="991949386967109493">"Jalur filem"</string>
<string name="switch_photo_grid" msgid="6533267664294518167">"Grid"</string>
- <!-- no translation found for trimming (9122385768369143997) -->
- <skip />
- <!-- no translation found for please_wait (7296066089146487366) -->
- <skip />
- <!-- no translation found for save_into (6688364520925473396) -->
- <skip />
- <!-- no translation found for trim_too_short (751593965620665326) -->
- <skip />
- <!-- no translation found for trim_too_long (2657958275279217174) -->
- <skip />
+ <string name="trimming" msgid="9122385768369143997">"Mencantas"</string>
+ <string name="please_wait" msgid="7296066089146487366">"Sila tunggu"</string>
+ <string name="save_into" msgid="6688364520925473396">"Simpan video yang dicantas ke"</string>
+ <string name="trim_too_short" msgid="751593965620665326">"Tidak boleh mencantas: video sasaran terlalu pendek"</string>
+ <string name="trim_too_long" msgid="2657958275279217174">"Tidak dicantas: panjang yang sama seperti yang asli"</string>
</resources>
diff --git a/res/values-nb/strings.xml b/res/values-nb/strings.xml
index 9272210..4d83aa1 100644
--- a/res/values-nb/strings.xml
+++ b/res/values-nb/strings.xml
@@ -181,14 +181,9 @@
<string name="no_external_storage" msgid="95726173164068417">"Ekstern lagringsplass ikke tilgjengelig"</string>
<string name="switch_photo_filmstrip" msgid="991949386967109493">"Filmstripe"</string>
<string name="switch_photo_grid" msgid="6533267664294518167">"Rutenett"</string>
- <!-- no translation found for trimming (9122385768369143997) -->
- <skip />
- <!-- no translation found for please_wait (7296066089146487366) -->
- <skip />
- <!-- no translation found for save_into (6688364520925473396) -->
- <skip />
- <!-- no translation found for trim_too_short (751593965620665326) -->
- <skip />
- <!-- no translation found for trim_too_long (2657958275279217174) -->
- <skip />
+ <string name="trimming" msgid="9122385768369143997">"Beskjærer"</string>
+ <string name="please_wait" msgid="7296066089146487366">"Et øyeblikk"</string>
+ <string name="save_into" msgid="6688364520925473396">"Lagre den beskjærte videoen i"</string>
+ <string name="trim_too_short" msgid="751593965620665326">"Videoen kan ikke beskjæres – målvideoen er for kort"</string>
+ <string name="trim_too_long" msgid="2657958275279217174">"Videoen ble ikke beskjært – lengden er den samme som originalen"</string>
</resources>
diff --git a/res/values-ro/strings.xml b/res/values-ro/strings.xml
index bad5ec6..3ce3461 100644
--- a/res/values-ro/strings.xml
+++ b/res/values-ro/strings.xml
@@ -181,14 +181,9 @@
<string name="no_external_storage" msgid="95726173164068417">"Nu este disponibilă nicio stocare externă"</string>
<string name="switch_photo_filmstrip" msgid="991949386967109493">"Bandă de film"</string>
<string name="switch_photo_grid" msgid="6533267664294518167">"Grilă"</string>
- <!-- no translation found for trimming (9122385768369143997) -->
- <skip />
- <!-- no translation found for please_wait (7296066089146487366) -->
- <skip />
- <!-- no translation found for save_into (6688364520925473396) -->
- <skip />
- <!-- no translation found for trim_too_short (751593965620665326) -->
- <skip />
- <!-- no translation found for trim_too_long (2657958275279217174) -->
- <skip />
+ <string name="trimming" msgid="9122385768369143997">"Se ajustează"</string>
+ <string name="please_wait" msgid="7296066089146487366">"Aşteptaţi"</string>
+ <string name="save_into" msgid="6688364520925473396">"Salvaţi videoclipul ajustat în"</string>
+ <string name="trim_too_short" msgid="751593965620665326">"Nu se poate ajusta: videoclipul ţintă este prea scurt"</string>
+ <string name="trim_too_long" msgid="2657958275279217174">"Nu aţi efectuat ajustări: videoclipul are aceeaşi durată ca şi cel iniţial"</string>
</resources>
diff --git a/src/com/android/gallery3d/data/ImageCacheService.java b/src/com/android/gallery3d/data/ImageCacheService.java
index 0e79313..f10a7b3 100644
--- a/src/com/android/gallery3d/data/ImageCacheService.java
+++ b/src/com/android/gallery3d/data/ImageCacheService.java
@@ -35,7 +35,7 @@
private static final String IMAGE_CACHE_FILE = "imgcache";
private static final int IMAGE_CACHE_MAX_ENTRIES = 5000;
private static final int IMAGE_CACHE_MAX_BYTES = 200 * 1024 * 1024;
- private static final int IMAGE_CACHE_VERSION = 4;
+ private static final int IMAGE_CACHE_VERSION = 5;
private BlobCache mCache;
diff --git a/src/com/android/gallery3d/data/MediaItem.java b/src/com/android/gallery3d/data/MediaItem.java
index 9d2040a..77b86b8 100644
--- a/src/com/android/gallery3d/data/MediaItem.java
+++ b/src/com/android/gallery3d/data/MediaItem.java
@@ -30,8 +30,6 @@
public static final int TYPE_THUMBNAIL = 1;
public static final int TYPE_MICROTHUMBNAIL = 2;
- public static final int THUMBNAIL_TARGET_SIZE = 640;
- public static final int MICROTHUMBNAIL_TARGET_SIZE = 200;
public static final int CACHED_IMAGE_QUALITY = 95;
public static final int IMAGE_READY = 0;
@@ -43,19 +41,17 @@
private static final int BYTESBUFFE_POOL_SIZE = 4;
private static final int BYTESBUFFER_SIZE = 200 * 1024;
- private static final BitmapPool sMicroThumbPool =
- ApiHelper.HAS_REUSING_BITMAP_IN_BITMAP_FACTORY
- ? new BitmapPool(MICROTHUMBNAIL_TARGET_SIZE, MICROTHUMBNAIL_TARGET_SIZE, 16)
- : null;
+ private static int sMicrothumbnailTargetSize = 200;
+ private static BitmapPool sMicroThumbPool;
+ private static final BytesBufferPool sMicroThumbBufferPool =
+ new BytesBufferPool(BYTESBUFFE_POOL_SIZE, BYTESBUFFER_SIZE);
+ private static int sThumbnailTargetSize = 640;
private static final BitmapPool sThumbPool =
ApiHelper.HAS_REUSING_BITMAP_IN_BITMAP_FACTORY
? new BitmapPool(4)
: null;
- private static final BytesBufferPool sMicroThumbBufferPool =
- new BytesBufferPool(BYTESBUFFE_POOL_SIZE, BYTESBUFFER_SIZE);
-
// TODO: fix default value for latlng and change this.
public static final double INVALID_LATLNG = 0f;
@@ -125,9 +121,9 @@
public static int getTargetSize(int type) {
switch (type) {
case TYPE_THUMBNAIL:
- return THUMBNAIL_TARGET_SIZE;
+ return sThumbnailTargetSize;
case TYPE_MICROTHUMBNAIL:
- return MICROTHUMBNAIL_TARGET_SIZE;
+ return sMicrothumbnailTargetSize;
default:
throw new RuntimeException(
"should only request thumb/microthumb from cache");
@@ -135,6 +131,9 @@
}
public static BitmapPool getMicroThumbPool() {
+ if (ApiHelper.HAS_REUSING_BITMAP_IN_BITMAP_FACTORY && sMicroThumbPool == null) {
+ initializeMicroThumbPool();
+ }
return sMicroThumbPool;
}
@@ -145,4 +144,19 @@
public static BytesBufferPool getBytesBufferPool() {
return sMicroThumbBufferPool;
}
+
+ private static void initializeMicroThumbPool() {
+ sMicroThumbPool =
+ ApiHelper.HAS_REUSING_BITMAP_IN_BITMAP_FACTORY
+ ? new BitmapPool(sMicrothumbnailTargetSize, sMicrothumbnailTargetSize, 16)
+ : null;
+ }
+
+ public static void setThumbnailSizes(int size, int microSize) {
+ sThumbnailTargetSize = size;
+ if (sMicrothumbnailTargetSize != microSize) {
+ sMicrothumbnailTargetSize = microSize;
+ initializeMicroThumbPool();
+ }
+ }
}
diff --git a/src/com/android/gallery3d/ui/BitmapScreenNail.java b/src/com/android/gallery3d/ui/BitmapScreenNail.java
index 25f88a1..9b62916 100644
--- a/src/com/android/gallery3d/ui/BitmapScreenNail.java
+++ b/src/com/android/gallery3d/ui/BitmapScreenNail.java
@@ -37,7 +37,7 @@
// The duration of the fading animation in milliseconds
private static final int DURATION = 180;
- private static final int MAX_SIDE = 640;
+ private static int sMaxSide = 640;
// These are special values for mAnimationStartTime
private static final long ANIMATION_NOT_NEEDED = -1;
@@ -73,10 +73,10 @@
private void setSize(int width, int height) {
if (width == 0 || height == 0) {
- width = 640;
- height = 480;
+ width = sMaxSide;
+ height = sMaxSide * 3 / 4;
}
- float scale = Math.min(1, (float) MAX_SIDE / Math.max(width, height));
+ float scale = Math.min(1, (float) sMaxSide / Math.max(width, height));
mWidth = Math.round(scale * width);
mHeight = Math.round(scale * height);
}
@@ -209,4 +209,8 @@
public TiledTexture getTexture() {
return mTexture;
}
+
+ public static void setMaxSide(int size) {
+ sMaxSide = size;
+ }
}
diff --git a/src/com/android/gallery3d/util/GalleryUtils.java b/src/com/android/gallery3d/util/GalleryUtils.java
index efa0614..05bd3de 100644
--- a/src/com/android/gallery3d/util/GalleryUtils.java
+++ b/src/com/android/gallery3d/util/GalleryUtils.java
@@ -75,16 +75,25 @@
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) {