private QuickAction prepareDirAction(final SeafDirent dirent) {
    final QuickAction mQuickAction = new QuickAction(mActivity);
    Resources resources = mActivity.getResources();
    ActionItem shareAction;
    shareAction =
        new ActionItem(
            ACTION_ID_SHARE,
            resources.getString(R.string.file_action_share),
            resources.getDrawable(R.drawable.action_share));
    mQuickAction.addActionItem(shareAction);

    // setup the action item click listener
    mQuickAction.setOnActionItemClickListener(
        new QuickAction.OnActionItemClickListener() {
          @Override
          public void onItemClick(QuickAction quickAction, int pos, int actionId) {
            NavContext nav = mActivity.getNavContext();
            String repoName = nav.getRepoName();
            String repoID = nav.getRepoID();
            String dir = nav.getDirPath();
            String path = Utils.pathJoin(dir, dirent.name);
            switch (actionId) {
              case ACTION_ID_SHARE:
                mActivity.shareDir(repoID, path);
                break;
            }
          }
        });

    mQuickAction.mAnimateTrack(false);
    return mQuickAction;
  }
 private void showError(int strID) {
   showError(mActivity.getResources().getString(strID));
 }
  private QuickAction prepareFileAction(final SeafDirent dirent, boolean cacheExists) {
    final QuickAction mQuickAction = new QuickAction(mActivity);
    Resources resources = mActivity.getResources();
    ActionItem shareAction, downloadAction, updateAction, exportAction, renameAction, deleteAction;

    shareAction =
        new ActionItem(
            ACTION_ID_SHARE,
            resources.getString(R.string.file_action_share),
            resources.getDrawable(R.drawable.action_share));
    mQuickAction.addActionItem(shareAction);

    // deleteAction = new ActionItem(ACTION_ID_DELETE,
    //                               resources.getString(R.string.file_action_delete),
    //                               resources.getDrawable(R.drawable.action_delete));
    // mQuickAction.addActionItem(deleteAction);

    renameAction =
        new ActionItem(
            ACTION_ID_RENAME,
            resources.getString(R.string.file_action_rename),
            resources.getDrawable(R.drawable.action_rename));
    mQuickAction.addActionItem(renameAction);

    exportAction =
        new ActionItem(
            ACTION_ID_EXPORT,
            resources.getString(R.string.file_action_export),
            resources.getDrawable(R.drawable.action_export));
    mQuickAction.addActionItem(exportAction);

    if (cacheExists) {
      if (mActivity.hasRepoWritePermission()) {
        updateAction =
            new ActionItem(
                ACTION_ID_UPDATE,
                resources.getString(R.string.file_action_update),
                resources.getDrawable(R.drawable.action_update));
        mQuickAction.addActionItem(updateAction);
      }

    } else {
      downloadAction =
          new ActionItem(
              ACTION_ID_DOWNLOAD,
              resources.getString(R.string.file_action_download),
              resources.getDrawable(R.drawable.action_download));
      mQuickAction.addActionItem(downloadAction);
    }

    // setup the action item click listener
    mQuickAction.setOnActionItemClickListener(
        new QuickAction.OnActionItemClickListener() {
          @Override
          public void onItemClick(QuickAction quickAction, int pos, int actionId) {
            NavContext nav = mActivity.getNavContext();
            String repoName = nav.getRepoName();
            String repoID = nav.getRepoID();
            String dir = nav.getDirPath();
            String path = Utils.pathJoin(dir, dirent.name);
            DataManager dataManager = mActivity.getDataManager();
            String localPath = dataManager.getLocalRepoFile(repoName, repoID, path).getPath();
            switch (actionId) {
              case ACTION_ID_SHARE:
                mActivity.shareFile(repoID, path);
                break;
              case ACTION_ID_EXPORT:
                mActivity.exportFile(dirent.name);
                break;
              case ACTION_ID_DOWNLOAD:
                mActivity.onFileSelected(dirent);
                break;
              case ACTION_ID_UPDATE:
                mActivity.addUpdateTask(repoID, repoName, dir, localPath);
                break;
              case ACTION_ID_RENAME:
                mActivity.renameFile(repoID, repoName, path);
                break;
            }
          }
        });

    mQuickAction.mAnimateTrack(false);
    return mQuickAction;
  }