private void stepBack(boolean cancelIfFirstStep) {
   switch (mStep) {
     case STEP_CHOOSE_ACCOUNT:
       if (cancelIfFirstStep) {
         mActivity.finish();
       }
       mUpLayout.setVisibility(View.INVISIBLE);
       break;
     case STEP_CHOOSE_REPO:
       if (canChooseAccount) {
         mCurrentDir = getString(R.string.settings_cuc_remote_lib_account);
         setCurrentDirText(mCurrentDir);
         chooseAccount(false);
       } else if (cancelIfFirstStep) {
         mActivity.finish();
       }
       break;
     case STEP_CHOOSE_DIR:
       if (getNavContext().isRepoRoot()) {
         mCurrentDir = getAccountManager().getCurrentAccount().getEmail();
         setCurrentDirText(mCurrentDir);
         chooseRepo();
       } else {
         String path = getNavContext().getDirPath();
         mCurrentDir = getNavContext().getRepoName() + Utils.getParentPath(path);
         setCurrentDirText(mCurrentDir);
         getNavContext().setDir(Utils.getParentPath(path), null);
         refreshDir();
       }
       break;
   }
 }
 public void showPasswordDialog(
     String repoName, String repoID, TaskDialog.TaskDialogListener listener, String password) {
   PasswordDialog passwordDialog = new PasswordDialog();
   passwordDialog.setRepo(repoName, repoID, mAccount);
   if (password != null) {
     passwordDialog.setPassword(password);
   }
   passwordDialog.setTaskDialogLisenter(listener);
   passwordDialog.show(mActivity.getSupportFragmentManager(), PASSWORD_DIALOG_FRAGMENT_TAG);
 }
  @Override
  public View onCreateView(
      LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    mActivity = (CameraUploadConfigActivity) getActivity();
    Intent intent = mActivity.getIntent();
    avatarManager = new AvatarManager();
    Account account = intent.getParcelableExtra("account");
    if (account == null) {
      canChooseAccount = true;
    } else {
      mAccount = account;
    }
    onlyShowWritableRepos = intent.getBooleanExtra(ONLY_SHOW_WRITABLE_REPOS, true);
    encryptedRepoId = intent.getStringExtra(ENCRYPTED_REPO_ID);
    isOnlyChooseRepo = true;

    View rootView =
        getActivity().getLayoutInflater().inflate(R.layout.cuc_multi_selection_layout, null);
    mFoldersListView = (ListView) rootView.findViewById(R.id.cuc_multi_selection_lv);
    mFoldersListView.setFastScrollEnabled(true);
    mUpLayout = (RelativeLayout) rootView.findViewById(R.id.cuc_multi_selection_up_layout);
    mCurrentFolderText =
        (TextView) rootView.findViewById(R.id.cuc_multi_selection_current_directory_txt);
    mEmptyText = (TextView) rootView.findViewById(R.id.cuc_multi_selection_empty_msg);
    mErrorText = (TextView) rootView.findViewById(R.id.cuc_multi_selection_error_msg);
    mRefreshBtn = (ImageView) rootView.findViewById(R.id.cuc_multi_selection_refresh_iv);
    mProgressContainer = rootView.findViewById(R.id.cuc_multi_selection_progress_container);
    mListContainer = rootView.findViewById(R.id.cuc_multi_selection_list_container);
    mRefreshBtn.setOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View v) {
            refreshList(true);
          }
        });

    mUpLayout.setOnClickListener(
        new View.OnClickListener() {

          @Override
          public void onClick(View v) {
            try {
              stepBack();
            } catch (Exception e) {
              e.printStackTrace();
            }
          }
        });

    mFoldersListView.setOnItemClickListener(
        new OnItemClickListener() {
          @Override
          public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
            onListItemClick(parent, position, id);
          }
        });

    if (canChooseAccount) {
      chooseAccount();
    } else {
      chooseRepo();
    }

    return rootView;
  }
 private void onRepoSelected(Account account, SeafRepo seafRepo) {
   mActivity.saveCameraUploadInfo(account, seafRepo);
   getReposAdapter().setSelectedRepo(seafRepo);
   getReposAdapter().notifyDataSetChanged();
 }