From 1cebb445779da9ca597621c79b020d6e5ea54fb2 Mon Sep 17 00:00:00 2001 From: John Reck Date: Fri, 10 Dec 2010 12:02:16 -0800 Subject: Removed 'Other Bookmarks' context menu Bug: 3253941 Change-Id: Ib2a4047a24632e3f56ff65afb1334203b292e9a4 --- src/com/android/browser/BookmarksLoader.java | 3 +++ src/com/android/browser/BrowserBookmarksPage.java | 9 +++++++++ 2 files changed, 12 insertions(+) (limited to 'src/com') diff --git a/src/com/android/browser/BookmarksLoader.java b/src/com/android/browser/BookmarksLoader.java index c5ca073..650c3ca 100644 --- a/src/com/android/browser/BookmarksLoader.java +++ b/src/com/android/browser/BookmarksLoader.java @@ -20,6 +20,7 @@ import android.content.Context; import android.content.CursorLoader; import android.net.Uri; import android.provider.BrowserContract.Bookmarks; +import android.provider.BrowserContract.ChromeSyncColumns; import android.text.TextUtils; public class BookmarksLoader extends CursorLoader { @@ -34,6 +35,7 @@ public class BookmarksLoader extends CursorLoader { public static final int COLUMN_INDEX_TOUCH_ICON = 5; public static final int COLUMN_INDEX_IS_FOLDER = 6; public static final int COLUMN_INDEX_PARENT = 8; + public static final int COLUMN_INDEX_SERVER_UNIQUE = 9; public static final String[] PROJECTION = new String[] { Bookmarks._ID, // 0 @@ -45,6 +47,7 @@ public class BookmarksLoader extends CursorLoader { Bookmarks.IS_FOLDER, // 6 Bookmarks.POSITION, // 7 Bookmarks.PARENT, // 8 + ChromeSyncColumns.SERVER_UNIQUE, // 9 }; private String mAccountType; diff --git a/src/com/android/browser/BrowserBookmarksPage.java b/src/com/android/browser/BrowserBookmarksPage.java index ccacee8..c030915 100644 --- a/src/com/android/browser/BrowserBookmarksPage.java +++ b/src/com/android/browser/BrowserBookmarksPage.java @@ -42,6 +42,7 @@ import android.os.Bundle; import android.preference.PreferenceManager; import android.provider.BrowserContract; import android.provider.BrowserContract.Accounts; +import android.provider.BrowserContract.ChromeSyncColumns; import android.text.TextUtils; import android.view.ContextMenu; import android.view.ContextMenu.ContextMenuInfo; @@ -331,6 +332,9 @@ public class BrowserBookmarksPage extends Fragment implements View.OnCreateConte public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) { AdapterView.AdapterContextMenuInfo info = (AdapterView.AdapterContextMenuInfo) menuInfo; Cursor cursor = mAdapter.getItem(info.position); + if (!canEdit(cursor)) { + return; + } boolean isFolder = cursor.getInt(BookmarksLoader.COLUMN_INDEX_IS_FOLDER) != 0; @@ -355,6 +359,11 @@ public class BrowserBookmarksPage extends Fragment implements View.OnCreateConte } } + boolean canEdit(Cursor c) { + String unique = c.getString(BookmarksLoader.COLUMN_INDEX_SERVER_UNIQUE); + return !ChromeSyncColumns.FOLDER_NAME_OTHER_BOOKMARKS.equals(unique); + } + private void populateBookmarkItem(Cursor cursor, BookmarkItem item, boolean isFolder) { item.setName(cursor.getString(BookmarksLoader.COLUMN_INDEX_TITLE)); if (isFolder) { -- cgit v1.1