// Path: app/src/main/java/hu/supercluster/gameoflife/app/view/AutomatonView.java
// public class AutomatonView extends SurfaceView implements SurfaceHolder.Callback {
//     private CellularAutomaton automaton;
//     private GameParams params;
//     private AutomatonThread thread;
// 
//     public AutomatonView(Context context) {
//         super(context);
//     }
// 
//     public AutomatonView(Context context, AttributeSet attrs) {
//         super(context, attrs);
//     }
// 
//     public AutomatonView(Context context, AttributeSet attrs, int defStyle) {
//         super(context, attrs, defStyle);
//     }
// 
//     @DebugLog
//     public void init(CellularAutomaton automaton, GameParams params) {
//         this.automaton = automaton;
//         this.params = params;
// 
//         SurfaceHolder surfaceHolder = getHolder();
//         surfaceHolder.addCallback(this);
//     }
// 
//     @Override
//     @DebugLog
//     public void surfaceCreated(SurfaceHolder holder) {
//         if (thread == null || thread.getState() == Thread.State.TERMINATED) {
//             thread = new AutomatonThread(automaton, holder, params);
//             thread.start();
//         }
//         
//         thread.setRunning(true);
//     }
// 
//     @Override
//     public void surfaceChanged(SurfaceHolder holder, int format, int width, int height) {
//         //
//     }
// 
//     @Override
//     @DebugLog
//     public void surfaceDestroyed(SurfaceHolder holder) {
//         thread.setRunning(false);
//         waitForThreadToDie();
//     }
// 
//     @DebugLog
//     private void waitForThreadToDie() {
//         while (true) {
//             try {
//                 thread.join();
//                 break;
// 
//             } catch (InterruptedException e) {
//             }
//         }
//     }
// 
//     @Override
//     public boolean onTouchEvent(MotionEvent event) {
//         paint(event);
// 
//         return true;
//     }
// 
//     protected void paint(MotionEvent event) {
//         int x = Math.round(event.getX() / params.getCellSizeInPixels());
//         int y = Math.round(event.getY() / params.getCellSizeInPixels());
// 
//         EventBus.getInstance().post(new PaintWithBrush(x, y));
//     }
// }


import android.app.Activity;
import android.os.Bundle;
import android.widget.ImageButton;
import org.androidannotations.annotations.AfterViews;
import org.androidannotations.annotations.Bean;
import org.androidannotations.annotations.Click;
import org.androidannotations.annotations.EActivity;
import org.androidannotations.annotations.Fullscreen;
import org.androidannotations.annotations.InstanceState;
import org.androidannotations.annotations.ViewById;
import hu.supercluster.gameoflife.R;
import hu.supercluster.gameoflife.app.view.AutomatonView;
import hugo.weaving.DebugLog;
package hu.supercluster.gameoflife.app.activity.main;




@EActivity(R.layout.activity_main)
@Fullscreen
public class MainActivity extends Activity {
    @InstanceState
    boolean paused;

    @InstanceState
    int lastOrientation;

    @InstanceState
    Bundle gameState;

    @Bean
    MainPresenter presenter;

    @ViewById
// Path: app/src/main/java/hu/supercluster/gameoflife/app/view/AutomatonView.java
// public class AutomatonView extends SurfaceView implements SurfaceHolder.Callback {
//     private CellularAutomaton automaton;
//     private GameParams params;
//     private AutomatonThread thread;
// 
//     public AutomatonView(Context context) {
//         super(context);
//     }
// 
//     public AutomatonView(Context context, AttributeSet attrs) {
//         super(context, attrs);
//     }
// 
//     public AutomatonView(Context context, AttributeSet attrs, int defStyle) {
//         super(context, attrs, defStyle);
//     }
// 
//     @DebugLog
//     public void init(CellularAutomaton automaton, GameParams params) {
//         this.automaton = automaton;
//         this.params = params;
// 
//         SurfaceHolder surfaceHolder = getHolder();
//         surfaceHolder.addCallback(this);
//     }
// 
//     @Override
//     @DebugLog
//     public void surfaceCreated(SurfaceHolder holder) {
//         if (thread == null || thread.getState() == Thread.State.TERMINATED) {
//             thread = new AutomatonThread(automaton, holder, params);
//             thread.start();
//         }
//         
//         thread.setRunning(true);
//     }
// 
//     @Override
//     public void surfaceChanged(SurfaceHolder holder, int format, int width, int height) {
//         //
//     }
// 
//     @Override
//     @DebugLog
//     public void surfaceDestroyed(SurfaceHolder holder) {
//         thread.setRunning(false);
//         waitForThreadToDie();
//     }
// 
//     @DebugLog
//     private void waitForThreadToDie() {
//         while (true) {
//             try {
//                 thread.join();
//                 break;
// 
//             } catch (InterruptedException e) {
//             }
//         }
//     }
// 
//     @Override
//     public boolean onTouchEvent(MotionEvent event) {
//         paint(event);
// 
//         return true;
//     }
// 
//     protected void paint(MotionEvent event) {
//         int x = Math.round(event.getX() / params.getCellSizeInPixels());
//         int y = Math.round(event.getY() / params.getCellSizeInPixels());
// 
//         EventBus.getInstance().post(new PaintWithBrush(x, y));
//     }
// }


// Path: app/src/main/java/hu/supercluster/gameoflife/app/activity/main/MainActivity.java
import android.app.Activity;
import android.os.Bundle;
import android.widget.ImageButton;
import org.androidannotations.annotations.AfterViews;
import org.androidannotations.annotations.Bean;
import org.androidannotations.annotations.Click;
import org.androidannotations.annotations.EActivity;
import org.androidannotations.annotations.Fullscreen;
import org.androidannotations.annotations.InstanceState;
import org.androidannotations.annotations.ViewById;
import hu.supercluster.gameoflife.R;
import hu.supercluster.gameoflife.app.view.AutomatonView;
import hugo.weaving.DebugLog;

package hu.supercluster.gameoflife.app.activity.main;




@EActivity(R.layout.activity_main)
@Fullscreen
public class MainActivity extends Activity {
    @InstanceState
    boolean paused;

    @InstanceState
    int lastOrientation;

    @InstanceState
    Bundle gameState;

    @Bean
    MainPresenter presenter;

    @ViewById
    AutomatonView automatonView;