summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--gallerycommon/src/com/android/gallery3d/common/BitmapUtils.java11
-rw-r--r--gallerycommon/src/com/android/gallery3d/common/EntrySchema.java18
2 files changed, 20 insertions, 9 deletions
diff --git a/gallerycommon/src/com/android/gallery3d/common/BitmapUtils.java b/gallerycommon/src/com/android/gallery3d/common/BitmapUtils.java
index 060d7f32e..c34e89631 100644
--- a/gallerycommon/src/com/android/gallery3d/common/BitmapUtils.java
+++ b/gallerycommon/src/com/android/gallery3d/common/BitmapUtils.java
@@ -155,6 +155,17 @@ public class BitmapUtils {
return resizeBitmapByScale(bitmap, scale, recycle);
}
+ // Resize the bitmap if each side is >= targetSize * 2
+ public static Bitmap resizeDownIfTooBig(
+ Bitmap bitmap, int targetSize, boolean recycle) {
+ int srcWidth = bitmap.getWidth();
+ int srcHeight = bitmap.getHeight();
+ float scale = Math.max(
+ (float) targetSize / srcWidth, (float) targetSize / srcHeight);
+ if (scale > 0.5f) return bitmap;
+ return resizeBitmapByScale(bitmap, scale, recycle);
+ }
+
// Crops a square from the center of the original image.
public static Bitmap cropCenter(Bitmap bitmap, boolean recycle) {
int width = bitmap.getWidth();
diff --git a/gallerycommon/src/com/android/gallery3d/common/EntrySchema.java b/gallerycommon/src/com/android/gallery3d/common/EntrySchema.java
index d652ac98a..46de03fd6 100644
--- a/gallerycommon/src/com/android/gallery3d/common/EntrySchema.java
+++ b/gallerycommon/src/com/android/gallery3d/common/EntrySchema.java
@@ -29,14 +29,14 @@ public final class EntrySchema {
@SuppressWarnings("unused")
private static final String TAG = "EntrySchema";
- private static final int TYPE_STRING = 0;
- private static final int TYPE_BOOLEAN = 1;
- private static final int TYPE_SHORT = 2;
- private static final int TYPE_INT = 3;
- private static final int TYPE_LONG = 4;
- private static final int TYPE_FLOAT = 5;
- private static final int TYPE_DOUBLE = 6;
- private static final int TYPE_BLOB = 7;
+ public static final int TYPE_STRING = 0;
+ public static final int TYPE_BOOLEAN = 1;
+ public static final int TYPE_SHORT = 2;
+ public static final int TYPE_INT = 3;
+ public static final int TYPE_LONG = 4;
+ public static final int TYPE_FLOAT = 5;
+ public static final int TYPE_DOUBLE = 6;
+ public static final int TYPE_BLOB = 7;
private static final String SQLITE_TYPES[] = {
"TEXT", "INTEGER", "INTEGER", "INTEGER", "INTEGER", "REAL", "REAL", "NONE" };
@@ -91,7 +91,7 @@ public final class EntrySchema {
return -1;
}
- private ColumnInfo getColumn(String columnName) {
+ public ColumnInfo getColumn(String columnName) {
int index = getColumnIndex(columnName);
return (index < 0) ? null : mColumnInfo[index];
}