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


Java FileObserver.DELETE屬性代碼示例

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


在下文中一共展示了FileObserver.DELETE屬性的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: onEvent

@Override public void onEvent(int event, String file) {
  if (event == FileObserver.DELETE) {
    // user deletes a recording file out of the app

    String filePath = android.os.Environment.getExternalStorageDirectory().toString()
        + "/SoundRecorder"
        + file
        + "]";

    Log.d(LOG_TAG, "File deleted ["
        + android.os.Environment.getExternalStorageDirectory().toString()
        + "/SoundRecorder"
        + file
        + "]");

    // remove file from database and recyclerview
    mPlayListAdapter.removeOutOfApp(filePath);
  }
}
 
開發者ID:Arjun-sna,項目名稱:Android-AudioRecorder-App,代碼行數:19,代碼來源:PlayListFragment.java

示例2: PFileObserver

PFileObserver(AppRunner appRunner, String path) {
    fileObserver = new FileObserver(appRunner.getProject().getFullPathForFile(path), FileObserver.CREATE | FileObserver.MODIFY | FileObserver.DELETE) {

        @Override
        public void onEvent(int event, String file) {
            ReturnObject ret = new ReturnObject();
            if ((FileObserver.CREATE & event) != 0) {
                ret.put("action", "created");
            } else if ((FileObserver.DELETE & event) != 0) {
                ret.put("action", "deleted");
            } else if ((FileObserver.MODIFY & event) != 0) {
                ret.put("action", "modified");
            }
            ret.put("file", file);
            if (callback != null) callback.event(ret);
        }

    };
    fileObserver.startWatching();
    getAppRunner().whatIsRunning.add(this);
}
 
開發者ID:victordiaz,項目名稱:phonk,代碼行數:21,代碼來源:PFileIO.java

示例3: onEvent

@Override
public void onEvent(int event, String file) {
    if(event == FileObserver.DELETE){
        // user deletes a recording file out of the app

        String filePath = android.os.Environment.getExternalStorageDirectory().toString()
                + "/Facebook Videos" + file + "]";

        Log.d(LOG_TAG, "File deleted ["
                + android.os.Environment.getExternalStorageDirectory().toString()
                + "/Facebook Videos" + file + "]");

        // remove file from database and recyclerview
        mFileViewerAdapter.removeOutOfApp(filePath);
    }
}
 
開發者ID:adarshgumashta,項目名稱:Facebook-Video-Downloader,代碼行數:16,代碼來源:FileViewerFragment.java

示例4: onEvent

@Override
public void onEvent(int event, String file) {
    if(event == FileObserver.DELETE){
        // user deletes a recording file out of the app

        String filePath = android.os.Environment.getExternalStorageDirectory().toString()
                + "/SoundRecorder" + file + "]";

        Log.d(LOG_TAG, "File deleted ["
                + android.os.Environment.getExternalStorageDirectory().toString()
                + "/SoundRecorder" + file + "]");

        // remove file from database and recyclerview
        mFileViewerAdapter.removeOutOfApp(filePath);
    }
}
 
開發者ID:tortuvshin,項目名稱:health,代碼行數:16,代碼來源:FileViewerFragment.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((MyBrowserActivity) getActivity(), path));
            break;
    }
}
 
開發者ID:wade-fs,項目名稱:MediaManager,代碼行數:19,代碼來源:AbstractBrowserFragment.java

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

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

示例8: onEvent

@Override
public void onEvent(int event, String path) {
	if (DebugLog.DEBUG) Log.d(TAG, "FileAccessService.AccessObserver.onEvent - access triggered");
	switch (event) {
		case FileObserver.ACCESS:
			values[READS] = Long.valueOf(values[READS].longValue() + 1);
			break;
		case FileObserver.MODIFY:
			values[WRITES] = Long.valueOf(values[WRITES].longValue() + 1);
			break;
		case FileObserver.CREATE:
			values[CREATES] = Long.valueOf(values[CREATES].longValue() + 1);
			break;
		case FileObserver.DELETE:
			values[DELETES] = Long.valueOf(values[DELETES].longValue() + 1);
			break;
		default:
			return;
	}
	updateMetric = new UpdateMetric();	// is this needed (nothing static)?
	metricHandler.post(updateMetric);
}
 
開發者ID:Sean1988,項目名稱:CIMON_Android,代碼行數:22,代碼來源:FileAccessService.java

示例9: performUpdates

@Override
protected void performUpdates() {
	long nextUpdate = updateValueNodes();
	if (nextUpdate < 0) {
		if (accessObserver != null) {
			accessObserver.stopWatching();
			accessObserver = null;
		}
	}
	else {
		if (accessObserver == null) {
			accessObserver = new AccessObserver(Environment.getExternalStorageDirectory().getPath(), 
					FileObserver.ACCESS | FileObserver.MODIFY | FileObserver.CREATE | FileObserver.DELETE);
			accessObserver.startWatching();
		}
	}
	updateObservable();
}
 
開發者ID:Sean1988,項目名稱:CIMON_Android,代碼行數:18,代碼來源:FileAccessService.java

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

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

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

示例13: onEvent

@Override
public void onEvent(int event, String file) {
    if ((FileObserver.CREATE & event) != 0) {
        MLog.d(TAG, "File created [" + PhonkSettings.getBaseDir() + "/" + file + "]");
    } else if ((FileObserver.DELETE & event) != 0) {
        MLog.d(TAG, "File deleted [" + PhonkSettings.getBaseDir() + "/" + file + "]");
    }
}
 
開發者ID:victordiaz,項目名稱:phonk,代碼行數:8,代碼來源:PhonkServerService.java

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

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


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