public void removeStorageObserver(Observer o) { Log.i(TAG, "removeStorageObserver: E"); synchronized (mStorageObservable) { if (mStorageObservable.countObservers() == 1) { mStorageReceiver.unregister(); } mStorageObservable.deleteObserver(o); } }
public void addStorageObserver(Observer o) { Log.i(TAG, "addStorageObserver: E"); synchronized (mStorageObservable) { if (mStorageObservable.countObservers() == 0) { mStorageReceiver.register(this); } mStorageObservable.addObserver(o); } }
/* * (non-Javadoc) * * @see * cn.mabin.lanfileshare.logic.StorageReceiver.OnStorageListener#onUnmounted * () */ @Override public void onUnmounted() { Log.i(TAG, "onUnmounted: isStorageAvailable = " + isStorageAvailable); if (isStorageAvailable) { isStorageAvailable = false; mStorageObservable.fireFastNotify(false); } }
/* * (non-Javadoc) * * @see * cn.mabin.lanfileshare.logic.StorageReceiver.OnStorageListener#onMounted() */ @Override public void onMounted() { Log.i(TAG, "onMounted: isStorageAvailable = " + isStorageAvailable); if (!isStorageAvailable) { isStorageAvailable = true; mStorageObservable.fireFastNotify(true); } }