Hidden files will not be shown by default, can diplay them if required
This commit is contained in:
parent
eb847de1b9
commit
81b6085731
|
|
@ -77,6 +77,7 @@ public abstract class AbstractFilePickerFragment<T> extends Fragment
|
|||
protected T mCurrentPath = null;
|
||||
protected boolean allowCreateDir = false;
|
||||
protected boolean allowMultiple = false;
|
||||
protected boolean showHiddenItems = false;
|
||||
protected OnFilePickedListener mListener;
|
||||
protected FileItemAdapter<T> mAdapter = null;
|
||||
protected TextView mCurrentDirView;
|
||||
|
|
@ -404,6 +405,14 @@ public abstract class AbstractFilePickerFragment<T> extends Fragment
|
|||
return true;
|
||||
}
|
||||
|
||||
public void showHiddenItems(boolean showHiddenItems){
|
||||
this.showHiddenItems = showHiddenItems;
|
||||
}
|
||||
|
||||
public boolean areHiddenItemsShown(){
|
||||
return showHiddenItems;
|
||||
}
|
||||
|
||||
/**
|
||||
* Instantiate and return a new Loader for the given ID.
|
||||
*
|
||||
|
|
|
|||
|
|
@ -297,14 +297,18 @@ public class FilePickerFragment extends AbstractFilePickerFragment<File> {
|
|||
/**
|
||||
* Used by the list to determine whether a file should be displayed or not.
|
||||
* Default behavior is to always display folders. If files can be selected,
|
||||
* then files are also displayed. Override this method to enable other
|
||||
* then files are also displayed. Set the showHiddenFiles property to show
|
||||
* hidden file. Default behaviour is to hide hidden files. Override this method to enable other
|
||||
* filtering behaviour, like only displaying files with specific extensions (.zip, .txt, etc).
|
||||
*
|
||||
* @param file to maybe add. Can be either a directory or file.
|
||||
* @return True if item should be added to the list, false otherwise
|
||||
*/
|
||||
protected boolean isItemVisible(final File file) {
|
||||
return isDir(file) || (mode == MODE_FILE || mode == MODE_FILE_AND_DIR);
|
||||
if(!showHiddenFiles && file.isHidden()){
|
||||
return false;
|
||||
}
|
||||
return (isDir(file) || (mode == MODE_FILE || mode == MODE_FILE_AND_DIR);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Reference in New Issue