commit d7de3072734a2549a8ea356af81eac96787ec78e
Author: Leszek Koltunski <leszek@koltunski.pl>
Date:   Mon Nov 16 13:04:47 2020 +0100

    More support for using the library from more than one activity

diff --git a/src/main/java/org/distorted/main/RubikActivity.java b/src/main/java/org/distorted/main/RubikActivity.java
index 585be087..4f29c34c 100644
--- a/src/main/java/org/distorted/main/RubikActivity.java
+++ b/src/main/java/org/distorted/main/RubikActivity.java
@@ -94,6 +94,8 @@ public class RubikActivity extends AppCompatActivity
     protected void onCreate(Bundle savedState)
       {
       super.onCreate(savedState);
+      DistortedLibrary.onCreate(0);
+
       setTheme(R.style.CustomActivityThemeNoActionBar);
       setContentView(R.layout.main);
 
@@ -223,7 +225,7 @@ public class RubikActivity extends AppCompatActivity
       super.onPause();
       RubikSurfaceView view = findViewById(R.id.rubikSurfaceView);
       view.onPause();
-      DistortedLibrary.onPause();
+      DistortedLibrary.onPause(0);
       RubikScoresDownloader.onPause();
       savePreferences();
       }
@@ -234,6 +236,7 @@ public class RubikActivity extends AppCompatActivity
     protected void onResume() 
       {
       super.onResume();
+      DistortedLibrary.onResume(0);
       RubikSurfaceView view = findViewById(R.id.rubikSurfaceView);
       view.onResume();
       view.initialize();
@@ -283,7 +286,7 @@ public class RubikActivity extends AppCompatActivity
     @Override
     protected void onDestroy() 
       {
-      DistortedLibrary.onDestroy();
+      DistortedLibrary.onDestroy(0);
       super.onDestroy();
       }
 
@@ -554,9 +557,6 @@ public class RubikActivity extends AppCompatActivity
 
     public void switchTutorial()
       {
-     // DistortedLibrary.onPause();
-     // DistortedLibrary.onDestroy();
-
       Intent myIntent = new Intent(this, TutorialActivity.class);
     //myIntent.putExtra("", value); //Optional parameters
       startActivity(myIntent);
diff --git a/src/main/java/org/distorted/main/RubikRenderer.java b/src/main/java/org/distorted/main/RubikRenderer.java
index 519ef245..546af791 100644
--- a/src/main/java/org/distorted/main/RubikRenderer.java
+++ b/src/main/java/org/distorted/main/RubikRenderer.java
@@ -127,7 +127,9 @@ public class RubikRenderer implements GLSurfaceView.Renderer, DistortedLibrary.E
       VertexEffectQuaternion.enable();
       BaseEffect.Type.enableEffects();
 
-      DistortedLibrary.onCreate(mView.getContext(),this,1);
+      DistortedLibrary.onSurfaceCreated(mView.getContext(),this,1);
+
+android.util.Log.e("ren", "onSurfaceCreated");
       }
 
 ///////////////////////////////////////////////////////////////////////////////////////////////////
diff --git a/src/main/java/org/distorted/tutorial/TutorialActivity.java b/src/main/java/org/distorted/tutorial/TutorialActivity.java
index 380e6121..2729b399 100644
--- a/src/main/java/org/distorted/tutorial/TutorialActivity.java
+++ b/src/main/java/org/distorted/tutorial/TutorialActivity.java
@@ -68,6 +68,7 @@ public class TutorialActivity extends AppCompatActivity
     protected void onCreate(Bundle savedState)
       {
       super.onCreate(savedState);
+      DistortedLibrary.onCreate(1);
       setTheme(R.style.CustomActivityThemeNoActionBar);
       setContentView(R.layout.tutorial);
 
@@ -156,7 +157,7 @@ public class TutorialActivity extends AppCompatActivity
       super.onPause();
       TutorialSurfaceView view = findViewById(R.id.tutorialSurfaceView);
       view.onPause();
-      DistortedLibrary.onPause();
+      DistortedLibrary.onPause(1);
       }
 
 ///////////////////////////////////////////////////////////////////////////////////////////////////
@@ -165,6 +166,7 @@ public class TutorialActivity extends AppCompatActivity
     protected void onResume() 
       {
       super.onResume();
+      DistortedLibrary.onResume(1);
       TutorialSurfaceView view = findViewById(R.id.tutorialSurfaceView);
       view.onResume();
       view.initialize();
@@ -204,6 +206,7 @@ public class TutorialActivity extends AppCompatActivity
     protected void onDestroy() 
       {
       super.onDestroy();
+      DistortedLibrary.onDestroy(1);
       }
 
 ///////////////////////////////////////////////////////////////////////////////////////////////////
diff --git a/src/main/java/org/distorted/tutorial/TutorialRenderer.java b/src/main/java/org/distorted/tutorial/TutorialRenderer.java
index 41d15a7b..2669acbe 100644
--- a/src/main/java/org/distorted/tutorial/TutorialRenderer.java
+++ b/src/main/java/org/distorted/tutorial/TutorialRenderer.java
@@ -79,7 +79,9 @@ public class TutorialRenderer implements GLSurfaceView.Renderer, DistortedLibrar
       VertexEffectQuaternion.enable();
       BaseEffect.Type.enableEffects();
 
-      DistortedLibrary.onCreate(mView.getContext(),this,1);
+      DistortedLibrary.onSurfaceCreated(mView.getContext(),this,1);
+
+android.util.Log.e("tut", "onSurfaceCreated");
       }
 
 ///////////////////////////////////////////////////////////////////////////////////////////////////
