android.support.annotation.RestrictTo#com.squareup.otto.ThreadEnforcer源码实例Demo

下面列出了android.support.annotation.RestrictTo#com.squareup.otto.ThreadEnforcer 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: codeexamples-android   文件: RssApplication.java
@Override
    public void onCreate() {
        super.onCreate();
        bus = new Bus(ThreadEnforcer.ANY);

        list = new ArrayList<>();
        StringBuffer buffer = new StringBuffer();
        try (BufferedReader input = new BufferedReader(
                new InputStreamReader(
                        openFileInput(RSS_FILE)))) {
            String line;
            while ((line = input.readLine()) != null) {
                buffer.append(line);
            }
        } catch (Exception ex) {
// do nothing
        }
        if (buffer!=null && buffer.length()>0 )
        {
            Gson gson = new Gson();
            Type type = new TypeToken<List<RssItem>>() {}.getType();
            List<RssItem> fromJson = gson.fromJson(buffer.toString(), type);
            list.addAll(fromJson);
        }
    }
 
源代码2 项目: android-open-project-demo   文件: DaggerModule.java
/**
 * 提供全局单例的event bus
 */
@Provides
@Singleton
public Bus provideBus() {
    // our event bus running on any thread
    return new Bus(ThreadEnforcer.ANY);
}
 
@Before public void setUp() throws Exception {
  this.busWrapper = new OttoBusWrapper(new Bus(ThreadEnforcer.ANY));
  Logger logger = Mockito.mock(Logger.class);
  Context context = Mockito.mock(Context.class);
  OnlineChecker onlineChecker = Mockito.mock(OnlineChecker.class);
  this.receiver = new NetworkConnectionChangeReceiver(busWrapper, logger, context, onlineChecker);
  this.connectivityChangeEvents = new ArrayList<>();
}
 
@Before public void setUp() throws Exception {
  this.busWrapper = new OttoBusWrapper(new Bus(ThreadEnforcer.ANY));
  Logger logger = Mockito.mock(Logger.class);
  Context context = Mockito.mock(Context.class);
  this.receiver = new InternetConnectionChangeReceiver(busWrapper, logger, context);
  this.connectivityChangeEvents = new ArrayList<>();
}
 
源代码5 项目: ploggy   文件: Events.java
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>();
}
 
private EventBusProvider() {
    mBus = new Bus(ThreadEnforcer.MAIN);
}
 
源代码7 项目: quill   文件: BusProvider.java
@RestrictTo(RestrictTo.Scope.TESTS)
public static void setupForTesting() {
    sBus = new Bus(ThreadEnforcer.ANY);
}
 
源代码8 项目: FluxyAndroidTodo   文件: DataBus.java
public DataBus() {
    super(ThreadEnforcer.MAIN);
}
 
源代码9 项目: FluxyAndroidTodo   文件: DataBus.java
public DataBus(ThreadEnforcer thread) {
    super(thread);
}
 
源代码10 项目: FluxyAndroidTodo   文件: ActionBus.java
@Inject
public ActionBus() {
    super(ThreadEnforcer.ANY);
}
 
源代码11 项目: FluxyAndroidTodo   文件: TodosActivityStoreTest.java
@Before
public void setup() {
    actionBus = new ActionBus();
    dataBus = new DataBus(ThreadEnforcer.ANY);
    store = new TodosActivityStore(actionBus, dataBus);
}
 
源代码12 项目: FluxyAndroidTodo   文件: TodoListManagerTest.java
@Before
public void setup() {
    actionBus = new ActionBus();
    dataBus = new DataBus(ThreadEnforcer.ANY);
    list = new TodoListManager(actionBus, dataBus);
}
 
源代码13 项目: GameOfLife   文件: EventBus.java
private EventBus() {
    super(ThreadEnforcer.ANY);
}
 
@Provides
@Singleton
public Bus provideBus() {
    return new Bus(ThreadEnforcer.ANY);
}
 
源代码15 项目: tapchat-android   文件: AndroidBus.java
public AndroidBus() {
    super(ThreadEnforcer.MAIN);
}
 
源代码16 项目: masterpassword   文件: BaseApp.java
public void onCreate() {
    super.onCreate();
    instance = this;
    bus = new Bus(ThreadEnforcer.ANY);
}
 
@Before public void setUp() throws Exception {
  this.busWrapper = new OttoBusWrapper(new Bus(ThreadEnforcer.ANY));
  Logger logger = Mockito.mock(Logger.class);
  Context context = Mockito.mock(Context.class);
  this.receiver = new WifiSignalStrengthChangeReceiver(busWrapper, logger, context);
}
 
源代码18 项目: Android-BleEventAdapter   文件: BleEventBus.java
public BleEventBus(ThreadEnforcer enforcer) {
    super(enforcer, "Indy-Ble-LowLevel");
}
 
源代码19 项目: JayPS-AndroidApp   文件: AndroidModule.java
@Provides @Singleton
Bus providesBus() { return new MainThreadBus(new Bus(ThreadEnforcer.ANY)); }
 
源代码20 项目: meatspace-android   文件: UIBus.java
public UIBus() {
    // events will be fired on the main thread
    this.bus = new Bus(ThreadEnforcer.MAIN);
}
 
源代码21 项目: meatspace-android   文件: ChatBus.java
public ChatBus() {
    // events will be fired on the main thread
    this.bus = new Bus(ThreadEnforcer.MAIN);
}