// Path: eventbus-api/src/main/java/com/shizhefei/eventbus/EventBus.java
// public class EventBus {
// 
//     private static EventProcessHandler defaultEventHandler;
//     private static WeakHashMap<Activity, EventHandler> eventHandlerMap;
//     private static EventHandler emptyEventHandler = new EventHandler();
//     private static Context staticContext;
//     private static boolean staticHasRemoteEvent;
//     volatile static IEventProxyFactory staticEventProxyFactory;
// 
//     public static void init(Context context, boolean hasRemoteEvent) {
//         staticContext = context.getApplicationContext();
//         staticHasRemoteEvent = hasRemoteEvent;
//         eventHandlerMap = new WeakHashMap<>();
//         defaultEventHandler = new EventProcessHandler(hasRemoteEvent);
//         staticEventProxyFactory = new EventProxyAptFactory();
//     }
// 
//     public static void setEventProxyFactory(IEventProxyFactory eventProxyFactory){
//         staticEventProxyFactory = eventProxyFactory;
//     }
// 
//     static IEventProxyFactory getEventProxyFactory(){
//         return staticEventProxyFactory;
//     }
// 
//     static Context getContext() {
//         return staticContext;
//     }
// 
//     static boolean isHasRemoteEvent() {
//         return staticHasRemoteEvent;
//     }
// 
//     public static void register(IEvent iEvent) {
//         checkInit();
//         defaultEventHandler.register(iEvent);
//     }
// 
//     public static void unregister(IEvent iEvent) {
//         checkInit();
//         defaultEventHandler.unregister(iEvent);
//     }
// 
//     public static <EVENT extends IEvent> EVENT postMain(Class<EVENT> eventInterface) {
//         checkInit();
//         return defaultEventHandler.postMain(eventInterface);
//     }
// 
//     public static <EVENT extends IEvent> EVENT post(Class<EVENT> eventInterface) {
//         checkInit();
//         return defaultEventHandler.post(eventInterface);
//     }
// 
//     public static <EVENT extends IRemoteEvent> EVENT postRemote(Class<EVENT> eventInterface, String processName) {
//         checkInit();
//         return defaultEventHandler.postRemote(eventInterface, processName);
//     }
// 
// //    public static <EVENT extends IEvent> EVENT postMainInActivity(Activity activity, Class<EVENT> eventInterface) {
// //        return withActivity(activity).postMain(eventInterface);
// //    }
// //
// //    public static <EVENT extends IEvent> EVENT postInActivity(Activity activity, Class<EVENT> eventInterface) {
// //        return withActivity(activity).postMain(eventInterface);
// //    }
// 
//     public static synchronized IEventHandler withActivity(Activity activity) {
//         checkInit();
//         if (activity == null) {
//             return emptyEventHandler;
//         }
//         EventHandler eventBusImp = eventHandlerMap.get(activity);
//         if (eventBusImp == null) {
//             eventBusImp = new EventHandler();
//             eventHandlerMap.put(activity, eventBusImp);
//         }
//         return eventBusImp;
//     }
// 
//     private static void checkInit() {
//         if (staticContext == null) {
//             throw new RuntimeException("请在Application调用EventBus.init方法进行初始化");
//         }
//     }
// }
// 
// Path: app/src/main/java/com/shizhefei/eventbusdemo/events/IAccountEventHAHAHAHAHHALLLLL.java
// @Event
// public interface IAccountEventHAHAHAHAHHALLLLL extends IEvent {
//     void logout();
//     void login();
// }
// 
// Path: app/src/main/java/com/shizhefei/eventbusdemo/events/IMessageEvent.java
// @Event
// public interface IMessageEvent extends IRemoteEvent {
//     void onReceiverMessage(int messageId, String message);
// }


import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.EditText;
import com.shizhefei.eventbus.EventBus;
import com.shizhefei.eventbus.demo.R;
import com.shizhefei.eventbusdemo.events.IAccountEventHAHAHAHAHHALLLLL;
import com.shizhefei.eventbusdemo.events.IMessageEvent;
package com.shizhefei.eventbusdemo;




/**
 * Created by LuckyJayce on 2017/3/20.
 */

public class SenderFragment extends Fragment {
    private Button sendButton;
    private EditText editText;
    private int messageId = 0;
    private Button logoutButton;

    @Nullable
    @Override
    public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
        View view = inflater.inflate(R.layout.fragment_sender, container, false);
        sendButton = (Button) view.findViewById(R.id.button);
        editText = (EditText) view.findViewById(R.id.editText);
        logoutButton = (Button) view.findViewById(R.id.logout_button);
        sendButton.setOnClickListener(onClickListener);
        logoutButton.setOnClickListener(onClickListener);
        return view;
    }

    private View.OnClickListener onClickListener = new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            if (v == sendButton) {
                String s = editText.getText().toString();

                long time = System.currentTimeMillis();
// Path: eventbus-api/src/main/java/com/shizhefei/eventbus/EventBus.java
// public class EventBus {
// 
//     private static EventProcessHandler defaultEventHandler;
//     private static WeakHashMap<Activity, EventHandler> eventHandlerMap;
//     private static EventHandler emptyEventHandler = new EventHandler();
//     private static Context staticContext;
//     private static boolean staticHasRemoteEvent;
//     volatile static IEventProxyFactory staticEventProxyFactory;
// 
//     public static void init(Context context, boolean hasRemoteEvent) {
//         staticContext = context.getApplicationContext();
//         staticHasRemoteEvent = hasRemoteEvent;
//         eventHandlerMap = new WeakHashMap<>();
//         defaultEventHandler = new EventProcessHandler(hasRemoteEvent);
//         staticEventProxyFactory = new EventProxyAptFactory();
//     }
// 
//     public static void setEventProxyFactory(IEventProxyFactory eventProxyFactory){
//         staticEventProxyFactory = eventProxyFactory;
//     }
// 
//     static IEventProxyFactory getEventProxyFactory(){
//         return staticEventProxyFactory;
//     }
// 
//     static Context getContext() {
//         return staticContext;
//     }
// 
//     static boolean isHasRemoteEvent() {
//         return staticHasRemoteEvent;
//     }
// 
//     public static void register(IEvent iEvent) {
//         checkInit();
//         defaultEventHandler.register(iEvent);
//     }
// 
//     public static void unregister(IEvent iEvent) {
//         checkInit();
//         defaultEventHandler.unregister(iEvent);
//     }
// 
//     public static <EVENT extends IEvent> EVENT postMain(Class<EVENT> eventInterface) {
//         checkInit();
//         return defaultEventHandler.postMain(eventInterface);
//     }
// 
//     public static <EVENT extends IEvent> EVENT post(Class<EVENT> eventInterface) {
//         checkInit();
//         return defaultEventHandler.post(eventInterface);
//     }
// 
//     public static <EVENT extends IRemoteEvent> EVENT postRemote(Class<EVENT> eventInterface, String processName) {
//         checkInit();
//         return defaultEventHandler.postRemote(eventInterface, processName);
//     }
// 
// //    public static <EVENT extends IEvent> EVENT postMainInActivity(Activity activity, Class<EVENT> eventInterface) {
// //        return withActivity(activity).postMain(eventInterface);
// //    }
// //
// //    public static <EVENT extends IEvent> EVENT postInActivity(Activity activity, Class<EVENT> eventInterface) {
// //        return withActivity(activity).postMain(eventInterface);
// //    }
// 
//     public static synchronized IEventHandler withActivity(Activity activity) {
//         checkInit();
//         if (activity == null) {
//             return emptyEventHandler;
//         }
//         EventHandler eventBusImp = eventHandlerMap.get(activity);
//         if (eventBusImp == null) {
//             eventBusImp = new EventHandler();
//             eventHandlerMap.put(activity, eventBusImp);
//         }
//         return eventBusImp;
//     }
// 
//     private static void checkInit() {
//         if (staticContext == null) {
//             throw new RuntimeException("请在Application调用EventBus.init方法进行初始化");
//         }
//     }
// }
// 
// Path: app/src/main/java/com/shizhefei/eventbusdemo/events/IAccountEventHAHAHAHAHHALLLLL.java
// @Event
// public interface IAccountEventHAHAHAHAHHALLLLL extends IEvent {
//     void logout();
//     void login();
// }
// 
// Path: app/src/main/java/com/shizhefei/eventbusdemo/events/IMessageEvent.java
// @Event
// public interface IMessageEvent extends IRemoteEvent {
//     void onReceiverMessage(int messageId, String message);
// }


// Path: app/src/main/java/com/shizhefei/eventbusdemo/SenderFragment.java
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.EditText;
import com.shizhefei.eventbus.EventBus;
import com.shizhefei.eventbus.demo.R;
import com.shizhefei.eventbusdemo.events.IAccountEventHAHAHAHAHHALLLLL;
import com.shizhefei.eventbusdemo.events.IMessageEvent;

package com.shizhefei.eventbusdemo;




/**
 * Created by LuckyJayce on 2017/3/20.
 */

public class SenderFragment extends Fragment {
    private Button sendButton;
    private EditText editText;
    private int messageId = 0;
    private Button logoutButton;

    @Nullable
    @Override
    public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
        View view = inflater.inflate(R.layout.fragment_sender, container, false);
        sendButton = (Button) view.findViewById(R.id.button);
        editText = (EditText) view.findViewById(R.id.editText);
        logoutButton = (Button) view.findViewById(R.id.logout_button);
        sendButton.setOnClickListener(onClickListener);
        logoutButton.setOnClickListener(onClickListener);
        return view;
    }

    private View.OnClickListener onClickListener = new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            if (v == sendButton) {
                String s = editText.getText().toString();

                long time = System.currentTimeMillis();
                EventBus.post(IMessageEvent.class).onReceiverMessage(messageId++, s);