Search in sources :

Example 1 with FilterMode

use of group.pals.android.lib.ui.filechooser.services.IFileProvider.FilterMode in project FBReaderJ by geometer.

the class FileChooserActivity method setupService.

// bindService()
/**
     * Setup the file provider:<br>
     * - filter mode;<br>
     * - display hidden files;<br>
     * - max file count;<br>
     * - ...
     */
private void setupService() {
    /*
         * set root path, if not specified, try using
         * IFileProvider#defaultPath()
         */
    if (getIntent().getParcelableExtra(_Rootpath) != null)
        mRoot = (IFile) getIntent().getSerializableExtra(_Rootpath);
    if (mRoot == null || !mRoot.isDirectory())
        mRoot = mFileProvider.defaultPath();
    IFileProvider.FilterMode filterMode = (FilterMode) getIntent().getSerializableExtra(_FilterMode);
    if (filterMode == null) {
        filterMode = IFileProvider.FilterMode.DirectoriesOnly;
    }
    IFileProvider.SortType sortType = DisplayPrefs.getSortType(this);
    boolean sortAscending = DisplayPrefs.isSortAscending(this);
    mFileProvider.setDisplayHiddenFiles(getIntent().getBooleanExtra(_DisplayHiddenFiles, false));
    mFileProvider.setFilterMode(mIsSaveDialog ? IFileProvider.FilterMode.FilesOnly : filterMode);
    mFileProvider.setMaxFileCount(getIntent().getIntExtra(_MaxFileCount, 1024));
    mFileProvider.setRegexFilenameFilter(getIntent().getStringExtra(_RegexFilenameFilter));
    mFileProvider.setSortOrder(sortAscending ? IFileProvider.SortOrder.Ascending : IFileProvider.SortOrder.Descending);
    mFileProvider.setSortType(sortType);
}
Also used : IFileProvider(group.pals.android.lib.ui.filechooser.services.IFileProvider) IFile(group.pals.android.lib.ui.filechooser.io.IFile) SortType(group.pals.android.lib.ui.filechooser.services.IFileProvider.SortType) FilterMode(group.pals.android.lib.ui.filechooser.services.IFileProvider.FilterMode) FilterMode(group.pals.android.lib.ui.filechooser.services.IFileProvider.FilterMode)

Aggregations

IFile (group.pals.android.lib.ui.filechooser.io.IFile)1 IFileProvider (group.pals.android.lib.ui.filechooser.services.IFileProvider)1 FilterMode (group.pals.android.lib.ui.filechooser.services.IFileProvider.FilterMode)1 SortType (group.pals.android.lib.ui.filechooser.services.IFileProvider.SortType)1