com.squareup.otto.Bus Java Examples

The following examples show how to use com.squareup.otto.Bus. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: Team.java    From talk-android with MIT License 6 votes vote down vote up
public static void update(final Team team, final Bus bus) {
    Observable.create(new Observable.OnSubscribe<Object>() {
        @Override
        public void call(Subscriber<? super Object> subscriber) {
            if (BizLogic.isCurrentTeam(team.get_id())) {
                MainApp.PREF_UTIL.putObject(Constant.TEAM, team);
                subscriber.onNext(null);
            }
        }
    }).subscribeOn(Schedulers.io())
            .observeOn(AndroidSchedulers.mainThread())
            .subscribe(new Action1<Object>() {
                @Override
                public void call(Object o) {
                    bus.post(new UpdateTeamEvent());
                }
            });

}
 
Example #2
Source File: MoviesPresenter.java    From Material-Movies with Apache License 2.0 5 votes vote down vote up
@Inject
public MoviesPresenter(ConfigurationUsecase configurationUsecase, GetMoviesUsecase getMoviesUsecase, Bus bus) {

    mConfigureUsecase   = configurationUsecase;
    mGetPopularShows    = getMoviesUsecase;
    mBus = bus;
}
 
Example #3
Source File: AccountPresenter.java    From TLint with Apache License 2.0 5 votes vote down vote up
@Inject
public AccountPresenter(UserDao mUserDao, Activity mActivity, UserStorage mUserStorage,
                        Bus mBus) {
    this.mUserDao = mUserDao;
    this.mActivity = mActivity;
    this.mUserStorage = mUserStorage;
    this.mBus = mBus;
}
 
Example #4
Source File: ContentPagerPresenter.java    From TLint with Apache License 2.0 5 votes vote down vote up
@Inject
public ContentPagerPresenter(ContentRepository mContentRepository, ForumApi mForumApi, Bus mBus,
                             ImageCacheDao mImageCacheDao, OkHttpHelper mOkHttpHelper, UserStorage mUserStorage) {
    this.mContentRepository = mContentRepository;
    this.mForumApi = mForumApi;
    this.mBus = mBus;
    this.mImageCacheDao = mImageCacheDao;
    this.mOkHttpHelper = mOkHttpHelper;
    this.mUserStorage = mUserStorage;
}
 
Example #5
Source File: ContentPresenter.java    From TLint with Apache License 2.0 5 votes vote down vote up
@Inject
public ContentPresenter(ForumApi forumApi, Context context, UserStorage userStorage, Bus mBus) {
    mForumApi = forumApi;
    mContext = context;
    mUserStorage = userStorage;
    this.mBus = mBus;
}
 
Example #6
Source File: LoginPresenter.java    From TLint with Apache License 2.0 5 votes vote down vote up
@Inject
public LoginPresenter(GameApi gameApi, Bus bus, UserDao userDao, UserStorage userStorage) {
    mGameApi = gameApi;
    mBus = bus;
    mUserDao = userDao;
    mUserStorage = userStorage;
}
 
Example #7
Source File: User.java    From talk-android with MIT License 5 votes vote down vote up
public void update(Bus bus) {
    if (preference == null) {
        User user = (User) MainApp.PREF_UTIL.getObject(Constant.USER, User.class);
        if (user != null) {
            setPreference(user.getPreference());
        }
    }
    MainApp.PREF_UTIL.putObject(Constant.USER, this);
    bus.post(new UpdateUserEvent());
}
 
Example #8
Source File: MoviesListPresenterImp.java    From UpcomingMoviesMVP with Apache License 2.0 5 votes vote down vote up
public MoviesListPresenterImp(UpcomingMoviesApi upcomingMoviesApi, Bus bus,
    Comparator<Movie> movieDateComparator, Comparator<Movie> movieTitleComparator) {
  this.upcomingMoviesApi = upcomingMoviesApi;
  this.bus = bus;
  this.movieDateComparator = movieDateComparator;
  this.movieTitleComparator = movieTitleComparator;
}
 
Example #9
Source File: PresenterModule.java    From UpcomingMoviesMVP with Apache License 2.0 5 votes vote down vote up
@Provides
@Singleton
MoviesListPresenter providesMoviesListPresenter(UpcomingMoviesApi upcomingMoviesApi, Bus eventBus,
    @Named("date") Comparator<Movie> movieDateComparator,
    @Named("title") Comparator<Movie> movieTitleComparator) {
  return new MoviesListPresenterImp(upcomingMoviesApi, eventBus, movieDateComparator,
      movieTitleComparator);
}
 
Example #10
Source File: MainPresenter.java    From TLint with Apache License 2.0 5 votes vote down vote up
@Inject
public MainPresenter(UserStorage mUserStorage, UserDao mUserDao, Bus mBus,
                     Observable<Integer> mNotificationObservable, UpdateAgent mUpdateAgent, Context mContext) {
    this.mUserStorage = mUserStorage;
    this.mUserDao = mUserDao;
    this.mBus = mBus;
    this.mNotificationObservable = mNotificationObservable;
    this.mUpdateAgent = mUpdateAgent;
    this.mContext = mContext;
}
 
Example #11
Source File: NetworkService.java    From quill with MIT License 5 votes vote down vote up
private void flushApiEventQueue(boolean loadCachedData) {
    Bus bus = getBus();
    boolean isQueueEmpty;
    while (! mApiEventQueue.isEmpty()) {
        ApiCallEvent event = mApiEventQueue.remove();
        isQueueEmpty = mApiEventQueue.isEmpty();
        if (loadCachedData) event.loadCachedData();
        bus.post(event);
        if (isQueueEmpty) {     // don't retry, gets into infinite loop
            mApiEventQueue.clear();
        }
    }
}
 
Example #12
Source File: Constants.java    From Mover with Apache License 2.0 5 votes vote down vote up
public static void init(Context context){
    //TODO initialize singletons or global instance of class
    Configuration config = new Configuration.Builder(context)
            .injector((WatchMeApplication) context)
            .build();

    sJobManager = new JobManager(context, config);

    sOkHttpClient = new OkHttpClient();
    sOkClient = new OkClient(sOkHttpClient);

    sEventBus = new Bus();
}
 
Example #13
Source File: BaseApp.java    From CatanArchitecture with Apache License 2.0 5 votes vote down vote up
@Override public void onCreate() {
  super.onCreate();

  eventsPort = new OttoEventsAdapter(new Bus());
  StoragePort storagePort = new SDCardStorageAdapter(eventsPort);
  FoldersModule notesModule = new FoldersModule(storagePort, eventsPort);

  notesModule.run();
}
 
Example #14
Source File: GetMovieDetailUsecaseController.java    From Material-Movies with Apache License 2.0 5 votes vote down vote up
public GetMovieDetailUsecaseController(String movieId, Bus uiBus,
    MediaDataSource dataSource) {

    mMovieId        = movieId;
    mUiBus          = uiBus;
    mMovieDataSource= dataSource;

    mUiBus.register(this);
}
 
Example #15
Source File: BusProvider.java    From Conquer with Apache License 2.0 4 votes vote down vote up
public static Bus getInstance(){
    return bus;
}
 
Example #16
Source File: MessageListPresenter.java    From TLint with Apache License 2.0 4 votes vote down vote up
@Inject
public MessageListPresenter(ForumApi mForumApi, Bus mBus) {
    this.mForumApi = mForumApi;
    this.mBus = mBus;
}
 
Example #17
Source File: Mover.java    From Mover with Apache License 2.0 4 votes vote down vote up
@Override
public void postEvent(Bus bus) {
    bus.post(new State.OnSearchResponseEvent(this));
}
 
Example #18
Source File: MovieDetailPresenter.java    From Material-Movies with Apache License 2.0 4 votes vote down vote up
@Inject
public MovieDetailPresenter(GetMovieDetailUsecase movieDetailUsecase, Bus bus) {

    mMovieDetailUsecase = movieDetailUsecase;
    mBus = bus;
}
 
Example #19
Source File: BusProvider.java    From BlueBoard with Apache License 2.0 4 votes vote down vote up
public static Bus getInstance() {
    return BUS;
}
 
Example #20
Source File: Mover.java    From Mover with Apache License 2.0 4 votes vote down vote up
@Override
public void postEvent(Bus bus) {
    bus.post(new State.OnPageResponseEvent(this));
}
 
Example #21
Source File: ApplicationModule.java    From TLint with Apache License 2.0 4 votes vote down vote up
@Provides
@Singleton
public Bus provideBusEvent() {
    return new Bus();
}
 
Example #22
Source File: MovieUsecasesModule.java    From Material-Movies with Apache License 2.0 4 votes vote down vote up
@Provides GetMovieDetailUsecase provideGetMovieDetailUsecase (Bus bus, RestMovieSource movieSource) {
    return new GetMovieDetailUsecaseController(movieId, bus, movieSource);
}
 
Example #23
Source File: BaseActivity.java    From udacity-p1-p2-popular-movies with MIT License 4 votes vote down vote up
protected Bus getDataBus() {
    return DataBusProvider.getBus();
}
 
Example #24
Source File: Model.java    From udacity-p1-p2-popular-movies with MIT License 4 votes vote down vote up
private Bus getDataBus() {
    return DataBusProvider.getBus();
}
 
Example #25
Source File: BusProvider.java    From quill with MIT License 4 votes vote down vote up
@RestrictTo(RestrictTo.Scope.TESTS)
public static void setupForTesting() {
    sBus = new Bus(ThreadEnforcer.ANY);
}
 
Example #26
Source File: AnalyticsService.java    From quill with MIT License 4 votes vote down vote up
private Bus getBus() {
    return mEventBus;
}
 
Example #27
Source File: AnalyticsService.java    From quill with MIT License 4 votes vote down vote up
public AnalyticsService(Bus eventBus) {
    mEventBus = eventBus;
}
 
Example #28
Source File: BaseFragment.java    From quill with MIT License 4 votes vote down vote up
protected Bus getBus() {
    return BusProvider.getBus();
}
 
Example #29
Source File: BusProvider.java    From sms-ticket with Apache License 2.0 4 votes vote down vote up
public static Bus getInstance() {
    return sBus;
}
 
Example #30
Source File: EventBusProvider.java    From dhis2-android-dashboard with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
private Bus getBus() {
    return mBus;
}