@@ -0,0 +1,1054 @@
+package berlin.reiche.securitas;%0D%0A%0D%0Aimport java.util.ArrayList;%0D%0Aimport java.util.List;%0D%0A%0D%0Aimport android.os.Handler;%0D%0Aimport android.os.HandlerThread;%0D%0Aimport android.os.Message;%0D%0A%0D%0Apublic abstract class Controller %7B%0D%0A%0D%0A%09final HandlerThread inboxHandlerThread;%0D%0A%09final Handler inboxHandler;%0D%0A%09final List%3CHandler%3E outboxHandlers;%0D%0A%0D%0A%09public Controller() %7B%0D%0A%09%09inboxHandlerThread = new HandlerThread(%22Controller%22);%0D%0A%09%09inboxHandler = new Handler(inboxHandlerThread.getLooper());%0D%0A%09%09outboxHandlers = new ArrayList%3CHandler%3E();%0D%0A%09%7D%0D%0A%0D%0A%09public final void dispose() %7B%0D%0A%09%09inboxHandlerThread.getLooper().quit();%0D%0A%09%7D%0D%0A%0D%0A%09public final void addOutboxHandler(Handler handler) %7B%0D%0A%09%09outboxHandlers.add(handler);%0D%0A%09%7D%0D%0A%0D%0A%09public final void removeOutboxHandler(Handler handler) %7B%0D%0A%09%09outboxHandlers.remove(handler);%0D%0A%09%7D%0D%0A%0D%0A%09final void notifyOutboxHandlers(int what, int arg1, int arg2, Object obj) %7B%0D%0A%0D%0A%09%09if (!outboxHandlers.isEmpty()) %7B%0D%0A%0D%0A%09%09%09for (Handler handler : outboxHandlers) %7B%0D%0A%09%09%09%09Message.obtain(handler, what, arg1, arg2, obj).sendToTarget();%0D%0A%09%09%09%7D%0D%0A%09%09%7D%0D%0A%09%7D%0D%0A%0D%0A%7D%0D%0A

Add abstract controller