当前位置: 首页>>代码示例>>Java>>正文


Java FileObserver.MOVED_TO属性代码示例

本文整理汇总了Java中android.os.FileObserver.MOVED_TO属性的典型用法代码示例。如果您正苦于以下问题:Java FileObserver.MOVED_TO属性的具体用法?Java FileObserver.MOVED_TO怎么用?Java FileObserver.MOVED_TO使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在android.os.FileObserver的用法示例。


在下文中一共展示了FileObserver.MOVED_TO属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: startWatching

private void startWatching() {
    final String pathToWatch = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DCIM).getAbsolutePath();

    observer = new RecursiveFileObserver(pathToWatch, FileObserver.CLOSE_WRITE| FileObserver.MOVED_TO) { // set up a file observer to watch this directory on sd card
        @Override
        public void onEvent(int event, final String mediaPath) {
            if (mediaPath != null && (!mediaPath.equals(".probe"))) { // check that it's not equal to .probe because thats created every time camera is launched

                new Handler(Looper.getMainLooper()).post(new Runnable() {
                    @Override
                    public void run() {

                        if (mediaPath.endsWith(".mp4"))
                            handleNewVideo(mediaPath);
                    }
                });
            }
        }
    };
    observer.startWatching();


}
 
开发者ID:guardianproject,项目名称:proofmode,代码行数:23,代码来源:MediaListenerService.java

示例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((MyBrowserActivity) getActivity(), path));
            break;
    }
}
 
开发者ID:wade-fs,项目名称:MediaManager,代码行数:19,代码来源:AbstractBrowserFragment.java

示例3: 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);
}
 
开发者ID:mrwojtek,项目名称:sens-rec,代码行数:25,代码来源:Records.java

示例4: 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

示例5: LockPasswordUtils

public LockPasswordUtils(Context context) {
	mSharedPreferences = context.getSharedPreferences(
			LOCK_PASSWORD_SALT_FILE, Context.MODE_PRIVATE);
	mEditor = mSharedPreferences.edit();
	if (sLockPasswordFilename == null) {
		String dataSystemDirectory = context.getCacheDir()
				.getAbsolutePath();
		sLockPasswordFilename = new File(dataSystemDirectory,
				LOCK_PASSWORD_FILE);
		sHaveNonZeroPasswordFile.set(sLockPasswordFilename.length() > 0);
		int fileObserverMask = FileObserver.CLOSE_WRITE
				| FileObserver.DELETE | FileObserver.MOVED_TO
				| FileObserver.CREATE;
		sPasswordObserver = new PasswordFileObserver(dataSystemDirectory,
				fileObserverMask);
		sPasswordObserver.startWatching();
	}
}
 
开发者ID:971758118,项目名称:git_wowodai,代码行数:18,代码来源:LockPasswordUtils.java

示例6: 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

示例7: 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

示例8: 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);
    }
    
}
 
开发者ID:skymania,项目名称:Cirrus,代码行数:40,代码来源:FolderObserver.java

示例9: 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);
    }
}
 
开发者ID:Git-tl,项目名称:appcan-plugin-pdfreader-android,代码行数:30,代码来源:FileSystemScanner.java

示例10: LockPatternUtils

public LockPatternUtils(Context context) {
	if (sLockPatternFilename == null) {
		String dataSystemDirectory = context.getFilesDir()
				.getAbsolutePath();
		sLockPatternFilename = new File(dataSystemDirectory
				, LOCK_PATTERN_FILE);
		sHaveNonZeroPatternFile.set(sLockPatternFilename.length() > 0);
		int fileObserverMask = FileObserver.CLOSE_WRITE
				| FileObserver.DELETE | FileObserver.MOVED_TO
				| FileObserver.CREATE;
		sPasswordObserver = new LockPatternFileObserver(
				dataSystemDirectory, fileObserverMask);
		sPasswordObserver.startWatching();
	}
}
 
开发者ID:linmp4,项目名称:quickmark,代码行数:15,代码来源:LockPatternUtils.java

示例11: LockPatternUtils

public LockPatternUtils(Context context) {
	if (sLockPatternFilename == null) {
		String dataSystemDirectory = context.getFilesDir()
				.getAbsolutePath();
		sLockPatternFilename = new File(dataSystemDirectory,
				LOCK_PATTERN_FILE);
		sHaveNonZeroPatternFile.set(sLockPatternFilename.length() > 0);
		int fileObserverMask = FileObserver.CLOSE_WRITE
				| FileObserver.DELETE | FileObserver.MOVED_TO
				| FileObserver.CREATE;
		sPasswordObserver = new LockPatternFileObserver(
				dataSystemDirectory, fileObserverMask);
		sPasswordObserver.startWatching();
	}
}
 
开发者ID:971758118,项目名称:git_wowodai,代码行数:15,代码来源:LockPatternUtils.java

示例12: FileInitializedObserver

public FileInitializedObserver(File directory, String ... filenames) {
    // MOVED_TO is required for the Tor case where the Tor process creates <target>.tmp,
    // writes to that file, then renames to <target>. There's no CLOSE_WRITE event for <target>.
    super(
        directory.getAbsolutePath(),
        FileObserver.MOVED_TO | FileObserver.CLOSE_WRITE);
    mTargetFilenames = new ArrayList<String>(Arrays.asList(filenames));
    mLatch = new CountDownLatch(mTargetFilenames.size());
}
 
开发者ID:Psiphon-Labs,项目名称:ploggy,代码行数:9,代码来源:Utils.java

示例13: MinidumpDirectoryObserver

public MinidumpDirectoryObserver() {
    // The file observer detects MOVED_TO for child processes.
    super(new File(PathUtils.getCacheDirectory(),
            CrashFileManager.CRASH_DUMP_DIR).toString(), FileObserver.MOVED_TO);
}
 
开发者ID:rkshuai,项目名称:chromium-for-android-56-debug-video,代码行数:5,代码来源:MinidumpDirectoryObserver.java

示例14: 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;
    }
}
 
开发者ID:mrspaceman,项目名称:ebookmgr,代码行数:53,代码来源:RecursiveFileObserver.java

示例15: Observer

public Observer(String path)
{
	super(path, FileObserver.CREATE | FileObserver.DELETE | FileObserver.MOVED_TO | FileObserver.MOVED_FROM);
	startWatching();
}
 
开发者ID:owoc,项目名称:teardrop,代码行数:5,代码来源:FileSystemAdapter.java


注:本文中的android.os.FileObserver.MOVED_TO属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。