本文整理汇总了Java中android.os.FileObserver.stopWatching方法的典型用法代码示例。如果您正苦于以下问题:Java FileObserver.stopWatching方法的具体用法?Java FileObserver.stopWatching怎么用?Java FileObserver.stopWatching使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.os.FileObserver
的用法示例。
在下文中一共展示了FileObserver.stopWatching方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: stopObservers
import android.os.FileObserver; //导入方法依赖的package包/类
public void stopObservers() {
synchronized (observers) {
for (final FileObserver o : observers.values()) {
o.stopWatching();
}
observers.clear();
}
}
示例2: stopWatching
import android.os.FileObserver; //导入方法依赖的package包/类
public synchronized void stopWatching() {
for(FileObserver observer : mObservers) {
observer.stopWatching();
}
mObservers.clear();
}
示例3: onDestroy
import android.os.FileObserver; //导入方法依赖的package包/类
@Override
public void onDestroy() {
super.onDestroy();
for (FileObserver fileObserver : fileObservers) fileObserver.stopWatching();
}
示例4: deactivate
import android.os.FileObserver; //导入方法依赖的package包/类
public void deactivate() {
for (FileObserver observer : myFileObservers) {
observer.stopWatching();
}
}
示例5: onDestroy
import android.os.FileObserver; //导入方法依赖的package包/类
public void onDestroy() {
for (FileObserver fileObserver : mFileObservers) {
fileObserver.stopWatching();
}
super.onDestroy();
}
示例6: stop
import android.os.FileObserver; //导入方法依赖的package包/类
public void stop() {
for (FileObserver o : observers) {
o.stopWatching();
}
observers.clear();
}
示例7: stopWatching
import android.os.FileObserver; //导入方法依赖的package包/类
public synchronized void stopWatching() {
for (FileObserver observer : mObservers) {
observer.stopWatching();
}
mObservers.clear();
}
示例8: scanDir
import android.os.FileObserver; //导入方法依赖的package包/类
void scanDir(final File dir) {
// Checks if scan should be continued
if (!inScan.get()) {
return;
}
if (dir == null || !dir.isDirectory()) {
return;
}
if (dir.getAbsolutePath().startsWith("/sys")) {
LCTX.d("Skip system dir: " + dir);
return;
}
try {
final File cd = CacheManager.getCacheDir();
if (cd != null && dir.getCanonicalPath().equals(cd.getCanonicalPath())) {
LCTX.d("Skip file cache: " + dir);
return;
}
} catch (final IOException ex) {
ex.printStackTrace();
}
if (LCTX.isDebugEnabled()) {
LCTX.d("Scan dir: " + dir);
}
// Retrieves file observer for scanning folder
final FileObserver observer = getObserver(dir);
// Stop watching
observer.stopWatching();
// Retrieves listener
final Listener l = listeners.getListener();
// Retrieves file list
final File[] files = dir.listFiles((FilenameFilter) filter);
// Sort file list
if (LengthUtils.isNotEmpty(files)) {
Arrays.sort(files, StringUtils.NFC);
}
// Call the file scan callback
l.onFileScan(dir, files);
// Retrieves files from current directory
final File[] childDirs = dir.listFiles(DirectoryFilter.ALL);
// Immediately starts folder watching
getObserver(dir).startWatching();
if (LengthUtils.isNotEmpty(childDirs)) {
// Sort child dir list
Arrays.sort(childDirs, StringUtils.NFC);
// Add children for deep ordered scanning
synchronized (this) {
for (int i = childDirs.length - 1; i >= 0; i--) {
this.paths.addFirst(childDirs[i]);
}
}
}
}