diff options
author | kaiyiz <kaiyiz@codeaurora.org> | 2015-02-03 17:50:20 +0800 |
---|---|---|
committer | Gerrit - the friendly Code Review server <code-review@localhost> | 2015-02-04 09:21:43 -0800 |
commit | 327b209bbdf2cbf41332fc0a1e1d92ae22e5d6d8 (patch) | |
tree | 07f133a5751a3c8bb86ea7a2b11bee80cb0dc8e6 | |
parent | 27e325a78eb54431192359df30c947f129161183 (diff) | |
download | android_packages_apps_Gallery2-327b209bbdf2cbf41332fc0a1e1d92ae22e5d6d8.tar.gz android_packages_apps_Gallery2-327b209bbdf2cbf41332fc0a1e1d92ae22e5d6d8.tar.bz2 android_packages_apps_Gallery2-327b209bbdf2cbf41332fc0a1e1d92ae22e5d6d8.zip |
Gallery2: Notify dirty after update content
The loading process end when the variable of 'mDirty' is false, and
this value will set false default and set true when NotifyDirty. As a
result, if the NotifyDirty called before set default value, the loading
process will end before update content.
Make sure there is a UpdateContent between two times of NotifyDirty.
Change-Id: Ie3ed56eba6a0e354f06436fabce4fca2810e28bd
CRs-Fixed: 789079
-rwxr-xr-x | src/com/android/gallery3d/app/PhotoDataAdapter.java | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/com/android/gallery3d/app/PhotoDataAdapter.java b/src/com/android/gallery3d/app/PhotoDataAdapter.java index 7be48ebeb..c7dd48b1e 100755 --- a/src/com/android/gallery3d/app/PhotoDataAdapter.java +++ b/src/com/android/gallery3d/app/PhotoDataAdapter.java @@ -72,6 +72,7 @@ public class PhotoDataAdapter implements PhotoPage.Model { private static final int BIT_SCREEN_NAIL = 1; private static final int BIT_FULL_IMAGE = 2; + private static final long NOTIFY_DIRTY_WAIT_TIME = 10; // sImageFetchSeq is the fetching sequence for images. // We want to fetch the current screennail first (offset = 0), the next // screennail (offset = +1), then the previous screennail (offset = -1) etc. @@ -1207,6 +1208,12 @@ public class PhotoDataAdapter implements PhotoPage.Model { } public synchronized void notifyDirty() { + while (mDirty) { + try { + wait(NOTIFY_DIRTY_WAIT_TIME); + } catch (Exception ex) { + } + } mDirty = true; notifyAll(); } |