title: RXJava - buffer observable 1 until observable 2 emits one item
body: <p>I want following behaviour:</p>
  
  <p><code>observableMain</code> should buffers all items until <code>observableResumed</code> emits a value. Then <code>observableMain</code> should emit all buffered and all feature values...</p>
  
  <p>What I do in my <code>activity's</code> <code>onCreate</code>:</p>
  
  <pre><code> PublishSubject&lt;T&gt; subject = ...; // I create a subject to emit items to and to subscribe to
  
   // 1) I create a main observable from my subject
   final Observable&lt;T&gt; observableMain = subject
              .subscribeOn(Schedulers.io())
              .observeOn(AndroidSchedulers.mainThread());
  
   // 2) I use a custom base class in which I can register listeners 
   // for the onResume event and which I can query the isResumed state! 
   // I call the object the pauseResumeProvider!
  
   // 2.1) I create an observable, it emits a value ONLY if my activity is resumed
   final Observable&lt;Boolean&gt; obsIsResumed = Observable
              .defer(() -&gt; Observable.just(pauseResumeProvider.isActivityResumed()))
              .skipWhile(aBoolean -&gt; aBoolean != true);
  
   // 2.2) I create a second observable, it emits a value as soon as my activity is resumed
   final Observable&lt;Boolean&gt; obsOnResumed = Observable.create(new Observable.OnSubscribe&lt;Boolean&gt;()
      {
          @Override
          public void call(final Subscriber&lt;? super Boolean&gt; subscriber)
          {
              pauseResumeProvider.addPauseResumeListener(new IPauseResumeListener() {
                  @Override
                  public void onResume() {
                      pauseResumeProvider.removePauseResumeListener(this);
                      subscriber.onNext(true);
                      subscriber.onCompleted();
                  }
  
                  @Override
                  public void onPause() {
  
                  }
              });
          }
      });
  
  // 2.3) I combine the resumed observables and only emit the FIRST value I can get
  final Observable&lt;Boolean&gt; observableResumed = Observable
          .concat(obsIsResumed, obsOnResumed)
          .first();
  
  // 3) here I'm stuck
  // 3 - Variant 1:
  Observable&lt;T&gt; observable = observableMain
              .buffer(observableResumed)
              .concatMap(values -&gt; Observable.from(values));
  // 3 - Variant 2:
  // Observable&lt;T&gt; observable = observableMain.delay(t -&gt; observableResumed);
  
  // 4) I emit events to my my subject...
  // this event is LOST!
  subject.onNext("Test in onCreate");
  </code></pre>
  
  <p><strong>Problem</strong></p>
  
  <p>All items that are send to the <code>subject</code> after the <code>activity</code> is resumed are working, all items before are lost (at least with the <code>delay</code> solution). I can't get my desired behaviour to work. How would I correctly solve that?</p>