本文整理汇总了Java中android.os.FileObserver.ATTRIB属性的典型用法代码示例。如果您正苦于以下问题:Java FileObserver.ATTRIB属性的具体用法?Java FileObserver.ATTRIB怎么用?Java FileObserver.ATTRIB使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类android.os.FileObserver
的用法示例。
在下文中一共展示了FileObserver.ATTRIB属性的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onEvent
@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((MyBrowserActivity) getActivity(), path));
break;
}
}
示例2: onEvent
@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((AbstractBrowserActivity) getActivity(), path));
break;
}
}
示例3: registerFileObserver
private void registerFileObserver() {
mFileObserver = new FileObserver(context.getDataDir() + "/shared_prefs",
FileObserver.ATTRIB | FileObserver.CLOSE_WRITE) {
@Override
public void onEvent(int event, String path) {
for (FileObserverListener l : mFileObserverListeners) {
if ((event & FileObserver.ATTRIB) != 0)
l.onFileAttributesChanged(path);
if ((event & FileObserver.CLOSE_WRITE) != 0)
l.onFileUpdated(path);
}
}
};
mFileObserver.startWatching();
}
示例4: onEvent
/**
* Receives and processes events about updates of the monitor folder and its children files.
*
* @param event Kind of event occurred.
* @param path Relative path of the file referred by the event.
*/
@Override
public void onEvent(int event, String path) {
Log_OC.d(TAG, "Got event " + event + " on FOLDER " + mPath + " about "
+ ((path != null) ? path : ""));
boolean shouldSynchronize = false;
synchronized(mObservedChildren) {
if (path != null && path.length() > 0 && mObservedChildren.containsKey(path)) {
if ( ((event & FileObserver.MODIFY) != 0) ||
((event & FileObserver.ATTRIB) != 0) ||
((event & FileObserver.MOVED_TO) != 0) ) {
if (!mObservedChildren.get(path)) {
mObservedChildren.put(path, Boolean.valueOf(true));
}
}
if ((event & FileObserver.CLOSE_WRITE) != 0 && mObservedChildren.get(path)) {
mObservedChildren.put(path, Boolean.valueOf(false));
shouldSynchronize = true;
}
}
}
if (shouldSynchronize) {
startSyncOperation(path);
}
if ((event & IN_IGNORE) != 0 &&
(path == null || path.length() == 0)) {
Log_OC.d(TAG, "Stopping the observance on " + mPath);
}
}
示例5: toString
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);
}
}
示例6: onEvent
@Override
public void onEvent(final int event, final String path) {
Intent localIntent = new Intent(INTENT_EBOOK_MODIFIED);
localIntent.putExtra(INTENT_EBOOK_MODIFIED_PATH, path);
switch (event) {
case FileObserver.ACCESS:
BookLibApplication.d(LOG_TAG + "onEvent() ACCESS: " + path);
break;
case FileObserver.ATTRIB:
BookLibApplication.d(LOG_TAG + "onEvent() ATTRIB: " + path);
break;
case FileObserver.CLOSE_NOWRITE:
BookLibApplication.d(LOG_TAG + "onEvent() CLOSE_NOWRITE: " + path);
break;
case FileObserver.CLOSE_WRITE:
BookLibApplication.d(LOG_TAG + "onEvent() CLOSE_WRITE: " + path);
break;
case FileObserver.CREATE:
BookLibApplication.d(LOG_TAG + "onEvent() CREATE: " + path);
BookLibApplication.getInstance().sendBroadcast(localIntent);
break;
case FileObserver.DELETE:
BookLibApplication.d(LOG_TAG + "onEvent() DELETE: " + path);
BookLibApplication.getInstance().sendBroadcast(localIntent);
break;
case FileObserver.DELETE_SELF:
BookLibApplication.d(LOG_TAG + "onEvent() DELETE_SELF: " + path);
BookLibApplication.getInstance().sendBroadcast(localIntent);
break;
case FileObserver.MODIFY:
BookLibApplication.d(LOG_TAG + "onEvent() MODIFY: " + path);
BookLibApplication.getInstance().sendBroadcast(localIntent);
break;
case FileObserver.MOVE_SELF:
BookLibApplication.d(LOG_TAG + "onEvent() MOVE_SELF: " + path);
BookLibApplication.getInstance().sendBroadcast(localIntent);
break;
case FileObserver.MOVED_FROM:
BookLibApplication.d(LOG_TAG + "onEvent() MOVED_FROM: " + path);
BookLibApplication.getInstance().sendBroadcast(localIntent);
break;
case FileObserver.MOVED_TO:
BookLibApplication.d(LOG_TAG + "onEvent() MOVED_TO: " + path);
BookLibApplication.getInstance().sendBroadcast(localIntent);
break;
case FileObserver.OPEN:
BookLibApplication.d(LOG_TAG + "onEvent() OPEN: " + path);
break;
default:
//BookLibApplication.d(LOG_TAG + "onEvent() DEFAULT(" + event + "): " + path);
break;
}
}
示例7: onEvent
@Override
public void onEvent(int event, String path) {
switch (event) {
case FileObserver.ACCESS:
Log.i(TAG, "ACCESS");
break;
case FileObserver.ATTRIB:
Log.i(TAG, "ATTRIB");
break;
case FileObserver.CLOSE_NOWRITE:
Log.i(TAG, "CLOSE_NOWRITE");
break;
case FileObserver.CLOSE_WRITE:
Log.i(TAG, "CLOSE_WRITE");
break;
case FileObserver.CREATE:
Log.i(TAG, "CREATE");
break;
case FileObserver.DELETE:
Log.i(TAG, "DELETE");
break;
case FileObserver.DELETE_SELF:
Log.i(TAG, "DELETE_SELF");
break;
case FileObserver.MODIFY:
Log.i(TAG, "MODIFY");
break;
case FileObserver.MOVE_SELF:
Log.i(TAG, "MOVE_SELF");
break;
case FileObserver.MOVED_FROM:
Log.i(TAG, "MOVED_FROM");
break;
case FileObserver.MOVED_TO:
Log.i(TAG, "MOVED_TO");
break;
case FileObserver.OPEN:
Log.i(TAG, "OPEN");
break;
case FileObserver.ALL_EVENTS:
Log.i(TAG, "ALL_EVENTS");
break;
default:
Log.i(TAG, "default, event=" + event + ", path=" + path);
break;
}
}
示例8: onEvent
@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);
}
}