/**
  * Remove a site object inside the listing without requesting an HTTP call.
  *
  * @param site : site to remove
  */
 public void remove(Node node) {
   if (adapter != null) {
     ((ProgressNodeAdapter) adapter).remove(node.getName());
     if (adapter.isEmpty()) {
       displayEmptyView();
     }
   }
 }
    @Override
    public void onReceive(Context context, Intent intent) {
      Log.d(TAG, intent.getAction());

      if (adapter == null) return;

      if (intent.getExtras() != null) {
        Folder parentFolder = getParent();
        Bundle b = intent.getExtras().getParcelable(IntentIntegrator.EXTRA_DATA);
        if (b == null) {
          return;
        }
        if (b.getSerializable(IntentIntegrator.EXTRA_FOLDER) instanceof File) {
          return;
        }
        String pFolder = ((Folder) b.getParcelable(IntentIntegrator.EXTRA_FOLDER)).getIdentifier();

        if (pFolder.equals(parentFolder.getIdentifier())) {
          if (intent.getAction().equals(IntentIntegrator.ACTION_DELETE_COMPLETED)) {
            remove((Node) b.getParcelable(IntentIntegrator.EXTRA_DOCUMENT));
            return;
          } else if (intent.getAction().equals(IntentIntegrator.ACTION_UPLOAD_STARTED)) {
            String documentName = b.getString(IntentIntegrator.EXTRA_DOCUMENT_NAME);
            Node node =
                new NodePlaceHolder(
                    documentName, CreateDocumentRequest.TYPE_ID, Operation.STATUS_RUNNING);
            ((ProgressNodeAdapter) adapter).replaceNode(node);
          } else if (intent.getAction().equals(IntentIntegrator.ACTION_UPLOAD_COMPLETED)) {
            Node node = (Node) b.getParcelable(IntentIntegrator.EXTRA_DOCUMENT);
            ((ProgressNodeAdapter) adapter).replaceNode(node);
          } else if (intent.getAction().equals(IntentIntegrator.ACTION_UPDATE_COMPLETED)) {
            if (b.containsKey(IntentIntegrator.EXTRA_DOCUMENT)) {
              remove((Node) b.getParcelable(IntentIntegrator.EXTRA_DOCUMENT));
            } else {
              remove((Node) b.getParcelable(IntentIntegrator.EXTRA_NODE));
            }

            Node updatedNode = (Node) b.getParcelable(IntentIntegrator.EXTRA_UPDATED_NODE);
            ((ProgressNodeAdapter) adapter).replaceNode(updatedNode);
          } else if (intent.getAction().equals(IntentIntegrator.ACTION_CREATE_FOLDER_COMPLETED)) {
            Node node = (Node) b.getParcelable(IntentIntegrator.EXTRA_CREATED_FOLDER);
            ((ProgressNodeAdapter) adapter).replaceNode(node);
          } else if (intent.getAction().equals(IntentIntegrator.ACTION_FAVORITE_COMPLETED)) {
            ((ProgressNodeAdapter) adapter).refreshOperations();
          } else if (intent.getAction().equals(IntentIntegrator.ACTION_DOWNLOAD_COMPLETED)) {
            Node node = (Node) b.getParcelable(IntentIntegrator.EXTRA_DOCUMENT);
            ((ProgressNodeAdapter) adapter).replaceNode(node);
          }
          ((ProgressNodeAdapter) adapter).refreshOperations();
          refreshList();
          gv.setSelection(selectedPosition);
        }
      }
    }