Created
March 28, 2013 12:30
-
-
Save macsystems/5262760 to your computer and use it in GitHub Desktop.
Some Proxy class to get Logging for register/unregister of Objects in greenrobots EventBus
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import android.util.Log; | |
import com.google.common.eventbus.EventBus; | |
/** | |
* An Proxy which allows better log control | |
* | |
* @author Jens Hohl | |
* | |
*/ | |
public final class EventBusProxy | |
{ | |
private final static String LOG_TAG = EventBusProxy.class.getSimpleName(); | |
private final EventBus bus = new EventBus("NameOfBus"); | |
private static EventBusProxy proxy = new EventBusProxy(); | |
private EventBusProxy() | |
{ | |
} | |
/** | |
* get instance of the EventBus | |
* | |
* @return | |
*/ | |
public static EventBusProxy get() | |
{ | |
return proxy; | |
} | |
public void post(final Object event) | |
{ | |
Log.d(LOG_TAG, "Posting Event :" + event.getClass().getSimpleName()); | |
bus.post(event); | |
} | |
public void register(final Object object) | |
{ | |
Log.d(LOG_TAG, "Register :" + object.getClass().getSimpleName()); | |
bus.register(object); | |
} | |
public void unregister(final Object object) | |
{ | |
Log.d(LOG_TAG, "Register :" + object.getClass().getSimpleName()); | |
bus.unregister(object); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment