Example usage for android.os FileObserver DELETE_SELF

List of usage examples for android.os FileObserver DELETE_SELF

Introduction

In this page you can find the example usage for android.os FileObserver DELETE_SELF.

Prototype

int DELETE_SELF

To view the source code for android.os FileObserver DELETE_SELF.

Click Source Link

Document

Event type: The monitored file or directory was deleted; monitoring effectively stops

Usage

From source file:org.arakhne.afc.ui.android.filechooser.AsyncFileLoader.java

/**
 * {@inheritDoc}/*from   w  w w . java2 s .  c om*/
 */
@Override
protected void onStartLoading() {
    // A list is already available. Publish it.
    if (this.discoveredFiles != null)
        deliverResult(this.discoveredFiles);

    if (this.fileObserver == null) {
        this.fileObserver = new FileObserver(this.path.getAbsolutePath(),
                FileObserver.CREATE | FileObserver.DELETE | FileObserver.DELETE_SELF | FileObserver.MOVED_FROM
                        | FileObserver.MOVED_TO | FileObserver.MODIFY | FileObserver.MOVE_SELF) {
            @Override
            public void onEvent(int event, String path) {
                onContentChanged();
            }
        };
    }
    this.fileObserver.startWatching();

    if (takeContentChanged() || this.discoveredFiles == null)
        forceLoad();
}

From source file:org.ado.minesync.minecraft.MinecraftWorldObserver.java

private String getFileAction(int event) {
    String fileAction = null;//  w ww.j  av  a 2 s.co m
    switch (event) {
    case FileObserver.ACCESS:
        fileAction = "ACCESS";
        break;
    case FileObserver.ALL_EVENTS:
        fileAction = "ALL_EVENTS";
        break;
    case FileObserver.ATTRIB:
        fileAction = "ATTRIB";
        break;
    case FileObserver.CLOSE_NOWRITE:
        fileAction = "CLOSE_NOWRITE";
        break;
    case FileObserver.CLOSE_WRITE:
        fileAction = "CLOSE_WRITE";
        break;
    case FileObserver.CREATE:
        fileAction = "CREATE";
        break;
    case FileObserver.DELETE:
        fileAction = "DELETE";
        break;
    case FileObserver.DELETE_SELF:
        fileAction = "DELETE_SELF";
        break;
    case FileObserver.MODIFY:
        fileAction = "MODIFY";
        break;
    case FileObserver.MOVE_SELF:
        fileAction = "MOVE_SELF";
        break;
    case FileObserver.MOVED_FROM:
        fileAction = "MOVED_FROM";
        break;
    case FileObserver.MOVED_TO:
        fileAction = "MOVED_TO";
        break;
    case FileObserver.OPEN:
        fileAction = "OPEN";
        break;
    }
    return fileAction;
}

From source file:com.lovejoy777sarootool.rootool.fragments.BrowserFragment.java

@Override
public void onEvent(int event, String path) {
    // this will automatically update the directory when an action like this
    // will be performed
    switch (event & FileObserver.ALL_EVENTS) {
    case FileObserver.CREATE:
    case FileObserver.CLOSE_WRITE:
    case FileObserver.MOVE_SELF:
    case FileObserver.MOVED_TO:
    case FileObserver.MOVED_FROM:
    case FileObserver.ATTRIB:
    case FileObserver.DELETE:
    case FileObserver.DELETE_SELF:
        sHandler.removeCallbacks(mLastRunnable);
        sHandler.post(mLastRunnable = new NavigateRunnable(path));
        break;// w  w w  .j a v a  2  s. c  o  m
    }
}

From source file:com.docd.purefm.adapters.BrowserBaseAdapter.java

/**
 * {@link android.os.FileObserver} event that should be ran only on UI thread
 *
 * @param event The type of event which happened
 * @param file The modified file, relative to the main monitored file or directory,
 *             of the file or directory which triggered the event
 *//*from w w  w  . j av a2  s .com*/
void onEventUIThread(final int event, @NonNull final GenericFile file) {
    switch (event & FileObserver.ALL_EVENTS) {
    case FileObserver.CREATE:
        //Do nothing. The event is handled in Browser
        break;

    case FileObserver.DELETE:
    case FileObserver.DELETE_SELF:
    case FileObserver.MOVED_FROM:
        onFileDeleted(file);
        break;

    default:
        onFileModified(file);
        break;
    }
}

From source file:com.dnielfe.manager.Browser.java

@Override
public void onEvent(int event, String path) {
    // this will automatically update the directory when an action like this
    // will be performed
    switch (event & FileObserver.ALL_EVENTS) {
    case FileObserver.CREATE:
    case FileObserver.CLOSE_WRITE:
    case FileObserver.MOVE_SELF:
    case FileObserver.MOVED_TO:
    case FileObserver.MOVED_FROM:
    case FileObserver.ATTRIB:
    case FileObserver.DELETE:
    case FileObserver.DELETE_SELF:
        sHandler.removeCallbacks(mLastRunnable);
        sHandler.post(mLastRunnable = new NavigateRunnable(mCurrentPath));
        break;//  w ww.  ja va 2s  .c  om
    }
}