Fix disable non clickable item in ContextMenuAdapter

This commit is contained in:
Alexey Kulish 2016-10-25 12:28:14 +03:00
parent d542766dc8
commit a609bc6dd9
2 changed files with 7 additions and 1 deletions

View file

@ -111,6 +111,12 @@ public class ContextMenuAdapter {
mIconsCache = app.getIconsCache();
}
@Override
public boolean isEnabled(int position) {
final ContextMenuItem item = getItem(position);
return item != null && item.getItemClickListener() != null;
}
@Override
public View getView(final int position, View convertView, ViewGroup parent) {
// User super class to create the View

View file

@ -860,7 +860,7 @@ public class MapActivityActions implements DialogProvider {
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
ContextMenuItem item = contextMenuAdapter.getItem(position);
ContextMenuAdapter.ItemClickListener click = item.getItemClickListener();
if (click.onContextMenuClick(simpleListAdapter, item.getTitleId(),
if (click != null && click.onContextMenuClick(simpleListAdapter, item.getTitleId(),
position, false)) {
mapActivity.closeDrawer();
}