package com.morihacky.android.rxjava;

import android.os.Bundle;
import android.support.v4.app.FragmentActivity;
import com.morihacky.android.rxjava.R;
import com.morihacky.android.rxjava.rxbus.RxBus;
import timber.log.Timber;

public class MainActivity
      extends FragmentActivity {

    private RxBus _rxBus = null;

    // This is better done with a DI Library like Dagger
    public RxBus getRxBusSingleton() {
        if (_rxBus == null) {
            _rxBus = new RxBus();
        }

        return _rxBus;
    }

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        Timber.plant(new Timber.DebugTree());

        getSupportFragmentManager().beginTransaction()
              .addToBackStack(this.toString())
              .replace(R.id.activity_main, new MainFragment(), this.toString())
              .commit();
    }
}

@@ -727,22 +727,58 @@
 ee());%0A%0A
+%09
     
-  
+if(savedInstanceState == null)%7B%0A    %09
   getSup
@@ -826,20 +826,17 @@
         
-    
+%09
   .addTo
@@ -854,32 +854,33 @@
 his.toString())%0A
+%09
               .r
@@ -873,20 +873,16 @@
         
-    
 .replace
@@ -938,28 +938,25 @@
 tring())%0A   
-    
+%09
        .comm
@@ -965,12 +965,15 @@
 ();%0A
+%09%09%7D%0A
     %7D%0A
+
 %7D
-%0A

add PR https://github.com/kaushikgopal/Android-RxJava/pull/13 from @sherifmakhlouf