Bug 909979 - Fix off-by-one error when long clicking views in BrowserSearch list. r=sriram

This commit is contained in:
Margaret Leibovic 2013-08-28 17:42:32 -07:00
parent caccd72028
commit 7a33025b1f

View File

@ -93,7 +93,7 @@ public class BrowserSearch extends HomeFragment
private LinearLayout mView;
// The list showing search results
private ListView mList;
private HomeListView mList;
// Client that performs search suggestion queries
private volatile SuggestClient mSuggestClient;
@ -205,7 +205,7 @@ public class BrowserSearch extends HomeFragment
// All list views are styled to look the same with a global activity theme.
// If the style of the list changes, inflate it from an XML.
mView = (LinearLayout) inflater.inflate(R.layout.browser_search, container, false);
mList = (ListView) mView.findViewById(R.id.home_list_view);
mList = (HomeListView) mView.findViewById(R.id.home_list_view);
return mView;
}
@ -239,6 +239,16 @@ public class BrowserSearch extends HomeFragment
}
});
mList.setOnItemLongClickListener(new AdapterView.OnItemLongClickListener() {
@Override
public boolean onItemLongClick(AdapterView<?> parent, View view, int position, long id) {
// Account for the search engines
position -= getSuggestEngineCount();
return mList.onItemLongClick(parent, view, position, id);
}
});
final ListSelectionListener listener = new ListSelectionListener();
mList.setOnItemSelectedListener(listener);
mList.setOnFocusChangeListener(listener);