de.unikassel.android.sdcframework.broadcast
Class BatteryLowStateObserver

Package class diagram package BatteryLowStateObserver
java.lang.Object
  extended by android.content.BroadcastReceiver
      extended by de.unikassel.android.sdcframework.broadcast.BatteryLowStateObserver
All Implemented Interfaces:
LifeCycleObject, ObservableEventSource<BatteryLowEvent>, ObserverRegistration<BatteryLowEvent>

public class BatteryLowStateObserver
extends BroadcastReceiver
implements ObservableEventSource<BatteryLowEvent>, LifeCycleObject

An observable battery low broadcast receiver.


Field Summary
private  ObservableEventSourceImpl<BatteryLowEvent> eventSource
          The observable event source
 
Constructor Summary
BatteryLowStateObserver()
          Constructor
 
Method Summary
 boolean hasObservers()
          Test method for observers.
 void notify(BatteryLowEvent data)
          Does set the changed flag and notifies all observers
 void onCreate(Context applicationContext)
          Creation method
 void onDestroy(Context applicationContext)
          Destroy method
 void onPause(Context applicationContext)
          Pause method
 void onReceive(Context context, Intent intent)
           
 void onResume(Context applicationContext)
          Resume method
 void registerEventObserver(EventObserver<? extends BatteryLowEvent> observer)
          Does register an observer
 void removeAllObservers()
          Does remove all registered observers
 void unregisterEventObserver(EventObserver<? extends BatteryLowEvent> observer)
          Does delete a registered observer
 
Methods inherited from class android.content.BroadcastReceiver
abortBroadcast, clearAbortBroadcast, getAbortBroadcast, getDebugUnregister, getResultCode, getResultData, getResultExtras, isInitialStickyBroadcast, isOrderedBroadcast, peekService, setDebugUnregister, setOrderedHint, setResult, setResultCode, setResultData, setResultExtras
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

eventSource

private final ObservableEventSourceImpl<BatteryLowEvent> eventSource
The observable event source

Constructor Detail

BatteryLowStateObserver

public BatteryLowStateObserver()
Constructor

Method Detail

onReceive

public void onReceive(Context context,
                      Intent intent)
Specified by:
onReceive in class BroadcastReceiver

registerEventObserver

public void registerEventObserver(EventObserver<? extends BatteryLowEvent> observer)
Description copied from interface: ObserverRegistration
Does register an observer

Specified by:
registerEventObserver in interface ObserverRegistration<BatteryLowEvent>
Parameters:
observer - the observer to add

unregisterEventObserver

public void unregisterEventObserver(EventObserver<? extends BatteryLowEvent> observer)
Description copied from interface: ObserverRegistration
Does delete a registered observer

Specified by:
unregisterEventObserver in interface ObserverRegistration<BatteryLowEvent>
Parameters:
observer - the observer to delete

removeAllObservers

public void removeAllObservers()
Description copied from interface: ObserverRegistration
Does remove all registered observers

Specified by:
removeAllObservers in interface ObserverRegistration<BatteryLowEvent>

notify

public void notify(BatteryLowEvent data)
Description copied from interface: ObservableEventSource
Does set the changed flag and notifies all observers

Specified by:
notify in interface ObservableEventSource<BatteryLowEvent>
Parameters:
data - the observable event data to create notifications for

onResume

public void onResume(Context applicationContext)
Description copied from interface: LifeCycleObject
Resume method

Specified by:
onResume in interface LifeCycleObject
Parameters:
applicationContext - the application context

onPause

public void onPause(Context applicationContext)
Description copied from interface: LifeCycleObject
Pause method

Specified by:
onPause in interface LifeCycleObject
Parameters:
applicationContext - the application context

onCreate

public void onCreate(Context applicationContext)
Description copied from interface: LifeCycleObject
Creation method

Specified by:
onCreate in interface LifeCycleObject
Parameters:
applicationContext - the application context

onDestroy

public void onDestroy(Context applicationContext)
Description copied from interface: LifeCycleObject
Destroy method

Specified by:
onDestroy in interface LifeCycleObject
Parameters:
applicationContext - the application context

hasObservers

public boolean hasObservers()
Description copied from interface: ObservableEventSource
Test method for observers.

Specified by:
hasObservers in interface ObservableEventSource<BatteryLowEvent>
Returns:
true if observers are registered, false otherwise