commit 1cbcc6bfcc1772b5d748c90383a3475c62e06c75
Author: Leszek Koltunski <leszek@koltunski.pl>
Date:   Fri May 10 15:16:05 2019 +0100

    Progress with Credits and Settings.

diff --git a/src/main/java/org/distorted/magic/RubikActivity.java b/src/main/java/org/distorted/magic/RubikActivity.java
index 0fbcc8d9..ff612916 100644
--- a/src/main/java/org/distorted/magic/RubikActivity.java
+++ b/src/main/java/org/distorted/magic/RubikActivity.java
@@ -41,10 +41,10 @@ public class RubikActivity extends AppCompatActivity implements RubikSettings.On
     private static final int SMALLEST_SIZE = 2;
     private static final int[] button_ids  = {R.id.rubikSize2, R.id.rubikSize3, R.id.rubikSize4};
 
-    private static final int DEFAULT_APPEAR_POS     = 10;
-    private static final int DEFAULT_DISAPPEAR_POS  = 10;
-    private static final int DEFAULT_APPEAR_TYPE    = 1;
-    private static final int DEFAULT_DISAPPEAR_TYPE = 1;
+    public static final int DEFAULT_APPEAR_POS     = 10;
+    public static final int DEFAULT_DISAPPEAR_POS  = 10;
+    public static final int DEFAULT_APPEAR_TYPE    = 1;
+    public static final int DEFAULT_DISAPPEAR_TYPE = 1;
 
     private static int mSize = DEFAULT_SIZE;
 
@@ -58,7 +58,7 @@ public class RubikActivity extends AppCompatActivity implements RubikSettings.On
       {
       super.onCreate(savedState);
       setTheme(R.style.CustomActivityThemeNoActionBar);
-      setContentView(R.layout.layout);
+      setContentView(R.layout.main);
       markButton(mSize);
 
       restorePreferences();
@@ -103,14 +103,6 @@ public class RubikActivity extends AppCompatActivity implements RubikSettings.On
       return mSize;
       }
 
-///////////////////////////////////////////////////////////////////////////////////////////////////
-
-    public void Scramble(View v)
-      {
-      RubikSurfaceView view = findViewById(R.id.rubikSurfaceView);
-      view.getRenderer().scrambleCube();
-      }
-
 ///////////////////////////////////////////////////////////////////////////////////////////////////
 
     public void Settings(View v)
@@ -127,6 +119,29 @@ public class RubikActivity extends AppCompatActivity implements RubikSettings.On
       settings.show(getSupportFragmentManager(), null);
       }
 
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+    public void Credits(View v)
+      {
+      RubikCredits credits = new RubikCredits();
+      credits.show(getSupportFragmentManager(), null);
+      }
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+    public void Scramble(View v)
+      {
+      RubikSurfaceView view = findViewById(R.id.rubikSurfaceView);
+      view.getRenderer().scrambleCube();
+      }
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+    public void Solve(View v)
+      {
+
+      }
+
 ///////////////////////////////////////////////////////////////////////////////////////////////////
 
     public void onComplete(int aP, int dP, int aT, int dT)
@@ -216,9 +231,16 @@ public class RubikActivity extends AppCompatActivity implements RubikSettings.On
      RubikSurfaceView view = findViewById(R.id.rubikSurfaceView);
      RubikRenderer renderer = view.getRenderer();
 
-     renderer.setAppearDuration(mAppearPos*100 +1);
-     renderer.setDisappearDuration(mDisappearPos*100 +1);
+     renderer.setAppearDuration(translateDuration(mAppearPos)+1);
+     renderer.setDisappearDuration(translateDuration(mDisappearPos) +1);
      renderer.setAppearType(AppearEffect.getType(mAppearType));
      renderer.setDisappearType(DisappearEffect.getType(mDisappearType));
      }
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+   public static int translateDuration(int pos)
+     {
+     return (pos/2)*100;
+     }
 }
diff --git a/src/main/java/org/distorted/magic/RubikCredits.java b/src/main/java/org/distorted/magic/RubikCredits.java
new file mode 100644
index 00000000..64ecd857
--- /dev/null
+++ b/src/main/java/org/distorted/magic/RubikCredits.java
@@ -0,0 +1,61 @@
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// Copyright 2019 Leszek Koltunski                                                               //
+//                                                                                               //
+// This file is part of Distorted.                                                               //
+//                                                                                               //
+// Distorted is free software: you can redistribute it and/or modify                             //
+// it under the terms of the GNU General Public License as published by                          //
+// the Free Software Foundation, either version 2 of the License, or                             //
+// (at your option) any later version.                                                           //
+//                                                                                               //
+// Distorted is distributed in the hope that it will be useful,                                  //
+// but WITHOUT ANY WARRANTY; without even the implied warranty of                                //
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the                                 //
+// GNU General Public License for more details.                                                  //
+//                                                                                               //
+// You should have received a copy of the GNU General Public License                             //
+// along with Distorted.  If not, see <http://www.gnu.org/licenses/>.                            //
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+package org.distorted.magic;
+
+import android.app.Dialog;
+import android.content.DialogInterface;
+import android.os.Bundle;
+import android.support.annotation.NonNull;
+import android.support.v4.app.FragmentActivity;
+import android.support.v7.app.AlertDialog;
+import android.support.v7.app.AppCompatDialogFragment;
+import android.view.LayoutInflater;
+import android.view.View;
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+public class RubikCredits extends AppCompatDialogFragment
+  {
+  @NonNull
+  @Override
+  public Dialog onCreateDialog(Bundle savedInstanceState)
+    {
+    FragmentActivity act = getActivity();
+    AlertDialog.Builder builder = new AlertDialog.Builder(act);
+
+    builder.setTitle(R.string.app_name);
+    builder.setIcon(R.drawable.logo);
+    builder.setCancelable(false);
+    builder.setPositiveButton( R.string.ok, new DialogInterface.OnClickListener()
+      {
+      @Override
+      public void onClick(DialogInterface dialog, int which)
+        {
+
+        }
+      });
+
+    LayoutInflater inflater = act.getLayoutInflater();
+    final View view = inflater.inflate(R.layout.credits, null);
+    builder.setView(view);
+
+    return builder.create();
+    }
+  }
diff --git a/src/main/java/org/distorted/magic/RubikSettings.java b/src/main/java/org/distorted/magic/RubikSettings.java
index de4afd27..1f7c7c26 100644
--- a/src/main/java/org/distorted/magic/RubikSettings.java
+++ b/src/main/java/org/distorted/magic/RubikSettings.java
@@ -34,6 +34,7 @@ import android.widget.AdapterView;
 import android.widget.ArrayAdapter;
 import android.widget.SeekBar;
 import android.widget.Spinner;
+import android.widget.TextView;
 
 import org.distorted.effect.AppearEffect;
 import org.distorted.effect.DisappearEffect;
@@ -52,6 +53,8 @@ public class RubikSettings extends AppCompatDialogFragment implements SeekBar.On
   private int mAppearPos, mDisappearPos;
   private int mAppearType, mDisappearType;
 
+  private TextView mAppearDuration, mDisappearDuration;
+
 ///////////////////////////////////////////////////////////////////////////////////////////////////
 
   @Override
@@ -87,10 +90,10 @@ public class RubikSettings extends AppCompatDialogFragment implements SeekBar.On
       }
     catch(NullPointerException ex)
       {
-      mAppearPos     = 10;
-      mDisappearPos  = 10;
-      mAppearType    =  1;
-      mDisappearType =  1;
+      mAppearPos     = RubikActivity.DEFAULT_APPEAR_POS;
+      mDisappearPos  = RubikActivity.DEFAULT_DISAPPEAR_POS;
+      mAppearType    = RubikActivity.DEFAULT_APPEAR_TYPE;
+      mDisappearType = RubikActivity.DEFAULT_DISAPPEAR_TYPE;
       }
     }
 
@@ -117,6 +120,9 @@ public class RubikSettings extends AppCompatDialogFragment implements SeekBar.On
     final View view = inflater.inflate(R.layout.settings, null);
     builder.setView(view);
 
+    mAppearDuration    = view.findViewById(R.id.appearDurationText);
+    mDisappearDuration = view.findViewById(R.id.disappearDurationText);
+
     Spinner appearTypeSpinner  = view.findViewById(R.id.appearType);
 
     if( appearTypeSpinner!=null )
@@ -224,8 +230,12 @@ public class RubikSettings extends AppCompatDialogFragment implements SeekBar.On
       {
       switch (bar.getId())
         {
-        case R.id.appearDuration   : mAppearPos   = progress; break;
-        case R.id.disappearDuration: mDisappearPos= progress; break;
+        case R.id.appearDuration   : mAppearPos   = progress;
+                                     mAppearDuration.setText(RubikActivity.translateDuration(mAppearPos)+" ms");
+                                     break;
+        case R.id.disappearDuration: mDisappearPos= progress;
+                                     mDisappearDuration.setText(RubikActivity.translateDuration(mDisappearPos)+" ms");
+                                     break;
         }
       }
 
diff --git a/src/main/res/drawable/logo.png b/src/main/res/drawable/logo.png
new file mode 100644
index 00000000..8a0c2637
Binary files /dev/null and b/src/main/res/drawable/logo.png differ
diff --git a/src/main/res/layout/credits.xml b/src/main/res/layout/credits.xml
new file mode 100644
index 00000000..6cf7c843
--- /dev/null
+++ b/src/main/res/layout/credits.xml
@@ -0,0 +1,50 @@
+<?xml version="1.0" encoding="utf-8"?>
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    android:layout_width="match_parent"
+    android:layout_height="match_parent"
+    android:gravity="center_horizontal"
+    android:orientation="vertical">
+
+
+    <LinearLayout
+        android:layout_width="fill_parent"
+        android:layout_height="fill_parent"
+        android:gravity="center|fill_horizontal"
+        android:orientation="vertical">
+
+        <TextView
+            android:id="@+id/textView1"
+            android:layout_width="match_parent"
+            android:layout_height="fill_parent"
+            android:layout_weight="0.33"
+            android:layout_marginBottom="10dp"
+            android:layout_marginTop="50dp"
+            android:layout_marginLeft="20dp"
+            android:layout_marginRight="20dp"
+            android:text="@string/credits1"/>
+
+        <TextView
+            android:id="@+id/textView2"
+            android:layout_width="match_parent"
+            android:layout_height="fill_parent"
+            android:layout_weight="0.33"
+            android:layout_marginBottom="10dp"
+            android:layout_marginTop="10dp"
+            android:layout_marginLeft="20dp"
+            android:layout_marginRight="20dp"
+            android:text="@string/credits2"/>
+
+        <TextView
+            android:id="@+id/textView3"
+            android:layout_width="match_parent"
+            android:layout_height="fill_parent"
+            android:layout_weight="0.33"
+            android:layout_marginBottom="20dp"
+            android:layout_marginTop="10dp"
+            android:layout_marginLeft="20dp"
+            android:layout_marginRight="20dp"
+            android:text="@string/credits3"/>
+
+    </LinearLayout>
+
+</LinearLayout>
\ No newline at end of file
diff --git a/src/main/res/layout/layout.xml b/src/main/res/layout/layout.xml
deleted file mode 100644
index d416c5fd..00000000
--- a/src/main/res/layout/layout.xml
+++ /dev/null
@@ -1,68 +0,0 @@
-<?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" >
-
-         <Button
-            android:id="@+id/rubikSettings"
-            android:layout_width="wrap_content"
-            android:layout_height="64dp"
-            android:layout_weight="0.5"
-            android:onClick="Settings"
-            android:paddingLeft="5dp"
-            android:paddingRight="5dp"
-            android:text="@string/settings" />
-
-        <ImageButton
-            android:id="@+id/rubikSize2"
-            android:layout_width="64dp"
-            android:layout_height="wrap_content"
-            android:onClick="setSize"
-            android:paddingLeft="5dp"
-            android:paddingRight="5dp"
-            android:src="@drawable/button2"/>
-
-        <ImageButton
-            android:id="@+id/rubikSize3"
-            android:layout_width="64dp"
-            android:layout_height="wrap_content"
-            android:onClick="setSize"
-            android:paddingLeft="5dp"
-            android:paddingRight="5dp"
-            android:src="@drawable/button3"/>
-
-        <ImageButton
-            android:id="@+id/rubikSize4"
-            android:layout_width="64dp"
-            android:layout_height="wrap_content"
-            android:onClick="setSize"
-            android:paddingLeft="5dp"
-            android:paddingRight="5dp"
-            android:src="@drawable/button4"/>
-
-        <Button
-            android:id="@+id/rubikScramble"
-            android:layout_width="wrap_content"
-            android:layout_height="64dp"
-            android:layout_weight="0.5"
-            android:onClick="Scramble"
-            android:paddingLeft="5dp"
-            android:paddingRight="5dp"
-            android:text="@string/scramble" />
-
-    </LinearLayout>
-
-    <org.distorted.magic.RubikSurfaceView
-        android:id="@+id/rubikSurfaceView"
-        android:layout_width="fill_parent"
-        android:layout_height="0dp"
-        android:layout_weight="1" />
-
-</LinearLayout>
diff --git a/src/main/res/layout/main.xml b/src/main/res/layout/main.xml
new file mode 100644
index 00000000..026e4849
--- /dev/null
+++ b/src/main/res/layout/main.xml
@@ -0,0 +1,68 @@
+<?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" >
+
+         <Button
+            android:id="@+id/rubikSettings"
+            android:layout_width="wrap_content"
+            android:layout_height="64dp"
+            android:layout_weight="0.5"
+            android:onClick="Settings"
+            android:paddingLeft="5dp"
+            android:paddingRight="5dp"
+            android:text="@string/settings" />
+
+        <ImageButton
+            android:id="@+id/rubikSize2"
+            android:layout_width="64dp"
+            android:layout_height="wrap_content"
+            android:onClick="setSize"
+            android:paddingLeft="5dp"
+            android:paddingRight="5dp"
+            android:src="@drawable/button2"/>
+
+        <ImageButton
+            android:id="@+id/rubikSize3"
+            android:layout_width="64dp"
+            android:layout_height="wrap_content"
+            android:onClick="setSize"
+            android:paddingLeft="5dp"
+            android:paddingRight="5dp"
+            android:src="@drawable/button3"/>
+
+        <ImageButton
+            android:id="@+id/rubikSize4"
+            android:layout_width="64dp"
+            android:layout_height="wrap_content"
+            android:onClick="setSize"
+            android:paddingLeft="5dp"
+            android:paddingRight="5dp"
+            android:src="@drawable/button4"/>
+
+        <Button
+            android:id="@+id/rubikCredits"
+            android:layout_width="wrap_content"
+            android:layout_height="64dp"
+            android:layout_weight="0.5"
+            android:onClick="Credits"
+            android:paddingLeft="5dp"
+            android:paddingRight="5dp"
+            android:text="@string/credits" />
+
+    </LinearLayout>
+
+    <org.distorted.magic.RubikSurfaceView
+        android:id="@+id/rubikSurfaceView"
+        android:layout_width="fill_parent"
+        android:layout_height="0dp"
+        android:layout_weight="1" />
+
+</LinearLayout>
diff --git a/src/main/res/layout/settings.xml b/src/main/res/layout/settings.xml
index c129dc65..ac2d4650 100644
--- a/src/main/res/layout/settings.xml
+++ b/src/main/res/layout/settings.xml
@@ -7,31 +7,69 @@
 
     <TextView
         android:layout_width="fill_parent"
-        android:layout_height="48dp"
+        android:layout_height="64dp"
         android:paddingStart="15dp"
         android:paddingEnd="15dp"
-        android:gravity="start|bottom"
+        android:gravity="start|center"
         android:text="@string/disappear"
         android:textAppearance="?android:attr/textAppearanceMedium" />
 
     <LinearLayout
         android:layout_width="fill_parent"
-        android:layout_height="48dp"
+        android:layout_height="40dp"
         android:gravity="center|fill_horizontal"
         android:orientation="horizontal">
 
+        <TextView
+            android:layout_weight="0.25"
+            android:layout_width="0dp"
+            android:layout_height="fill_parent"
+            android:paddingStart="5dp"
+            android:paddingEnd="5dp"
+            android:gravity="start|center"
+            android:text="@string/duration"
+            android:textAppearance="?android:attr/textAppearanceSmall" />
+
+        <TextView
+            android:id="@+id/disappearDurationText"
+            android:layout_weight="0.25"
+            android:layout_width="0dp"
+            android:layout_height="fill_parent"
+            android:paddingStart="5dp"
+            android:paddingEnd="5dp"
+            android:gravity="end|center"
+            android:textAppearance="?android:attr/textAppearanceSmall" />
+
         <SeekBar
             android:id="@+id/disappearDuration"
-            android:layout_weight="0.6"
-            android:layout_width="fill_parent"
+            android:layout_weight="0.5"
+            android:layout_width="0dp"
             android:layout_height="fill_parent"
             android:paddingLeft="10dp"
             android:paddingRight="10dp" />
 
+    </LinearLayout>
+
+    <LinearLayout
+        android:layout_width="fill_parent"
+        android:layout_height="40dp"
+        android:gravity="center|fill_horizontal"
+        android:orientation="horizontal">
+
+        <TextView
+            android:layout_weight="0.5"
+            android:layout_width="0dp"
+            android:layout_height="fill_parent"
+            android:paddingStart="5dp"
+            android:paddingEnd="5dp"
+            android:gravity="start|center"
+            android:text="@string/type"
+            android:textAppearance="?android:attr/textAppearanceSmall" />
+
         <Spinner
             android:id="@+id/disappearType"
-            android:layout_weight="0.4"
-            android:layout_width="fill_parent"
+            android:layout_weight="0.5"
+            android:layout_width="0dp"
             android:layout_height="fill_parent"
             android:textAlignment="center"
             android:paddingLeft="10dp"
@@ -44,28 +82,66 @@
         android:layout_height="48dp"
         android:paddingStart="15dp"
         android:paddingEnd="15dp"
-        android:gravity="start|bottom"
+        android:gravity="start|center"
         android:text="@string/appear"
         android:textAppearance="?android:attr/textAppearanceMedium" />
 
     <LinearLayout
         android:layout_width="fill_parent"
-        android:layout_height="48dp"
+        android:layout_height="40dp"
         android:gravity="center|fill_horizontal"
         android:orientation="horizontal">
 
+        <TextView
+            android:layout_weight="0.25"
+            android:layout_width="0dp"
+            android:layout_height="fill_parent"
+            android:paddingStart="5dp"
+            android:paddingEnd="5dp"
+            android:gravity="start|center"
+            android:text="@string/duration"
+            android:textAppearance="?android:attr/textAppearanceSmall" />
+
+        <TextView
+            android:id="@+id/appearDurationText"
+            android:layout_weight="0.25"
+            android:layout_width="0dp"
+            android:layout_height="fill_parent"
+            android:paddingStart="5dp"
+            android:paddingEnd="5dp"
+            android:gravity="end|center"
+            android:textAppearance="?android:attr/textAppearanceSmall" />
+
         <SeekBar
             android:id="@+id/appearDuration"
-            android:layout_weight="0.6"
-            android:layout_width="fill_parent"
+            android:layout_weight="0.5"
+            android:layout_width="0dp"
             android:layout_height="fill_parent"
             android:paddingLeft="10dp"
             android:paddingRight="10dp" />
 
+    </LinearLayout>
+
+    <LinearLayout
+        android:layout_width="fill_parent"
+        android:layout_height="40dp"
+        android:gravity="center|fill_horizontal"
+        android:orientation="horizontal">
+
+        <TextView
+            android:layout_weight="0.5"
+            android:layout_width="0dp"
+            android:layout_height="fill_parent"
+            android:paddingStart="5dp"
+            android:paddingEnd="5dp"
+            android:gravity="start|center"
+            android:text="@string/type"
+            android:textAppearance="?android:attr/textAppearanceSmall" />
+
         <Spinner
             android:id="@+id/appearType"
-            android:layout_weight="0.4"
-            android:layout_width="fill_parent"
+            android:layout_weight="0.5"
+            android:layout_width="0dp"
             android:layout_height="fill_parent"
             android:textAlignment="center"
             android:paddingLeft="10dp"
diff --git a/src/main/res/values/strings.xml b/src/main/res/values/strings.xml
index 2d9cc32a..1339a57b 100644
--- a/src/main/res/values/strings.xml
+++ b/src/main/res/values/strings.xml
@@ -1,8 +1,17 @@
 <resources>
     <string name="app_name">Magic Cube</string>
+    <string name="distorted">DISTORTED</string>
     <string name="scramble">Scramble</string>
+    <string name="solve">Solve</string>
     <string name="settings">Settings</string>
+    <string name="credits">Credits</string>
     <string name="save">SAVE</string>
+    <string name="ok">OK</string>
     <string name="appear">Appear Effects</string>
     <string name="disappear">Disappear Effects</string>
+    <string name="duration">Duration:</string>
+    <string name="type">Type:</string>
+    <string name="credits1">Open Source app developed using the Distorted graphics library. </string>
+    <string name="credits2">Code, tutorials, how to write your own graphics effect: http://www.distorted.org/cube</string>
+    <string name="credits3">Distorted.org 2019</string>
 </resources>
