commit 6647b730cf3ad5392d4c8e263e0d88c09c2a9e49
Author: Leszek Koltunski <leszek@koltunski.pl>
Date:   Sat Apr 2 00:01:18 2022 +0200

    Bandaged 3x3: new dialog.

diff --git a/src/main/java/org/distorted/bandaged/BandagedCreatorObjectView.java b/src/main/java/org/distorted/bandaged/BandagedCreatorObjectView.java
index 109bac2e..39df4d51 100644
--- a/src/main/java/org/distorted/bandaged/BandagedCreatorObjectView.java
+++ b/src/main/java/org/distorted/bandaged/BandagedCreatorObjectView.java
@@ -19,10 +19,12 @@
 
 package org.distorted.bandaged;
 
+import android.os.Bundle;
 import android.view.LayoutInflater;
 import android.view.View;
 import android.widget.LinearLayout;
 
+import org.distorted.dialogs.RubikDialogBandagedDelete;
 import org.distorted.helpers.TransparentButton;
 import org.distorted.helpers.TransparentImageButton;
 import org.distorted.main.R;
@@ -88,7 +90,11 @@ public class BandagedCreatorObjectView
       @Override
       public void onClick(View v)
         {
-        act.deleteObject(mName);
+        Bundle bundle = new Bundle();
+        bundle.putString("name", mName );
+        RubikDialogBandagedDelete dialog = new RubikDialogBandagedDelete();
+        dialog.setArguments(bundle);
+        dialog.show( act.getSupportFragmentManager(), RubikDialogBandagedDelete.getDialogTag() );
         }
       });
     }
diff --git a/src/main/java/org/distorted/bandaged/BandagedCreatorRenderer.java b/src/main/java/org/distorted/bandaged/BandagedCreatorRenderer.java
index 6098ad7f..42fd9172 100644
--- a/src/main/java/org/distorted/bandaged/BandagedCreatorRenderer.java
+++ b/src/main/java/org/distorted/bandaged/BandagedCreatorRenderer.java
@@ -27,7 +27,7 @@ import android.opengl.GLES31;
 import android.opengl.GLSurfaceView;
 import android.widget.Toast;
 
-import org.distorted.dialogs.RubikDialogSaveBandaged;
+import org.distorted.dialogs.RubikDialogBandagedSave;
 import org.distorted.library.effect.PostprocessEffectBorder;
 import org.distorted.library.main.DistortedEffects;
 import org.distorted.library.main.DistortedFramebuffer;
@@ -504,7 +504,7 @@ public class BandagedCreatorRenderer implements GLSurfaceView.Renderer, Distorte
    public void displaySavingDialog()
      {
      BandagedCreatorActivity act = (BandagedCreatorActivity)mView.getContext();
-     RubikDialogSaveBandaged saveDiag = new RubikDialogSaveBandaged();
+     RubikDialogBandagedSave saveDiag = new RubikDialogBandagedSave();
      saveDiag.show(act.getSupportFragmentManager(), null);
      }
 
diff --git a/src/main/java/org/distorted/dialogs/RubikDialogBandagedDelete.java b/src/main/java/org/distorted/dialogs/RubikDialogBandagedDelete.java
new file mode 100644
index 00000000..b610a7ab
--- /dev/null
+++ b/src/main/java/org/distorted/dialogs/RubikDialogBandagedDelete.java
@@ -0,0 +1,139 @@
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// Copyright 2022 Leszek Koltunski                                                               //
+//                                                                                               //
+// This file is part of Magic Cube.                                                              //
+//                                                                                               //
+// Magic Cube 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.                                                           //
+//                                                                                               //
+// Magic Cube 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 Magic Cube.  If not, see <http://www.gnu.org/licenses/>.                           //
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+package org.distorted.dialogs;
+
+import android.app.Dialog;
+import android.content.DialogInterface;
+import android.os.Bundle;
+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 androidx.annotation.NonNull;
+import androidx.appcompat.app.AlertDialog;
+import androidx.appcompat.app.AppCompatDialogFragment;
+import androidx.fragment.app.FragmentActivity;
+
+import org.distorted.bandaged.BandagedCreatorActivity;
+import org.distorted.main.R;
+import org.distorted.main.RubikActivity;
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+public class RubikDialogBandagedDelete 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 * RubikActivity.MENU_BIG_TEXT_SIZE;
+    final float okSize   = displaymetrics.widthPixels * RubikActivity.DIALOG_BUTTON_SIZE;
+
+    TextView tv = (TextView) inflater.inflate(R.layout.dialog_title, null);
+    tv.setTextSize(TypedValue.COMPLEX_UNIT_PX, titleSize);
+    tv.setText( R.string.delete_object );
+    builder.setCustomTitle(tv);
+
+    final View view = inflater.inflate(R.layout.dialog_delete_object, null);
+
+    TextView save = view.findViewById(R.id.delete_object_text);
+    save.setTextSize(TypedValue.COMPLEX_UNIT_PX, titleSize);
+
+    builder.setCancelable(true);
+
+    Bundle args = getArguments();
+    String name;
+
+    try
+      {
+      name = args.getString("name");
+      }
+    catch(Exception e)
+      {
+      name = "";
+      }
+    final String objectName = name;
+
+    builder.setPositiveButton( R.string.yes, new DialogInterface.OnClickListener()
+      {
+      @Override
+      public void onClick(DialogInterface dialog, int which)
+        {
+        BandagedCreatorActivity bact = (BandagedCreatorActivity)getContext();
+
+        if( bact!=null )
+          {
+          bact.deleteObject(objectName);
+          }
+        }
+      });
+
+    builder.setNegativeButton( R.string.no, new DialogInterface.OnClickListener()
+      {
+      @Override
+      public void onClick(DialogInterface dialog, int which)
+        {
+        // empty
+        }
+      });
+
+    builder.setView(view);
+    final Dialog dialog = builder.create();
+
+    dialog.setCanceledOnTouchOutside(false);
+    Window window = dialog.getWindow();
+
+    if( window!=null )
+      {
+      window.getDecorView().setSystemUiVisibility(RubikActivity.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);
+        Button btnNegative = ((AlertDialog)dialog).getButton(Dialog.BUTTON_NEGATIVE);
+        btnNegative.setTextSize(TypedValue.COMPLEX_UNIT_PX, okSize);
+        }
+      });
+
+    return dialog;
+    }
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+  public static String getDialogTag()
+    {
+    return "DialogBandagedDelete";
+    }
+  }
diff --git a/src/main/java/org/distorted/dialogs/RubikDialogBandagedSave.java b/src/main/java/org/distorted/dialogs/RubikDialogBandagedSave.java
new file mode 100644
index 00000000..cc21373a
--- /dev/null
+++ b/src/main/java/org/distorted/dialogs/RubikDialogBandagedSave.java
@@ -0,0 +1,122 @@
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// Copyright 2022 Leszek Koltunski                                                               //
+//                                                                                               //
+// This file is part of Magic Cube.                                                              //
+//                                                                                               //
+// Magic Cube 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.                                                           //
+//                                                                                               //
+// Magic Cube 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 Magic Cube.  If not, see <http://www.gnu.org/licenses/>.                           //
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+package org.distorted.dialogs;
+
+import android.app.Dialog;
+import android.content.DialogInterface;
+import android.os.Bundle;
+import android.util.DisplayMetrics;
+import android.util.TypedValue;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.Window;
+import android.view.WindowManager;
+import android.widget.Button;
+import android.widget.TextView;
+
+import androidx.annotation.NonNull;
+import androidx.appcompat.app.AlertDialog;
+import androidx.appcompat.app.AppCompatDialogFragment;
+import androidx.fragment.app.FragmentActivity;
+
+import org.distorted.bandaged.BandagedCreatorActivity;
+import org.distorted.bandaged.BandagedCreatorRenderer;
+import org.distorted.main.R;
+import org.distorted.main.RubikActivity;
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+public class RubikDialogBandagedSave 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 * RubikActivity.MENU_BIG_TEXT_SIZE;
+    final float okSize   = displaymetrics.widthPixels * RubikActivity.DIALOG_BUTTON_SIZE;
+
+    TextView tv = (TextView) inflater.inflate(R.layout.dialog_title, null);
+    tv.setTextSize(TypedValue.COMPLEX_UNIT_PX, titleSize);
+    tv.setText( R.string.save_object );
+    builder.setCustomTitle(tv);
+
+    final View view = inflater.inflate(R.layout.dialog_save_object, null);
+
+    TextView save = view.findViewById(R.id.save_object_text);
+    save.setTextSize(TypedValue.COMPLEX_UNIT_PX, titleSize);
+
+    builder.setCancelable(true);
+
+    builder.setPositiveButton( R.string.yes, new DialogInterface.OnClickListener()
+      {
+      @Override
+      public void onClick(DialogInterface dialog, int which)
+        {
+        BandagedCreatorActivity bact = (BandagedCreatorActivity)getContext();
+
+        if( bact!=null )
+          {
+          BandagedCreatorRenderer rend = bact.getRenderer();
+          rend.saveObject();
+          }
+        }
+      });
+
+    builder.setNegativeButton( R.string.no, new DialogInterface.OnClickListener()
+      {
+      @Override
+      public void onClick(DialogInterface dialog, int which)
+        {
+        // empty
+        }
+      });
+
+    builder.setView(view);
+    final Dialog dialog = builder.create();
+
+    dialog.setCanceledOnTouchOutside(false);
+    Window window = dialog.getWindow();
+
+    if( window!=null )
+      {
+      window.getDecorView().setSystemUiVisibility(RubikActivity.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);
+        Button btnNegative = ((AlertDialog)dialog).getButton(Dialog.BUTTON_NEGATIVE);
+        btnNegative.setTextSize(TypedValue.COMPLEX_UNIT_PX, okSize);
+        }
+      });
+
+    return dialog;
+    }
+  }
diff --git a/src/main/java/org/distorted/dialogs/RubikDialogSaveBandaged.java b/src/main/java/org/distorted/dialogs/RubikDialogSaveBandaged.java
deleted file mode 100644
index cbc4e7b0..00000000
--- a/src/main/java/org/distorted/dialogs/RubikDialogSaveBandaged.java
+++ /dev/null
@@ -1,122 +0,0 @@
-///////////////////////////////////////////////////////////////////////////////////////////////////
-// Copyright 2022 Leszek Koltunski                                                               //
-//                                                                                               //
-// This file is part of Magic Cube.                                                              //
-//                                                                                               //
-// Magic Cube 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.                                                           //
-//                                                                                               //
-// Magic Cube 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 Magic Cube.  If not, see <http://www.gnu.org/licenses/>.                           //
-///////////////////////////////////////////////////////////////////////////////////////////////////
-
-package org.distorted.dialogs;
-
-import android.app.Dialog;
-import android.content.DialogInterface;
-import android.os.Bundle;
-import android.util.DisplayMetrics;
-import android.util.TypedValue;
-import android.view.LayoutInflater;
-import android.view.View;
-import android.view.Window;
-import android.view.WindowManager;
-import android.widget.Button;
-import android.widget.TextView;
-
-import androidx.annotation.NonNull;
-import androidx.appcompat.app.AlertDialog;
-import androidx.appcompat.app.AppCompatDialogFragment;
-import androidx.fragment.app.FragmentActivity;
-
-import org.distorted.bandaged.BandagedCreatorActivity;
-import org.distorted.bandaged.BandagedCreatorRenderer;
-import org.distorted.main.R;
-import org.distorted.main.RubikActivity;
-
-///////////////////////////////////////////////////////////////////////////////////////////////////
-
-public class RubikDialogSaveBandaged 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 * RubikActivity.MENU_BIG_TEXT_SIZE;
-    final float okSize   = displaymetrics.widthPixels * RubikActivity.DIALOG_BUTTON_SIZE;
-
-    TextView tv = (TextView) inflater.inflate(R.layout.dialog_title, null);
-    tv.setTextSize(TypedValue.COMPLEX_UNIT_PX, titleSize);
-    tv.setText( R.string.save_object );
-    builder.setCustomTitle(tv);
-
-    final View view = inflater.inflate(R.layout.dialog_save_object, null);
-
-    TextView save = view.findViewById(R.id.save_object_text);
-    save.setTextSize(TypedValue.COMPLEX_UNIT_PX, titleSize);
-
-    builder.setCancelable(true);
-
-    builder.setPositiveButton( R.string.yes, new DialogInterface.OnClickListener()
-      {
-      @Override
-      public void onClick(DialogInterface dialog, int which)
-        {
-        BandagedCreatorActivity bact = (BandagedCreatorActivity)getContext();
-
-        if( bact!=null )
-          {
-          BandagedCreatorRenderer rend = bact.getRenderer();
-          rend.saveObject();
-          }
-        }
-      });
-
-    builder.setNegativeButton( R.string.no, new DialogInterface.OnClickListener()
-      {
-      @Override
-      public void onClick(DialogInterface dialog, int which)
-        {
-        // empty
-        }
-      });
-
-    builder.setView(view);
-    final Dialog dialog = builder.create();
-
-    dialog.setCanceledOnTouchOutside(false);
-    Window window = dialog.getWindow();
-
-    if( window!=null )
-      {
-      window.getDecorView().setSystemUiVisibility(RubikActivity.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);
-        Button btnNegative = ((AlertDialog)dialog).getButton(Dialog.BUTTON_NEGATIVE);
-        btnNegative.setTextSize(TypedValue.COMPLEX_UNIT_PX, okSize);
-        }
-      });
-
-    return dialog;
-    }
-  }
diff --git a/src/main/res/layout/dialog_delete_object.xml b/src/main/res/layout/dialog_delete_object.xml
new file mode 100644
index 00000000..76f51bd4
--- /dev/null
+++ b/src/main/res/layout/dialog_delete_object.xml
@@ -0,0 +1,31 @@
+<?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:layout_marginLeft="10dp"
+        android:layout_marginRight="10dp"
+        android:layout_marginTop="0dp"
+        android:background="@color/grey"
+        android:orientation="vertical">
+
+         <TextView
+            android:id="@+id/delete_object_text"
+            android:layout_width="match_parent"
+            android:layout_height="match_parent"
+            android:gravity="center"
+            android:textSize="24sp"
+            android:layout_marginTop="10dp"
+            android:layout_marginLeft="10dp"
+            android:layout_marginRight="10dp"
+            android:layout_marginBottom="10dp"
+            android:text="@string/delete_object_really"/>
+
+    </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 646c6bdf..84c06ec9 100644
--- a/src/main/res/values/strings.xml
+++ b/src/main/res/values/strings.xml
@@ -40,6 +40,8 @@
     <string name="level_full">Full Scramble</string>
     <string name="save_object">Save</string>
     <string name="save_object_really">Do you want to save this Cube?</string>
+    <string name="delete_object">Delete</string>
+    <string name="delete_object_really">Do you want to delete this Cube?</string>
 
     <string name="scores">High Scores</string>
     <string name="patterns">Pretty Patterns</string>
