summaryrefslogtreecommitdiffstats
path: root/src/com/android/gallery3d/app
diff options
context:
space:
mode:
authorLinux Build Service Account <lnxbuild@localhost>2016-04-25 23:13:59 -0700
committerGerrit - the friendly Code Review server <code-review@localhost>2016-04-25 23:13:59 -0700
commit9166741f9eb6d7b337e2257b701fcf5556c88231 (patch)
tree9a03bdc793bed554875d35a76abfb147889078d8 /src/com/android/gallery3d/app
parentd74a961ac7bf422893645fc281ff208e87ff31b1 (diff)
parent78e8aba594ba385b812c1ed65a0f80bb03a3a4b2 (diff)
downloadandroid_packages_apps_Gallery2-9166741f9eb6d7b337e2257b701fcf5556c88231.tar.gz
android_packages_apps_Gallery2-9166741f9eb6d7b337e2257b701fcf5556c88231.tar.bz2
android_packages_apps_Gallery2-9166741f9eb6d7b337e2257b701fcf5556c88231.zip
Merge "Gallery2: fix photo details title display incorrect in Timeline." into android_ui.lnx.1.2-dev
Diffstat (limited to 'src/com/android/gallery3d/app')
-rw-r--r--src/com/android/gallery3d/app/TimeLineDataLoader.java19
-rw-r--r--src/com/android/gallery3d/app/TimeLinePage.java3
2 files changed, 18 insertions, 4 deletions
diff --git a/src/com/android/gallery3d/app/TimeLineDataLoader.java b/src/com/android/gallery3d/app/TimeLineDataLoader.java
index be0f42cd3..28cb274cd 100644
--- a/src/com/android/gallery3d/app/TimeLineDataLoader.java
+++ b/src/com/android/gallery3d/app/TimeLineDataLoader.java
@@ -154,10 +154,23 @@ public class TimeLineDataLoader {
// Returns the index of the MediaItem with the given path or
// -1 if the path is not cached
public int findItem(Path id) {
- for (int i = mContentStart; i < mContentEnd; i++) {
+ return getIndex(id, true);
+ }
+
+ /**
+ * @param id given path
+ * @param needTitleItem timeline title items will be filtered out if true.
+ * @return the index of the MediaItem with the given path or -1 if the path is not cached.
+ */
+ public int getIndex(Path id, final boolean needTitleItem) {
+ for (int i = mContentStart, offset = 0; i < mContentEnd; i++) {
MediaItem item = mData[i % DATA_CACHE_SIZE];
- if (item != null && id == item.getPath()) {
- return i;
+ if (item != null) {
+ if (!needTitleItem && !item.isSelectable()) {
+ offset++;
+ } else if (id == item.getPath()) {
+ return i - offset;
+ }
}
}
return -1;
diff --git a/src/com/android/gallery3d/app/TimeLinePage.java b/src/com/android/gallery3d/app/TimeLinePage.java
index 46e5c7d63..a2b472107 100644
--- a/src/com/android/gallery3d/app/TimeLinePage.java
+++ b/src/com/android/gallery3d/app/TimeLinePage.java
@@ -809,7 +809,8 @@ public class TimeLinePage extends ActivityState implements
if (mSelectionManager.getSelected(false) == null) return -1;
Path id = mSelectionManager.getSelected(false).get(0);
mIndex = mAlbumDataAdapter.findItem(id);
- return mIndex;
+ int indexToDisplay = mAlbumDataAdapter.getIndex(id, false);
+ return indexToDisplay;
}
@Override