commit 3e26ff354215fad5ee77203fde09d7c31c0dc23f
Author: Leszek Koltunski <leszek@koltunski.pl>
Date:   Mon Jul 25 00:07:17 2022 +0200

    About Dialog

diff --git a/distorted-sokoban/src/main/java/helpers/TransparentButton.java b/distorted-sokoban/src/main/java/helpers/TransparentButton.java
deleted file mode 100644
index 7611522..0000000
--- a/distorted-sokoban/src/main/java/helpers/TransparentButton.java
+++ /dev/null
@@ -1,46 +0,0 @@
-///////////////////////////////////////////////////////////////////////////////////////////////////
-// Copyright 2020 Leszek Koltunski                                                               //
-//                                                                                               //
-// This file is part of Magic Cube.                                                              //
-//                                                                                               //
-// Magic Cube is proprietary software licensed under an EULA which you should have received      //
-// along with the code. If not, check https://distorted.org/magic/License-Magic-Cube.html        //
-///////////////////////////////////////////////////////////////////////////////////////////////////
-
-package helpers;
-
-import android.annotation.SuppressLint;
-import android.content.Context;
-import android.util.TypedValue;
-import android.widget.LinearLayout;
-
-import com.google.android.material.button.MaterialButton;
-
-///////////////////////////////////////////////////////////////////////////////////////////////////
-
-@SuppressLint("ViewConstructor")
-public class TransparentButton extends MaterialButton
-{
-   public TransparentButton(Context context, int resId, float textSize)
-      {
-      this(context, resId, textSize, 1.0f);
-      }
-
-///////////////////////////////////////////////////////////////////////////////////////////////////
-
-   public TransparentButton(Context context, int resId, float textSize, float weight)
-      {
-      super(context);
-
-      LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT,LinearLayout.LayoutParams.MATCH_PARENT, weight);
-
-      setLayoutParams(params);
-      setPadding(0,0,0,0);
-      setTextSize(TypedValue.COMPLEX_UNIT_PX, textSize);
-      setText(resId);
-
-      TypedValue outValue = new TypedValue();
-      context.getTheme().resolveAttribute(android.R.attr.selectableItemBackgroundBorderless, outValue, true);
-      setBackgroundResource(outValue.resourceId);
-      }
-}
diff --git a/distorted-sokoban/src/main/java/helpers/TransparentImageButton.java b/distorted-sokoban/src/main/java/helpers/TransparentImageButton.java
deleted file mode 100644
index d40a01e..0000000
--- a/distorted-sokoban/src/main/java/helpers/TransparentImageButton.java
+++ /dev/null
@@ -1,50 +0,0 @@
-///////////////////////////////////////////////////////////////////////////////////////////////////
-// Copyright 2020 Leszek Koltunski                                                               //
-//                                                                                               //
-// This file is part of Magic Cube.                                                              //
-//                                                                                               //
-// Magic Cube is proprietary software licensed under an EULA which you should have received      //
-// along with the code. If not, check https://distorted.org/magic/License-Magic-Cube.html        //
-///////////////////////////////////////////////////////////////////////////////////////////////////
-
-package helpers;
-
-import android.annotation.SuppressLint;
-import android.content.Context;
-import android.util.TypedValue;
-import android.widget.LinearLayout;
-
-import com.google.android.material.button.MaterialButton;
-
-///////////////////////////////////////////////////////////////////////////////////////////////////
-
-@SuppressLint("ViewConstructor")
-public class TransparentImageButton extends MaterialButton
-{
-  public static final int GRAVITY_START  = 0;
-  public static final int GRAVITY_MIDDLE = 1;
-  public static final int GRAVITY_END    = 2;
-
-///////////////////////////////////////////////////////////////////////////////////////////////////
-
-  public TransparentImageButton(Context context, int icon, int gravity, LinearLayout.LayoutParams params)
-    {
-    super(context);
-
-    setLayoutParams(params);
-    setPadding(0,0,0,0);
-    setIconResource(icon);
-    setIconTint(null);
-
-    switch(gravity)
-      {
-      case GRAVITY_START : setIconGravity(MaterialButton.ICON_GRAVITY_START     ); break;
-      case GRAVITY_MIDDLE: setIconGravity(MaterialButton.ICON_GRAVITY_TEXT_START); break;
-      case GRAVITY_END   : setIconGravity(MaterialButton.ICON_GRAVITY_END       ); break;
-      }
-
-    TypedValue outValue = new TypedValue();
-    context.getTheme().resolveAttribute(android.R.attr.selectableItemBackgroundBorderless, outValue, true);
-    setBackgroundResource(outValue.resourceId);
-    }
-}
diff --git a/distorted-sokoban/src/main/java/org/distorted/dialogs/SokobanDialogAbout.java b/distorted-sokoban/src/main/java/org/distorted/dialogs/SokobanDialogAbout.java
new file mode 100644
index 0000000..1fd9d25
--- /dev/null
+++ b/distorted-sokoban/src/main/java/org/distorted/dialogs/SokobanDialogAbout.java
@@ -0,0 +1,114 @@
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// Copyright 2022 Leszek Koltunski                                                               //
+//                                                                                               //
+// This file is part of Magic Sokoban.                                                           //
+//                                                                                               //
+// Magic Cube is proprietary software licensed under an EULA which you should have received      //
+// along with the code. If not, check https://distorted.org/magic/License-Magic-Cube.html        //
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+package org.distorted.dialogs;
+
+import android.app.Dialog;
+import android.content.DialogInterface;
+import android.content.pm.PackageInfo;
+import android.content.pm.PackageManager;
+import android.os.Bundle;
+import androidx.annotation.NonNull;
+import androidx.fragment.app.FragmentActivity;
+import androidx.appcompat.app.AlertDialog;
+import androidx.appcompat.app.AppCompatDialogFragment;
+
+import android.util.DisplayMetrics;
+import android.util.TypedValue;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.Window;
+import android.widget.Button;
+import android.widget.TextView;
+
+import org.distorted.sokoban.R;
+import org.distorted.sokoban.SokobanActivity;
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+public class SokobanDialogAbout extends AppCompatDialogFragment
+  {
+  @NonNull
+  @Override
+  public Dialog onCreateDialog(Bundle savedInstanceState)
+    {
+    FragmentActivity act = getActivity();
+    LayoutInflater inflater = act.getLayoutInflater();
+    AlertDialog.Builder builder = new AlertDialog.Builder(act);
+
+    DisplayMetrics displaymetrics = new DisplayMetrics();
+    act.getWindowManager().getDefaultDisplay().getMetrics(displaymetrics);
+    final float titleSize= displaymetrics.widthPixels * SokobanActivity.MENU_BIG_TEXT_SIZE;
+    final float okSize   = displaymetrics.widthPixels * SokobanActivity.DIALOG_BUTTON_SIZE;
+    final float textSize = displaymetrics.widthPixels * SokobanActivity.MENU_SMALL_TEXT_SIZE;
+
+    TextView tv = (TextView) inflater.inflate(R.layout.dialog_title, null);
+    tv.setTextSize(TypedValue.COMPLEX_UNIT_PX, titleSize);
+    tv.setText(R.string.about);
+    builder.setCustomTitle(tv);
+
+    builder.setCancelable(true);
+    builder.setPositiveButton( R.string.ok, new DialogInterface.OnClickListener()
+      {
+      @Override
+      public void onClick(DialogInterface dialog, int which)
+        {
+
+        }
+      });
+
+    final View view = inflater.inflate(R.layout.dialog_about, null);
+    TextView text = view.findViewById(R.id.about_version);
+    String appName = getString(R.string.app_name);
+
+    text.setTextSize(TypedValue.COMPLEX_UNIT_PX, textSize);
+    text.setText(getString(R.string.ap_placeholder,appName, getAppVers(act)));
+
+    TextView help = view.findViewById(R.id.about_help);
+    help.setTextSize(TypedValue.COMPLEX_UNIT_PX, textSize);
+
+    builder.setView(view);
+
+    Dialog dialog = builder.create();
+    dialog.setCanceledOnTouchOutside(false);
+    Window window = dialog.getWindow();
+
+    if( window!=null )
+      {
+      window.getDecorView().setSystemUiVisibility(SokobanActivity.FLAGS);
+      }
+
+    dialog.setOnShowListener(new DialogInterface.OnShowListener()
+      {
+      @Override
+      public void onShow(DialogInterface dialog)
+        {
+        Button btnPositive = ((AlertDialog)dialog).getButton(Dialog.BUTTON_POSITIVE);
+        btnPositive.setTextSize(TypedValue.COMPLEX_UNIT_PX, okSize);
+        }
+      });
+
+    return dialog;
+    }
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+  private String getAppVers(FragmentActivity act)
+    {
+    try
+      {
+      PackageInfo pInfo = act.getPackageManager().getPackageInfo( act.getPackageName(), 0);
+      return pInfo.versionName;
+      }
+    catch (PackageManager.NameNotFoundException e)
+      {
+      return "unknown";
+      }
+    }
+  }
diff --git a/distorted-sokoban/src/main/java/org/distorted/helpers/TransparentButton.java b/distorted-sokoban/src/main/java/org/distorted/helpers/TransparentButton.java
new file mode 100644
index 0000000..d6f5e67
--- /dev/null
+++ b/distorted-sokoban/src/main/java/org/distorted/helpers/TransparentButton.java
@@ -0,0 +1,46 @@
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// Copyright 2020 Leszek Koltunski                                                               //
+//                                                                                               //
+// This file is part of Magic Cube.                                                              //
+//                                                                                               //
+// Magic Cube is proprietary software licensed under an EULA which you should have received      //
+// along with the code. If not, check https://distorted.org/magic/License-Magic-Cube.html        //
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+package org.distorted.helpers;
+
+import android.annotation.SuppressLint;
+import android.content.Context;
+import android.util.TypedValue;
+import android.widget.LinearLayout;
+
+import com.google.android.material.button.MaterialButton;
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+@SuppressLint("ViewConstructor")
+public class TransparentButton extends MaterialButton
+{
+   public TransparentButton(Context context, int resId, float textSize)
+      {
+      this(context, resId, textSize, 1.0f);
+      }
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+   public TransparentButton(Context context, int resId, float textSize, float weight)
+      {
+      super(context);
+
+      LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT,LinearLayout.LayoutParams.MATCH_PARENT, weight);
+
+      setLayoutParams(params);
+      setPadding(0,0,0,0);
+      setTextSize(TypedValue.COMPLEX_UNIT_PX, textSize);
+      setText(resId);
+
+      TypedValue outValue = new TypedValue();
+      context.getTheme().resolveAttribute(android.R.attr.selectableItemBackgroundBorderless, outValue, true);
+      setBackgroundResource(outValue.resourceId);
+      }
+}
diff --git a/distorted-sokoban/src/main/java/org/distorted/helpers/TransparentImageButton.java b/distorted-sokoban/src/main/java/org/distorted/helpers/TransparentImageButton.java
new file mode 100644
index 0000000..7fcaf6f
--- /dev/null
+++ b/distorted-sokoban/src/main/java/org/distorted/helpers/TransparentImageButton.java
@@ -0,0 +1,50 @@
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// Copyright 2020 Leszek Koltunski                                                               //
+//                                                                                               //
+// This file is part of Magic Cube.                                                              //
+//                                                                                               //
+// Magic Cube is proprietary software licensed under an EULA which you should have received      //
+// along with the code. If not, check https://distorted.org/magic/License-Magic-Cube.html        //
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+package org.distorted.helpers;
+
+import android.annotation.SuppressLint;
+import android.content.Context;
+import android.util.TypedValue;
+import android.widget.LinearLayout;
+
+import com.google.android.material.button.MaterialButton;
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+@SuppressLint("ViewConstructor")
+public class TransparentImageButton extends MaterialButton
+{
+  public static final int GRAVITY_START  = 0;
+  public static final int GRAVITY_MIDDLE = 1;
+  public static final int GRAVITY_END    = 2;
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+  public TransparentImageButton(Context context, int icon, int gravity, LinearLayout.LayoutParams params)
+    {
+    super(context);
+
+    setLayoutParams(params);
+    setPadding(0,0,0,0);
+    setIconResource(icon);
+    setIconTint(null);
+
+    switch(gravity)
+      {
+      case GRAVITY_START : setIconGravity(MaterialButton.ICON_GRAVITY_START     ); break;
+      case GRAVITY_MIDDLE: setIconGravity(MaterialButton.ICON_GRAVITY_TEXT_START); break;
+      case GRAVITY_END   : setIconGravity(MaterialButton.ICON_GRAVITY_END       ); break;
+      }
+
+    TypedValue outValue = new TypedValue();
+    context.getTheme().resolveAttribute(android.R.attr.selectableItemBackgroundBorderless, outValue, true);
+    setBackgroundResource(outValue.resourceId);
+    }
+}
diff --git a/distorted-sokoban/src/main/java/org/distorted/sokoban/SokobanActivity.java b/distorted-sokoban/src/main/java/org/distorted/sokoban/SokobanActivity.java
index 02d67ce..898e387 100644
--- a/distorted-sokoban/src/main/java/org/distorted/sokoban/SokobanActivity.java
+++ b/distorted-sokoban/src/main/java/org/distorted/sokoban/SokobanActivity.java
@@ -19,7 +19,6 @@
 
 package org.distorted.sokoban;
 
-import android.app.Activity;
 import android.os.Build;
 import android.os.Bundle;
 import android.util.DisplayMetrics;
@@ -33,16 +32,23 @@ import android.widget.GridView;
 import android.widget.LinearLayout;
 import android.widget.TextView;
 
-import helpers.TransparentImageButton;
+import androidx.appcompat.app.AppCompatActivity;
+
+import org.distorted.dialogs.SokobanDialogAbout;
+import org.distorted.helpers.TransparentImageButton;
 
 ///////////////////////////////////////////////////////////////////////////////////////////////////
 
-public class SokobanActivity extends Activity
+public class SokobanActivity extends AppCompatActivity
   {
   private static final float RATIO_BAR    = 0.10f;
   private static final float RATIO_INSET  = 0.09f;
   private static final float MENU_SIZE    = 0.05f;
 
+  public static final float MENU_BIG_TEXT_SIZE  = 0.05f;
+  public static final float MENU_SMALL_TEXT_SIZE= 0.035f;
+  public static final float DIALOG_BUTTON_SIZE  = 0.06f;
+
   public static final int FLAGS =  View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
                                  | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
                                  | View.SYSTEM_UI_FLAG_HIDE_NAVIGATION
@@ -53,7 +59,7 @@ public class SokobanActivity extends Activity
 
   private int mHeightUpperBar;
   private int mCurrentApiVersion;
-  private TransparentImageButton mRecordsButton, mExitButton;
+  private TransparentImageButton mRecordsButton, mAboutButton;
   private TextView mAppName;
 
 ///////////////////////////////////////////////////////////////////////////////////////////////////
@@ -158,8 +164,8 @@ public class SokobanActivity extends Activity
     upper.addView(mRecordsButton);
     setupAppName();
     upper.addView(mAppName);
-    setupExitButton();
-    upper.addView(mExitButton);
+    setupAboutButton();
+    upper.addView(mAboutButton);
     }
 
 ///////////////////////////////////////////////////////////////////////////////////////////////////
@@ -182,18 +188,19 @@ public class SokobanActivity extends Activity
 
 ///////////////////////////////////////////////////////////////////////////////////////////////////
 
-  private void setupExitButton()
+  private void setupAboutButton()
     {
-    final int icon = getDrawable(R.drawable.ui_exit_s,R.drawable.ui_exit_m, R.drawable.ui_exit_b, R.drawable.ui_exit_h);
+    final int icon = getDrawable(R.drawable.ui_info_s,R.drawable.ui_info_m, R.drawable.ui_info_b, R.drawable.ui_info_h);
     LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT,LinearLayout.LayoutParams.MATCH_PARENT,1.0f);
-    mExitButton = new TransparentImageButton(this, icon, TransparentImageButton.GRAVITY_MIDDLE, params);
+    mAboutButton = new TransparentImageButton(this, icon, TransparentImageButton.GRAVITY_MIDDLE, params);
 
-    mExitButton.setOnClickListener( new View.OnClickListener()
+    mAboutButton.setOnClickListener( new View.OnClickListener()
       {
       @Override
       public void onClick(View view)
         {
-        finish();
+        SokobanDialogAbout aDiag = new SokobanDialogAbout();
+        aDiag.show( getSupportFragmentManager(), null);
         }
       });
     }
diff --git a/distorted-sokoban/src/main/res/drawable-nodpi/ui_info_b.png b/distorted-sokoban/src/main/res/drawable-nodpi/ui_info_b.png
new file mode 100644
index 0000000..162c084
Binary files /dev/null and b/distorted-sokoban/src/main/res/drawable-nodpi/ui_info_b.png differ
diff --git a/distorted-sokoban/src/main/res/drawable-nodpi/ui_info_h.png b/distorted-sokoban/src/main/res/drawable-nodpi/ui_info_h.png
new file mode 100644
index 0000000..0d402b3
Binary files /dev/null and b/distorted-sokoban/src/main/res/drawable-nodpi/ui_info_h.png differ
diff --git a/distorted-sokoban/src/main/res/drawable-nodpi/ui_info_m.png b/distorted-sokoban/src/main/res/drawable-nodpi/ui_info_m.png
new file mode 100644
index 0000000..04fa5fa
Binary files /dev/null and b/distorted-sokoban/src/main/res/drawable-nodpi/ui_info_m.png differ
diff --git a/distorted-sokoban/src/main/res/drawable-nodpi/ui_info_s.png b/distorted-sokoban/src/main/res/drawable-nodpi/ui_info_s.png
new file mode 100644
index 0000000..ace371a
Binary files /dev/null and b/distorted-sokoban/src/main/res/drawable-nodpi/ui_info_s.png differ
diff --git a/distorted-sokoban/src/main/res/layout/dialog_about.xml b/distorted-sokoban/src/main/res/layout/dialog_about.xml
new file mode 100644
index 0000000..fd613ff
--- /dev/null
+++ b/distorted-sokoban/src/main/res/layout/dialog_about.xml
@@ -0,0 +1,39 @@
+<?xml version="1.0" encoding="utf-8"?>
+<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
+    android:layout_width="match_parent"
+    android:layout_height="match_parent">
+
+    <LinearLayout
+        android:layout_width="fill_parent"
+        android:layout_height="wrap_content"
+        android:gravity="center|fill_horizontal"
+        android:layout_marginLeft="10dp"
+        android:layout_marginRight="10dp"
+        android:layout_marginTop="0dp"
+        android:background="@color/grey"
+        android:orientation="vertical">
+
+        <TextView
+            android:id="@+id/about_version"
+            android:layout_width="match_parent"
+            android:layout_height="fill_parent"
+            android:layout_weight="0.40"
+            android:layout_marginTop="10dp"
+            android:layout_marginLeft="10dp"
+            android:layout_marginRight="10dp"
+            android:layout_marginBottom="10dp"/>
+
+        <TextView
+            android:id="@+id/about_help"
+            android:layout_width="match_parent"
+            android:layout_height="fill_parent"
+            android:layout_weight="0.80"
+            android:layout_marginTop="10dp"
+            android:layout_marginLeft="10dp"
+            android:layout_marginRight="10dp"
+            android:layout_marginBottom="10dp"
+            android:text="@string/helptxt"/>
+
+    </LinearLayout>
+
+</ScrollView>
\ No newline at end of file
diff --git a/distorted-sokoban/src/main/res/layout/dialog_title.xml b/distorted-sokoban/src/main/res/layout/dialog_title.xml
new file mode 100644
index 0000000..5b1fc0c
--- /dev/null
+++ b/distorted-sokoban/src/main/res/layout/dialog_title.xml
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="utf-8"?>
+<TextView xmlns:android="http://schemas.android.com/apk/res/android"
+  android:layout_width="match_parent"
+  android:layout_height="match_parent"
+  android:textSize="20sp"
+  android:gravity="center"
+  android:padding="10dp"/>
\ No newline at end of file
diff --git a/distorted-sokoban/src/main/res/layout/splash.xml b/distorted-sokoban/src/main/res/layout/splash.xml
deleted file mode 100644
index 18b6464..0000000
--- a/distorted-sokoban/src/main/res/layout/splash.xml
+++ /dev/null
@@ -1,24 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<RelativeLayout
-  xmlns:android="http://schemas.android.com/apk/res/android"
-  android:layout_width="fill_parent"
-  android:layout_height="fill_parent"
-  android:gravity="center"
-  android:background="#FFFFFF">
-  <ImageView 
-      android:id="@+id/splashimage"
-      android:src="@drawable/splash"
-      android:layout_gravity="center"
-      android:layout_width="wrap_content"
-      android:layout_height="wrap_content"
-      android:layout_centerHorizontal="true"/>
-  <TextView 
-  	  android:id="@+id/splashtext"
-  	  android:layout_width="wrap_content"
-      android:layout_height="wrap_content"
-      android:text="@string/splash"
-      android:textColor="#65bd45"
-      android:textSize="24dp"
-      android:layout_centerHorizontal="true"
-      android:layout_below="@id/splashimage"/>
-</RelativeLayout>
diff --git a/distorted-sokoban/src/main/res/values/strings.xml b/distorted-sokoban/src/main/res/values/strings.xml
index eacaad1..b7070a4 100644
--- a/distorted-sokoban/src/main/res/values/strings.xml
+++ b/distorted-sokoban/src/main/res/values/strings.xml
@@ -1,7 +1,6 @@
 <?xml version="1.0" encoding="utf-8"?>
 <resources>
     <string name="app_name">Magic Sokoban</string>
-    <string name="splash">ThreeDCell presents</string>
     <string name="error">Startup error!!</string>
     <string name="email">sokoban@koltunski.pl</string>
     <string name="level">Level</string>
@@ -9,7 +8,7 @@
     <string name="questions">Questions?</string>
     <string name="yourbest">Your best:</string>
     <string name="worldsbest">World\'s best:</string>
-    <string name="helptxt">Your goal is to move all the crates (yellow squares) to destination squares (marked with blue crosses). You can only push a crate, never pull it.\n\nYou can also create your own levels (go to Options -> Create New Level) and download levels created by others. Enjoy!</string>
+    <string name="helptxt">Your goal is to move all the crates (yellow squares) to destination squares (marked with blue crosses). You can only push a crate, never pull it.</string>
     <string name="newr">New Record</string>
     <string name="subm">Submit it online?</string>
     <string name="moves">moves</string>
@@ -68,4 +67,7 @@
     <string name="ods">of destination squares</string>
 
     <string name="level_image">Level Image</string>
+    <string name="about">About</string>
+
+    <string name="ap_placeholder">%1$s %2$s</string>
 </resources>
