本文整理匯總了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]);
}
}
}
}