diff options
author | Ray Chen <raychen@google.com> | 2011-10-21 16:07:12 +0800 |
---|---|---|
committer | Ray Chen <raychen@google.com> | 2011-10-27 17:49:59 +0800 |
commit | 09efcf9a9367bda0a9d28f312c9b3d0e93dd49da (patch) | |
tree | adbbdd51460d52d7b47f5fe2caa35bbde09f320b /src/com/android/gallery3d/app/SlideshowDataAdapter.java | |
parent | 773d368357ce50bc299551a768584d5a222fd440 (diff) | |
download | android_packages_apps_Snap-09efcf9a9367bda0a9d28f312c9b3d0e93dd49da.tar.gz android_packages_apps_Snap-09efcf9a9367bda0a9d28f312c9b3d0e93dd49da.tar.bz2 android_packages_apps_Snap-09efcf9a9367bda0a9d28f312c9b3d0e93dd49da.zip |
Fix 5471518 Playing slide show from any picture doesn't start from the current picture which is unexpected IRL17 Crespo
Change-Id: I2ed78cee2f6257254794a7724897845c43a3e0a5
Diffstat (limited to 'src/com/android/gallery3d/app/SlideshowDataAdapter.java')
-rw-r--r-- | src/com/android/gallery3d/app/SlideshowDataAdapter.java | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/src/com/android/gallery3d/app/SlideshowDataAdapter.java b/src/com/android/gallery3d/app/SlideshowDataAdapter.java index fb7eec886..7c934ee3b 100644 --- a/src/com/android/gallery3d/app/SlideshowDataAdapter.java +++ b/src/com/android/gallery3d/app/SlideshowDataAdapter.java @@ -16,18 +16,19 @@ package com.android.gallery3d.app; +import android.graphics.Bitmap; + import com.android.gallery3d.app.SlideshowPage.Slide; import com.android.gallery3d.data.ContentListener; import com.android.gallery3d.data.MediaItem; import com.android.gallery3d.data.MediaObject; +import com.android.gallery3d.data.Path; import com.android.gallery3d.util.Future; import com.android.gallery3d.util.FutureListener; import com.android.gallery3d.util.ThreadPool; import com.android.gallery3d.util.ThreadPool.Job; import com.android.gallery3d.util.ThreadPool.JobContext; -import android.graphics.Bitmap; - import java.util.LinkedList; import java.util.concurrent.atomic.AtomicBoolean; @@ -42,6 +43,7 @@ public class SlideshowDataAdapter implements SlideshowPage.Model { public void removeContentListener(ContentListener listener); public long reload(); public MediaItem getMediaItem(int index); + public int findItemIndex(Path path, int hint); } private final SlideshowSource mSource; @@ -51,6 +53,7 @@ public class SlideshowDataAdapter implements SlideshowPage.Model { private boolean mIsActive = false; private boolean mNeedReset; private boolean mDataReady; + private Path mInitialPath; private final LinkedList<Slide> mImageQueue = new LinkedList<Slide>(); @@ -61,8 +64,11 @@ public class SlideshowDataAdapter implements SlideshowPage.Model { private final AtomicBoolean mNeedReload = new AtomicBoolean(false); private final SourceListener mSourceListener = new SourceListener(); - public SlideshowDataAdapter(GalleryContext context, SlideshowSource source, int index) { + // The index is just a hint if initialPath is set + public SlideshowDataAdapter(GalleryContext context, SlideshowSource source, int index, + Path initialPath) { mSource = source; + mInitialPath = initialPath; mLoadIndex = index; mNextOutput = index; mThreadPool = context.getThreadPool(); @@ -77,7 +83,12 @@ public class SlideshowDataAdapter implements SlideshowPage.Model { return null; } } - return mSource.getMediaItem(mLoadIndex); + int index = mLoadIndex; + if (mInitialPath != null) { + index = mSource.findItemIndex(mInitialPath, index); + mInitialPath = null; + } + return mSource.getMediaItem(index); } private class ReloadTask implements Job<Void> { |