本文整理匯總了Java中android.os.FileObserver.MOVED_FROM屬性的典型用法代碼示例。如果您正苦於以下問題:Java FileObserver.MOVED_FROM屬性的具體用法?Java FileObserver.MOVED_FROM怎麽用?Java FileObserver.MOVED_FROM使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在類android.os.FileObserver
的用法示例。
在下文中一共展示了FileObserver.MOVED_FROM屬性的11個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的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 synchronized void onEvent(int event, String path) {
if (path.equals(tabuPath)) {
return;
}
long delay = 0;
switch (event) {
case FileObserver.MODIFY:
delay = Math.max(0,
lastUpdateTime + MODIFICATION_INTERVAL - SystemClock.elapsedRealtime());
modified.add(path);
break;
case FileObserver.CREATE:
case FileObserver.MOVED_TO:
added.add(path);
break;
case FileObserver.DELETE:
case FileObserver.MOVED_FROM:
deleted.add(path);
break;
}
schedule(delay);
}
示例3: onEvent
/**
* This method is invoked when a registered event occur.
*
* @param event The type of event which happened
* @param path The path, relative to the main monitored file or directory,
* of the file or directory which triggered the event
*/
@Override
public void onEvent(int event, String path) {
switch (event & FileObserver.ALL_EVENTS) {
case FileObserver.CREATE:
checkAutoRenameTask(path);
break;
case FileObserver.DELETE:
case FileObserver.DELETE_SELF:
case FileObserver.MODIFY:
case FileObserver.MOVED_FROM:
case FileObserver.MOVED_TO:
case FileObserver.MOVE_SELF:
checkForFolder(path);
break;
}
}
示例4: onEventUIThread
/**
* {@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
*/
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;
}
}
示例5: 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;
}
}
示例6: 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);
}
}
示例7: onEvent
@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;
}
}
示例8: 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;
}
}
示例9: Observer
public Observer(String path)
{
super(path, FileObserver.CREATE | FileObserver.DELETE | FileObserver.MOVED_TO | FileObserver.MOVED_FROM);
startWatching();
}
示例10: RecordsObserver
public RecordsObserver(String path) {
super(path, FileObserver.MODIFY | FileObserver.CREATE | FileObserver.MOVED_TO |
FileObserver.DELETE | FileObserver.MOVED_FROM);
lastUpdateTime = SystemClock.elapsedRealtime() - MODIFICATION_INTERVAL;
}
示例11: 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;
}
}