@Override
    public void onItemClick(AdapterView<?> parent_, View list_, int position, long id_) {
        if (position < 0 || position >= _entries.size()) return;

        scrollTo = 0;
        File file = _entries.get(position);
        if (file instanceof RootFile) {
            if (_folderNavUpCB == null) _folderNavUpCB = _defaultNavUpCB;
            /*if (_folderNavUpCB.canUpTo(file))*/ {
                _currentDir = file;
                _chooseMode = _chooseMode == CHOOSE_MODE_DELETE ? CHOOSE_MODE_NORMAL : _chooseMode;
                if (_deleteModeIndicator != null) _deleteModeIndicator.run();
                lastSelected = false;
                if (!_adapter.getIndexStack().empty()) {
                    scrollTo = _adapter.getIndexStack().pop();
                }
            }
        } else {
            switch (_chooseMode) {
                case CHOOSE_MODE_NORMAL:
                    if (file.isDirectory()) {
                        if (_folderNavToCB == null) _folderNavToCB = _defaultNavToCB;
                        if (_folderNavToCB.canNavigate(file)) {
                            _currentDir = file;
                            scrollTo = 0;
                            _adapter.getIndexStack().push(position);
                        }
                    } else if ((!_dirOnly) && _result != null) {
                        _alertDialog.dismiss();
                        _result.onChoosePath(file.getAbsolutePath(), file);
                        if (_enableMultiple) {
                            _result.onChoosePath(_currentDir.getAbsolutePath(), _currentDir);
                        }
                        return;
                    }
                    lastSelected = false;
                    break;
                case CHOOSE_MODE_SELECT_MULTIPLE:
                    if (file.isDirectory()) {
                        if (_folderNavToCB == null) _folderNavToCB = _defaultNavToCB;
                        if (_folderNavToCB.canNavigate(file)) {
                            _currentDir = file;
                            scrollTo = 0;
                            _adapter.getIndexStack().push(position);
                        }
                    } else {
                        _adapter.selectItem(position);
                        if (!_adapter.isAnySelected()) {
                            _chooseMode = CHOOSE_MODE_NORMAL;
                            _positiveBtn.setVisibility(View.INVISIBLE);
                        }
                        _result.onChoosePath(file.getAbsolutePath(), file);
                        return;
                    }
                    break;
                case CHOOSE_MODE_DELETE:
                    try {
                        FileUtil.deleteFileRecursively(file);
                    } catch (IOException e) {
                        e.printStackTrace();
                        Toast.makeText(_context, e.getMessage(), Toast.LENGTH_LONG).show();
                    }
                    _chooseMode = CHOOSE_MODE_NORMAL;
                    if (_deleteModeIndicator != null) _deleteModeIndicator.run();
                    scrollTo = -1;
                    break;
                default:
                    // ERROR! It shouldn't get here...
                    return;
            }
        }
        refreshDirs();
        if (scrollTo != -1) {
            _list.setSelection(scrollTo);
            _list.post(() -> _list.setSelection(scrollTo));
        }
    }
allows dialog title follows the current folder name

@param followDir dialog title will follow the changing of directory
@return this
android-file-chooser/src/main/java/com/obsez/android/lib/filechooser/ChooserDialog.java