package kit.scyla.test;

import android.content.Context;

import kit.scyla.canvas.ScylaCanvas;
import kit.scyla.canvas.views.ScylaCanvasView;
import kit.scyla.canvas.views.ViewHandler;

public class MainActivity extends ScylaCanvas {

    @Override
    public int layoutID() {
        return R.layout.activity_main;
    }

    @Override
    public int renderID() {
        return R.id.render;
    }

    @Override
    public ScylaCanvasView firstView(ViewHandler handler, Context context) {
        return new myView(handler, context);
    }

}

@@ -37,260 +37,638 @@
 oid.
-content.Context;%0A%0Aimport kit.scyla.canvas.ScylaCanvas;%0Aimport kit.scyla.canvas.views.ScylaCanvasView;%0Aimport kit.scyla.canvas.views.ViewHandler;%0A%0Apublic class MainActivity extends ScylaCanvas %7B%0A%0A    @Override%0A    public int layoutID() %7B%0A        return 
+app.Activity;%0Aimport android.app.FragmentManager;%0Aimport android.app.FragmentTransaction;%0Aimport android.content.Context;%0Aimport android.os.Bundle;%0Aimport android.view.KeyEvent;%0A%0Aimport kit.scyla.canvas.ScylaCanvasFragment;%0Aimport kit.scyla.canvas.render.ScylaCanvasSurface;%0Aimport kit.scyla.canvas.views.ScylaCanvasView;%0Aimport kit.scyla.canvas.views.ViewHandler;%0Aimport kit.scyla.core.ScylaFragment;%0A%0Apublic class MainActivity extends Activity %7B%0A%0A    ScylaCanvasFragment m_Scyla_fragment;%0A%0A    @Override%0A    protected void onCreate(Bundle savedInstanceState) %7B%0A        super.onCreate(savedInstanceState);%0A        setContentView(
 R.la
@@ -689,67 +689,180 @@
 main
-;
+);%0A
 %0A    
-%7D%0A%0A
     
-@Override%0A    public int renderID()
+if(savedInstanceState != null)%7B%0A            m_Scyla_fragment = (ScylaCanvasFragment) getFragmentManager().findFragmentByTag(%22scyla%22);%0A        %7D else
  %7B%0A
+%0A
         
 retu
@@ -861,35 +861,103 @@
     
-return R.id.render;%0A    %7D%0A%0A
+    ScylaCanvasSurface surface = new ScylaCanvasSurface(getApplicationContext()) %7B%0A            
     
@@ -962,24 +962,36 @@
   @Override%0A
+            
     public S
@@ -1009,12 +1009,14 @@
 iew 
-firs
+defaul
 tVie
@@ -1053,24 +1053,36 @@
  context) %7B%0A
+            
         retu
@@ -1118,13 +1118,776 @@
 t);%0A    
+            %7D%0A            %7D;%0A%0A            m_Scyla_fragment = new ScylaCanvasFragment();%0A%0A            Bundle args = new Bundle();%0A            args.putSerializable(ScylaFragment.INITIALIZE, surface);%0A            m_Scyla_fragment.setArguments(args);%0A%0A            FragmentManager fm = getFragmentManager();%0A            FragmentTransaction ft = fm.beginTransaction();%0A            ft.replace(R.id.render, m_Scyla_fragment, %22scyla%22);%0A            ft.commit();%0A            fm.executePendingTransactions();%0A        %7D%0A    %7D%0A%0A    @Override%0A    public boolean onKeyDown(int keyCode, KeyEvent event) %7B%0A        return m_Scyla_fragment.onKeyDown(keyCode, event);%0A    %7D%0A%0A    @Override%0A    protected void onPause() %7B%0A        m_Scyla_fragment.onPause();%0A        super.onPause();%0A    
 %7D
-%0A
 %0A%7D%0A

Update sample Rotation Safe