// Path: app/src/main/java/com/rxjava2/android/samples/MyApplication.java
// public class MyApplication extends Application {
// 
//     public static final String TAG = "MyApplication";
//     private RxBus bus;
// 
//     @Override
//     public void onCreate() {
//         super.onCreate();
//         bus = new RxBus();
//     }
// 
//     public RxBus bus() {
//         return bus;
//     }
// 
//     public void sendAutoEvent() {
//         Observable.timer(2, TimeUnit.SECONDS)
//                 .subscribe(new Consumer<Long>() {
//                     @Override
//                     public void accept(Long aLong) {
//                         bus.send(new Events.AutoEvent());
//                     }
//                 });
//     }
// 
// }
// 
// Path: app/src/main/java/com/rxjava2/android/samples/model/Events.java
// public class Events {
// 
//     private Events() {
// 
//     }
// 
//     public static class TapEvent {
// 
//     }
// 
//     public static class AutoEvent {
// 
//     }
// 
// }


import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;
import com.rxjava2.android.samples.MyApplication;
import com.rxjava2.android.samples.R;
import com.rxjava2.android.samples.model.Events;
import androidx.appcompat.app.AppCompatActivity;
import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.disposables.CompositeDisposable;
import io.reactivex.functions.Consumer;
import io.reactivex.schedulers.Schedulers;
package com.rxjava2.android.samples.ui.rxbus;




/**
 * Created by amitshekhar on 06/02/17.
 */

public class RxBusActivity extends AppCompatActivity {

    public static final String TAG = RxBusActivity.class.getSimpleName();
    TextView textView;
    Button button;
    private final CompositeDisposable disposables = new CompositeDisposable();

    @Override
    protected void onDestroy() {
        super.onDestroy();
        disposables.clear(); // do not send event after activity has been destroyed
    }

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
// Path: app/src/main/java/com/rxjava2/android/samples/MyApplication.java
// public class MyApplication extends Application {
// 
//     public static final String TAG = "MyApplication";
//     private RxBus bus;
// 
//     @Override
//     public void onCreate() {
//         super.onCreate();
//         bus = new RxBus();
//     }
// 
//     public RxBus bus() {
//         return bus;
//     }
// 
//     public void sendAutoEvent() {
//         Observable.timer(2, TimeUnit.SECONDS)
//                 .subscribe(new Consumer<Long>() {
//                     @Override
//                     public void accept(Long aLong) {
//                         bus.send(new Events.AutoEvent());
//                     }
//                 });
//     }
// 
// }
// 
// Path: app/src/main/java/com/rxjava2/android/samples/model/Events.java
// public class Events {
// 
//     private Events() {
// 
//     }
// 
//     public static class TapEvent {
// 
//     }
// 
//     public static class AutoEvent {
// 
//     }
// 
// }


// Path: app/src/main/java/com/rxjava2/android/samples/ui/rxbus/RxBusActivity.java
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;
import com.rxjava2.android.samples.MyApplication;
import com.rxjava2.android.samples.R;
import com.rxjava2.android.samples.model.Events;
import androidx.appcompat.app.AppCompatActivity;
import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.disposables.CompositeDisposable;
import io.reactivex.functions.Consumer;
import io.reactivex.schedulers.Schedulers;

package com.rxjava2.android.samples.ui.rxbus;




/**
 * Created by amitshekhar on 06/02/17.
 */

public class RxBusActivity extends AppCompatActivity {

    public static final String TAG = RxBusActivity.class.getSimpleName();
    TextView textView;
    Button button;
    private final CompositeDisposable disposables = new CompositeDisposable();

    @Override
    protected void onDestroy() {
        super.onDestroy();
        disposables.clear(); // do not send event after activity has been destroyed
    }

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