Skip to content
This repository has been archived by the owner on May 23, 2020. It is now read-only.

How to call/subscribe to other observables inside rxnavi.observe? #42

Closed
sirvon opened this issue Feb 15, 2016 · 3 comments
Closed

How to call/subscribe to other observables inside rxnavi.observe? #42

sirvon opened this issue Feb 15, 2016 · 3 comments

Comments

@sirvon
Copy link

sirvon commented Feb 15, 2016

How would I subscribe to multiple subscribe events in this new lifecycle paradigm...
The example code below from the readme shows one observable what

// Counter that operates on screen only while resumed; automatically ends itself on destroy
    RxNavi.observe(naviComponent, Event.RESUME)
        .flatMap(new Func1<Void, Observable<Long>>() {
          @Override public Observable<Long> call(Void v) {
            return Observable.interval(1, TimeUnit.SECONDS)
                .takeUntil(RxNavi.observe(naviComponent, Event.PAUSE));
          }
        })
        .takeUntil(RxNavi.observe(naviComponent, Event.DESTROY))
        .startWith(-1L)
        .observeOn(AndroidSchedulers.mainThread())
        .subscribe(new Action1<Long>() {
          @Override public void call(Long count) {
            counter.setText("Num seconds resumed: " + (count + 1));
          }
        });
  }

In the old RESUME paradigm....i did this..

   @Override
    public void onResume() {
        super.onResume();

        rxBus.toObserverable()//
                .compose(bindToLifecycle())
                .ofType(EURUSDBidAsk.class)

         .......
        rxBus.toObserverable()//
                .compose(bindToLifecycle())
                .ofType(123.class)
         .......
        rxBus.toObserverable()//
                .compose(bindToLifecycle())
                .ofType(234.class)
         .......
        rxBus.toObserverable()//
                .compose(bindToLifecycle())
                .ofType(564.class)
@sirvon sirvon changed the title How to call mulitple subscriptions in this new way of calling lifecycles.... How to call/subscribe to other observables inside rxnavi.observe? Feb 15, 2016
@dlew
Copy link
Contributor

dlew commented Feb 15, 2016

It's not really clear to me what you're asking.

@sirvon
Copy link
Author

sirvon commented Feb 15, 2016

how do I not use this:

   @Override
    public void onResume() {
        super.onResume();

and still have all my subscriptions run during that lifecycle..

if i'm using this..

 RxNavi.observe(naviComponent, Event.RESUME)

as the new way to call onResume...
where do i put all of this....

        rxBus.toObserverable()//
                .compose(bindToLifecycle())
                .ofType(123.class)
         .......
        rxBus.toObserverable()//
                .compose(bindToLifecycle())
                .ofType(234.class)
         .......
        rxBus.toObserverable()//
                .compose(bindToLifecycle())
                .ofType(564.class)

basically how do i combine this...

 RxNavi.observe(naviComponent, Event.RESUME)

and this..

        rxBus.toObserverable()//
                .compose(bindToLifecycle())
                .ofType(123.class)
         .......
        rxBus.toObserverable()//
                .compose(bindToLifecycle())
                .ofType(234.class)
         .......
        rxBus.toObserverable()//
                .compose(bindToLifecycle())
                .ofType(564.class)

@dlew
Copy link
Contributor

dlew commented Feb 15, 2016

This doesn't make any sense. You're trying to combine a RESUME event with an Observable... in what way? So that it pauses during RESUME? So that it starts during RESUME? For some other purpose? It's very unclear what you're asking for.

Regardless, this is an issue tracker, for bugs and features in the framework itself.

@dlew dlew closed this as completed Feb 15, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants