Search in sources :

Example 1 with CustomFileObserver

use of com.amaze.filemanager.filesystem.CustomFileObserver in project AmazeFileManager by TeamAmaze.

the class MainFragment method startFileObserver.

private void startFileObserver() {
    switch(openMode) {
        case ROOT:
        case FILE:
            if (customFileObserver != null && !customFileObserver.wasStopped() && customFileObserver.getPath().equals(getCurrentPath())) {
                return;
            }
            File file = new File(CURRENT_PATH);
            if (file.isDirectory() && file.canRead()) {
                if (customFileObserver != null) {
                    // already a watcher instantiated, first it should be stopped
                    customFileObserver.stopWatching();
                }
                customFileObserver = new CustomFileObserver(CURRENT_PATH, new FileHandler(this, listView, getBoolean(PREFERENCE_SHOW_THUMB)));
                customFileObserver.startWatching();
            }
            break;
        default:
            break;
    }
}
Also used : CustomFileObserver(com.amaze.filemanager.filesystem.CustomFileObserver) File(java.io.File) SmbFile(jcifs.smb.SmbFile) HybridFile(com.amaze.filemanager.filesystem.HybridFile) FileHandler(com.amaze.filemanager.asynchronous.handlers.FileHandler)

Aggregations

FileHandler (com.amaze.filemanager.asynchronous.handlers.FileHandler)1 CustomFileObserver (com.amaze.filemanager.filesystem.CustomFileObserver)1 HybridFile (com.amaze.filemanager.filesystem.HybridFile)1 File (java.io.File)1 SmbFile (jcifs.smb.SmbFile)1