diff options
author | John Reck <jreck@google.com> | 2012-05-04 13:53:25 -0700 |
---|---|---|
committer | John Reck <jreck@google.com> | 2012-05-04 13:53:25 -0700 |
commit | 9ee87d9ce5aae1460f53bea66bfcafd3671505a0 (patch) | |
tree | 8b866f9ad37661878944ed4a51c6d155fefecb75 /src | |
parent | b0fb2baae970c52b0dcf2f0677df5d89078f1480 (diff) | |
download | packages_apps_Browser-9ee87d9ce5aae1460f53bea66bfcafd3671505a0.zip packages_apps_Browser-9ee87d9ce5aae1460f53bea66bfcafd3671505a0.tar.gz packages_apps_Browser-9ee87d9ce5aae1460f53bea66bfcafd3671505a0.tar.bz2 |
Fix getItemId()
Bug: 6446119
Change-Id: If8c13c9f2cb9b93c6f3575f12111059aeeacd5cb
Diffstat (limited to 'src')
-rw-r--r-- | src/com/android/browser/BrowserBookmarksAdapter.java | 5 | ||||
-rw-r--r-- | src/com/android/browser/util/ThreadedCursorAdapter.java | 5 | ||||
-rw-r--r-- | src/com/android/browser/view/BookmarkExpandableView.java | 3 |
3 files changed, 10 insertions, 3 deletions
diff --git a/src/com/android/browser/BrowserBookmarksAdapter.java b/src/com/android/browser/BrowserBookmarksAdapter.java index 93cf5d9..afc28ba 100644 --- a/src/com/android/browser/BrowserBookmarksAdapter.java +++ b/src/com/android/browser/BrowserBookmarksAdapter.java @@ -49,6 +49,11 @@ public class BrowserBookmarksAdapter extends } @Override + protected long getItemId(Cursor c) { + return c.getLong(BookmarksLoader.COLUMN_INDEX_ID); + } + + @Override public View newView(Context context, ViewGroup parent) { return mInflater.inflate(R.layout.bookmark_thumbnail, parent, false); } diff --git a/src/com/android/browser/util/ThreadedCursorAdapter.java b/src/com/android/browser/util/ThreadedCursorAdapter.java index b70ca36..72a07ea 100644 --- a/src/com/android/browser/util/ThreadedCursorAdapter.java +++ b/src/com/android/browser/util/ThreadedCursorAdapter.java @@ -137,7 +137,9 @@ public abstract class ThreadedCursorAdapter<T> extends BaseAdapter { @Override public long getItemId(int position) { - return position; + synchronized (mCursorLock) { + return getItemId(getItem(position)); + } } private void loadRowObject(int position, LoadContainer container) { @@ -207,4 +209,5 @@ public abstract class ThreadedCursorAdapter<T> extends BaseAdapter { public abstract void bindView(View view, T object); public abstract T getRowObject(Cursor c, T recycleObject); public abstract T getLoadingObject(); + protected abstract long getItemId(Cursor c); }
\ No newline at end of file diff --git a/src/com/android/browser/view/BookmarkExpandableView.java b/src/com/android/browser/view/BookmarkExpandableView.java index 095bb7b..7badaf5 100644 --- a/src/com/android/browser/view/BookmarkExpandableView.java +++ b/src/com/android/browser/view/BookmarkExpandableView.java @@ -228,7 +228,7 @@ public class BookmarkExpandableView extends ExpandableListView || mAdapter.mChildren.get(groupPosition).getCount() <= childPosition) { return; } - long id = (Long) v.getTag(R.id.child_id); + long id = mAdapter.mChildren.get(groupPosition).getItemId(childPosition); if (mOnChildClickListener != null) { mOnChildClickListener.onChildClick(BookmarkExpandableView.this, v, groupPosition, childPosition, id); @@ -331,7 +331,6 @@ public class BookmarkExpandableView extends ExpandableListView View v = childAdapter.getView(realChildPosition, cv, row); v.setTag(R.id.group_position, groupPosition); v.setTag(R.id.child_position, realChildPosition); - v.setTag(R.id.child_id, childAdapter.getItemId(realChildPosition)); v.setOnClickListener(mChildClickListener); v.setLongClickable(mLongClickable); if (cv == null) { |