// Path: 2016-06-08_queue/app/src/main/java-fcm/com/gdgand/rxjava/rxjavasample/fcm/message/event/NotificationEvent.java
// public class NotificationEvent {
//     private String index;
//     private String message;
// 
//     public NotificationEvent(String index, String message) {
// 
//         this.index = index;
//         this.message = message;
//     }
// 
//     public String getIndex() {
//         return index;
//     }
// 
//     public void setIndex(String index) {
//         this.index = index;
//     }
// 
//     public String getMessage() {
//         return message;
//     }
// 
//     public void setMessage(String message) {
//         this.message = message;
//     }
// }


import android.app.Notification;
import android.app.NotificationManager;
import android.content.Context;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.util.Pair;
import android.support.v7.app.AppCompatActivity;
import android.widget.TextView;
import com.gdgand.rxjava.rxjavasample.R;
import com.gdgand.rxjava.rxjavasample.fcm.message.event.NotificationEvent;
import com.google.firebase.iid.FirebaseInstanceId;
import org.greenrobot.eventbus.EventBus;
import org.greenrobot.eventbus.Subscribe;
import java.util.concurrent.TimeUnit;
import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;
import rx.subjects.PublishSubject;
        setContentView(R.layout.activity_queue);

        ButterKnife.bind(this);

        initObject();

        String token = FirebaseInstanceId.getInstance().getToken();
        System.out.println("token : " + token);

        EventBus.getDefault().register(this);
    }

    @Override
    protected void onDestroy() {
        EventBus.getDefault().unregister(this);
        super.onDestroy();
    }

    private void initObject() {
        notificationManager = ((NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE));

        subject = PublishSubject.create();
        subject.onBackpressureBuffer()
                .throttleLast(700, TimeUnit.MILLISECONDS)
                .subscribe(pair -> {
                    notifyMessage(pair.first, pair.second);
                });
    }

    @Subscribe
// Path: 2016-06-08_queue/app/src/main/java-fcm/com/gdgand/rxjava/rxjavasample/fcm/message/event/NotificationEvent.java
// public class NotificationEvent {
//     private String index;
//     private String message;
// 
//     public NotificationEvent(String index, String message) {
// 
//         this.index = index;
//         this.message = message;
//     }
// 
//     public String getIndex() {
//         return index;
//     }
// 
//     public void setIndex(String index) {
//         this.index = index;
//     }
// 
//     public String getMessage() {
//         return message;
//     }
// 
//     public void setMessage(String message) {
//         this.message = message;
//     }
// }


// Path: 2016-06-08_queue/app/src/main/java/com/gdgand/rxjava/rxjavasample/queue/Queue1Activity.java
import android.app.Notification;
import android.app.NotificationManager;
import android.content.Context;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.util.Pair;
import android.support.v7.app.AppCompatActivity;
import android.widget.TextView;
import com.gdgand.rxjava.rxjavasample.R;
import com.gdgand.rxjava.rxjavasample.fcm.message.event.NotificationEvent;
import com.google.firebase.iid.FirebaseInstanceId;
import org.greenrobot.eventbus.EventBus;
import org.greenrobot.eventbus.Subscribe;
import java.util.concurrent.TimeUnit;
import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;
import rx.subjects.PublishSubject;

        setContentView(R.layout.activity_queue);

        ButterKnife.bind(this);

        initObject();

        String token = FirebaseInstanceId.getInstance().getToken();
        System.out.println("token : " + token);

        EventBus.getDefault().register(this);
    }

    @Override
    protected void onDestroy() {
        EventBus.getDefault().unregister(this);
        super.onDestroy();
    }

    private void initObject() {
        notificationManager = ((NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE));

        subject = PublishSubject.create();
        subject.onBackpressureBuffer()
                .throttleLast(700, TimeUnit.MILLISECONDS)
                .subscribe(pair -> {
                    notifyMessage(pair.first, pair.second);
                });
    }

    @Subscribe
    public void onNotificationEvent(NotificationEvent event) {