/** {@inheritDoc} */
  @Override
  public void onRequestRefresh(Object o) {
    // Refresh only the item
    SearchResultAdapter adapter = (SearchResultAdapter) this.mSearchListView.getAdapter();
    if (adapter != null) {
      if (o instanceof FileSystemObject) {

        FileSystemObject fso = (FileSystemObject) o;
        int pos = adapter.getPosition(fso);
        if (pos >= 0) {
          SearchResult sr = adapter.getItem(pos);
          sr.setFso(fso);
        }
      } else if (o == null) {
        // Refresh all
        List<SearchResult> results = adapter.getData();
        this.mResultList = new ArrayList<FileSystemObject>(results.size());
        int cc = results.size();
        for (int i = 0; i < cc; i++) {
          this.mResultList.add(results.get(i).getFso());
        }
        drawResults();
      }
    }
  }
 /**
  * Method that removes all items and display a message.
  *
  * @hide
  */
 void removeAll() {
   SearchResultAdapter adapter = (SearchResultAdapter) this.mSearchListView.getAdapter();
   adapter.clear();
   adapter.notifyDataSetChanged();
   this.mSearchListView.setSelection(0);
   toggleResults(false, true);
 }
        @Override
        public void onItemFlingerEnd(
            OnItemFlingerResponder responder,
            AdapterView<?> parent,
            View view,
            int position,
            long id) {

          try {
            // Response if the item can be removed
            SearchResultAdapter adapter = (SearchResultAdapter) parent.getAdapter();
            SearchResult result = adapter.getItem(position);
            if (result != null && result.getFso() != null) {
              DeleteActionPolicy.removeFileSystemObject(
                  SearchActivity.this, result.getFso(), null, SearchActivity.this, responder);
              return;
            }

            // Cancels the flinger operation
            responder.cancel();

          } catch (Exception e) {
            ExceptionUtil.translateException(SearchActivity.this, e, true, false);
            responder.cancel();
          }
        }
  /** {@inheritDoc} */
  @Override
  public boolean onItemLongClick(AdapterView<?> parent, View view, int position, long id) {
    // Different actions depending on user preference

    // Get the adapter, the search result and the fso
    SearchResultAdapter adapter = ((SearchResultAdapter) parent.getAdapter());
    SearchResult searchResult = adapter.getItem(position);
    FileSystemObject fso = searchResult.getFso();

    // Open the actions menu
    onRequestMenu(fso);
    return true; // Always consume the event
  }
  /**
   * Method that removes the {@link FileSystemObject} reference
   *
   * @param fso The file system object
   */
  private void removeItem(FileSystemObject fso) {
    SearchResultAdapter adapter = (SearchResultAdapter) this.mSearchListView.getAdapter();
    if (adapter != null) {
      int pos = adapter.getPosition(fso);
      if (pos != -1) {
        SearchResult sr = adapter.getItem(pos);
        adapter.remove(sr);
      }

      // Toggle resultset?
      toggleResults(adapter.getCount() > 0, true);
      setFoundItems(adapter.getCount(), this.mSearchDirectory);
    }
  }
 @Override
 public boolean onItemFlingerStart(AdapterView<?> parent, View view, int position, long id) {
   try {
     // Response if the item can be removed
     SearchResultAdapter adapter = (SearchResultAdapter) parent.getAdapter();
     SearchResult result = adapter.getItem(position);
     if (result != null && result.getFso() != null) {
       if (result.getFso() instanceof ParentDirectory) {
         // This is not possible ...
         return false;
       }
       return true;
     }
   } catch (Exception e) {
     ExceptionUtil.translateException(SearchActivity.this, e, true, false);
   }
   return false;
 }