Bug 759041 - Fix context menus in all pages. r=lucasr

This commit is contained in:
Wes Johnston 2012-06-18 12:39:13 -07:00
parent 2c41c4f575
commit 48dbb78127

View File

@ -54,6 +54,7 @@ import org.mozilla.gecko.db.BrowserContract.Combined;
public class AllPagesTab extends AwesomeBarTab {
public static final String LOGTAG = "ALL_PAGES";
private static final String TAG = "allPages";
private String mSearchTerm;
private SearchEngine mSuggestEngine;
private ArrayList<SearchEngine> mSearchEngines;
private ListView mView = null;
@ -150,12 +151,6 @@ public class AllPagesTab extends AwesomeBarTab {
public void onClick();
}
private class AwesomeBarCursorAdapter extends SimpleCursorAdapter {
private String mSearchTerm;
private static final int ROW_SEARCH = 0;
private static final int ROW_STANDARD = 1;
private class AwesomeBarCursorItem implements AwesomeBarItem {
private Cursor mCursor;
@ -163,6 +158,10 @@ public class AllPagesTab extends AwesomeBarTab {
mCursor = cursor;
}
public Cursor getCursor() {
return mCursor;
}
public void onClick() {
AwesomeBarTabs.OnUrlOpenListener listener = getUrlListener();
if (listener == null)
@ -192,6 +191,10 @@ public class AllPagesTab extends AwesomeBarTab {
}
}
private class AwesomeBarCursorAdapter extends SimpleCursorAdapter {
private static final int ROW_SEARCH = 0;
private static final int ROW_STANDARD = 1;
public AwesomeBarCursorAdapter(Context context) {
super(context, -1, null, new String[] {}, new int[] {});
mSearchTerm = "";
@ -519,12 +522,12 @@ public class AllPagesTab extends AwesomeBarTab {
AdapterView.AdapterContextMenuInfo info = (AdapterView.AdapterContextMenuInfo) menuInfo;
Object selectedItem = list.getItemAtPosition(info.position);
if (!(selectedItem instanceof Cursor)) {
Log.e(LOGTAG, "item at " + info.position + " is not a Cursor");
if (!(selectedItem instanceof AwesomeBarCursorItem)) {
Log.e(LOGTAG, "item at " + info.position + " is a search item");
return subject;
}
Cursor cursor = (Cursor) selectedItem;
Cursor cursor = ((AwesomeBarCursorItem) selectedItem).getCursor();
// Don't show the context menu for folders
String keyword = null;