diff options
author | Ray Chen <raychen@google.com> | 2012-05-17 12:29:12 +0800 |
---|---|---|
committer | Hung-ying Tyan <tyanh@google.com> | 2012-05-23 12:41:50 +0800 |
commit | 0b920dba5d7452132f51c322e4a8282a1f73aac0 (patch) | |
tree | 2c85b2064cbf869e59efe0e19481e09fb04255b8 /src/com/android/gallery3d/data/LocalAlbumSet.java | |
parent | 048ca675a9e659fb0d3b150880d71cd42770023d (diff) | |
download | android_packages_apps_Snap-0b920dba5d7452132f51c322e4a8282a1f73aac0.tar.gz android_packages_apps_Snap-0b920dba5d7452132f51c322e4a8282a1f73aac0.tar.bz2 android_packages_apps_Snap-0b920dba5d7452132f51c322e4a8282a1f73aac0.zip |
Fix 6259517 "0 images / videos available" toast is displayed in gallery on launch though it has images / videos
And removed sync error toast.
Bug: 6259517
Change-Id: Ib7b25176a6db290220661a2e98e4e031043201d9
Diffstat (limited to 'src/com/android/gallery3d/data/LocalAlbumSet.java')
-rw-r--r-- | src/com/android/gallery3d/data/LocalAlbumSet.java | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/com/android/gallery3d/data/LocalAlbumSet.java b/src/com/android/gallery3d/data/LocalAlbumSet.java index dbb518985..07741efcb 100644 --- a/src/com/android/gallery3d/data/LocalAlbumSet.java +++ b/src/com/android/gallery3d/data/LocalAlbumSet.java @@ -100,6 +100,7 @@ public class LocalAlbumSet extends MediaSet private final ChangeNotifier mNotifierVideo; private final String mName; private final Handler mHandler; + private boolean mIsLoading; private Future<ArrayList<MediaSet>> mLoadTask; private ArrayList<MediaSet> mLoadBuffer; @@ -261,6 +262,11 @@ public class LocalAlbumSet extends MediaSet } @Override + public synchronized boolean isLoading() { + return mIsLoading; + } + + @Override // synchronized on this function for // 1. Prevent calling reload() concurrently. // 2. Prevent calling onFutureDone() and reload() concurrently @@ -268,6 +274,7 @@ public class LocalAlbumSet extends MediaSet // "|" is used instead of "||" because we want to clear both flags. if (mNotifierImage.isDirty() | mNotifierVideo.isDirty()) { if (mLoadTask != null) mLoadTask.cancel(); + mIsLoading = true; mLoadTask = mApplication.getThreadPool().submit(new AlbumsLoader(), this); } if (mLoadBuffer != null) { @@ -285,6 +292,7 @@ public class LocalAlbumSet extends MediaSet public synchronized void onFutureDone(Future<ArrayList<MediaSet>> future) { if (mLoadTask != future) return; // ignore, wait for the latest task mLoadBuffer = future.get(); + mIsLoading = false; if (mLoadBuffer == null) mLoadBuffer = new ArrayList<MediaSet>(); mHandler.post(new Runnable() { @Override |