commit 8982b894d828009e64f62873a6b3e0e526f705ed
Author: Leszek Koltunski <leszek@koltunski.pl>
Date:   Sat May 23 22:05:17 2020 +0100

    Progress with MeshJoin.

diff --git a/src/main/java/org/distorted/examples/meshjoin/MeshJoinActivity.java b/src/main/java/org/distorted/examples/meshjoin/MeshJoinActivity.java
index fd7b264..1ecf7a2 100644
--- a/src/main/java/org/distorted/examples/meshjoin/MeshJoinActivity.java
+++ b/src/main/java/org/distorted/examples/meshjoin/MeshJoinActivity.java
@@ -20,24 +20,23 @@
 package org.distorted.examples.meshjoin;
 
 import android.app.Activity;
+import android.opengl.GLSurfaceView;
 import android.os.Bundle;
+import android.view.View;
+import android.widget.CheckBox;
 
+import org.distorted.examples.R;
 import org.distorted.library.main.DistortedLibrary;
 
 ///////////////////////////////////////////////////////////////////////////////////////////////////
 
 public class MeshJoinActivity extends Activity
 {
-    private MeshJoinSurfaceView mView;
-
-///////////////////////////////////////////////////////////////////////////////////////////////////
-    
     @Override
     protected void onCreate(Bundle icicle) 
       {
       super.onCreate(icicle);
-      mView = new MeshJoinSurfaceView(this);
-      setContentView(mView);
+      setContentView(R.layout.meshjoinlayout);
       }
 
 ///////////////////////////////////////////////////////////////////////////////////////////////////
@@ -45,7 +44,8 @@ public class MeshJoinActivity extends Activity
     @Override
     protected void onPause() 
       {
-      mView.onPause();
+      GLSurfaceView view = this.findViewById(R.id.meshjoinSurfaceView);
+      view.onPause();
       DistortedLibrary.onPause();
       super.onPause();
       }
@@ -56,7 +56,8 @@ public class MeshJoinActivity extends Activity
     protected void onResume() 
       {
       super.onResume();
-      mView.onResume();
+      GLSurfaceView view = this.findViewById(R.id.meshjoinSurfaceView);
+      view.onResume();
       }
     
 ///////////////////////////////////////////////////////////////////////////////////////////////////
@@ -67,5 +68,22 @@ public class MeshJoinActivity extends Activity
       DistortedLibrary.onDestroy();
       super.onDestroy();
       }
-    
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+    public void onClick(View view)
+      {
+      CheckBox box = (CheckBox)view;
+      int id = box.getId();
+      boolean checked = box.isChecked();
+      MeshJoinSurfaceView sView = findViewById(R.id.meshjoinSurfaceView);
+
+      switch(id)
+        {
+        case R.id.meshjoinCheckBox0  : sView.getRenderer().setChecked(0,checked); break;
+        case R.id.meshjoinCheckBox1  : sView.getRenderer().setChecked(1,checked); break;
+        case R.id.meshjoinCheckBox2  : sView.getRenderer().setChecked(2,checked); break;
+        case R.id.meshjoinCheckBox3  : sView.getRenderer().setChecked(3,checked); break;
+        }
+      }
 }
diff --git a/src/main/java/org/distorted/examples/meshjoin/MeshJoinRenderer.java b/src/main/java/org/distorted/examples/meshjoin/MeshJoinRenderer.java
index 0921e27..55c52df 100644
--- a/src/main/java/org/distorted/examples/meshjoin/MeshJoinRenderer.java
+++ b/src/main/java/org/distorted/examples/meshjoin/MeshJoinRenderer.java
@@ -135,6 +135,13 @@ class MeshJoinRenderer implements GLSurfaceView.Renderer
         }
       }
 
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+    void setChecked(int number, boolean checked)
+      {
+      android.util.Log.e("renderer", "Checkbox "+number+" checked: "+checked);
+      }
+
 ///////////////////////////////////////////////////////////////////////////////////////////////////
 
     private Bitmap createTetrahedronTexture()
@@ -225,7 +232,7 @@ class MeshJoinRenderer implements GLSurfaceView.Renderer
       effect3.setMeshAssociation(15);  // apply to all 4 meshes
       effect4.setMeshAssociation(14);  // apply to mesh[1], [2] and [3]
       effect5.setMeshAssociation( 2);  // apply only to mesh[1]
-      effect6.setMeshAssociation( 4);  // apply onlt to mesh[2]
+      effect6.setMeshAssociation( 4);  // apply only to mesh[2]
       effect7.setMeshAssociation( 8);  // apply only to mesh[3]
 
       result.apply(effect1);
diff --git a/src/main/java/org/distorted/examples/meshjoin/MeshJoinSurfaceView.java b/src/main/java/org/distorted/examples/meshjoin/MeshJoinSurfaceView.java
index bfff5c9..11741d2 100644
--- a/src/main/java/org/distorted/examples/meshjoin/MeshJoinSurfaceView.java
+++ b/src/main/java/org/distorted/examples/meshjoin/MeshJoinSurfaceView.java
@@ -23,6 +23,7 @@ import android.app.ActivityManager;
 import android.content.Context;
 import android.content.pm.ConfigurationInfo;
 import android.opengl.GLSurfaceView;
+import android.util.AttributeSet;
 import android.view.MotionEvent;
 
 ///////////////////////////////////////////////////////////////////////////////////////////////////
@@ -35,18 +36,21 @@ class MeshJoinSurfaceView extends GLSurfaceView
 	
 ///////////////////////////////////////////////////////////////////////////////////////////////////
    
-    public MeshJoinSurfaceView(Context context)
+    public MeshJoinSurfaceView(Context context, AttributeSet attrs)
       {
-      super(context);
+      super(context,attrs);
     
       mX = -1;
       mY = -1;
 
-      mRenderer = new MeshJoinRenderer(this);
-      final ActivityManager activityManager     = (ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE);
-      final ConfigurationInfo configurationInfo = activityManager.getDeviceConfigurationInfo();
-      setEGLContextClientVersion( (configurationInfo.reqGlEsVersion>>16) >= 3 ? 3:2 );
-      setRenderer(mRenderer);
+      if(!isInEditMode())
+        {
+        mRenderer = new MeshJoinRenderer(this);
+        final ActivityManager activityManager     = (ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE);
+        final ConfigurationInfo configurationInfo = activityManager.getDeviceConfigurationInfo();
+        setEGLContextClientVersion( (configurationInfo.reqGlEsVersion>>16) >= 3 ? 3:2 );
+        setRenderer(mRenderer);
+        }
       }
 
 ///////////////////////////////////////////////////////////////////////////////////////////////////
diff --git a/src/main/res/layout/meshjoinlayout.xml b/src/main/res/layout/meshjoinlayout.xml
new file mode 100644
index 0000000..070dee8
--- /dev/null
+++ b/src/main/res/layout/meshjoinlayout.xml
@@ -0,0 +1,60 @@
+<?xml version="1.0" encoding="utf-8"?>
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    android:layout_width="fill_parent"
+    android:layout_height="fill_parent"
+    android:orientation="vertical" >
+
+    <org.distorted.examples.meshjoin.MeshJoinSurfaceView
+        android:id="@+id/meshjoinSurfaceView"
+        android:layout_width="fill_parent"
+        android:layout_height="0dp"
+        android:layout_weight="1" />
+
+    <TextView
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:layout_gravity="center"
+        android:text="@string/association"
+        android:textAppearance="?android:attr/textAppearanceMedium" />
+
+    <LinearLayout
+        android:orientation="horizontal"
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content">
+
+        <CheckBox
+            android:layout_width="wrap_content"
+            android:layout_height="match_parent"
+            android:id="@+id/meshjoinCheckBox0"
+            android:text="@string/color_yellow"
+            android:onClick="onClick"
+            android:layout_weight="1"
+            android:checked="true"/>
+        <CheckBox
+            android:layout_width="wrap_content"
+            android:layout_height="match_parent"
+            android:id="@+id/meshjoinCheckBox1"
+            android:text="@string/color_green"
+            android:onClick="onClick"
+            android:layout_weight="1"
+            android:checked="true"/>
+        <CheckBox
+            android:layout_width="wrap_content"
+            android:layout_height="match_parent"
+            android:id="@+id/meshjoinCheckBox2"
+            android:text="@string/color_blue"
+            android:onClick="onClick"
+            android:layout_weight="1"
+            android:checked="true"/>
+        <CheckBox
+            android:layout_width="wrap_content"
+            android:layout_height="match_parent"
+            android:id="@+id/meshjoinCheckBox3"
+            android:text="@string/color_red"
+            android:onClick="onClick"
+            android:layout_weight="1"
+            android:checked="true"/>
+
+    </LinearLayout>
+
+</LinearLayout>
\ No newline at end of file
diff --git a/src/main/res/values/strings.xml b/src/main/res/values/strings.xml
index e3f69d7..71263da 100644
--- a/src/main/res/values/strings.xml
+++ b/src/main/res/values/strings.xml
@@ -84,6 +84,7 @@
     <string name="scramble">Scramble</string>
     <string name="credits">Credits</string>
     <string name="start">Start</string>
+    <string name="association">Sink Association</string>
 
     <string name="quality0">Highest</string>
     <string name="quality1">High</string>
