當前位置: 首頁>>代碼示例>>Java>>正文


Java FileObserver.ALL_EVENTS屬性代碼示例

本文整理匯總了Java中android.os.FileObserver.ALL_EVENTS屬性的典型用法代碼示例。如果您正苦於以下問題:Java FileObserver.ALL_EVENTS屬性的具體用法?Java FileObserver.ALL_EVENTS怎麽用?Java FileObserver.ALL_EVENTS使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在android.os.FileObserver的用法示例。


在下文中一共展示了FileObserver.ALL_EVENTS屬性的12個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的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;
    }
}
 
開發者ID:wade-fs,項目名稱:MediaManager,代碼行數:19,代碼來源:AbstractBrowserFragment.java

示例2: 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;
	}
}
 
開發者ID:ciubex,項目名稱:dscautorename,代碼行數:23,代碼來源:FolderObserver.java

示例3: onEvent

@Override
public void onEvent(int event, String pathString) {
    switch (event & FileObserver.ALL_EVENTS) {
        case FileObserver.MOVE_SELF:
        case FileObserver.DELETE_SELF:
            sHandler.removeCallbacks(mLastRunnable);
            final GenericFile parent = resolveExistingParent(mCurrentPath);
            sHandler.post(mLastRunnable = new NavigateRunnable(
                    Browser.this, parent, true));
            break;

        case FileObserver.CREATE:
        case FileObserver.MOVED_TO:
            sHandler.removeCallbacks(mLastRunnable);
            sHandler.post(mLastRunnable = new InvalidateRunnable(this));
            break;
    }
}
 
開發者ID:Doctoror,項目名稱:Pure-File-Manager,代碼行數:18,代碼來源:Browser.java

示例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;
    }
}
 
開發者ID:Doctoror,項目名稱:Pure-File-Manager,代碼行數:25,代碼來源:BrowserBaseAdapter.java

示例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;
    }
}
 
開發者ID:DF1E,項目名稱:SimpleExplorer,代碼行數:19,代碼來源:AbstractBrowserFragment.java

示例6: onEvent

@Override
public void onEvent(int event, String path) {
    switch(event) {
        case FileObserver.ALL_EVENTS:
            Log.d("all", "path:"+ path);
            break;
        case FileObserver.CREATE:
            Log.d("Create", "path:"+ path);
            break;
    }
}
 
開發者ID:hubcarl,項目名稱:mobile-manager-tool,代碼行數:11,代碼來源:SDCardListener.java

示例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;
	}
}
 
開發者ID:concentricsky,項目名稱:android-viewer-for-khan-academy,代碼行數:34,代碼來源:OfflineVideoManager.java

示例8: MultiFileObserver

private MultiFileObserver(String path, int mask) {
    super(path, FileObserver.ALL_EVENTS);
    this.path = path;
    this.listeners = new HashSet<>();
}
 
開發者ID:wade-fs,項目名稱:MediaManager,代碼行數:5,代碼來源:MultiFileObserver.java

示例9: 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;
    }

}
 
開發者ID:cheyiliu,項目名稱:test4android,代碼行數:48,代碼來源:MainActivity.java

示例10: onEvent

/**
 * Handles incoming events for changed files.
 */
@Override
public void onEvent(int event, String path) {
    // Ignore some weird events that we may receive.
    event &= FileObserver.ALL_EVENTS;
    if (event == 0)
        return;

    File fullPath = (path != null)
            ? new File(mPath, path)
            : new File(mPath);

    Log.v(TAG, "Received inotify event " + Integer.toHexString(event) + " at " +
            fullPath.getAbsolutePath());
    switch (event) {
        case MOVED_FROM:
            // fall through
        case DELETE_SELF:
            // fall through
        case DELETE:
            for (FolderObserver c : mChilds) {
                if (c.mPath.equals(path)) {
                    mChilds.remove(c);
                    break;
                }
            }
            mHandler.postDelayed(() -> mListener.onFolderFileChange(mFolder.id, fullPath.getPath()),
                    SCAN_DELAY_MILLIS);
            break;
        case MOVED_TO:
            // fall through
        case CREATE:
            if (fullPath.isDirectory()) {
                try {
                    mChilds.add(new FolderObserver(mListener, mFolder, path, mHandler));
                } catch (FolderNotExistingException e) {
                    Log.w(TAG, "Failed to add listener for nonexisting folder", e);
                }
            }
            // fall through
        default:
            mHandler.postDelayed(() -> mListener.onFolderFileChange(mFolder.id, fullPath.getPath()),
                    SCAN_DELAY_MILLIS);
    }
}
 
開發者ID:syncthing,項目名稱:syncthing-android,代碼行數:47,代碼來源:FolderObserver.java

示例11: DCIMFileMonitor

public DCIMFileMonitor(String dcim_alias) {
    super(dcim_alias, FileObserver.ALL_EVENTS);
    this.dcim_alias = dcim_alias;
}
 
開發者ID:guardianproject,項目名稱:CameraV,代碼行數:4,代碼來源:DeviceSucker.java

示例12: MyFileObserver

public MyFileObserver(String path) {

        super(path, FileObserver.ALL_EVENTS);

        absolutePath = path;
        Log.i("iNotify", "MyFileObserver est initialisé ");

    }
 
開發者ID:uhuru-mobile,項目名稱:mobile-dashboard,代碼行數:8,代碼來源:MyFileObserver.java


注:本文中的android.os.FileObserver.ALL_EVENTS屬性示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。