本文整理匯總了Java中com.squareup.otto.ThreadEnforcer.MAIN屬性的典型用法代碼示例。如果您正苦於以下問題:Java ThreadEnforcer.MAIN屬性的具體用法?Java ThreadEnforcer.MAIN怎麽用?Java ThreadEnforcer.MAIN使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在類com.squareup.otto.ThreadEnforcer
的用法示例。
在下文中一共展示了ThreadEnforcer.MAIN屬性的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: onCreate
@Override public void onCreate() {
super.onCreate();
// create an event bus to allow our gcm intent service to notify when new messages are available
EVENT_BUS = new Bus(ThreadEnforcer.MAIN);
// create instances - typically these would be created as part of a dependency injection framework to allow for mocking, different environments, etc.
SharedPreferences gcmSharedPrefs = getSharedPreferences(GCM_SHARED_PREFS_NAME, Context.MODE_PRIVATE);
PUSH_REGISTRATION_SERVICE = new RestAdapter.Builder()
.setEndpoint(BuildConfig.PUSH_SERVER_ENDPOINT)
.setLogLevel(RestAdapter.LogLevel.FULL)
.build()
.create(ExamplePushRegistrationService.class);
PUSH_MANAGER = new ExamplePushManager(InstanceID.getInstance(this), GCM_SENDER_ID, gcmSharedPrefs, PUSH_REGISTRATION_SERVICE);
// this will register the device with GCM and retrieve a registration id for this device
PUSH_MANAGER.registerWithGCM();
}
示例2: getEventBus
/**
* Lazy loading event bus.
*
* @return Event bus service.
*/
public Bus getEventBus() {
if (eventBus == null) {
eventBus = new Bus(ThreadEnforcer.MAIN, LOG_TAG);
}
return eventBus;
}
示例3: initialize
public static void initialize() {
mBus = new Bus(ThreadEnforcer.MAIN);
mHandler = new Handler();
// Activity and fragment lifecycle events make it difficult to reliably
// make register and unregister calls in a 1-to-1 way. So we're going
// to make sure that things only get registered once and unregistered if
// they're actually registered.
mRegisteredObjects = new HashSet<Object>();
}
示例4: MainThreadBus
public MainThreadBus() {
super(ThreadEnforcer.MAIN);
}
示例5: BusModule
public BusModule() {
bus = new Bus(ThreadEnforcer.MAIN);
}
示例6: provideBus
@Provides @Singleton
public Bus provideBus() {
return new Bus(ThreadEnforcer.MAIN);
}
示例7: PostFromAnyThreadBus
public PostFromAnyThreadBus()
{
super(ThreadEnforcer.MAIN);
}
示例8: EventBusProvider
private EventBusProvider() {
mBus = new Bus(ThreadEnforcer.MAIN);
}
示例9: DataBus
public DataBus() {
super(ThreadEnforcer.MAIN);
}
示例10: provideBus
@Singleton @Provides Bus provideBus() {
return new Bus(ThreadEnforcer.MAIN, "Fonz Bus");
}
示例11: provideBus
@Singleton
@Provides
protected Bus provideBus() {
return new Bus(ThreadEnforcer.MAIN);
}
示例12: providesEventBus
@Provides
@Singleton
public Bus providesEventBus() {
return new Bus(ThreadEnforcer.MAIN);
}
示例13: provideBus
@Provides
@Singleton
Bus provideBus() {
return new Bus(ThreadEnforcer.MAIN);
}
示例14: AndroidBus
public AndroidBus() {
super(ThreadEnforcer.MAIN);
}
示例15: PostFromAnyThreadBus
public PostFromAnyThreadBus() {
super(ThreadEnforcer.MAIN);
}