packages/apps/Gallery2
修订版 | 992286cae8c88693228d21a12b9a514c3d932558 (tree) |
---|---|
时间 | 2011-09-21 01:23:33 |
作者 | Chih-Chung Chang <chihchung@goog...> |
Commiter | Android (Google) Code Review |
Merge "Fix 5224359: query width and height from media provider."
@@ -61,6 +61,8 @@ public class LocalImage extends LocalMediaItem { | ||
61 | 61 | private static final int INDEX_ORIENTATION = 9; |
62 | 62 | private static final int INDEX_BUCKET_ID = 10; |
63 | 63 | private static final int INDEX_SIZE_ID = 11; |
64 | + private static final int INDEX_WIDTH = 12; | |
65 | + private static final int INDEX_HEIGHT = 13; | |
64 | 66 | |
65 | 67 | static final String[] PROJECTION = { |
66 | 68 | ImageColumns._ID, // 0 |
@@ -74,12 +76,17 @@ public class LocalImage extends LocalMediaItem { | ||
74 | 76 | ImageColumns.DATA, // 8 |
75 | 77 | ImageColumns.ORIENTATION, // 9 |
76 | 78 | ImageColumns.BUCKET_ID, // 10 |
77 | - ImageColumns.SIZE // 11 | |
79 | + ImageColumns.SIZE, // 11 | |
80 | + // These should be changed to proper names after they are made public. | |
81 | + "width", // ImageColumns.WIDTH, // 12 | |
82 | + "height", // ImageColumns.HEIGHT // 13 | |
78 | 83 | }; |
79 | 84 | |
80 | 85 | private final GalleryApp mApplication; |
81 | 86 | |
82 | 87 | public int rotation; |
88 | + public int width; | |
89 | + public int height; | |
83 | 90 | |
84 | 91 | public LocalImage(Path path, GalleryApp application, Cursor cursor) { |
85 | 92 | super(path, nextVersionNumber()); |
@@ -118,6 +125,8 @@ public class LocalImage extends LocalMediaItem { | ||
118 | 125 | rotation = cursor.getInt(INDEX_ORIENTATION); |
119 | 126 | bucketId = cursor.getInt(INDEX_BUCKET_ID); |
120 | 127 | fileSize = cursor.getLong(INDEX_SIZE_ID); |
128 | + width = cursor.getInt(INDEX_WIDTH); | |
129 | + height = cursor.getInt(INDEX_HEIGHT); | |
121 | 130 | } |
122 | 131 | |
123 | 132 | @Override |
@@ -138,6 +147,8 @@ public class LocalImage extends LocalMediaItem { | ||
138 | 147 | rotation = uh.update(rotation, cursor.getInt(INDEX_ORIENTATION)); |
139 | 148 | bucketId = uh.update(bucketId, cursor.getInt(INDEX_BUCKET_ID)); |
140 | 149 | fileSize = uh.update(fileSize, cursor.getLong(INDEX_SIZE_ID)); |
150 | + width = uh.update(width, cursor.getInt(INDEX_WIDTH)); | |
151 | + height = uh.update(height, cursor.getInt(INDEX_HEIGHT)); | |
141 | 152 | return uh.isUpdated(); |
142 | 153 | } |
143 | 154 |
@@ -309,13 +320,11 @@ public class LocalImage extends LocalMediaItem { | ||
309 | 320 | |
310 | 321 | @Override |
311 | 322 | public int getWidth() { |
312 | - // TODO | |
313 | - return 0; | |
323 | + return width; | |
314 | 324 | } |
315 | 325 | |
316 | 326 | @Override |
317 | 327 | public int getHeight() { |
318 | - // TODO | |
319 | - return 0; | |
328 | + return height; | |
320 | 329 | } |
321 | 330 | } |
@@ -213,13 +213,11 @@ public class LocalVideo extends LocalMediaItem { | ||
213 | 213 | |
214 | 214 | @Override |
215 | 215 | public int getWidth() { |
216 | - // TODO | |
217 | 216 | return 0; |
218 | 217 | } |
219 | 218 | |
220 | 219 | @Override |
221 | 220 | public int getHeight() { |
222 | - // TODO | |
223 | 221 | return 0; |
224 | 222 | } |
225 | 223 | } |