diff options
| author | huiyan <huiyan@codeaurora.org> | 2016-03-26 16:27:24 +0800 |
|---|---|---|
| committer | Steve Kondik <steve@cyngn.com> | 2016-09-26 04:54:49 -0700 |
| commit | 454b1567fc6cbfcdbbf3a6f18f64f6fa5524563b (patch) | |
| tree | d5104a6118abbc854dbf921666ca2a564325c65f | |
| parent | bde96829065bbbeb0620f072a4ae0657a0300ca1 (diff) | |
| download | android_packages_apps_Gallery2-454b1567fc6cbfcdbbf3a6f18f64f6fa5524563b.tar.gz android_packages_apps_Gallery2-454b1567fc6cbfcdbbf3a6f18f64f6fa5524563b.tar.bz2 android_packages_apps_Gallery2-454b1567fc6cbfcdbbf3a6f18f64f6fa5524563b.zip | |
Gallery2: Fix the image add to the status bar.
The Gallery is killed by system in background due to some reason.
The Gallery restore last states after restart it.
But the mediaset is loading, the reload function return immediately,
and the data is empty,the Photopage is finished when the data is empty.
So the UI is wrong.
If the mediaset is loading, waiting for it. After loading successfully,
display the right photo.
Change-Id: Icb95524bd151145beeba83205b365065fbb20530
CRs-Fixed: 979193
| -rwxr-xr-x | src/com/android/gallery3d/app/PhotoDataAdapter.java | 9 | ||||
| -rw-r--r-- | src/com/android/gallery3d/data/ClusterAlbum.java | 6 |
2 files changed, 12 insertions, 3 deletions
diff --git a/src/com/android/gallery3d/app/PhotoDataAdapter.java b/src/com/android/gallery3d/app/PhotoDataAdapter.java index 4322d9b7a..3382c115d 100755 --- a/src/com/android/gallery3d/app/PhotoDataAdapter.java +++ b/src/com/android/gallery3d/app/PhotoDataAdapter.java @@ -1069,18 +1069,23 @@ public class PhotoDataAdapter implements PhotoPage.Model { @Override public void run() { + long version = MediaObject.INVALID_DATA_VERSION; while (mActive) { synchronized (this) { - if (!mDirty && mActive) { + if (!mDirty && mActive && version != MediaObject.INVALID_DATA_VERSION) { updateLoading(false); Utils.waitWithoutInterrupt(this); continue; } } mDirty = false; + version = mSource.reload(); + //if data is not ready, continue to reload + if (version == MediaObject.INVALID_DATA_VERSION) { + continue; + } UpdateInfo info = executeAndWait(new GetUpdateInfo()); updateLoading(true); - long version = mSource.reload(); // Used for delete photo, RTL need to re-decide the slide range. if (View.LAYOUT_DIRECTION_RTL == TextUtils diff --git a/src/com/android/gallery3d/data/ClusterAlbum.java b/src/com/android/gallery3d/data/ClusterAlbum.java index 8681952bf..595527cca 100644 --- a/src/com/android/gallery3d/data/ClusterAlbum.java +++ b/src/com/android/gallery3d/data/ClusterAlbum.java @@ -107,7 +107,11 @@ public class ClusterAlbum extends MediaSet implements ContentListener { @Override public long reload() { - if (mClusterAlbumSet.reload() > mDataVersion) { + long version = mClusterAlbumSet.reload(); + if (version == INVALID_DATA_VERSION) { + return INVALID_DATA_VERSION; + } + if (version > mDataVersion) { mDataVersion = nextVersionNumber(); } return mDataVersion; |
