packages/apps/Gallery2
修订版 | 2b04f591f758b7af03c43d90e91b939cbd515506 (tree) |
---|---|
时间 | 2009-12-04 12:02:18 |
作者 | Venkat Krishnaraj <venkatkrishnaraj@venk...> |
Commiter | Dave Sparks |
Prevent locking of files when the sd card is ejected New Cache Dirty system which will work on any arbitrary directory Non-static hudlayer and pathbar TouchEventQueue has a max size before it starts dropping touch_move events Other bug fixes
@@ -131,6 +131,10 @@ | ||
131 | 131 | <action android:name="android.intent.action.MEDIA_MOUNTED" /> |
132 | 132 | <data android:scheme="file" /> |
133 | 133 | </intent-filter> |
134 | + <intent-filter> | |
135 | + <action android:name="android.intent.action.MEDIA_EJECT" /> | |
136 | + <data android:scheme="file" /> | |
137 | + </intent-filter> | |
134 | 138 | </receiver> |
135 | 139 | <receiver android:name="PhotoAppWidgetProvider" android:label="@string/gadget_title"> |
136 | 140 | <intent-filter> |
@@ -1,6 +1,7 @@ | ||
1 | 1 | package com.cooliris.cache; |
2 | 2 | |
3 | 3 | import com.cooliris.media.LocalDataSource; |
4 | +import com.cooliris.media.PicasaDataSource; | |
4 | 5 | import com.cooliris.media.SingleDataSource; |
5 | 6 | |
6 | 7 | import android.content.BroadcastReceiver; |
@@ -50,6 +51,12 @@ public class BootReceiver extends BroadcastReceiver { | ||
50 | 51 | ContentResolver cr = context.getContentResolver(); |
51 | 52 | cr.registerContentObserver(uriImages, false, localObserver); |
52 | 53 | cr.registerContentObserver(uriVideos, false, localObserver); |
54 | + } else if (action.equals(Intent.ACTION_MEDIA_EJECT)) { | |
55 | + LocalDataSource.sThumbnailCache.close(); | |
56 | + LocalDataSource.sThumbnailCacheVideo.close(); | |
57 | + PicasaDataSource.sThumbnailCache.close(); | |
58 | + CacheService.sAlbumCache.close(); | |
59 | + CacheService.sMetaAlbumCache.close(); | |
53 | 60 | } |
54 | 61 | } |
55 | 62 | } |
@@ -19,6 +19,7 @@ import java.util.Locale; | ||
19 | 19 | import java.util.concurrent.atomic.AtomicReference; |
20 | 20 | |
21 | 21 | import android.app.IntentService; |
22 | +import android.content.ContentProviderClient; | |
22 | 23 | import android.content.ContentResolver; |
23 | 24 | import android.content.ContentValues; |
24 | 25 | import android.content.Context; |
@@ -56,7 +57,7 @@ import com.cooliris.media.Utils; | ||
56 | 57 | public final class CacheService extends IntentService { |
57 | 58 | public static final String ACTION_CACHE = "com.cooliris.cache.action.CACHE"; |
58 | 59 | public static final DiskCache sAlbumCache = new DiskCache("local-album-cache"); |
59 | - public static final DiskCache sMetaAlbumCache = new DiskCache("local-meta-album-cache"); | |
60 | + public static final DiskCache sMetaAlbumCache = new DiskCache("local-meta-cache"); | |
60 | 61 | |
61 | 62 | private static final String TAG = "CacheService"; |
62 | 63 | private static ImageList sList = null; |
@@ -94,7 +95,7 @@ public final class CacheService extends IntentService { | ||
94 | 95 | Images.ImageColumns.DATA, Images.ImageColumns.ORIENTATION }; |
95 | 96 | |
96 | 97 | public static final String[] SENSE_PROJECTION = new String[] { Images.ImageColumns.BUCKET_ID, |
97 | - "MAX(" + Images.ImageColumns.DATE_ADDED + ")" }; | |
98 | + "MAX(" + Images.ImageColumns.DATE_ADDED + "), COUNT(*)" }; | |
98 | 99 | |
99 | 100 | // Must preserve order between these indices and the order of the terms in |
100 | 101 | // INITIAL_PROJECTION_IMAGES and |
@@ -204,10 +205,10 @@ public final class CacheService extends IntentService { | ||
204 | 205 | if (ids != null && observer != null) { |
205 | 206 | observer.onChange(ids); |
206 | 207 | } |
207 | - if (ids.length > 0) { | |
208 | + if (ids != null && ids.length > 0) { | |
208 | 209 | sList = null; |
210 | + Log.i(TAG, "Done computing dirty sets for num " + ids.length); | |
209 | 211 | } |
210 | - Log.i(TAG, "Done computing dirty sets for num " + ids.length); | |
211 | 212 | } |
212 | 213 | }); |
213 | 214 | } else { |
@@ -556,12 +557,10 @@ public final class CacheService extends IntentService { | ||
556 | 557 | } |
557 | 558 | byte[] bitmap = thumbnailCache.get(thumbId, timestamp); |
558 | 559 | if (bitmap == null) { |
559 | - Process.setThreadPriority(Process.THREAD_PRIORITY_DEFAULT); | |
560 | 560 | final long time = SystemClock.uptimeMillis(); |
561 | 561 | bitmap = buildThumbnailForId(context, thumbnailCache, thumbId, origId, isVideo, DEFAULT_THUMBNAIL_WIDTH, |
562 | 562 | DEFAULT_THUMBNAIL_HEIGHT); |
563 | 563 | Log.i(TAG, "Built thumbnail and screennail for " + origId + " in " + (SystemClock.uptimeMillis() - time)); |
564 | - Process.setThreadPriority(Process.THREAD_PRIORITY_BACKGROUND); | |
565 | 564 | } |
566 | 565 | return bitmap; |
567 | 566 | } |
@@ -608,7 +607,6 @@ public final class CacheService extends IntentService { | ||
608 | 607 | return null; |
609 | 608 | } |
610 | 609 | } else { |
611 | - Process.setThreadPriority(Process.THREAD_PRIORITY_DEFAULT); | |
612 | 610 | new Thread() { |
613 | 611 | public void run() { |
614 | 612 | try { |
@@ -883,13 +881,22 @@ public final class CacheService extends IntentService { | ||
883 | 881 | lBuffer.put(0, l); |
884 | 882 | return bArray; |
885 | 883 | } |
884 | + | |
885 | + private static final byte[] longArrayToByteArray(final long[] l) { | |
886 | + final byte[] bArray = new byte[8 * l.length]; | |
887 | + final ByteBuffer bBuffer = ByteBuffer.wrap(bArray); | |
888 | + final LongBuffer lBuffer = bBuffer.asLongBuffer(); | |
889 | + int numLongs = l.length; | |
890 | + for (int i = 0; i < numLongs; ++i) { | |
891 | + lBuffer.put(i, l[i]); | |
892 | + } | |
893 | + return bArray; | |
894 | + } | |
886 | 895 | |
887 | 896 | private final static void refresh(final Context context) { |
888 | 897 | // First we build the album cache. |
889 | 898 | // This is the meta-data about the albums / buckets on the SD card. |
890 | 899 | Log.i(TAG, "Refreshing cache."); |
891 | - int priority = Process.getThreadPriority(Process.myTid()); | |
892 | - Process.setThreadPriority(Process.THREAD_PRIORITY_MORE_FAVORABLE); | |
893 | 900 | sAlbumCache.deleteAll(); |
894 | 901 | putLocaleForAlbumCache(Locale.getDefault()); |
895 | 902 |
@@ -944,7 +951,6 @@ public final class CacheService extends IntentService { | ||
944 | 951 | // Now we must cache the items contained in every album / bucket. |
945 | 952 | populateMediaItemsForSets(context, sets, acceleratedSets, false); |
946 | 953 | sAlbumCache.delete(ALBUM_CACHE_INCOMPLETE_INDEX); |
947 | - Process.setThreadPriority(priority); | |
948 | 954 | |
949 | 955 | // Complete any queued dirty requests |
950 | 956 | processQueuedDirty(context); |
@@ -973,36 +979,52 @@ public final class CacheService extends IntentService { | ||
973 | 979 | } |
974 | 980 | |
975 | 981 | private static final long[] computeDirtySets(final Context context) { |
976 | - final Uri uriImages = Images.Media.EXTERNAL_CONTENT_URI.buildUpon().appendQueryParameter("distinct", "true").build(); | |
977 | - final Uri uriVideos = Video.Media.EXTERNAL_CONTENT_URI.buildUpon().appendQueryParameter("distinct", "true").build(); | |
982 | + final Uri uriImages = Images.Media.EXTERNAL_CONTENT_URI; | |
983 | + final Uri uriVideos = Video.Media.EXTERNAL_CONTENT_URI; | |
978 | 984 | final ContentResolver cr = context.getContentResolver(); |
979 | - | |
980 | - final Cursor cursorImages = cr.query(uriImages, SENSE_PROJECTION, null, null, null); | |
981 | - final Cursor cursorVideos = cr.query(uriVideos, SENSE_PROJECTION, null, null, null); | |
985 | + final String where = Images.ImageColumns.BUCKET_ID + "!=0) GROUP BY (" + Images.ImageColumns.BUCKET_ID + " "; | |
986 | + final Cursor cursorImages = cr.query(uriImages, SENSE_PROJECTION, where, null, null); | |
987 | + final Cursor cursorVideos = cr.query(uriVideos, SENSE_PROJECTION, where, null, null); | |
982 | 988 | Cursor[] cursors = new Cursor[2]; |
983 | 989 | cursors[0] = cursorImages; |
984 | 990 | cursors[1] = cursorVideos; |
985 | 991 | final MergeCursor cursor = new MergeCursor(cursors); |
986 | 992 | long[] retVal = null; |
993 | + int ctr = 0; | |
987 | 994 | try { |
988 | 995 | if (cursor.moveToFirst()) { |
989 | 996 | retVal = new long[cursor.getCount()]; |
990 | - int ctr = 0; | |
991 | 997 | boolean allDirty = false; |
992 | 998 | do { |
993 | 999 | long setId = cursor.getLong(0); |
994 | - retVal[ctr++] = setId; | |
995 | - byte[] data = sMetaAlbumCache.get(setId, 0); | |
996 | - if (data == null) { | |
997 | - // We need to refresh everything. | |
998 | - markDirty(context); | |
999 | - allDirty = true; | |
1000 | - } | |
1001 | - if (!allDirty) { | |
1002 | - long maxAdded = cursor.getLong(1); | |
1003 | - long oldMaxAdded = toLong(data); | |
1004 | - if (maxAdded > oldMaxAdded) { | |
1005 | - markDirty(context, setId); | |
1000 | + if (allDirty) { | |
1001 | + retVal[ctr++] = setId; | |
1002 | + } else { | |
1003 | + boolean contains = sAlbumCache.isDataAvailable(setId, 0); | |
1004 | + if (!contains) { | |
1005 | + // We need to refresh everything. | |
1006 | + markDirty(context); | |
1007 | + retVal[ctr++] = setId; | |
1008 | + allDirty = true; | |
1009 | + } | |
1010 | + if (!allDirty) { | |
1011 | + long maxAdded = cursor.getLong(1); | |
1012 | + int count = cursor.getInt(2); | |
1013 | + byte[] data = sMetaAlbumCache.get(setId, 0); | |
1014 | + long[] dataLong = new long[2]; | |
1015 | + if (data != null) { | |
1016 | + dataLong = toLongArray(data); | |
1017 | + } | |
1018 | + long oldMaxAdded = dataLong[0]; | |
1019 | + long oldCount = dataLong[1]; | |
1020 | + Log.i(TAG, "Bucket " + setId + " Old added " + oldMaxAdded + " count " + oldCount + " New added " + maxAdded + " count " + count); | |
1021 | + if (maxAdded > oldMaxAdded || oldCount != count) { | |
1022 | + markDirty(context, setId); | |
1023 | + retVal[ctr++] = setId; | |
1024 | + dataLong[0] = maxAdded; | |
1025 | + dataLong[1] = count; | |
1026 | + sMetaAlbumCache.put(setId, longArrayToByteArray(dataLong)); | |
1027 | + } | |
1006 | 1028 | } |
1007 | 1029 | } |
1008 | 1030 | } while (cursor.moveToNext()); |
@@ -1010,8 +1032,13 @@ public final class CacheService extends IntentService { | ||
1010 | 1032 | } finally { |
1011 | 1033 | cursor.close(); |
1012 | 1034 | } |
1035 | + sMetaAlbumCache.flush(); | |
1013 | 1036 | processQueuedDirty(context); |
1014 | - return retVal; | |
1037 | + long[] retValCompact = new long[ctr]; | |
1038 | + for (int i = 0; i < ctr; ++i) { | |
1039 | + retValCompact[i] = retVal[i]; | |
1040 | + } | |
1041 | + return retValCompact; | |
1015 | 1042 | } |
1016 | 1043 | |
1017 | 1044 | private static final void processQueuedDirty(final Context context) { |
@@ -1074,7 +1101,6 @@ public final class CacheService extends IntentService { | ||
1074 | 1101 | final int approximateCountPerSet = count / numSets; |
1075 | 1102 | for (int i = 0; i < numSets; ++i) { |
1076 | 1103 | final MediaSet set = sets.get(i); |
1077 | - set.getItems().clear(); | |
1078 | 1104 | set.setNumExpectedItems(approximateCountPerSet); |
1079 | 1105 | } |
1080 | 1106 | do { |
@@ -1091,7 +1117,7 @@ public final class CacheService extends IntentService { | ||
1091 | 1117 | final long setId = sortCursor.getLong(MEDIA_BUCKET_ID_INDEX); |
1092 | 1118 | final MediaSet set = findSet(setId, acceleratedSets); |
1093 | 1119 | if (set != null) { |
1094 | - set.getItems().add(item); | |
1120 | + set.addItem(item); | |
1095 | 1121 | } |
1096 | 1122 | } while (sortCursor.moveToNext()); |
1097 | 1123 | } |
@@ -1144,20 +1170,9 @@ public final class CacheService extends IntentService { | ||
1144 | 1170 | } |
1145 | 1171 | writeItemsForASet(sets.get(i)); |
1146 | 1172 | } |
1147 | - writeMetaAlbumCache(sets); | |
1148 | 1173 | sAlbumCache.flush(); |
1149 | 1174 | } |
1150 | 1175 | |
1151 | - private static final void writeMetaAlbumCache(ArrayList<MediaSet> sets) { | |
1152 | - final int numSets = sets.size(); | |
1153 | - for (int i = 0; i < numSets; ++i) { | |
1154 | - final MediaSet set = sets.get(i); | |
1155 | - byte[] data = longToByteArray(set.mMaxAddedTimestamp); | |
1156 | - sMetaAlbumCache.put(set.mId, data); | |
1157 | - } | |
1158 | - sMetaAlbumCache.flush(); | |
1159 | - } | |
1160 | - | |
1161 | 1176 | private static final void writeItemsForASet(final MediaSet set) { |
1162 | 1177 | final ByteArrayOutputStream bos = new ByteArrayOutputStream(); |
1163 | 1178 | final DataOutputStream dos = new DataOutputStream(new BufferedOutputStream(bos, 256)); |
@@ -124,7 +124,7 @@ public final class Gallery extends Activity { | ||
124 | 124 | final ConcatenatedDataSource singleCombinedDataSource = new ConcatenatedDataSource(singleDataSource, picasaDataSource); |
125 | 125 | mGridLayer.setDataSource(singleCombinedDataSource); |
126 | 126 | mGridLayer.setViewIntent(true, Utils.getBucketNameFromUri(uri)); |
127 | - if (SingleDataSource.isSingleImageMode(uri.toString())) { | |
127 | + if (singleDataSource.isSingleImage()) { | |
128 | 128 | mGridLayer.setSingleImage(false); |
129 | 129 | } else if (slideshow) { |
130 | 130 | mGridLayer.setSingleImage(true); |
@@ -7,7 +7,6 @@ import android.hardware.SensorEvent; | ||
7 | 7 | import android.opengl.GLU; |
8 | 8 | import android.os.PowerManager; |
9 | 9 | import android.os.PowerManager.WakeLock; |
10 | -import android.util.Log; | |
11 | 10 | import android.view.KeyEvent; |
12 | 11 | import android.view.MotionEvent; |
13 | 12 | import android.content.Context; |
@@ -29,7 +28,7 @@ public final class GridLayer extends RootLayer implements MediaFeed.Listener, Ti | ||
29 | 28 | |
30 | 29 | private static final float SLIDESHOW_TRANSITION_TIME = 3.5f; |
31 | 30 | |
32 | - private static HudLayer sHud; | |
31 | + private HudLayer mHud; | |
33 | 32 | private int mState; |
34 | 33 | private static final IndexRange sBufferedVisibleRange = new IndexRange(); |
35 | 34 | private static final IndexRange sVisibleRange = new IndexRange(); |
@@ -133,33 +132,32 @@ public final class GridLayer extends RootLayer implements MediaFeed.Listener, Ti | ||
133 | 132 | sBucketList.clear(); |
134 | 133 | |
135 | 134 | sVisibleItems = new ArrayList<MediaItem>(); |
136 | - if (sHud == null) { | |
137 | - sHud = new HudLayer(context); | |
138 | - } | |
139 | - sHud.setContext(context); | |
140 | - sHud.setGridLayer(this); | |
141 | - sHud.getPathBar().clear(); | |
142 | - sHud.setGridLayer(this); | |
143 | - sHud.getTimeBar().setListener(this); | |
144 | - sHud.getPathBar().pushLabel(R.drawable.icon_home_small, context.getResources().getString(R.string.app_name), | |
135 | + mHud = new HudLayer(context); | |
136 | + mHud.setContext(context); | |
137 | + mHud.setGridLayer(this); | |
138 | + mHud.getPathBar().clear(); | |
139 | + mHud.setGridLayer(this); | |
140 | + mHud.getTimeBar().setListener(this); | |
141 | + mHud.getPathBar().pushLabel(R.drawable.icon_home_small, context.getResources().getString(R.string.app_name), | |
145 | 142 | new Runnable() { |
146 | 143 | public void run() { |
147 | - if (sHud.getAlpha() == 1.0f) { | |
144 | + if (mHud.getAlpha() == 1.0f) { | |
148 | 145 | if (!mFeedAboutToChange) { |
149 | 146 | setState(STATE_MEDIA_SETS); |
150 | 147 | } |
151 | 148 | } else { |
152 | - sHud.setAlpha(1.0f); | |
149 | + mHud.setAlpha(1.0f); | |
153 | 150 | } |
154 | 151 | } |
155 | 152 | }); |
156 | 153 | mCameraManager = new GridCameraManager(mCamera); |
157 | 154 | mDrawManager = new GridDrawManager(context, mCamera, mDrawables, sDisplayList, sDisplayItems, sDisplaySlots); |
158 | 155 | mInputProcessor = new GridInputProcessor(context, mCamera, this, mView, sTempVec, sDisplayItems); |
156 | + setState(STATE_MEDIA_SETS); | |
159 | 157 | } |
160 | 158 | |
161 | 159 | public HudLayer getHud() { |
162 | - return sHud; | |
160 | + return mHud; | |
163 | 161 | } |
164 | 162 | |
165 | 163 | public void shutdown() { |
@@ -185,13 +183,13 @@ public final class GridLayer extends RootLayer implements MediaFeed.Listener, Ti | ||
185 | 183 | mBackground.generate(view, lists); |
186 | 184 | lists.blendedList.add(this); |
187 | 185 | lists.hitTestList.add(this); |
188 | - sHud.generate(view, lists); | |
186 | + mHud.generate(view, lists); | |
189 | 187 | } |
190 | 188 | |
191 | 189 | @Override |
192 | 190 | protected void onSizeChanged() { |
193 | - sHud.setSize(mWidth, mHeight); | |
194 | - sHud.setAlpha(1.0f); | |
191 | + mHud.setSize(mWidth, mHeight); | |
192 | + mHud.setAlpha(1.0f); | |
195 | 193 | mBackground.setSize(mWidth, mHeight); |
196 | 194 | mTimeElapsedSinceTransition = 0.0f; |
197 | 195 | if (mView != null) { |
@@ -240,24 +238,24 @@ public final class GridLayer extends RootLayer implements MediaFeed.Listener, Ti | ||
240 | 238 | MediaSet set = feed.getCurrentSet(); |
241 | 239 | int icon = mDrawables.getIconForSet(set, true); |
242 | 240 | if (set != null) { |
243 | - sHud.getPathBar().pushLabel(icon, set.mNoCountTitleString, new Runnable() { | |
241 | + mHud.getPathBar().pushLabel(icon, set.mNoCountTitleString, new Runnable() { | |
244 | 242 | public void run() { |
245 | 243 | if (mFeedAboutToChange) { |
246 | 244 | return; |
247 | 245 | } |
248 | - if (sHud.getAlpha() == 1.0f) { | |
246 | + if (mHud.getAlpha() == 1.0f) { | |
249 | 247 | disableLocationFiltering(); |
250 | 248 | mInputProcessor.clearSelection(); |
251 | 249 | setState(STATE_GRID_VIEW); |
252 | 250 | } else { |
253 | - sHud.setAlpha(1.0f); | |
251 | + mHud.setAlpha(1.0f); | |
254 | 252 | } |
255 | 253 | } |
256 | 254 | }); |
257 | 255 | } |
258 | 256 | } |
259 | 257 | if (mState == STATE_FULL_SCREEN) { |
260 | - sHud.getPathBar().popLabel(); | |
258 | + mHud.getPathBar().popLabel(); | |
261 | 259 | } |
262 | 260 | break; |
263 | 261 | case STATE_TIMELINE: |
@@ -276,12 +274,12 @@ public final class GridLayer extends RootLayer implements MediaFeed.Listener, Ti | ||
276 | 274 | layoutInterface.mSpacingX = (int) (40 * Gallery.PIXEL_DENSITY); |
277 | 275 | layoutInterface.mSpacingY = (int) (40 * Gallery.PIXEL_DENSITY); |
278 | 276 | if (mState != STATE_FULL_SCREEN) { |
279 | - sHud.getPathBar().pushLabel(R.drawable.ic_fs_details, "", new Runnable() { | |
277 | + mHud.getPathBar().pushLabel(R.drawable.ic_fs_details, "", new Runnable() { | |
280 | 278 | public void run() { |
281 | - if (sHud.getAlpha() == 1.0f) { | |
282 | - sHud.swapFullscreenLabel(); | |
279 | + if (mHud.getAlpha() == 1.0f) { | |
280 | + mHud.swapFullscreenLabel(); | |
283 | 281 | } |
284 | - sHud.setAlpha(1.0f); | |
282 | + mHud.setAlpha(1.0f); | |
285 | 283 | } |
286 | 284 | }); |
287 | 285 | } |
@@ -300,15 +298,15 @@ public final class GridLayer extends RootLayer implements MediaFeed.Listener, Ti | ||
300 | 298 | layoutInterface.mSpacingY = (int) (70 * Gallery.PIXEL_DENSITY * yStretch); |
301 | 299 | if (mInAlbum) { |
302 | 300 | if (mState == STATE_FULL_SCREEN) { |
303 | - sHud.getPathBar().popLabel(); | |
301 | + mHud.getPathBar().popLabel(); | |
304 | 302 | } |
305 | - sHud.getPathBar().popLabel(); | |
303 | + mHud.getPathBar().popLabel(); | |
306 | 304 | mInAlbum = false; |
307 | 305 | } |
308 | 306 | break; |
309 | 307 | } |
310 | 308 | mState = state; |
311 | - sHud.onGridStateChanged(); | |
309 | + mHud.onGridStateChanged(); | |
312 | 310 | if (performLayout && mFeedAboutToChange == false) { |
313 | 311 | onLayout(Shared.INVALID, Shared.INVALID, oldLayout); |
314 | 312 | } |
@@ -321,9 +319,9 @@ public final class GridLayer extends RootLayer implements MediaFeed.Listener, Ti | ||
321 | 319 | protected void enableLocationFiltering(String label) { |
322 | 320 | if (mLocationFilter == false) { |
323 | 321 | mLocationFilter = true; |
324 | - sHud.getPathBar().pushLabel(R.drawable.icon_location_small, label, new Runnable() { | |
322 | + mHud.getPathBar().pushLabel(R.drawable.icon_location_small, label, new Runnable() { | |
325 | 323 | public void run() { |
326 | - if (sHud.getAlpha() == 1.0f) { | |
324 | + if (mHud.getAlpha() == 1.0f) { | |
327 | 325 | if (mState == STATE_FULL_SCREEN) { |
328 | 326 | mInputProcessor.clearSelection(); |
329 | 327 | setState(STATE_GRID_VIEW); |
@@ -331,7 +329,7 @@ public final class GridLayer extends RootLayer implements MediaFeed.Listener, Ti | ||
331 | 329 | disableLocationFiltering(); |
332 | 330 | } |
333 | 331 | } else { |
334 | - sHud.setAlpha(1.0f); | |
332 | + mHud.setAlpha(1.0f); | |
335 | 333 | } |
336 | 334 | } |
337 | 335 | }); |
@@ -342,7 +340,7 @@ public final class GridLayer extends RootLayer implements MediaFeed.Listener, Ti | ||
342 | 340 | if (mLocationFilter) { |
343 | 341 | mLocationFilter = false; |
344 | 342 | mMediaFeed.removeFilter(); |
345 | - sHud.getPathBar().popLabel(); | |
343 | + mHud.getPathBar().popLabel(); | |
346 | 344 | } |
347 | 345 | } |
348 | 346 |
@@ -383,7 +381,7 @@ public final class GridLayer extends RootLayer implements MediaFeed.Listener, Ti | ||
383 | 381 | } |
384 | 382 | mWakeLock = null; |
385 | 383 | } |
386 | - sHud.setAlpha(1.0f); | |
384 | + mHud.setAlpha(1.0f); | |
387 | 385 | } |
388 | 386 | |
389 | 387 | @Override |
@@ -490,9 +488,9 @@ public final class GridLayer extends RootLayer implements MediaFeed.Listener, Ti | ||
490 | 488 | hud.setMode(HudLayer.MODE_NORMAL); |
491 | 489 | } |
492 | 490 | if (view.elapsedLoadingExpensiveTextures() > 150 || (mMediaFeed != null && mMediaFeed.getWaitingForMediaScanner())) { |
493 | - sHud.getPathBar().setAnimatedIcons(GridDrawables.TEXTURE_SPINNER); | |
491 | + mHud.getPathBar().setAnimatedIcons(GridDrawables.TEXTURE_SPINNER); | |
494 | 492 | } else { |
495 | - sHud.getPathBar().setAnimatedIcons(null); | |
493 | + mHud.getPathBar().setAnimatedIcons(null); | |
496 | 494 | } |
497 | 495 | |
498 | 496 | // In that case, we need to commit the respective Display Items when the |
@@ -500,17 +498,17 @@ public final class GridLayer extends RootLayer implements MediaFeed.Listener, Ti | ||
500 | 498 | GridCamera camera = mCamera; |
501 | 499 | camera.update(timeElapsed); |
502 | 500 | DisplayItem anchorDisplayItem = getAnchorDisplayItem(ANCHOR_CENTER); |
503 | - if (anchorDisplayItem != null && !sHud.getTimeBar().isDragged()) { | |
504 | - sHud.getTimeBar().setItem(anchorDisplayItem.mItemRef); | |
501 | + if (anchorDisplayItem != null && !mHud.getTimeBar().isDragged()) { | |
502 | + mHud.getTimeBar().setItem(anchorDisplayItem.mItemRef); | |
505 | 503 | } |
506 | 504 | sDisplayList.update(timeElapsed); |
507 | 505 | mInputProcessor.update(timeElapsed); |
508 | 506 | mSelectedAlpha = FloatUtils.animate(mSelectedAlpha, mTargetAlpha, timeElapsed * 0.5f); |
509 | 507 | if (mState == STATE_FULL_SCREEN) { |
510 | - sHud.autoHide(true); | |
508 | + mHud.autoHide(true); | |
511 | 509 | } else { |
512 | - sHud.autoHide(false); | |
513 | - sHud.setAlpha(1.0f); | |
510 | + mHud.autoHide(false); | |
511 | + mHud.setAlpha(1.0f); | |
514 | 512 | } |
515 | 513 | GridQuad[] fullscreenQuads = GridDrawables.sFullscreenGrid; |
516 | 514 | int numFullScreenQuads = fullscreenQuads.length; |
@@ -670,8 +668,8 @@ public final class GridLayer extends RootLayer implements MediaFeed.Listener, Ti | ||
670 | 668 | if (mState == STATE_GRID_VIEW) { |
671 | 669 | MediaSet expandedSet = mMediaFeed.getExpandedMediaSet(); |
672 | 670 | if (expandedSet != null) { |
673 | - if (!sHud.getPathBar().getCurrentLabel().equals(expandedSet.mNoCountTitleString)) { | |
674 | - sHud.getPathBar().changeLabel(expandedSet.mNoCountTitleString); | |
671 | + if (!mHud.getPathBar().getCurrentLabel().equals(expandedSet.mNoCountTitleString)) { | |
672 | + mHud.getPathBar().changeLabel(expandedSet.mNoCountTitleString); | |
675 | 673 | } |
676 | 674 | } |
677 | 675 | } |
@@ -688,13 +686,13 @@ public final class GridLayer extends RootLayer implements MediaFeed.Listener, Ti | ||
688 | 686 | if (itemUri != null && mRequestFocusContentUri != null) { |
689 | 687 | if (itemUri.equals(mRequestFocusContentUri)) { |
690 | 688 | mInputProcessor.setCurrentSelectedSlot(i); |
691 | - mRequestFocusContentUri = null; | |
692 | 689 | break; |
693 | 690 | } |
694 | 691 | } |
695 | 692 | } |
696 | 693 | } |
697 | 694 | } |
695 | + mRequestFocusContentUri = null; | |
698 | 696 | } |
699 | 697 | } |
700 | 698 | } finally { |
@@ -726,8 +724,8 @@ public final class GridLayer extends RootLayer implements MediaFeed.Listener, Ti | ||
726 | 724 | @Override |
727 | 725 | public void onSurfaceCreated(RenderView view, GL11 gl) { |
728 | 726 | sDisplayList.clear(); |
729 | - sHud.clear(); | |
730 | - sHud.reset(); | |
727 | + mHud.clear(); | |
728 | + mHud.reset(); | |
731 | 729 | GridDrawables.sStringTextureTable.clear(); |
732 | 730 | mDrawables.onSurfaceCreated(view, gl); |
733 | 731 | mBackground.clear(); |
@@ -780,8 +778,8 @@ public final class GridLayer extends RootLayer implements MediaFeed.Listener, Ti | ||
780 | 778 | |
781 | 779 | public void renderBlended(RenderView view, GL11 gl) { |
782 | 780 | // We draw the placeholder for all visible slots. |
783 | - if (sHud != null && mDrawManager != null) { | |
784 | - mDrawManager.drawBlendedComponents(view, gl, mSelectedAlpha, mState, sHud.getMode(), mTimeElapsedSinceStackViewReady, | |
781 | + if (mHud != null && mDrawManager != null) { | |
782 | + mDrawManager.drawBlendedComponents(view, gl, mSelectedAlpha, mState, mHud.getMode(), mTimeElapsedSinceStackViewReady, | |
785 | 783 | mTimeElapsedSinceGridViewReady, sBucketList, mMediaFeed.getWaitingForMediaScanner() || mFeedAboutToChange |
786 | 784 | || mMediaFeed.isLoading()); |
787 | 785 | } |
@@ -857,7 +855,7 @@ public final class GridLayer extends RootLayer implements MediaFeed.Listener, Ti | ||
857 | 855 | mFeedChanged = true; |
858 | 856 | forceRecomputeVisibleRange(); |
859 | 857 | if (mState == STATE_GRID_VIEW || mState == STATE_FULL_SCREEN) |
860 | - sHud.setFeed(feed, mState, needsLayout); | |
858 | + mHud.setFeed(feed, mState, needsLayout); | |
861 | 859 | return; |
862 | 860 | } |
863 | 861 |
@@ -865,10 +863,10 @@ public final class GridLayer extends RootLayer implements MediaFeed.Listener, Ti | ||
865 | 863 | Thread.yield(); |
866 | 864 | } |
867 | 865 | if (mState == STATE_GRID_VIEW) { |
868 | - if (sHud != null) { | |
866 | + if (mHud != null) { | |
869 | 867 | MediaSet set = feed.getCurrentSet(); |
870 | 868 | if (set != null && !mLocationFilter) |
871 | - sHud.getPathBar().changeLabel(set.mNoCountTitleString); | |
869 | + mHud.getPathBar().changeLabel(set.mNoCountTitleString); | |
872 | 870 | } |
873 | 871 | } |
874 | 872 | DisplayItem[] displayItems = sDisplayItems; |
@@ -953,7 +951,7 @@ public final class GridLayer extends RootLayer implements MediaFeed.Listener, Ti | ||
953 | 951 | mFeedChanged = true; |
954 | 952 | if (feed != null) { |
955 | 953 | if (mState == STATE_GRID_VIEW || mState == STATE_FULL_SCREEN) |
956 | - sHud.setFeed(feed, mState, needsLayout); | |
954 | + mHud.setFeed(feed, mState, needsLayout); | |
957 | 955 | } |
958 | 956 | if (mView != null) { |
959 | 957 | mView.requestRender(); |
@@ -1058,7 +1056,7 @@ public final class GridLayer extends RootLayer implements MediaFeed.Listener, Ti | ||
1058 | 1056 | boolean retVal = changeFocusToSlot(currentSelectedSlot + 1, convergence); |
1059 | 1057 | if (mInputProcessor.getCurrentSelectedSlot() == currentSelectedSlot) { |
1060 | 1058 | endSlideshow(); |
1061 | - sHud.setAlpha(1.0f); | |
1059 | + mHud.setAlpha(1.0f); | |
1062 | 1060 | } |
1063 | 1061 | return retVal; |
1064 | 1062 | } |
@@ -1070,7 +1068,7 @@ public final class GridLayer extends RootLayer implements MediaFeed.Listener, Ti | ||
1070 | 1068 | DisplayItem displayItem = sDisplayItems[index * MAX_ITEMS_PER_SLOT]; |
1071 | 1069 | if (displayItem != null) { |
1072 | 1070 | MediaItem item = displayItem.mItemRef; |
1073 | - sHud.fullscreenSelectionChanged(item, slotId + 1, sCompleteRange.end + 1); | |
1071 | + mHud.fullscreenSelectionChanged(item, slotId + 1, sCompleteRange.end + 1); | |
1074 | 1072 | if (slotId != Shared.INVALID && slotId <= sCompleteRange.end) { |
1075 | 1073 | mInputProcessor.setCurrentFocusSlot(slotId); |
1076 | 1074 | centerCameraForSlot(slotId, convergence); |
@@ -1106,7 +1104,7 @@ public final class GridLayer extends RootLayer implements MediaFeed.Listener, Ti | ||
1106 | 1104 | |
1107 | 1105 | public void deselectOrCancelSelectMode() { |
1108 | 1106 | if (sBucketList.size() == 0) { |
1109 | - sHud.cancelSelection(); | |
1107 | + mHud.cancelSelection(); | |
1110 | 1108 | } else { |
1111 | 1109 | sBucketList.clear(); |
1112 | 1110 | updateCountOfSelectedItems(); |
@@ -1114,7 +1112,7 @@ public final class GridLayer extends RootLayer implements MediaFeed.Listener, Ti | ||
1114 | 1112 | } |
1115 | 1113 | |
1116 | 1114 | public void deselectAll() { |
1117 | - sHud.cancelSelection(); | |
1115 | + mHud.cancelSelection(); | |
1118 | 1116 | sBucketList.clear(); |
1119 | 1117 | updateCountOfSelectedItems(); |
1120 | 1118 | } |
@@ -1141,11 +1139,11 @@ public final class GridLayer extends RootLayer implements MediaFeed.Listener, Ti | ||
1141 | 1139 | deselectAll(); |
1142 | 1140 | } |
1143 | 1141 | } |
1144 | - sHud.computeBottomMenu(); | |
1142 | + mHud.computeBottomMenu(); | |
1145 | 1143 | } |
1146 | 1144 | |
1147 | 1145 | private void updateCountOfSelectedItems() { |
1148 | - sHud.updateNumItemsSelected(sBucketList.size()); | |
1146 | + mHud.updateNumItemsSelected(sBucketList.size()); | |
1149 | 1147 | } |
1150 | 1148 | |
1151 | 1149 | public int getMetadataSlotIndexForScreenPosition(int posX, int posY) { |
@@ -1244,7 +1242,7 @@ public final class GridLayer extends RootLayer implements MediaFeed.Listener, Ti | ||
1244 | 1242 | mZoomValue = 1.0f; |
1245 | 1243 | centerCameraForSlot(mInputProcessor.getCurrentSelectedSlot(), 1.0f); |
1246 | 1244 | mTimeElapsedSinceView = SLIDESHOW_TRANSITION_TIME - 1.0f; |
1247 | - sHud.setAlpha(0); | |
1245 | + mHud.setAlpha(0); | |
1248 | 1246 | PowerManager pm = (PowerManager) mContext.getSystemService(Context.POWER_SERVICE); |
1249 | 1247 | mWakeLock = pm.newWakeLock(PowerManager.SCREEN_BRIGHT_WAKE_LOCK, "GridView.Slideshow"); |
1250 | 1248 | mWakeLock.acquire(); |
@@ -1252,7 +1250,7 @@ public final class GridLayer extends RootLayer implements MediaFeed.Listener, Ti | ||
1252 | 1250 | |
1253 | 1251 | public void enterSelectionMode() { |
1254 | 1252 | mSlideshowMode = false; |
1255 | - sHud.enterSelectionMode(); | |
1253 | + mHud.enterSelectionMode(); | |
1256 | 1254 | int currentSlot = mInputProcessor.getCurrentSelectedSlot(); |
1257 | 1255 | if (currentSlot == Shared.INVALID) { |
1258 | 1256 | currentSlot = mInputProcessor.getCurrentFocusSlot(); |
@@ -1275,7 +1273,7 @@ public final class GridLayer extends RootLayer implements MediaFeed.Listener, Ti | ||
1275 | 1273 | if (mZoomValue > 6.0f) { |
1276 | 1274 | mZoomValue = 6.0f; |
1277 | 1275 | } |
1278 | - sHud.setAlpha(1.0f); | |
1276 | + mHud.setAlpha(1.0f); | |
1279 | 1277 | centerCameraForSlot(mInputProcessor.getCurrentSelectedSlot(), 1.0f); |
1280 | 1278 | } |
1281 | 1279 |
@@ -1289,7 +1287,7 @@ public final class GridLayer extends RootLayer implements MediaFeed.Listener, Ti | ||
1289 | 1287 | if (mZoomValue < 1.0f) { |
1290 | 1288 | mZoomValue = 1.0f; |
1291 | 1289 | } |
1292 | - sHud.setAlpha(1.0f); | |
1290 | + mHud.setAlpha(1.0f); | |
1293 | 1291 | centerCameraForSlot(mInputProcessor.getCurrentSelectedSlot(), 1.0f); |
1294 | 1292 | } |
1295 | 1293 |
@@ -1373,16 +1371,16 @@ public final class GridLayer extends RootLayer implements MediaFeed.Listener, Ti | ||
1373 | 1371 | |
1374 | 1372 | public void setPickIntent(boolean b) { |
1375 | 1373 | mPickIntent = b; |
1376 | - sHud.getPathBar().popLabel(); | |
1377 | - sHud.getPathBar().pushLabel(R.drawable.icon_location_small, mContext.getResources().getString(R.string.pick), | |
1374 | + mHud.getPathBar().popLabel(); | |
1375 | + mHud.getPathBar().pushLabel(R.drawable.icon_location_small, mContext.getResources().getString(R.string.pick), | |
1378 | 1376 | new Runnable() { |
1379 | 1377 | public void run() { |
1380 | - if (sHud.getAlpha() == 1.0f) { | |
1378 | + if (mHud.getAlpha() == 1.0f) { | |
1381 | 1379 | if (!mFeedAboutToChange) { |
1382 | 1380 | setState(STATE_MEDIA_SETS); |
1383 | 1381 | } |
1384 | 1382 | } else { |
1385 | - sHud.setAlpha(1.0f); | |
1383 | + mHud.setAlpha(1.0f); | |
1386 | 1384 | } |
1387 | 1385 | } |
1388 | 1386 | }); |
@@ -1398,19 +1396,19 @@ public final class GridLayer extends RootLayer implements MediaFeed.Listener, Ti | ||
1398 | 1396 | mMediaFeed.expandMediaSet(0); |
1399 | 1397 | setState(STATE_GRID_VIEW); |
1400 | 1398 | // We need to make sure we haven't pushed the same label twice |
1401 | - if (sHud.getPathBar().getNumLevels() == 1) { | |
1402 | - sHud.getPathBar().pushLabel(R.drawable.icon_folder_small, setName, new Runnable() { | |
1399 | + if (mHud.getPathBar().getNumLevels() == 1) { | |
1400 | + mHud.getPathBar().pushLabel(R.drawable.icon_folder_small, setName, new Runnable() { | |
1403 | 1401 | public void run() { |
1404 | 1402 | if (mFeedAboutToChange) { |
1405 | 1403 | return; |
1406 | 1404 | } |
1407 | - if (sHud.getAlpha() == 1.0f) { | |
1405 | + if (mHud.getAlpha() == 1.0f) { | |
1408 | 1406 | disableLocationFiltering(); |
1409 | 1407 | if (mInputProcessor != null) |
1410 | 1408 | mInputProcessor.clearSelection(); |
1411 | 1409 | setState(STATE_GRID_VIEW); |
1412 | 1410 | } else { |
1413 | - sHud.setAlpha(1.0f); | |
1411 | + mHud.setAlpha(1.0f); | |
1414 | 1412 | } |
1415 | 1413 | } |
1416 | 1414 | }); |
@@ -29,8 +29,8 @@ public final class HudLayer extends Layer { | ||
29 | 29 | private final ImageButton mTopRightButton = new ImageButton(); |
30 | 30 | private final ImageButton mZoomInButton = new ImageButton(); |
31 | 31 | private final ImageButton mZoomOutButton = new ImageButton(); |
32 | - private static PathBarLayer sPathBar; | |
33 | - private static TimeBar sTimeBar; | |
32 | + private PathBarLayer mPathBar; | |
33 | + private TimeBar mTimeBar; | |
34 | 34 | private MenuBar.Menu[] mNormalBottomMenu = null; |
35 | 35 | private MenuBar.Menu[] mSingleViewIntentBottomMenu = null; |
36 | 36 | private final MenuBar mSelectionMenuBottom; |
@@ -103,9 +103,9 @@ public final class HudLayer extends Layer { | ||
103 | 103 | |
104 | 104 | HudLayer(Context context) { |
105 | 105 | mAlpha = 1.0f; |
106 | - if (sTimeBar == null) { | |
107 | - sTimeBar = new TimeBar(context); | |
108 | - sPathBar = new PathBarLayer(); | |
106 | + if (mTimeBar == null) { | |
107 | + mTimeBar = new TimeBar(context); | |
108 | + mPathBar = new PathBarLayer(); | |
109 | 109 | } |
110 | 110 | mTopRightButton.setSize((int) (100 * Gallery.PIXEL_DENSITY), (int) (94 * Gallery.PIXEL_DENSITY)); |
111 | 111 |
@@ -191,7 +191,7 @@ public final class HudLayer extends Layer { | ||
191 | 191 | public void setContext(Context context) { |
192 | 192 | if (mContext != context) { |
193 | 193 | mContext = context; |
194 | - sTimeBar.regenerateStringsForContext(context); | |
194 | + mTimeBar.regenerateStringsForContext(context); | |
195 | 195 | } |
196 | 196 | } |
197 | 197 |
@@ -416,8 +416,8 @@ public final class HudLayer extends Layer { | ||
416 | 416 | final float height = mHeight; |
417 | 417 | closeSelectionMenu(); |
418 | 418 | |
419 | - sTimeBar.setPosition(0f, height - TimeBar.HEIGHT * Gallery.PIXEL_DENSITY); | |
420 | - sTimeBar.setSize(width, TimeBar.HEIGHT * Gallery.PIXEL_DENSITY); | |
419 | + mTimeBar.setPosition(0f, height - TimeBar.HEIGHT * Gallery.PIXEL_DENSITY); | |
420 | + mTimeBar.setSize(width, TimeBar.HEIGHT * Gallery.PIXEL_DENSITY); | |
421 | 421 | mSelectionMenuTop.setPosition(0f, 0); |
422 | 422 | mSelectionMenuTop.setSize(width, MenuBar.HEIGHT * Gallery.PIXEL_DENSITY); |
423 | 423 | mSelectionMenuBottom.setPosition(0f, height - MenuBar.HEIGHT * Gallery.PIXEL_DENSITY); |
@@ -426,7 +426,7 @@ public final class HudLayer extends Layer { | ||
426 | 426 | mFullscreenMenu.setPosition(0f, height - MenuBar.HEIGHT * Gallery.PIXEL_DENSITY); |
427 | 427 | mFullscreenMenu.setSize(width, MenuBar.HEIGHT * Gallery.PIXEL_DENSITY); |
428 | 428 | |
429 | - sPathBar.setPosition(0f, -4f * Gallery.PIXEL_DENSITY); | |
429 | + mPathBar.setPosition(0f, -4f * Gallery.PIXEL_DENSITY); | |
430 | 430 | computeSizeForPathbar(); |
431 | 431 | |
432 | 432 | mTopRightButton.setPosition(width - mTopRightButton.getWidth(), 0f); |
@@ -438,12 +438,12 @@ public final class HudLayer extends Layer { | ||
438 | 438 | float pathBarWidth = mWidth |
439 | 439 | - ((mGridLayer.getState() == GridLayer.STATE_FULL_SCREEN) ? 32 * Gallery.PIXEL_DENSITY |
440 | 440 | : 120 * Gallery.PIXEL_DENSITY); |
441 | - sPathBar.setSize(pathBarWidth, FloatMath.ceil(39 * Gallery.PIXEL_DENSITY)); | |
442 | - sPathBar.recomputeComponents(); | |
441 | + mPathBar.setSize(pathBarWidth, FloatMath.ceil(39 * Gallery.PIXEL_DENSITY)); | |
442 | + mPathBar.recomputeComponents(); | |
443 | 443 | } |
444 | 444 | |
445 | 445 | public void setFeed(MediaFeed feed, int state, boolean needsLayout) { |
446 | - sTimeBar.setFeed(feed, state, needsLayout); | |
446 | + mTimeBar.setFeed(feed, state, needsLayout); | |
447 | 447 | } |
448 | 448 | |
449 | 449 | public void onGridStateChanged() { |
@@ -465,11 +465,11 @@ public final class HudLayer extends Layer { | ||
465 | 465 | mZoomOutButton.setHidden(mFullscreenMenu.isHidden()); |
466 | 466 | |
467 | 467 | // Show the time bar in stack and grid states, except in selection mode. |
468 | - sTimeBar.setHidden(fullscreenMode || selectionMode || stackMode); | |
468 | + mTimeBar.setHidden(fullscreenMode || selectionMode || stackMode); | |
469 | 469 | // mTimeBar.setHidden(selectionMode || (state != GridLayer.STATE_TIMELINE && state != GridLayer.STATE_GRID_VIEW)); |
470 | 470 | |
471 | 471 | // Hide the path bar and top-right button in selection mode. |
472 | - sPathBar.setHidden(selectionMode); | |
472 | + mPathBar.setHidden(selectionMode); | |
473 | 473 | mTopRightButton.setHidden(selectionMode || fullscreenMode); |
474 | 474 | computeSizeForPathbar(); |
475 | 475 |
@@ -505,11 +505,11 @@ public final class HudLayer extends Layer { | ||
505 | 505 | } |
506 | 506 | |
507 | 507 | public TimeBar getTimeBar() { |
508 | - return sTimeBar; | |
508 | + return mTimeBar; | |
509 | 509 | } |
510 | 510 | |
511 | 511 | public PathBarLayer getPathBar() { |
512 | - return sPathBar; | |
512 | + return mPathBar; | |
513 | 513 | } |
514 | 514 | |
515 | 515 | public GridLayer getGridLayer() { |
@@ -576,11 +576,11 @@ public final class HudLayer extends Layer { | ||
576 | 576 | mTopRightButton.generate(view, lists); |
577 | 577 | mZoomInButton.generate(view, lists); |
578 | 578 | mZoomOutButton.generate(view, lists); |
579 | - sTimeBar.generate(view, lists); | |
579 | + mTimeBar.generate(view, lists); | |
580 | 580 | mSelectionMenuTop.generate(view, lists); |
581 | 581 | mSelectionMenuBottom.generate(view, lists); |
582 | 582 | mFullscreenMenu.generate(view, lists); |
583 | - sPathBar.generate(view, lists); | |
583 | + mPathBar.generate(view, lists); | |
584 | 584 | // mLoadingLayer.generate(view, lists); |
585 | 585 | mView = view; |
586 | 586 | } |
@@ -619,7 +619,7 @@ public final class HudLayer extends Layer { | ||
619 | 619 | |
620 | 620 | void reset() { |
621 | 621 | mLoadingLayer.reset(); |
622 | - sTimeBar.regenerateStringsForContext(mContext); | |
622 | + mTimeBar.regenerateStringsForContext(mContext); | |
623 | 623 | } |
624 | 624 | |
625 | 625 | public void fullscreenSelectionChanged(MediaItem item, int index, int count) { |
@@ -633,7 +633,7 @@ public final class HudLayer extends Layer { | ||
633 | 633 | mCachedCaption = item.mCaption; |
634 | 634 | mCachedPosition = location; |
635 | 635 | mCachedCurrentLabel = location; |
636 | - sPathBar.changeLabel(location); | |
636 | + mPathBar.changeLabel(location); | |
637 | 637 | } |
638 | 638 | |
639 | 639 | private void updateShareMenu() { |
@@ -745,7 +745,7 @@ public final class HudLayer extends Layer { | ||
745 | 745 | |
746 | 746 | public void swapFullscreenLabel() { |
747 | 747 | mCachedCurrentLabel = (mCachedCurrentLabel == mCachedCaption || mCachedCaption == null) ? mCachedPosition : mCachedCaption; |
748 | - sPathBar.changeLabel(mCachedCurrentLabel); | |
748 | + mPathBar.changeLabel(mCachedCurrentLabel); | |
749 | 749 | } |
750 | 750 | |
751 | 751 | public void clear() { |
@@ -242,7 +242,9 @@ public final class MediaFeed implements Runnable { | ||
242 | 242 | } |
243 | 243 | |
244 | 244 | public void removeMediaSet(MediaSet set) { |
245 | - mMediaSets.remove(set); | |
245 | + synchronized (mMediaSets) { | |
246 | + mMediaSets.remove(set); | |
247 | + } | |
246 | 248 | mMediaFeedNeedsToRun = true; |
247 | 249 | } |
248 | 250 |
@@ -434,7 +436,7 @@ public final class MediaFeed implements Runnable { | ||
434 | 436 | } |
435 | 437 | if (expandedSetIndex == Shared.INVALID) { |
436 | 438 | // We purge the sets outside this visibleRange. |
437 | - int numSets = mMediaSets.size(); | |
439 | + int numSets = mediaSets.size(); | |
438 | 440 | IndexRange visibleRange = mVisibleRange; |
439 | 441 | IndexRange bufferedRange = mBufferedRange; |
440 | 442 | boolean scanMediaSets = true; |
@@ -463,7 +465,7 @@ public final class MediaFeed implements Runnable { | ||
463 | 465 | } |
464 | 466 | } |
465 | 467 | } |
466 | - numSets = mMediaSets.size(); | |
468 | + numSets = mediaSets.size(); | |
467 | 469 | for (int i = 0; i < numSets; ++i) { |
468 | 470 | MediaSet set = mediaSets.get(i); |
469 | 471 | if (i >= bufferedRange.begin && i <= bufferedRange.end) { |
@@ -167,12 +167,12 @@ public class MediaSet { | ||
167 | 167 | mMaxTimestamp = dateTaken; |
168 | 168 | } |
169 | 169 | } else if (item.isDateAddedValid()) { |
170 | - long dateTaken = item.mDateAddedInSec * 1000; | |
171 | - if (dateTaken < mMinAddedTimestamp) { | |
172 | - mMinAddedTimestamp = dateTaken; | |
170 | + long dateAdded = item.mDateAddedInSec * 1000; | |
171 | + if (dateAdded < mMinAddedTimestamp) { | |
172 | + mMinAddedTimestamp = dateAdded; | |
173 | 173 | } |
174 | - if (dateTaken > mMaxAddedTimestamp) { | |
175 | - mMaxAddedTimestamp = dateTaken; | |
174 | + if (dateAdded > mMaxAddedTimestamp) { | |
175 | + mMaxAddedTimestamp = dateAdded; | |
176 | 176 | } |
177 | 177 | } |
178 | 178 |
@@ -864,6 +864,8 @@ public final class RenderView extends GLSurfaceView implements GLSurfaceView.Ren | ||
864 | 864 | return false; |
865 | 865 | } |
866 | 866 | // Wait for the render thread to process this event. |
867 | + if (mTouchEventQueue.size() > 8 && event.getAction() == MotionEvent.ACTION_MOVE) | |
868 | + return true; | |
867 | 869 | synchronized (mTouchEventQueue) { |
868 | 870 | MotionEvent eventCopy = MotionEvent.obtain(event); |
869 | 871 | mTouchEventQueue.addLast(eventCopy); |
@@ -60,8 +60,12 @@ public class SingleDataSource implements DataSource { | ||
60 | 60 | public void shutdown() { |
61 | 61 | |
62 | 62 | } |
63 | + | |
64 | + public boolean isSingleImage() { | |
65 | + return mSingleUri; | |
66 | + } | |
63 | 67 | |
64 | - public static boolean isSingleImageMode(String uriString) { | |
68 | + private static boolean isSingleImageMode(String uriString) { | |
65 | 69 | return !uriString.equals(MediaStore.Images.Media.EXTERNAL_CONTENT_URI.toString()) |
66 | 70 | && !uriString.equals(MediaStore.Images.Media.INTERNAL_CONTENT_URI.toString()); |
67 | 71 | } |