commit f8a21f6be95ed2e948ae89f972fc57539d9b030f
Author: Leszek Koltunski <leszek@koltunski.pl>
Date:   Fri Jan 20 17:19:21 2023 +0100

    Unify all dialogs.

diff --git a/src/main/java/org/distorted/dialogs/RubikDialogAbandon.java b/src/main/java/org/distorted/dialogs/RubikDialogAbandon.java
index 22d0d2da..3288af94 100644
--- a/src/main/java/org/distorted/dialogs/RubikDialogAbandon.java
+++ b/src/main/java/org/distorted/dialogs/RubikDialogAbandon.java
@@ -10,12 +10,8 @@
 package org.distorted.dialogs;
 
 import android.app.Dialog;
-import android.content.DialogInterface;
-import android.util.TypedValue;
 import android.view.View;
-import android.widget.Button;
 
-import androidx.appcompat.app.AlertDialog;
 import androidx.fragment.app.FragmentActivity;
 
 import org.distorted.main.R;
@@ -26,63 +22,25 @@ import org.distorted.screens.ScreenList;
 
 public class RubikDialogAbandon extends RubikDialogAbstract
   {
-  public int getResource()
-    {
-    return R.layout.abandon_solve;
-    }
-
-///////////////////////////////////////////////////////////////////////////////////////////////////
-
-  public int getTitleResource()
-    {
-    return -1;
-    }
-
-///////////////////////////////////////////////////////////////////////////////////////////////////
-
-  public boolean hasArgument()
-    {
-    return false;
-    }
+  public int getResource()      { return R.layout.abandon_solve; }
+  public int getTitleResource() { return -1; }
+  public boolean hasArgument()  { return false; }
+  public int getPositive()      { return R.string.yes; }
+  public int getNegative()      { return R.string.no; }
 
 ///////////////////////////////////////////////////////////////////////////////////////////////////
 
-  public void setPositive(AlertDialog.Builder builder)
+  public void positiveAction()
     {
     final RubikActivity ract = (RubikActivity)getContext();
-
-    builder.setPositiveButton( R.string.yes, new DialogInterface.OnClickListener()
-      {
-      @Override
-      public void onClick(DialogInterface dialog, int which)
-        {
-        ScreenList.goBack(ract);
-        }
-      });
+    ScreenList.goBack(ract);
     }
 
 ///////////////////////////////////////////////////////////////////////////////////////////////////
 
-  public void setNegative(AlertDialog.Builder builder)
+  public void negativeAction()
     {
-    builder.setNegativeButton( R.string.no, new DialogInterface.OnClickListener()
-      {
-      @Override
-      public void onClick(DialogInterface dialog, int which)
-        {
 
-        }
-      });
-    }
-
-///////////////////////////////////////////////////////////////////////////////////////////////////
-
-  public void onShowDialog(DialogInterface dialog, float size)
-    {
-    Button btnPositive = ((AlertDialog)dialog).getButton(Dialog.BUTTON_POSITIVE);
-    btnPositive.setTextSize(TypedValue.COMPLEX_UNIT_PX, size);
-    Button btnNegative = ((AlertDialog)dialog).getButton(Dialog.BUTTON_NEGATIVE);
-    btnNegative.setTextSize(TypedValue.COMPLEX_UNIT_PX, size);
     }
 
 ///////////////////////////////////////////////////////////////////////////////////////////////////
diff --git a/src/main/java/org/distorted/dialogs/RubikDialogAbout.java b/src/main/java/org/distorted/dialogs/RubikDialogAbout.java
index c9f2b6e8..9d88c306 100644
--- a/src/main/java/org/distorted/dialogs/RubikDialogAbout.java
+++ b/src/main/java/org/distorted/dialogs/RubikDialogAbout.java
@@ -10,17 +10,14 @@
 package org.distorted.dialogs;
 
 import android.app.Dialog;
-import android.content.DialogInterface;
 import android.content.pm.PackageInfo;
 import android.content.pm.PackageManager;
 import androidx.fragment.app.FragmentActivity;
-import androidx.appcompat.app.AlertDialog;
 
 import android.text.method.LinkMovementMethod;
 import android.text.method.MovementMethod;
 import android.util.TypedValue;
 import android.view.View;
-import android.widget.Button;
 import android.widget.TextView;
 
 import org.distorted.main.R;
@@ -30,54 +27,26 @@ import org.distorted.main.RubikActivity;
 
 public class RubikDialogAbout extends RubikDialogAbstract
   {
-  public int getResource()
-    {
-    return R.layout.dialog_about;
-    }
-
-///////////////////////////////////////////////////////////////////////////////////////////////////
-
-  public int getTitleResource()
-    {
-    return R.string.about;
-    }
-
-///////////////////////////////////////////////////////////////////////////////////////////////////
-
-  public boolean hasArgument()
-    {
-    return false;
-    }
+  public int getResource()      { return R.layout.dialog_about; }
+  public int getTitleResource() { return R.string.about; }
+  public boolean hasArgument()  { return false; }
+  public int getPositive()      { return R.string.ok; }
+  public int getNegative()      { return -1; }
 
 ///////////////////////////////////////////////////////////////////////////////////////////////////
 
-  public void setPositive(AlertDialog.Builder builder)
+  public void positiveAction()
     {
-    builder.setPositiveButton( R.string.ok, new DialogInterface.OnClickListener()
-      {
-      @Override
-      public void onClick(DialogInterface dialog, int which)
-        {
 
-        }
-      });
     }
 
 ///////////////////////////////////////////////////////////////////////////////////////////////////
 
-  public void setNegative(AlertDialog.Builder builder)
+  public void negativeAction()
     {
 
     }
 
-///////////////////////////////////////////////////////////////////////////////////////////////////
-
-  public void onShowDialog(DialogInterface dialog, float size)
-    {
-    Button btnPositive = ((AlertDialog)dialog).getButton(Dialog.BUTTON_POSITIVE);
-    btnPositive.setTextSize(TypedValue.COMPLEX_UNIT_PX, size);
-    }
-
 ///////////////////////////////////////////////////////////////////////////////////////////////////
 
   public void prepareBody(Dialog dialog, View view, FragmentActivity act, float size)
@@ -86,7 +55,19 @@ public class RubikDialogAbout extends RubikDialogAbstract
     String appName = getString(R.string.app_name);
 
     text.setTextSize(TypedValue.COMPLEX_UNIT_PX, size);
-    text.setText(getString(R.string.ap_placeholder,appName, getAppVers(act)));
+
+    String version;
+    try
+      {
+      PackageInfo pInfo = act.getPackageManager().getPackageInfo( act.getPackageName(), 0);
+      version= pInfo.versionName;
+      }
+    catch (PackageManager.NameNotFoundException e)
+      {
+      version= "unknown";
+      }
+
+    text.setText(getString(R.string.ap_placeholder,appName, version));
 
     MovementMethod mm = LinkMovementMethod.getInstance();
     TextView text2 = view.findViewById(R.id.about_section2);
@@ -107,19 +88,4 @@ public class RubikDialogAbout extends RubikDialogAbstract
       text4.setVisibility(View.GONE);
       }
     }
-
-///////////////////////////////////////////////////////////////////////////////////////////////////
-
-  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/src/main/java/org/distorted/dialogs/RubikDialogAbstract.java b/src/main/java/org/distorted/dialogs/RubikDialogAbstract.java
index 75ae5435..9f5f3db0 100644
--- a/src/main/java/org/distorted/dialogs/RubikDialogAbstract.java
+++ b/src/main/java/org/distorted/dialogs/RubikDialogAbstract.java
@@ -17,6 +17,7 @@ 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;
@@ -39,10 +40,11 @@ abstract public class RubikDialogAbstract extends AppCompatDialogFragment
 
   abstract int getResource();
   abstract int getTitleResource();
+  abstract int getPositive();
+  abstract int getNegative();
   abstract boolean hasArgument();
-  abstract void setPositive(AlertDialog.Builder builder);
-  abstract void setNegative(AlertDialog.Builder builder);
-  abstract void onShowDialog(DialogInterface dialog, float size);
+  abstract void positiveAction();
+  abstract void negativeAction();
   abstract void prepareBody(Dialog dialog, View view, FragmentActivity act, float size);
 
 ///////////////////////////////////////////////////////////////////////////////////////////////////
@@ -91,8 +93,31 @@ abstract public class RubikDialogAbstract extends AppCompatDialogFragment
       builder.setCustomTitle(tv);
       }
 
-    setPositive(builder);
-    setNegative(builder);
+    int positive = getPositive();
+    if( positive>=0 )
+      {
+      builder.setPositiveButton( positive, new DialogInterface.OnClickListener()
+        {
+        @Override
+        public void onClick(DialogInterface dialog, int which)
+          {
+          positiveAction();
+          }
+        });
+      }
+
+    int negative = getNegative();
+    if( negative>=0 )
+      {
+      builder.setNegativeButton( positive, new DialogInterface.OnClickListener()
+        {
+        @Override
+        public void onClick(DialogInterface dialog, int which)
+          {
+          negativeAction();
+          }
+        });
+      }
 
     Dialog dialog = builder.create();
     dialog.setCanceledOnTouchOutside(false);
@@ -111,7 +136,16 @@ abstract public class RubikDialogAbstract extends AppCompatDialogFragment
       @Override
       public void onShow(DialogInterface dialog)
         {
-        onShowDialog(dialog,mButSize);
+        if( positive>=0 )
+          {
+          Button btnPositive = ((AlertDialog)dialog).getButton(Dialog.BUTTON_POSITIVE);
+          btnPositive.setTextSize(TypedValue.COMPLEX_UNIT_PX, mButSize);
+          }
+        if( negative>=0 )
+          {
+          Button btnNegative = ((AlertDialog)dialog).getButton(Dialog.BUTTON_NEGATIVE);
+          btnNegative.setTextSize(TypedValue.COMPLEX_UNIT_PX, mButSize);
+          }
         }
       });
 
diff --git a/src/main/java/org/distorted/dialogs/RubikDialogBandagedDelete.java b/src/main/java/org/distorted/dialogs/RubikDialogBandagedDelete.java
index 15b696fa..af0c4828 100644
--- a/src/main/java/org/distorted/dialogs/RubikDialogBandagedDelete.java
+++ b/src/main/java/org/distorted/dialogs/RubikDialogBandagedDelete.java
@@ -10,13 +10,10 @@
 package org.distorted.dialogs;
 
 import android.app.Dialog;
-import android.content.DialogInterface;
 import android.util.TypedValue;
 import android.view.View;
-import android.widget.Button;
 import android.widget.TextView;
 
-import androidx.appcompat.app.AlertDialog;
 import androidx.fragment.app.FragmentActivity;
 
 import org.distorted.bandaged.BandagedCreatorActivity;
@@ -26,64 +23,25 @@ import org.distorted.main.R;
 
 public class RubikDialogBandagedDelete extends RubikDialogAbstract
   {
-  public int getResource()
-    {
-    return R.layout.dialog_delete_object;
-    }
-
-///////////////////////////////////////////////////////////////////////////////////////////////////
-
-  public int getTitleResource()
-    {
-    return R.string.delete_object;
-    }
-
-///////////////////////////////////////////////////////////////////////////////////////////////////
-
-  public boolean hasArgument()
-    {
-    return true;
-    }
+  public int getResource()      { return R.layout.dialog_delete_object; }
+  public int getTitleResource() { return R.string.delete_object; }
+  public boolean hasArgument()  { return true; }
+  public int getPositive()      { return R.string.yes; }
+  public int getNegative()      { return R.string.no; }
 
 ///////////////////////////////////////////////////////////////////////////////////////////////////
 
-  public void setPositive(AlertDialog.Builder builder)
+  public void positiveAction()
     {
-    final String objectName = mArgument;
-
-    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);
-        }
-      });
+    BandagedCreatorActivity bact = (BandagedCreatorActivity)getContext();
+    if( bact!=null ) bact.deleteObject(mArgument);
     }
 
 ///////////////////////////////////////////////////////////////////////////////////////////////////
 
-  public void setNegative(AlertDialog.Builder builder)
+  public void negativeAction()
     {
-    builder.setNegativeButton( R.string.no, new DialogInterface.OnClickListener()
-      {
-      @Override
-      public void onClick(DialogInterface dialog, int which)
-        {
 
-        }
-      });
-    }
-
-///////////////////////////////////////////////////////////////////////////////////////////////////
-
-  public void onShowDialog(DialogInterface dialog, float size)
-    {
-    Button btnPositive = ((AlertDialog)dialog).getButton(Dialog.BUTTON_POSITIVE);
-    btnPositive.setTextSize(TypedValue.COMPLEX_UNIT_PX, size);
-    Button btnNegative = ((AlertDialog)dialog).getButton(Dialog.BUTTON_NEGATIVE);
-    btnNegative.setTextSize(TypedValue.COMPLEX_UNIT_PX, size);
     }
 
 ///////////////////////////////////////////////////////////////////////////////////////////////////
diff --git a/src/main/java/org/distorted/dialogs/RubikDialogBandagedSave.java b/src/main/java/org/distorted/dialogs/RubikDialogBandagedSave.java
index 4f76a889..f26382f3 100644
--- a/src/main/java/org/distorted/dialogs/RubikDialogBandagedSave.java
+++ b/src/main/java/org/distorted/dialogs/RubikDialogBandagedSave.java
@@ -10,13 +10,10 @@
 package org.distorted.dialogs;
 
 import android.app.Dialog;
-import android.content.DialogInterface;
 import android.util.TypedValue;
 import android.view.View;
-import android.widget.Button;
 import android.widget.TextView;
 
-import androidx.appcompat.app.AlertDialog;
 import androidx.fragment.app.FragmentActivity;
 
 import org.distorted.bandaged.BandagedCreatorActivity;
@@ -27,67 +24,30 @@ import org.distorted.main.R;
 
 public class RubikDialogBandagedSave extends RubikDialogAbstract
   {
-  public int getResource()
-    {
-    return R.layout.dialog_save_object;
-    }
+  public int getResource()      { return R.layout.dialog_save_object; }
+  public int getTitleResource() { return R.string.save_object; }
+  public boolean hasArgument()  { return false; }
+  public int getPositive()      { return R.string.yes; }
+  public int getNegative()      { return R.string.no; }
 
 ///////////////////////////////////////////////////////////////////////////////////////////////////
 
-  public int getTitleResource()
+  public void positiveAction()
     {
-    return R.string.save_object;
-    }
-
-///////////////////////////////////////////////////////////////////////////////////////////////////
-
-  public boolean hasArgument()
-    {
-    return false;
-    }
-
-///////////////////////////////////////////////////////////////////////////////////////////////////
+    BandagedCreatorActivity bact = (BandagedCreatorActivity)getContext();
 
-  public void setPositive(AlertDialog.Builder builder)
-    {
-    builder.setPositiveButton( R.string.yes, new DialogInterface.OnClickListener()
+    if( bact!=null )
       {
-      @Override
-      public void onClick(DialogInterface dialog, int which)
-        {
-        BandagedCreatorActivity bact = (BandagedCreatorActivity)getContext();
-
-        if( bact!=null )
-          {
-          BandagedCreatorRenderer rend = bact.getRenderer();
-          rend.saveObject();
-          }
-        }
-      });
+      BandagedCreatorRenderer rend = bact.getRenderer();
+      rend.saveObject();
+      }
     }
 
 ///////////////////////////////////////////////////////////////////////////////////////////////////
 
-  public void setNegative(AlertDialog.Builder builder)
+  public void negativeAction()
     {
-    builder.setNegativeButton( R.string.no, new DialogInterface.OnClickListener()
-      {
-      @Override
-      public void onClick(DialogInterface dialog, int which)
-        {
 
-        }
-      });
-    }
-
-///////////////////////////////////////////////////////////////////////////////////////////////////
-
-  public void onShowDialog(DialogInterface dialog, float size)
-    {
-    Button btnPositive = ((AlertDialog)dialog).getButton(Dialog.BUTTON_POSITIVE);
-    btnPositive.setTextSize(TypedValue.COMPLEX_UNIT_PX, size);
-    Button btnNegative = ((AlertDialog)dialog).getButton(Dialog.BUTTON_NEGATIVE);
-    btnNegative.setTextSize(TypedValue.COMPLEX_UNIT_PX, size);
     }
 
 ///////////////////////////////////////////////////////////////////////////////////////////////////
diff --git a/src/main/java/org/distorted/dialogs/RubikDialogError.java b/src/main/java/org/distorted/dialogs/RubikDialogError.java
index cfff86f7..b8d5a862 100644
--- a/src/main/java/org/distorted/dialogs/RubikDialogError.java
+++ b/src/main/java/org/distorted/dialogs/RubikDialogError.java
@@ -10,13 +10,10 @@
 package org.distorted.dialogs;
 
 import android.app.Dialog;
-import android.content.DialogInterface;
 import android.util.TypedValue;
 import android.view.View;
-import android.widget.Button;
 import android.widget.TextView;
 
-import androidx.appcompat.app.AlertDialog;
 import androidx.fragment.app.FragmentActivity;
 
 import org.distorted.main.R;
@@ -25,56 +22,27 @@ import org.distorted.main.R;
 
 public class RubikDialogError extends RubikDialogAbstract
   {
-  public int getResource()
-    {
-    return R.layout.dialog_error;
-    }
-
-///////////////////////////////////////////////////////////////////////////////////////////////////
-
-  public int getTitleResource()
-    {
-    return R.string.opengl_error;
-    }
-
-///////////////////////////////////////////////////////////////////////////////////////////////////
-
-  public boolean hasArgument()
-    {
-    return false;
-    }
+  public int getResource()      { return R.layout.dialog_error; }
+  public int getTitleResource() { return R.string.opengl_error; }
+  public boolean hasArgument()  { return false; }
+  public int getPositive()      { return R.string.ok; }
+  public int getNegative()      { return -1; }
 
 ///////////////////////////////////////////////////////////////////////////////////////////////////
 
-  public void setPositive(AlertDialog.Builder builder)
+  public void positiveAction()
     {
     final FragmentActivity act = getActivity();
-
-    builder.setPositiveButton( R.string.ok, new DialogInterface.OnClickListener()
-      {
-      @Override
-      public void onClick(DialogInterface dialog, int which)
-        {
-        if( act!=null ) act.finish();
-        }
-      });
+    if( act!=null ) act.finish();
     }
 
 ///////////////////////////////////////////////////////////////////////////////////////////////////
 
-  public void setNegative(AlertDialog.Builder builder)
+  public void negativeAction()
     {
 
     }
 
-///////////////////////////////////////////////////////////////////////////////////////////////////
-
-  public void onShowDialog(DialogInterface dialog, float size)
-    {
-    Button btnPositive = ((AlertDialog)dialog).getButton(Dialog.BUTTON_POSITIVE);
-    btnPositive.setTextSize(TypedValue.COMPLEX_UNIT_PX, size);
-    }
-
 ///////////////////////////////////////////////////////////////////////////////////////////////////
 
   public void prepareBody(Dialog dialog, View view, FragmentActivity act, float size)
diff --git a/src/main/java/org/distorted/dialogs/RubikDialogNewRecord.java b/src/main/java/org/distorted/dialogs/RubikDialogNewRecord.java
index 4cb27a53..06ac5990 100644
--- a/src/main/java/org/distorted/dialogs/RubikDialogNewRecord.java
+++ b/src/main/java/org/distorted/dialogs/RubikDialogNewRecord.java
@@ -10,14 +10,11 @@
 package org.distorted.dialogs;
 
 import android.app.Dialog;
-import android.content.DialogInterface;
 import android.os.Bundle;
 import androidx.fragment.app.FragmentActivity;
-import androidx.appcompat.app.AlertDialog;
 
 import android.util.TypedValue;
 import android.view.View;
-import android.widget.Button;
 import android.widget.TextView;
 
 import org.distorted.main.R;
@@ -29,81 +26,44 @@ import org.distorted.screens.ScreenList;
 
 public class RubikDialogNewRecord extends RubikDialogAbstract
   {
-  public int getResource()
-    {
-    return R.layout.dialog_new_record;
-    }
+  public int getResource()      { return R.layout.dialog_new_record; }
+  public int getTitleResource() { return R.string.new_record; }
+  public boolean hasArgument()  { return true; }
+  public int getPositive()      { return R.string.yes; }
+  public int getNegative()      { return R.string.no; }
 
 ///////////////////////////////////////////////////////////////////////////////////////////////////
 
-  public int getTitleResource()
+  public void positiveAction()
     {
-    return R.string.new_record;
-    }
-
-///////////////////////////////////////////////////////////////////////////////////////////////////
+    RubikActivity act = (RubikActivity)getActivity();
+    RubikScores scores = RubikScores.getInstance();
+    String name = scores.getName();
+    Bundle bundle = new Bundle();
+    ScreenList.switchScreen(act, ScreenList.PLAY);
 
-  public boolean hasArgument()
-    {
-    return true;
-    }
-
-///////////////////////////////////////////////////////////////////////////////////////////////////
-
-  public void setPositive(AlertDialog.Builder builder)
-    {
-    builder.setPositiveButton( R.string.yes, new DialogInterface.OnClickListener()
+    if( name.length()>0 )
       {
-      @Override
-      public void onClick(DialogInterface dialog, int which)
-        {
-        RubikActivity act = (RubikActivity)getActivity();
-        RubikScores scores = RubikScores.getInstance();
-        String name = scores.getName();
-        Bundle bundle = new Bundle();
-        ScreenList.switchScreen(act, ScreenList.PLAY);
-
-        if( name.length()>0 )
-          {
-          bundle.putString("argument", "true");
-          RubikDialogScores scoresDiag = new RubikDialogScores();
-          scoresDiag.setArguments(bundle);
-          scoresDiag.show(act.getSupportFragmentManager(), null);
-          }
-        else
-          {
-          bundle.putString("argument", name );
-          RubikDialogSetName nameDiag = new RubikDialogSetName();
-          nameDiag.setArguments(bundle);
-          nameDiag.show(act.getSupportFragmentManager(), null);
-          }
-        }
-      });
-    }
-
-///////////////////////////////////////////////////////////////////////////////////////////////////
-
-  public void setNegative(AlertDialog.Builder builder)
-    {
-    builder.setNegativeButton(R.string.no, new DialogInterface.OnClickListener()
+      bundle.putString("argument", "true");
+      RubikDialogScores scoresDiag = new RubikDialogScores();
+      scoresDiag.setArguments(bundle);
+      scoresDiag.show(act.getSupportFragmentManager(), null);
+      }
+    else
       {
-      @Override
-      public void onClick(DialogInterface dialog, int which)
-        {
-        RubikActivity act = (RubikActivity)getActivity();
-        ScreenList.switchScreen(act, ScreenList.PLAY);
-        }
-      });
+      bundle.putString("argument", name );
+      RubikDialogSetName nameDiag = new RubikDialogSetName();
+      nameDiag.setArguments(bundle);
+      nameDiag.show(act.getSupportFragmentManager(), null);
+      }
     }
 
 ///////////////////////////////////////////////////////////////////////////////////////////////////
 
-  public void onShowDialog(DialogInterface dialog, float size)
+  public void negativeAction()
     {
-    Button btnPositive = ((AlertDialog)dialog).getButton(Dialog.BUTTON_POSITIVE);
-    btnPositive.setTextSize(TypedValue.COMPLEX_UNIT_PX, size);
-    Button btnNegative = ((AlertDialog)dialog).getButton(Dialog.BUTTON_NEGATIVE);
-    btnNegative.setTextSize(TypedValue.COMPLEX_UNIT_PX, size);
+    RubikActivity act = (RubikActivity)getActivity();
+    ScreenList.switchScreen(act, ScreenList.PLAY);
     }
 
 ///////////////////////////////////////////////////////////////////////////////////////////////////
diff --git a/src/main/java/org/distorted/dialogs/RubikDialogPattern.java b/src/main/java/org/distorted/dialogs/RubikDialogPattern.java
index 79b29abb..2a691bb5 100644
--- a/src/main/java/org/distorted/dialogs/RubikDialogPattern.java
+++ b/src/main/java/org/distorted/dialogs/RubikDialogPattern.java
@@ -10,25 +10,15 @@
 package org.distorted.dialogs;
 
 import android.app.Dialog;
-import android.content.Context;
-import android.content.DialogInterface;
-import android.os.Bundle;
-import androidx.annotation.NonNull;
 import androidx.fragment.app.FragmentActivity;
 import androidx.viewpager.widget.ViewPager;
-import androidx.appcompat.app.AlertDialog;
-import androidx.appcompat.app.AppCompatDialogFragment;
 import com.google.android.material.tabs.TabLayout;
-import android.util.DisplayMetrics;
-import android.util.TypedValue;
-import android.view.LayoutInflater;
+
 import android.view.View;
 import android.view.ViewGroup;
 import android.view.Window;
 import android.view.WindowManager;
-import android.widget.Button;
 import android.widget.ImageView;
-import android.widget.TextView;
 
 import org.distorted.main.R;
 import org.distorted.main.RubikActivity;
@@ -38,52 +28,66 @@ import org.distorted.patterns.RubikPatternList;
 
 ///////////////////////////////////////////////////////////////////////////////////////////////////
 
-public class RubikDialogPattern extends AppCompatDialogFragment
+public class RubikDialogPattern extends RubikDialogAbstract
   {
   private RubikDialogPatternPagerAdapter mPagerAdapter;
 
 ///////////////////////////////////////////////////////////////////////////////////////////////////
 
-  @NonNull
   @Override
-  public Dialog onCreateDialog(Bundle savedInstanceState)
+  public void onResume()
     {
-    final FragmentActivity act = getActivity();
-    AlertDialog.Builder builder = new AlertDialog.Builder(act);
+    super.onResume();
 
-    DisplayMetrics displaymetrics = new DisplayMetrics();
-    act.getWindowManager().getDefaultDisplay().getMetrics(displaymetrics);
+    Window window = getDialog().getWindow();
 
-    int h = displaymetrics.heightPixels;
-    final float titleSize= h*RubikActivity.TAB_TEXT_SIZE;
-    final float okSize   = h*RubikActivity.TAB_BUTTON_SIZE;
-    final int   tabHeight= (int)(h*RubikActivity.TAB_HEIGHT);
-    final int   tabWidth = (int)(h*RubikActivity.TAB_WIDTH);
+    if( window!=null )
+      {
+      WindowManager.LayoutParams params = window.getAttributes();
+      params.width  = (int)Math.min( mHeight*0.65f,mWidth*0.98f );
+      params.height = (int)Math.min( mHeight*0.85f,mWidth*1.30f );
+      window.setAttributes(params);
+      }
+    }
 
-    LayoutInflater layoutInflater = act.getLayoutInflater();
-    TextView tv = (TextView) layoutInflater.inflate(R.layout.dialog_title, null);
-    tv.setTextSize(TypedValue.COMPLEX_UNIT_PX, titleSize);
-    tv.setText(R.string.choose_pattern);
-    builder.setCustomTitle(tv);
+///////////////////////////////////////////////////////////////////////////////////////////////////
 
-    builder.setPositiveButton( R.string.ok, new DialogInterface.OnClickListener()
-      {
-      @Override
-      public void onClick(DialogInterface dialog, int which)
-        {
+  public int getResource()      { return R.layout.dialog_tabbed; }
+  public int getTitleResource() { return R.string.choose_pattern; }
+  public boolean hasArgument()  { return false; }
+  public int getPositive()      { return R.string.ok; }
+  public int getNegative()      { return -1; }
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+  public void positiveAction()
+    {
+
+    }
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
 
-        }
-      });
+  public void negativeAction()
+    {
 
-    LayoutInflater inflater = act.getLayoutInflater();
-    final View view = inflater.inflate(R.layout.dialog_tabbed, null);
-    builder.setView(view);
+    }
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+  public void prepareBody(Dialog dialog, View view, FragmentActivity act, float size)
+    {
+    final int tabHeight= (int)(mHeight*RubikActivity.TAB_HEIGHT);
+    final int tabWidth = (int)(mHeight*RubikActivity.TAB_WIDTH);
 
     ViewPager viewPager = view.findViewById(R.id.viewpager);
     TabLayout tabLayout = view.findViewById(R.id.sliding_tabs);
     mPagerAdapter = new RubikDialogPatternPagerAdapter(act, viewPager, this);
     tabLayout.setupWithViewPager(viewPager);
-    viewPager.setCurrentItem(getPatternOrdinal());
+
+    int obj = RubikObjectList.getCurrObject();
+    int ord = RubikPatternList.getOrdinal(obj);
+    if( ord<0 ) ord = RubikPatternList.getOrdinal(RubikObjectList.DEF_OBJECT);
+    viewPager.setCurrentItem(ord);
 
     ViewGroup.LayoutParams paramsView = new ViewGroup.LayoutParams( tabWidth,tabHeight );
 
@@ -97,62 +101,6 @@ public class RubikDialogPattern extends AppCompatDialogFragment
       TabLayout.Tab tab = tabLayout.getTabAt(i);
       if(tab!=null) tab.setCustomView(imageView);
       }
-
-    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);
-        }
-      });
-
-    return dialog;
-    }
-
-///////////////////////////////////////////////////////////////////////////////////////////////////
-
-  private int getPatternOrdinal()
-    {
-    int obj = RubikObjectList.getCurrObject();
-    int ret = RubikPatternList.getOrdinal(obj);
-
-    if( ret<0 )
-      {
-      ret = RubikPatternList.getOrdinal(RubikObjectList.DEF_OBJECT);
-      }
-
-    return ret;
-    }
-
-///////////////////////////////////////////////////////////////////////////////////////////////////
-
-  @Override
-  public void onResume()
-    {
-    super.onResume();
-
-    Window window = getDialog().getWindow();
-    Context context = getContext();
-
-    if( window!=null && context!=null )
-      {
-      DisplayMetrics metrics = context.getResources().getDisplayMetrics();
-      WindowManager.LayoutParams params = window.getAttributes();
-      params.width  = (int)Math.min( 0.65f*metrics.heightPixels,0.98f*metrics.widthPixels );
-      params.height = (int)Math.min( 0.85f*metrics.heightPixels,1.30f*metrics.widthPixels );
-      window.setAttributes(params);
-      }
     }
 
 ///////////////////////////////////////////////////////////////////////////////////////////////////
diff --git a/src/main/java/org/distorted/dialogs/RubikDialogPrivacy.java b/src/main/java/org/distorted/dialogs/RubikDialogPrivacy.java
index c79fe477..eb4edf98 100644
--- a/src/main/java/org/distorted/dialogs/RubikDialogPrivacy.java
+++ b/src/main/java/org/distorted/dialogs/RubikDialogPrivacy.java
@@ -10,15 +10,11 @@
 package org.distorted.dialogs;
 
 import android.app.Dialog;
-import android.content.DialogInterface;
 import android.text.method.LinkMovementMethod;
 import android.text.method.MovementMethod;
-import android.util.TypedValue;
 import android.view.View;
-import android.widget.Button;
 import android.widget.TextView;
 
-import androidx.appcompat.app.AlertDialog;
 import androidx.fragment.app.FragmentActivity;
 
 import org.distorted.main.R;
@@ -28,65 +24,26 @@ import org.distorted.main.RubikActivity;
 
 public class RubikDialogPrivacy extends RubikDialogAbstract
   {
-  public int getResource()
-    {
-    return R.layout.dialog_privacy;
-    }
-
-///////////////////////////////////////////////////////////////////////////////////////////////////
-
-  public int getTitleResource()
-    {
-    return R.string.privacy_policy;
-    }
+  public int getResource()      { return R.layout.dialog_privacy; }
+  public int getTitleResource() { return R.string.privacy_policy; }
+  public boolean hasArgument()  { return false; }
+  public int getPositive()      { return R.string.accept; }
+  public int getNegative()      { return R.string.decline; }
 
 ///////////////////////////////////////////////////////////////////////////////////////////////////
 
-  public boolean hasArgument()
+  public void positiveAction()
     {
-    return false;
-    }
-
-///////////////////////////////////////////////////////////////////////////////////////////////////
-
-  public void setPositive(AlertDialog.Builder builder)
-    {
-    final RubikActivity ract = (RubikActivity)getContext();
-
-    builder.setPositiveButton( R.string.accept, new DialogInterface.OnClickListener()
-      {
-      @Override
-      public void onClick(DialogInterface dialog, int which)
-        {
-        if( ract!=null ) ract.acceptPrivacy();
-        }
-      });
-    }
-
-///////////////////////////////////////////////////////////////////////////////////////////////////
-
-  public void setNegative(AlertDialog.Builder builder)
-    {
-    final RubikActivity ract = (RubikActivity)getContext();
-
-    builder.setNegativeButton( R.string.decline, new DialogInterface.OnClickListener()
-      {
-      @Override
-      public void onClick(DialogInterface dialog, int which)
-        {
-        if( ract!=null ) ract.declinePrivacy();
-        }
-      });
+    final RubikActivity act = (RubikActivity)getContext();
+    if( act!=null ) act.acceptPrivacy();
     }
 
 ///////////////////////////////////////////////////////////////////////////////////////////////////
 
-  public void onShowDialog(DialogInterface dialog, float size)
+  public void negativeAction()
     {
-    Button btnPositive = ((AlertDialog)dialog).getButton(Dialog.BUTTON_POSITIVE);
-    btnPositive.setTextSize(TypedValue.COMPLEX_UNIT_PX, size);
-    Button btnNegative = ((AlertDialog)dialog).getButton(Dialog.BUTTON_NEGATIVE);
-    btnNegative.setTextSize(TypedValue.COMPLEX_UNIT_PX, size);
+    final RubikActivity act = (RubikActivity)getContext();
+    if( act!=null ) act.declinePrivacy();
     }
 
 ///////////////////////////////////////////////////////////////////////////////////////////////////
diff --git a/src/main/java/org/distorted/dialogs/RubikDialogScores.java b/src/main/java/org/distorted/dialogs/RubikDialogScores.java
index d18162e3..35ae5357 100644
--- a/src/main/java/org/distorted/dialogs/RubikDialogScores.java
+++ b/src/main/java/org/distorted/dialogs/RubikDialogScores.java
@@ -10,26 +10,15 @@
 package org.distorted.dialogs;
 
 import android.app.Dialog;
-import android.content.Context;
-import android.content.DialogInterface;
-import android.os.Bundle;
-import androidx.annotation.NonNull;
 import androidx.fragment.app.FragmentActivity;
 import androidx.viewpager.widget.ViewPager;
-import androidx.appcompat.app.AlertDialog;
-import androidx.appcompat.app.AppCompatDialogFragment;
 import com.google.android.material.tabs.TabLayout;
 
-import android.util.DisplayMetrics;
-import android.util.TypedValue;
-import android.view.LayoutInflater;
 import android.view.View;
 import android.view.ViewGroup;
 import android.view.Window;
 import android.view.WindowManager;
-import android.widget.Button;
 import android.widget.ImageView;
-import android.widget.TextView;
 
 import org.distorted.main.R;
 import org.distorted.main.RubikActivity;
@@ -38,63 +27,60 @@ import org.distorted.objects.RubikObjectList;
 
 ///////////////////////////////////////////////////////////////////////////////////////////////////
 
-public class RubikDialogScores extends AppCompatDialogFragment
+public class RubikDialogScores extends RubikDialogAbstract
   {
   private RubikDialogScoresPagerAdapter mPagerAdapter;
 
 ///////////////////////////////////////////////////////////////////////////////////////////////////
 
-  @NonNull
   @Override
-  public Dialog onCreateDialog(Bundle savedInstanceState)
+  public void onResume()
     {
-    FragmentActivity act = getActivity();
-    AlertDialog.Builder builder = new AlertDialog.Builder(act);
-
-    DisplayMetrics displaymetrics = new DisplayMetrics();
-    act.getWindowManager().getDefaultDisplay().getMetrics(displaymetrics);
-
-    int h = displaymetrics.heightPixels;
-    final float titleSize= h*RubikActivity.TAB_TEXT_SIZE;
-    final float okSize   = h*RubikActivity.TAB_BUTTON_SIZE;
-    final int   tabHeight= (int)(h*RubikActivity.TAB_HEIGHT);
-    final int   tabWidth = (int)(h*RubikActivity.TAB_WIDTH);
-
-    LayoutInflater layoutInflater = act.getLayoutInflater();
-    TextView tv = (TextView) layoutInflater.inflate(R.layout.dialog_title, null);
-    tv.setTextSize(TypedValue.COMPLEX_UNIT_PX, titleSize);
-    tv.setText(R.string.scores);
-    builder.setCustomTitle(tv);
-
-    builder.setCancelable(true);
-    builder.setPositiveButton( R.string.ok, new DialogInterface.OnClickListener()
-      {
-      @Override
-      public void onClick(DialogInterface dialog, int which)
-        {
-
-        }
-      });
+    super.onResume();
 
-    Bundle args = getArguments();
-    String submitting;
+    Window window = getDialog().getWindow();
 
-    try
-      {
-      submitting = args.getString("argument");
-      }
-    catch(Exception e)
+    if( window!=null )
       {
-      submitting = "";
+      WindowManager.LayoutParams params = window.getAttributes();
+      params.width  = (int)Math.min( mHeight*0.65f,mWidth*0.98f );
+      params.height = (int)( mHeight*0.77f);
+      window.setAttributes(params);
       }
+    }
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
 
-    LayoutInflater inflater = act.getLayoutInflater();
-    final View view = inflater.inflate(R.layout.dialog_tabbed, null);
-    builder.setView(view);
+  public int getResource()      { return R.layout.dialog_tabbed; }
+  public int getTitleResource() { return R.string.scores; }
+  public boolean hasArgument()  { return true; }
+  public int getPositive()      { return R.string.ok; }
+  public int getNegative()      { return -1; }
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+  public void positiveAction()
+    {
+
+    }
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+  public void negativeAction()
+    {
+
+    }
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+  public void prepareBody(Dialog dialog, View view, FragmentActivity act, float size)
+    {
+    final int tabHeight= (int)(mHeight*RubikActivity.TAB_HEIGHT);
+    final int tabWidth = (int)(mHeight*RubikActivity.TAB_WIDTH);
 
     ViewPager viewPager = view.findViewById(R.id.viewpager);
     TabLayout tabLayout = view.findViewById(R.id.sliding_tabs);
-    mPagerAdapter = new RubikDialogScoresPagerAdapter(act,viewPager,submitting.equals("true"), this);
+    mPagerAdapter = new RubikDialogScoresPagerAdapter(act,viewPager,mArgument.equals("true"), this);
     tabLayout.setupWithViewPager(viewPager);
 
     viewPager.setCurrentItem(RubikObjectList.getCurrObject());
@@ -110,46 +96,5 @@ public class RubikDialogScores extends AppCompatDialogFragment
       TabLayout.Tab tab = tabLayout.getTabAt(object);
       if(tab!=null) tab.setCustomView(imageView);
       }
-
-    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);
-        }
-      });
-
-    return dialog;
-    }
-
-///////////////////////////////////////////////////////////////////////////////////////////////////
-
-  @Override
-  public void onResume()
-    {
-    super.onResume();
-
-    Window window = getDialog().getWindow();
-    Context context = getContext();
-
-    if( window!=null && context!=null )
-      {
-      DisplayMetrics metrics = context.getResources().getDisplayMetrics();
-      WindowManager.LayoutParams params = window.getAttributes();
-      params.width  = (int)Math.min( 0.65f*metrics.heightPixels,0.98f*metrics.widthPixels );
-      params.height = (int)(0.77f*metrics.heightPixels);
-      window.setAttributes(params);
-      }
     }
   }
diff --git a/src/main/java/org/distorted/dialogs/RubikDialogSetName.java b/src/main/java/org/distorted/dialogs/RubikDialogSetName.java
index ec77cde8..b944b786 100644
--- a/src/main/java/org/distorted/dialogs/RubikDialogSetName.java
+++ b/src/main/java/org/distorted/dialogs/RubikDialogSetName.java
@@ -10,7 +10,6 @@
 package org.distorted.dialogs;
 
 import android.app.Dialog;
-import android.content.DialogInterface;
 import android.os.Bundle;
 import androidx.fragment.app.FragmentActivity;
 import androidx.appcompat.app.AlertDialog;
@@ -58,80 +57,52 @@ public class RubikDialogSetName extends RubikDialogAbstract
 
 ///////////////////////////////////////////////////////////////////////////////////////////////////
 
-  public int getResource()
-    {
-    return R.layout.dialog_set_name;
-    }
-
-///////////////////////////////////////////////////////////////////////////////////////////////////
-
-  public int getTitleResource()
-    {
-    return mArgument.length()==0 ? R.string.choose_name : R.string.name_taken;
-    }
+  public int getResource()      { return R.layout.dialog_set_name; }
+  public int getTitleResource() { return mArgument.length()==0 ? R.string.choose_name : R.string.name_taken; }
+  public boolean hasArgument()  { return true; }
+  public int getPositive()      { return R.string.ok; }
+  public int getNegative()      { return -1; }
 
 ///////////////////////////////////////////////////////////////////////////////////////////////////
 
-  public boolean hasArgument()
+  public void positiveAction()
     {
-    return true;
-    }
-
-///////////////////////////////////////////////////////////////////////////////////////////////////
+    String name = mEdit.getText().toString();
+    int len = name.length();
 
-  public void setPositive(AlertDialog.Builder builder)
-    {
-    builder.setPositiveButton( R.string.ok, new DialogInterface.OnClickListener()
+    if( len>0 )
       {
-      @Override
-      public void onClick(DialogInterface dialog, int which)
+      if( len>MAX_NAME_LEN )
         {
-        String name = mEdit.getText().toString();
-        int len = name.length();
-
-        if( len>0 )
-          {
-          if( len>MAX_NAME_LEN )
-            {
-            name = name.substring(0,MAX_NAME_LEN);
-            }
-
-          name = name.replace(' ', '_');
-
-          try
-            {
-            RubikActivity act = (RubikActivity)getActivity();
-            ScreenList.switchScreen(act, ScreenList.PLAY);
-            RubikScores.getInstance().setName(name);
-
-            Bundle bundle = new Bundle();
-            bundle.putString("argument", "true");
-            RubikDialogScores scores = new RubikDialogScores();
-            scores.setArguments(bundle);
-            scores.show(act.getSupportFragmentManager(), null);
-            }
-          catch(IllegalStateException ex)
-            {
-            android.util.Log.e("D", "IllegalStateException trying to display SetName");
-            }
-          }
+        name = name.substring(0,MAX_NAME_LEN);
         }
-      });
-    }
-
-///////////////////////////////////////////////////////////////////////////////////////////////////
 
-  public void setNegative(AlertDialog.Builder builder)
-    {
+      name = name.replace(' ', '_');
 
+      try
+        {
+        RubikActivity act = (RubikActivity)getActivity();
+        ScreenList.switchScreen(act, ScreenList.PLAY);
+        RubikScores.getInstance().setName(name);
+
+        Bundle bundle = new Bundle();
+        bundle.putString("argument", "true");
+        RubikDialogScores scores = new RubikDialogScores();
+        scores.setArguments(bundle);
+        scores.show(act.getSupportFragmentManager(), null);
+        }
+      catch(IllegalStateException ex)
+        {
+        android.util.Log.e("D", "IllegalStateException trying to display SetName");
+        }
+      }
     }
 
 ///////////////////////////////////////////////////////////////////////////////////////////////////
 
-  public void onShowDialog(DialogInterface dialog, float size)
+  public void negativeAction()
     {
-    Button btnPositive = ((AlertDialog)dialog).getButton(Dialog.BUTTON_POSITIVE);
-    btnPositive.setTextSize(TypedValue.COMPLEX_UNIT_PX, size);
+
     }
 
 ///////////////////////////////////////////////////////////////////////////////////////////////////
diff --git a/src/main/java/org/distorted/dialogs/RubikDialogSolved.java b/src/main/java/org/distorted/dialogs/RubikDialogSolved.java
index 442e5dd5..3aaf14dd 100644
--- a/src/main/java/org/distorted/dialogs/RubikDialogSolved.java
+++ b/src/main/java/org/distorted/dialogs/RubikDialogSolved.java
@@ -10,13 +10,10 @@
 package org.distorted.dialogs;
 
 import android.app.Dialog;
-import android.content.DialogInterface;
 import androidx.fragment.app.FragmentActivity;
-import androidx.appcompat.app.AlertDialog;
 
 import android.util.TypedValue;
 import android.view.View;
-import android.widget.Button;
 import android.widget.TextView;
 
 import org.distorted.main.R;
@@ -27,53 +24,25 @@ import org.distorted.screens.ScreenList;
 
 public class RubikDialogSolved extends RubikDialogAbstract
   {
-  public int getResource()
-    {
-    return R.layout.dialog_solved;
-    }
+  public int getResource()      { return R.layout.dialog_solved; }
+  public int getTitleResource() { return R.string.solved; }
+  public boolean hasArgument()  { return true; }
+  public int getPositive()      { return R.string.ok; }
+  public int getNegative()      { return -1; }
 
 ///////////////////////////////////////////////////////////////////////////////////////////////////
 
-  public int getTitleResource()
+  public void positiveAction()
     {
-    return R.string.solved;
+    RubikActivity act = (RubikActivity)getActivity();
+    ScreenList.switchScreen(act, ScreenList.PLAY);
     }
 
 ///////////////////////////////////////////////////////////////////////////////////////////////////
 
-  public boolean hasArgument()
+  public void negativeAction()
     {
-    return true;
-    }
-
-///////////////////////////////////////////////////////////////////////////////////////////////////
 
-  public void setPositive(AlertDialog.Builder builder)
-    {
-    builder.setPositiveButton( R.string.ok, new DialogInterface.OnClickListener()
-      {
-      @Override
-      public void onClick(DialogInterface dialog, int which)
-        {
-        RubikActivity act = (RubikActivity)getActivity();
-        ScreenList.switchScreen(act, ScreenList.PLAY);
-        }
-      });
-    }
-
-///////////////////////////////////////////////////////////////////////////////////////////////////
-
-  public void setNegative(AlertDialog.Builder builder)
-    {
-
-    }
-
-///////////////////////////////////////////////////////////////////////////////////////////////////
-
-  public void onShowDialog(DialogInterface dialog, float size)
-    {
-    Button btnPositive = ((AlertDialog)dialog).getButton(Dialog.BUTTON_POSITIVE);
-    btnPositive.setTextSize(TypedValue.COMPLEX_UNIT_PX, size);
     }
 
 ///////////////////////////////////////////////////////////////////////////////////////////////////
diff --git a/src/main/java/org/distorted/dialogs/RubikDialogSolverError.java b/src/main/java/org/distorted/dialogs/RubikDialogSolverError.java
index 11ddf6f2..2dcd7952 100644
--- a/src/main/java/org/distorted/dialogs/RubikDialogSolverError.java
+++ b/src/main/java/org/distorted/dialogs/RubikDialogSolverError.java
@@ -10,13 +10,10 @@
 package org.distorted.dialogs;
 
 import android.app.Dialog;
-import android.content.DialogInterface;
 import androidx.fragment.app.FragmentActivity;
-import androidx.appcompat.app.AlertDialog;
 
 import android.util.TypedValue;
 import android.view.View;
-import android.widget.Button;
 import android.widget.TextView;
 
 import org.distorted.main.R;
@@ -25,52 +22,24 @@ import org.distorted.main.R;
 
 public class RubikDialogSolverError extends RubikDialogAbstract
   {
-  public int getResource()
-    {
-    return R.layout.dialog_solver_error;
-    }
+  public int getResource()      { return R.layout.dialog_solver_error; }
+  public int getTitleResource() { return R.string.error; }
+  public boolean hasArgument()  { return true; }
+  public int getPositive()      { return R.string.ok; }
+  public int getNegative()      { return -1; }
 
 ///////////////////////////////////////////////////////////////////////////////////////////////////
 
-  public int getTitleResource()
+  public void positiveAction()
     {
-    return R.string.error;
-    }
-
-///////////////////////////////////////////////////////////////////////////////////////////////////
 
-  public boolean hasArgument()
-    {
-    return true;
     }
 
 ///////////////////////////////////////////////////////////////////////////////////////////////////
 
-  public void setPositive(AlertDialog.Builder builder)
+  public void negativeAction()
     {
-    builder.setPositiveButton( R.string.ok, new DialogInterface.OnClickListener()
-      {
-      @Override
-      public void onClick(DialogInterface dialog, int which)
-        {
-
-        }
-      });
-    }
 
-///////////////////////////////////////////////////////////////////////////////////////////////////
-
-  public void setNegative(AlertDialog.Builder builder)
-    {
-
-    }
-
-///////////////////////////////////////////////////////////////////////////////////////////////////
-
-  public void onShowDialog(DialogInterface dialog, float size)
-    {
-    Button btnPositive = ((AlertDialog)dialog).getButton(Dialog.BUTTON_POSITIVE);
-    btnPositive.setTextSize(TypedValue.COMPLEX_UNIT_PX, size);
     }
 
 ///////////////////////////////////////////////////////////////////////////////////////////////////
diff --git a/src/main/java/org/distorted/dialogs/RubikDialogStarsExplain.java b/src/main/java/org/distorted/dialogs/RubikDialogStarsExplain.java
index 85ca936b..2b272f8c 100644
--- a/src/main/java/org/distorted/dialogs/RubikDialogStarsExplain.java
+++ b/src/main/java/org/distorted/dialogs/RubikDialogStarsExplain.java
@@ -10,13 +10,10 @@
 package org.distorted.dialogs;
 
 import android.app.Dialog;
-import android.content.DialogInterface;
 import android.util.TypedValue;
 import android.view.View;
-import android.widget.Button;
 import android.widget.TextView;
 
-import androidx.appcompat.app.AlertDialog;
 import androidx.fragment.app.FragmentActivity;
 
 import org.distorted.main.R;
@@ -25,52 +22,24 @@ import org.distorted.main.R;
 
 public class RubikDialogStarsExplain extends RubikDialogAbstract
   {
-  public int getResource()
-    {
-    return R.layout.dialog_stars_explain;
-    }
+  public int getResource()      { return R.layout.dialog_stars_explain; }
+  public int getTitleResource() { return -1; }
+  public boolean hasArgument()  { return false; }
+  public int getPositive()      { return R.string.ok; }
+  public int getNegative()      { return -1; }
 
 ///////////////////////////////////////////////////////////////////////////////////////////////////
 
-  public int getTitleResource()
+  public void positiveAction()
     {
-    return -1;
-    }
-
-///////////////////////////////////////////////////////////////////////////////////////////////////
 
-  public boolean hasArgument()
-    {
-    return false;
     }
 
 ///////////////////////////////////////////////////////////////////////////////////////////////////
 
-  public void setPositive(AlertDialog.Builder builder)
+  public void negativeAction()
     {
-    builder.setPositiveButton( R.string.ok, new DialogInterface.OnClickListener()
-      {
-      @Override
-      public void onClick(DialogInterface dialog, int which)
-        {
-
-        }
-      });
-    }
 
-///////////////////////////////////////////////////////////////////////////////////////////////////
-
-  public void setNegative(AlertDialog.Builder builder)
-    {
-
-    }
-
-///////////////////////////////////////////////////////////////////////////////////////////////////
-
-  public void onShowDialog(DialogInterface dialog, float size)
-    {
-    Button btnPositive = ((AlertDialog)dialog).getButton(Dialog.BUTTON_POSITIVE);
-    btnPositive.setTextSize(TypedValue.COMPLEX_UNIT_PX, size);
     }
 
 ///////////////////////////////////////////////////////////////////////////////////////////////////
diff --git a/src/main/java/org/distorted/dialogs/RubikDialogStarsStatus.java b/src/main/java/org/distorted/dialogs/RubikDialogStarsStatus.java
index 2607a8b8..de758524 100644
--- a/src/main/java/org/distorted/dialogs/RubikDialogStarsStatus.java
+++ b/src/main/java/org/distorted/dialogs/RubikDialogStarsStatus.java
@@ -10,18 +10,12 @@
 package org.distorted.dialogs;
 
 import android.app.Dialog;
-import android.content.Context;
-import android.content.DialogInterface;
-import android.util.DisplayMetrics;
-import android.util.TypedValue;
 import android.view.View;
 import android.view.Window;
 import android.view.WindowManager;
-import android.widget.Button;
 import android.widget.LinearLayout;
 import android.widget.TextView;
 
-import androidx.appcompat.app.AlertDialog;
 import androidx.fragment.app.FragmentActivity;
 
 import org.distorted.external.RubikScores;
@@ -37,9 +31,8 @@ public class RubikDialogStarsStatus extends RubikDialogAbstract
     super.onResume();
 
     Window window = getDialog().getWindow();
-    Context context = getContext();
 
-    if( window!=null && context!=null )
+    if( window!=null )
       {
       WindowManager.LayoutParams params = window.getAttributes();
       params.width  = (int)Math.min( mHeight*0.65f,mWidth*0.95f );
@@ -50,54 +43,26 @@ public class RubikDialogStarsStatus extends RubikDialogAbstract
 
 ///////////////////////////////////////////////////////////////////////////////////////////////////
 
-  public int getResource()
-    {
-    return R.layout.dialog_stars_status;
-    }
-
-///////////////////////////////////////////////////////////////////////////////////////////////////
-
-  public int getTitleResource()
-    {
-    return -1;
-    }
-
-///////////////////////////////////////////////////////////////////////////////////////////////////
-
-  public boolean hasArgument()
-    {
-    return false;
-    }
+  public int getResource()      { return R.layout.dialog_stars_status; }
+  public int getTitleResource() { return -1; }
+  public boolean hasArgument()  { return false; }
+  public int getPositive()      { return R.string.ok; }
+  public int getNegative()      { return -1; }
 
 ///////////////////////////////////////////////////////////////////////////////////////////////////
 
-  public void setPositive(AlertDialog.Builder builder)
+  public void positiveAction()
     {
-    builder.setPositiveButton( R.string.ok, new DialogInterface.OnClickListener()
-      {
-      @Override
-      public void onClick(DialogInterface dialog, int which)
-        {
 
-        }
-      });
     }
 
 ///////////////////////////////////////////////////////////////////////////////////////////////////
 
-  public void setNegative(AlertDialog.Builder builder)
+  public void negativeAction()
     {
 
     }
 
-///////////////////////////////////////////////////////////////////////////////////////////////////
-
-  public void onShowDialog(DialogInterface dialog, float size)
-    {
-    Button btnPositive = ((AlertDialog)dialog).getButton(Dialog.BUTTON_POSITIVE);
-    btnPositive.setTextSize(TypedValue.COMPLEX_UNIT_PX, size);
-    }
-
 ///////////////////////////////////////////////////////////////////////////////////////////////////
 
   public void prepareBody(Dialog dialog, View view, FragmentActivity act, float size)
diff --git a/src/main/java/org/distorted/dialogs/RubikDialogTutorial.java b/src/main/java/org/distorted/dialogs/RubikDialogTutorial.java
index 9c2326b8..7b12031c 100644
--- a/src/main/java/org/distorted/dialogs/RubikDialogTutorial.java
+++ b/src/main/java/org/distorted/dialogs/RubikDialogTutorial.java
@@ -10,23 +10,12 @@
 package org.distorted.dialogs;
 
 import android.app.Dialog;
-import android.content.Context;
-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.ViewGroup;
 import android.view.Window;
 import android.view.WindowManager;
-import android.widget.Button;
 import android.widget.ImageView;
-import android.widget.TextView;
 
-import androidx.annotation.NonNull;
-import androidx.appcompat.app.AlertDialog;
-import androidx.appcompat.app.AppCompatDialogFragment;
 import androidx.fragment.app.FragmentActivity;
 import androidx.viewpager.widget.ViewPager;
 
@@ -39,52 +28,66 @@ import org.distorted.objects.RubikObjectList;
 
 ///////////////////////////////////////////////////////////////////////////////////////////////////
 
-public class RubikDialogTutorial extends AppCompatDialogFragment
+public class RubikDialogTutorial extends RubikDialogAbstract
   {
   private RubikDialogTutorialPagerAdapter mPagerAdapter;
 
 ///////////////////////////////////////////////////////////////////////////////////////////////////
 
-  @NonNull
   @Override
-  public Dialog onCreateDialog(Bundle savedInstanceState)
+  public void onResume()
     {
-    final FragmentActivity act = getActivity();
-    AlertDialog.Builder builder = new AlertDialog.Builder(act);
-
-    DisplayMetrics displaymetrics = new DisplayMetrics();
-    act.getWindowManager().getDefaultDisplay().getMetrics(displaymetrics);
+    super.onResume();
 
-    int h = displaymetrics.heightPixels;
-    final float titleSize= h*RubikActivity.TAB_TEXT_SIZE;
-    final float okSize   = h*RubikActivity.TAB_BUTTON_SIZE;
-    final int   tabHeight= (int)(h*RubikActivity.TAB_HEIGHT);
-    final int   tabWidth = (int)(h*RubikActivity.TAB_WIDTH);
+    if( mPagerAdapter!=null ) mPagerAdapter.clickPossible();
 
-    LayoutInflater layoutInflater = act.getLayoutInflater();
-    TextView tv = (TextView) layoutInflater.inflate(R.layout.dialog_title, null);
-    tv.setTextSize(TypedValue.COMPLEX_UNIT_PX, titleSize);
-    tv.setText(R.string.tutorials);
-    builder.setCustomTitle(tv);
+    Window window = getDialog().getWindow();
 
-    builder.setPositiveButton( R.string.ok, new DialogInterface.OnClickListener()
+    if( window!=null )
       {
-      @Override
-      public void onClick(DialogInterface dialog, int which)
-        {
+      WindowManager.LayoutParams params = window.getAttributes();
+      params.width  = (int)Math.min( mHeight*0.65f,mWidth*0.98f );
+      params.height = (int)Math.min( mHeight*0.85f,mWidth*1.30f );
+      window.setAttributes(params);
+      }
+    }
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
 
-        }
-      });
+  public int getResource()      { return R.layout.dialog_tabbed; }
+  public int getTitleResource() { return R.string.tutorials; }
+  public boolean hasArgument()  { return false; }
+  public int getPositive()      { return R.string.ok; }
+  public int getNegative()      { return -1; }
 
-    LayoutInflater inflater = act.getLayoutInflater();
-    final View view = inflater.inflate(R.layout.dialog_tabbed, null);
-    builder.setView(view);
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+  public void positiveAction()
+    {
+
+    }
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+  public void negativeAction()
+    {
+
+    }
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+  public void prepareBody(Dialog dialog, View view, FragmentActivity act, float size)
+    {
+    final int tabHeight= (int)(mHeight*RubikActivity.TAB_HEIGHT);
+    final int tabWidth = (int)(mHeight*RubikActivity.TAB_WIDTH);
 
     ViewPager viewPager = view.findViewById(R.id.viewpager);
     TabLayout tabLayout = view.findViewById(R.id.sliding_tabs);
     mPagerAdapter = new RubikDialogTutorialPagerAdapter(act,viewPager);
     tabLayout.setupWithViewPager(viewPager);
-    viewPager.setCurrentItem(getTutorialOrdinal());
+    int obj = RubikObjectList.getCurrObject();
+    int ord = RubikObjectList.getTutorialOrdinal(obj);
+    viewPager.setCurrentItem(ord);
 
     ViewGroup.LayoutParams paramsView = new ViewGroup.LayoutParams( tabWidth,tabHeight );
     int numObjects = RubikObjectList.getNumTutorialObjects();
@@ -99,57 +102,6 @@ public class RubikDialogTutorial extends AppCompatDialogFragment
       TabLayout.Tab tab = tabLayout.getTabAt(i);
       if(tab!=null) tab.setCustomView(imageView);
       }
-
-    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);
-        }
-      });
-
-    return dialog;
-    }
-
-///////////////////////////////////////////////////////////////////////////////////////////////////
-
-  private int getTutorialOrdinal()
-    {
-    int obj = RubikObjectList.getCurrObject();
-    return RubikObjectList.getTutorialOrdinal(obj);
-    }
-
-///////////////////////////////////////////////////////////////////////////////////////////////////
-
-  @Override
-  public void onResume()
-    {
-    super.onResume();
-
-    if( mPagerAdapter!=null ) mPagerAdapter.clickPossible();
-
-    Window window = getDialog().getWindow();
-    Context context = getContext();
-
-    if( window!=null && context!=null )
-      {
-      DisplayMetrics metrics = context.getResources().getDisplayMetrics();
-      WindowManager.LayoutParams params = window.getAttributes();
-      params.width  = (int)Math.min( 0.65f*metrics.heightPixels,0.98f*metrics.widthPixels );
-      params.height = (int)Math.min( 0.85f*metrics.heightPixels,1.30f*metrics.widthPixels );
-      window.setAttributes(params);
-      }
     }
 
 ///////////////////////////////////////////////////////////////////////////////////////////////////
diff --git a/src/main/java/org/distorted/dialogs/RubikDialogUpdates.java b/src/main/java/org/distorted/dialogs/RubikDialogUpdates.java
index 6c6792d3..5e2d830b 100644
--- a/src/main/java/org/distorted/dialogs/RubikDialogUpdates.java
+++ b/src/main/java/org/distorted/dialogs/RubikDialogUpdates.java
@@ -12,15 +12,12 @@ package org.distorted.dialogs;
 import java.util.ArrayList;
 
 import android.app.Dialog;
-import android.content.DialogInterface;
 import android.graphics.Bitmap;
 import android.util.TypedValue;
 import android.view.View;
-import android.widget.Button;
 import android.widget.LinearLayout;
 import android.widget.TextView;
 
-import androidx.appcompat.app.AlertDialog;
 import androidx.fragment.app.FragmentActivity;
 
 import org.distorted.main.R;
@@ -38,52 +35,24 @@ public class RubikDialogUpdates extends RubikDialogAbstract implements RubikNetw
 
 ///////////////////////////////////////////////////////////////////////////////////////////////////
 
-  public int getResource()
-    {
-    return R.layout.dialog_updates;
-    }
+  public int getResource()      { return R.layout.dialog_updates; }
+  public int getTitleResource() { return R.string.updates; }
+  public boolean hasArgument()  { return false; }
+  public int getPositive()      { return R.string.ok; }
+  public int getNegative()      { return -1; }
 
 ///////////////////////////////////////////////////////////////////////////////////////////////////
 
-  public int getTitleResource()
+  public void positiveAction()
     {
-    return R.string.updates;
-    }
 
-///////////////////////////////////////////////////////////////////////////////////////////////////
-
-  public boolean hasArgument()
-    {
-    return false;
     }
 
 ///////////////////////////////////////////////////////////////////////////////////////////////////
 
-  public void setPositive(AlertDialog.Builder builder)
+  public void negativeAction()
     {
-    builder.setPositiveButton( R.string.ok, new DialogInterface.OnClickListener()
-      {
-      @Override
-      public void onClick(DialogInterface dialog, int which)
-        {
 
-        }
-      });
-    }
-
-///////////////////////////////////////////////////////////////////////////////////////////////////
-
-  public void setNegative(AlertDialog.Builder builder)
-    {
-
-    }
-
-///////////////////////////////////////////////////////////////////////////////////////////////////
-
-  public void onShowDialog(DialogInterface dialog, float size)
-    {
-    Button btnPositive = ((AlertDialog)dialog).getButton(Dialog.BUTTON_POSITIVE);
-    btnPositive.setTextSize(TypedValue.COMPLEX_UNIT_PX, size);
     }
 
 ///////////////////////////////////////////////////////////////////////////////////////////////////
@@ -170,8 +139,6 @@ public class RubikDialogUpdates extends RubikDialogAbstract implements RubikNetw
     {
     FragmentActivity act = getActivity();
 
-android.util.Log.e("D", "receiveUpdate1");
-
     if( act!=null )
       {
       act.runOnUiThread(new Runnable()
