diff options
author | kaiyiz <kaiyiz@codeaurora.org> | 2014-03-04 11:25:07 +0800 |
---|---|---|
committer | emancebo <emancebo@cyngn.com> | 2014-09-04 10:40:19 -0700 |
commit | b4a96363005b5bb066cf1f31339317398374e713 (patch) | |
tree | 65fdfa90bce06eac66373dd930454f911062250e /src | |
parent | a8bb13b5c19fea1e711f260fbbfa2245e422e08f (diff) | |
download | android_packages_apps_Gallery2-b4a96363005b5bb066cf1f31339317398374e713.tar.gz android_packages_apps_Gallery2-b4a96363005b5bb066cf1f31339317398374e713.tar.bz2 android_packages_apps_Gallery2-b4a96363005b5bb066cf1f31339317398374e713.zip |
Gallery2: update content start/end once getUpdateinfo
When delete last picture in album , the album has changed,
but this time current index and content start/end is still
old value.
To aviod this situation, will update content start and content end
once after getUpdateinfo and then can get correct current index and
item path.
CRs-Fixed: 624471
Change-Id: I8eb92e685f321df2d11481f440f7d9d33cf7b820
Diffstat (limited to 'src')
-rwxr-xr-x | src/com/android/gallery3d/app/PhotoDataAdapter.java | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/com/android/gallery3d/app/PhotoDataAdapter.java b/src/com/android/gallery3d/app/PhotoDataAdapter.java index 1e47ab0b7..20702b646 100755 --- a/src/com/android/gallery3d/app/PhotoDataAdapter.java +++ b/src/com/android/gallery3d/app/PhotoDataAdapter.java @@ -1043,6 +1043,10 @@ public class PhotoDataAdapter implements PhotoPage.Model { if (info.version != version) { info.reloadContent = true; info.size = mSource.getMediaItemCount(); + int start = Utils.clamp(info.indexHint - DATA_CACHE_SIZE / 2, + 0, Math.max(0, info.size - DATA_CACHE_SIZE)); + info.contentStart = start; + info.contentEnd = Math.min(info.size, start + DATA_CACHE_SIZE); } if (!info.reloadContent) continue; info.items = mSource.getMediaItem( @@ -1086,8 +1090,8 @@ public class PhotoDataAdapter implements PhotoPage.Model { } // Don't change index if mSize == 0 - if (mSize > 0) { - if (index >= mSize) index = mSize - 1; + if (info.size > 0) { + if (index >= info.size) index = info.size - 1; } info.indexHint = index; |