Example usage for android.os FileObserver MOVE_SELF

List of usage examples for android.os FileObserver MOVE_SELF

Introduction

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

Prototype

int MOVE_SELF

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

Click Source Link

Document

Event type: The monitored file or directory was moved; monitoring continues

Usage

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

/**
 * {@inheritDoc}//  w w  w.  j  av a  2s  .c o m
 */
@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;/*from   ww w.  j  av  a2  s  . com*/
    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  ww. j  a v a2s  .c  o  m*/
    }
}

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 v  a  2s .c o m*/
    }
}