commit 201376f3286bf0da17ef74b90f1131763a0a2f43
Author: Leszek Koltunski <leszek@koltunski.pl>
Date:   Sun Apr 7 22:59:43 2019 +0100

    Rubk App: add 4 buttons in the top.

diff --git a/src/main/java/org/distorted/examples/rubik/RubikActivity.java b/src/main/java/org/distorted/examples/rubik/RubikActivity.java
index 88108c0..bf812c8 100644
--- a/src/main/java/org/distorted/examples/rubik/RubikActivity.java
+++ b/src/main/java/org/distorted/examples/rubik/RubikActivity.java
@@ -20,24 +20,22 @@
 package org.distorted.examples.rubik;
 
 import android.app.Activity;
+import android.opengl.GLSurfaceView;
 import android.os.Bundle;
+import android.view.View;
 
+import org.distorted.examples.R;
 import org.distorted.library.main.Distorted;
 
 ///////////////////////////////////////////////////////////////////////////////////////////////////
 
 public class RubikActivity extends Activity
 {
-    private RubikSurfaceView mView;
-
-///////////////////////////////////////////////////////////////////////////////////////////////////
-
     @Override
     protected void onCreate(Bundle icicle)
       {
       super.onCreate(icicle);
-      mView = new RubikSurfaceView(this);
-      setContentView(mView);
+      setContentView(R.layout.rubiklayout);
       }
 
 ///////////////////////////////////////////////////////////////////////////////////////////////////
@@ -45,7 +43,8 @@ public class RubikActivity extends Activity
     @Override
     protected void onPause() 
       {
-      mView.onPause();
+      GLSurfaceView view = findViewById(R.id.rubikSurfaceView);
+      view.onPause();
       Distorted.onPause();
       super.onPause();
       }
@@ -56,7 +55,8 @@ public class RubikActivity extends Activity
     protected void onResume() 
       {
       super.onResume();
-      mView.onResume();
+      GLSurfaceView view = findViewById(R.id.rubikSurfaceView);
+      view.onResume();
       }
     
 ///////////////////////////////////////////////////////////////////////////////////////////////////
@@ -67,4 +67,18 @@ public class RubikActivity extends Activity
       Distorted.onDestroy();  
       super.onDestroy();
       }
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+    public void Scramble(View v)
+      {
+      android.util.Log.e("rubik", "scrambling...");
+      }
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+    public void setSize(View v)
+      {
+      android.util.Log.e("rubik", "setting size...");
+      }
 }
diff --git a/src/main/java/org/distorted/examples/rubik/RubikSurfaceView.java b/src/main/java/org/distorted/examples/rubik/RubikSurfaceView.java
index c480782..3ba0c9a 100644
--- a/src/main/java/org/distorted/examples/rubik/RubikSurfaceView.java
+++ b/src/main/java/org/distorted/examples/rubik/RubikSurfaceView.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;
 
 import org.distorted.library.type.Static4D;
@@ -59,30 +60,33 @@ class RubikSurfaceView extends GLSurfaceView
 
 ///////////////////////////////////////////////////////////////////////////////////////////////////
 
-    public RubikSurfaceView(Context context)
+    public RubikSurfaceView(Context context, AttributeSet attrs)
       {
-      super(context);
+      super(context,attrs);
 
-      mRotationVect = VECT[0];
+      if(!isInEditMode())
+        {
+        mRotationVect = VECT[0];
 
-      mPoint = new float[3];
-      mCamera= new float[3];
-      mDiff  = new float[3];
-      mTouchPoint = new float[3];
-      mTouchPointCastOntoFace = new float[3];
+        mPoint = new float[3];
+        mCamera= new float[3];
+        mDiff  = new float[3];
+        mTouchPoint = new float[3];
+        mTouchPointCastOntoFace = new float[3];
 
-      mScreenWidth = mScreenHeight = mScreenMin = 0;
+        mScreenWidth = mScreenHeight = mScreenMin = 0;
 
-      mRenderer = new RubikRenderer(this);
-      mCube = mRenderer.getCube();
+        mRenderer = new RubikRenderer(this);
+        mCube = mRenderer.getCube();
 
-      mQuatCurrent     = new Static4D(0,0,0,1);
-      mQuatAccumulated = mRenderer.initializeQuat();
+        mQuatCurrent     = new Static4D(0,0,0,1);
+        mQuatAccumulated = mRenderer.initializeQuat();
 
-      final ActivityManager activityManager     = (ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE);
-      final ConfigurationInfo configurationInfo = activityManager.getDeviceConfigurationInfo();
-      setEGLContextClientVersion( (configurationInfo.reqGlEsVersion>>16) >= 3 ? 3:2 );
-      setRenderer(mRenderer);
+        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/rubiklayout.xml b/src/main/res/layout/rubiklayout.xml
new file mode 100644
index 0000000..42e0a37
--- /dev/null
+++ b/src/main/res/layout/rubiklayout.xml
@@ -0,0 +1,71 @@
+<?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" >
+
+    <LinearLayout
+        android:id="@+id/linearLayout"
+        android:layout_width="fill_parent"
+        android:layout_height="wrap_content"
+        android:gravity="center|fill_horizontal"
+        android:paddingBottom="10dp"
+        android:paddingTop="10dp" >
+
+        <Button
+            android:id="@+id/rubikSize2"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:layout_marginLeft="2dp"
+            android:layout_marginRight="2dp"
+            android:layout_weight="0.17"
+            android:onClick="setSize"
+            android:paddingLeft="5dp"
+            android:paddingRight="5dp"
+            android:text="@string/swirl" />
+
+        <Button
+            android:id="@+id/rubikSize3"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:layout_marginLeft="2dp"
+            android:layout_marginRight="2dp"
+            android:layout_weight="0.17"
+            android:onClick="setSize"
+            android:paddingLeft="5dp"
+            android:paddingRight="5dp"
+            android:text="@string/bubble" />
+
+        <Button
+            android:id="@+id/rubikSize4"
+            android:layout_width="54dp"
+            android:layout_height="wrap_content"
+            android:layout_marginLeft="2dp"
+            android:layout_marginRight="2dp"
+            android:layout_weight="0.17"
+            android:onClick="setSize"
+            android:paddingLeft="5dp"
+            android:paddingRight="5dp"
+            android:text="@string/sink" />
+
+        <Button
+            android:id="@+id/rubikScramble"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:layout_marginLeft="2dp"
+            android:layout_marginRight="2dp"
+            android:layout_weight="0.17"
+            android:onClick="Scramble"
+            android:paddingLeft="5dp"
+            android:paddingRight="5dp"
+            android:text="@string/alpha" />
+
+    </LinearLayout>
+
+    <org.distorted.examples.rubik.RubikSurfaceView
+        android:id="@+id/rubikSurfaceView"
+        android:layout_width="fill_parent"
+        android:layout_height="0dp"
+        android:layout_weight="1" />
+
+</LinearLayout>
