本文整理汇总了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);
}