Java Code Examples for android.os.FileObserver#OPEN
The following examples show how to use
android.os.FileObserver#OPEN .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: FileSystemScanner.java From document-viewer with GNU General Public License v3.0 | 5 votes |
public static String toString(final int event) { switch (event) { case FileObserver.ACCESS: return "ACCESS"; case FileObserver.MODIFY: return "MODIFY"; case FileObserver.ATTRIB: return "ATTRIB"; case FileObserver.CLOSE_WRITE: return "CLOSE_WRITE"; case FileObserver.CLOSE_NOWRITE: return "CLOSE_NOWRITE"; case FileObserver.OPEN: return "OPEN"; case FileObserver.MOVED_FROM: return "MOVED_FROM"; case FileObserver.MOVED_TO: return "MOVED_TO"; case FileObserver.CREATE: return "CREATE"; case FileObserver.DELETE: return "DELETE"; case FileObserver.DELETE_SELF: return "DELETE_SELF"; case FileObserver.MOVE_SELF: return "MOVE_SELF"; default: return "0x" + Integer.toHexString(event); } }
Example 2
Source File: OfflineVideoManager.java From android-viewer-for-khan-academy with GNU General Public License v3.0 | 5 votes |
@Override public void onEvent(int event, final String path) { if (path == null) { return; } switch (event & FileObserver.ALL_EVENTS) { case FileObserver.CLOSE_WRITE: // Download complete, or paused when wifi is disconnected. Possibly reported more than once in a row. // Useful for noticing when a download has been paused. For completions, register a receiver for // DownloadManager.ACTION_DOWNLOAD_COMPLETE. break; case FileObserver.OPEN: // Called for both read and write modes. // Useful for noticing a download has been started or resumed. break; case FileObserver.DELETE: case FileObserver.MOVED_FROM: // This video is lost never to return. Remove it. handler.post(new Runnable() { @Override public void run() { DatabaseHelper helper = dataService.getHelper(); helper.removeDownloadFromDownloadManager(helper.getVideoForFilename(path)); } }); break; case FileObserver.MODIFY: // Called very frequently while a download is ongoing (~1 per ms). // This could be used to trigger a progress update, but that should probably be done less often than this. shouldPoll = true; break; } }
Example 3
Source File: DeviceSucker.java From CameraV with GNU General Public License v3.0 | 4 votes |
@Override public void onEvent(int event, String path) { String parse = null; switch(event) { case FileObserver.CREATE: parse = "file created"; break; case FileObserver.MODIFY: parse = "file modified"; break; case FileObserver.CLOSE_WRITE: parse = "file closed/writen"; break; case FileObserver.ACCESS: //parse = "file accessed"; break; case FileObserver.DELETE: parse = "file deleted"; break; case FileObserver.OPEN: //parse = "file opened"; break; case FileObserver.CLOSE_NOWRITE: //parse = "file closed/not writen"; break; case FileObserver.ATTRIB: parse = "file attribs changed"; break; } if(parse != null) { Logger.d(LOG, String.format("EVENT %d ON %s: %s", event, path, parse)); //lsof_r1(path); ILogPack logPack = new ILogPack(); logPack.put(Keys.FILE_EFFECTED, path); logPack.put(Keys.ACCESS_TYPE, parse); logPack.put(Keys.ACCESS_CODE, event); DeviceSucker.this.sendToBuffer(logPack); } }