Bug 908423 - Account for parent folder row when creating bookmark list context menu. r=sriram
authorMargaret Leibovic <margaret.leibovic@gmail.com>
Tue, 27 Aug 2013 08:44:58 -0700
changeset 144543 ed5ffec871a60133bea3bd4c70f4272158a8e75e
parent 144542 35112ff85c605d737e9d7bae694412a9a64ea7d0
child 144544 b8217f322b54b73828cf3ab92304f9745f050a47
push id25167
push userryanvm@gmail.com
push dateWed, 28 Aug 2013 02:38:05 +0000
treeherdermozilla-central@416075f77249 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssriram
bugs908423
milestone26.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 908423 - Account for parent folder row when creating bookmark list context menu. r=sriram
mobile/android/base/home/BookmarksListView.java
--- a/mobile/android/base/home/BookmarksListView.java
+++ b/mobile/android/base/home/BookmarksListView.java
@@ -142,16 +142,28 @@ public class BookmarksListView extends H
             // Otherwise, just open the URL
             final String url = cursor.getString(cursor.getColumnIndexOrThrow(URLColumns.URL));
 
             // This item is a TwoLinePageRow, so we allow switch-to-tab.
             getOnUrlOpenListener().onUrlOpen(url, EnumSet.of(OnUrlOpenListener.Flags.ALLOW_SWITCH_TO_TAB));
         }
     }
 
+    @Override
+    public boolean onItemLongClick(AdapterView<?> parent, View view, int position, long id) {
+        // Adjust the item position to account for the parent folder row that is inserted
+        // at the top of the list when viewing the contents of a folder.
+        final BookmarksListAdapter adapter = getBookmarksListAdapter();
+        if (adapter.isShowingChildFolder()) {
+            position--;
+        }
+
+        return super.onItemLongClick(parent, view, position, id);
+    }
+
     private BookmarksListAdapter getBookmarksListAdapter() {
         BookmarksListAdapter adapter;
         ListAdapter listAdapter = getAdapter();
         if (listAdapter instanceof HeaderViewListAdapter) {
             adapter = (BookmarksListAdapter) ((HeaderViewListAdapter) listAdapter).getWrappedAdapter();
         } else {
             adapter = (BookmarksListAdapter) listAdapter;
         }