@Override
    public boolean onPrepareOptionsMenu(final Menu menu) {
        super.onPrepareOptionsMenu(menu);

        final boolean isSelectMode = adapter.isSelectMode();
        final boolean isHistory = type == CacheListType.HISTORY;
        final boolean isOffline = type == CacheListType.OFFLINE;
        final boolean isConcrete = isConcreteList();
        final boolean isNonDefaultList = isConcrete && listId != StoredList.STANDARD_LIST_ID;

        final boolean isEmpty = adapter.isEmpty();
        final Collection<Geocache> caches = adapter.getCheckedOrAllCaches();
        final boolean containsOfflineLogs = containsOfflineLogs(caches);
        final boolean containsStoredPastEvents = containsStoredPastEvents(caches);
        final boolean containsStoredCaches = containsStoredCaches(caches);

        final boolean isGcConnectorActive = Settings.isGCConnectorActive();
        final boolean isGcPremiumMember = isGcConnectorActive && Settings.isGCPremiumMember();

        final boolean hasListNavigationApps = CacheListApps.getActiveApps().size() > 1;
        final int checkedCount = adapter.getCheckedCount();


        try {
            // toplevel menu items
            MenuUtils.setEnabled(menu, R.id.menu_show_on_map, !isEmpty);
            MenuUtils.setVisibleEnabled(menu, R.id.menu_sort, !isHistory, !isEmpty);

            MenuUtils.setEnabled(menu, R.id.menu_switch_select_mode, !isEmpty);
            updateSelectSwitchMenuItem(menu.findItem(R.id.menu_switch_select_mode));
            MenuUtils.setVisible(menu, R.id.menu_invert_selection, isSelectMode); // exception to the general rule: only show in select mode
            MenuUtils.setVisible(menu, R.id.menu_select_next20, isSelectMode); // same here
            MenuUtils.setVisible(menu, R.id.menu_select_next100, isSelectMode); // same here

            MenuUtils.setVisibleEnabled(menu, R.id.menu_cache_list_app_provider, hasListNavigationApps, !isEmpty);

            // Manage Caches submenu
            MenuUtils.setEnabled(menu, R.id.menu_refresh_stored, !isEmpty);
            if (isOffline || isHistory) { // only offline list
                setMenuItemLabel(menu, R.id.menu_refresh_stored, R.string.caches_refresh_selected, R.string.caches_refresh_all, checkedCount);
            } else { // search and global list (all other than offline and history)
                setMenuItemLabel(menu, R.id.menu_refresh_stored, R.string.caches_store_selected, R.string.caches_store_offline, checkedCount);
            }

            MenuUtils.setVisible(menu, R.id.menu_move_to_list, containsStoredCaches);
            setMenuItemLabel(menu, R.id.menu_move_to_list, R.string.caches_move_selected, R.string.caches_move_all, checkedCount);
            MenuUtils.setVisible(menu, R.id.menu_copy_to_list, containsStoredCaches);
            setMenuItemLabel(menu, R.id.menu_copy_to_list, R.string.caches_copy_selected, R.string.caches_copy_all, checkedCount);

            MenuUtils.setEnabled(menu, R.id.menu_add_to_route, !isEmpty);
            setMenuItemLabel(menu, R.id.menu_add_to_route, R.string.caches_append_to_route_selected, R.string.caches_append_to_route_all, checkedCount);
            MenuUtils.setVisible(menu, R.id.menu_delete_events, containsStoredPastEvents);
            MenuUtils.setVisible(menu, R.id.menu_clear_offline_logs, containsOfflineLogs);
            MenuUtils.setVisibleEnabled(menu, R.id.menu_remove_from_history, isHistory, !isEmpty);
            setMenuItemLabel(menu, R.id.menu_remove_from_history, R.string.cache_remove_from_history, R.string.cache_clear_history, checkedCount);

            final boolean removeFromDevice = removeWillDeleteFromDevice(listId);
            MenuUtils.setVisibleEnabled(menu, R.id.menu_drop_caches, (isHistory || containsStoredCaches) && !removeFromDevice, !isEmpty);
            setMenuItemLabel(menu, R.id.menu_drop_caches, R.string.caches_remove_selected, R.string.caches_remove_all, checkedCount);
            MenuUtils.setVisibleEnabled(menu, R.id.menu_drop_caches_all_lists, isHistory || containsStoredCaches, !isEmpty);
            setMenuItemLabel(menu, R.id.menu_drop_caches_all_lists, R.string.caches_remove_selected_completely, R.string.caches_remove_all_completely, checkedCount);

            MenuUtils.setVisibleEnabled(menu, R.id.menu_upload_bookmarklist, isGcPremiumMember, !isEmpty);
            setMenuItemLabel(menu, R.id.menu_upload_bookmarklist, R.string.caches_upload_bookmarklist_selected, R.string.caches_upload_bookmarklist_all, checkedCount);
            MenuUtils.setEnabled(menu, R.id.menu_show_attributes, !isEmpty);
            setMenuItemLabel(menu, R.id.menu_show_attributes, R.string.caches_show_attributes_selected, R.string.caches_show_attributes_all, checkedCount);
            MenuUtils.setEnabled(menu, R.id.menu_set_cache_icon, !isEmpty);
            setMenuItemLabel(menu, R.id.menu_set_cache_icon, R.string.caches_set_cache_icon_selected, R.string.caches_set_cache_icon_all, checkedCount);
            MenuUtils.setVisibleEnabled(menu, R.id.menu_remove_from_other_lists, isOffline && listId != PseudoList.ALL_LIST.id, !isEmpty);
            setMenuItemLabel(menu, R.id.menu_remove_from_other_lists, R.string.caches_remove_from_other_lists_selected, R.string.caches_remove_from_other_lists_all, checkedCount);

            // Manage Lists submenu
            MenuUtils.setVisibleEnabled(menu, R.id.menu_lists, isOffline, !isSelectMode);
            MenuUtils.setVisible(menu, R.id.menu_drop_list, isNonDefaultList);
            MenuUtils.setVisible(menu, R.id.menu_rename_list, isNonDefaultList);
            MenuUtils.setVisible(menu, R.id.menu_rename_list_prefix, isNonDefaultList && DataStore.getListHierarchy().size() > 1);
            MenuUtils.setVisibleEnabled(menu, R.id.menu_make_list_unique, listId != PseudoList.ALL_LIST.id, !isEmpty);
            MenuUtils.setVisible(menu, R.id.menu_set_listmarker, isNonDefaultList);
            MenuUtils.setVisibleEnabled(menu, R.id.menu_set_askfordeletion, isNonDefaultList, preventAskForDeletion);

            // Import submenu
            MenuUtils.setVisibleEnabled(menu, R.id.menu_import, isOffline && listId != PseudoList.ALL_LIST.id, !isSelectMode);
            MenuUtils.setEnabled(menu, R.id.menu_import_pq, isGcPremiumMember);
            MenuUtils.setEnabled(menu, R.id.menu_bookmarklists, isGcPremiumMember);

            // Export
            MenuUtils.setVisibleEnabled(menu, R.id.menu_export, isHistory || isOffline, !isEmpty);
            setMenuItemLabel(menu, R.id.menu_export_gpx, R.string.export_gpx, R.string.export_gpx, checkedCount);
            setMenuItemLabel(menu, R.id.menu_export_fieldnotes, R.string.export_fieldnotes, R.string.export_fieldnotes, checkedCount);
            setMenuItemLabel(menu, R.id.menu_export_persnotes, R.string.export_persnotes, R.string.export_persnotes, checkedCount);
            MenuUtils.setVisibleEnabled(menu, R.id.menu_upload_modifiedcoords, isGcConnectorActive, !isEmpty);
            MenuUtils.setVisibleEnabled(menu, R.id.menu_upload_allcoords, isGcConnectorActive, !isEmpty);
            setMenuItemLabel(menu, R.id.menu_upload_allcoords, R.string.caches_upload_allcoords, R.string.caches_upload_allcoords, checkedCount);

        } catch (final RuntimeException e) {
            Log.e("CacheListActivity.onPrepareOptionsMenu", e);
        }
        MenuUtils.tintToolbarAndOverflowIcons(menu);

        return true;
    }
Menu items which are not at all usable with the current list type should be hidden.
Menu items which are usable with the current list type but not in the current situation should be disabled.
main/src/main/java/cgeo/geocaching/CacheListActivity.java