commit 2536c8da542b9480573183db79342be925386e84
Author: Leszek Koltunski <leszek@koltunski.pl>
Date:   Thu Nov 13 00:47:32 2025 +0100

    progress with remembering solves.

diff --git a/src/main/java/org/distorted/helpers/RubikRememberedSolves.java b/src/main/java/org/distorted/helpers/RubikRememberedSolves.java
index 935151c3..226e1266 100644
--- a/src/main/java/org/distorted/helpers/RubikRememberedSolves.java
+++ b/src/main/java/org/distorted/helpers/RubikRememberedSolves.java
@@ -9,6 +9,8 @@
 
 package org.distorted.helpers;
 
+import android.app.Activity;
+
 import org.distorted.library.type.Static4D;
 import org.distorted.main.MainObjectPopup;
 import org.json.JSONArray;
@@ -64,9 +66,41 @@ public class RubikRememberedSolves
 
 ///////////////////////////////////////////////////////////////////////////////////////////////////
 
-  public String addInfo(InputStream stream, int level, long time, Static4D rot, int[] quats)
+  public JSONArray readFile(Activity act, String filename)
+    {
+    RubikFiles files = RubikFiles.getInstance();
+    InputStream file = files.openFile(act, filename);
+
+    try
+      {
+      String contents = readContents(file);
+      return new JSONArray(contents);
+      }
+    catch(IOException iex)    { android.util.Log.e("D", "readFile: failed to read file" ); }
+    catch(JSONException jex)  { android.util.Log.e("D", "readFile: failed to parse file"); }
+
+    return null;
+    }
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+  private String readContents(InputStream stream) throws IOException
+    {
+    BufferedReader br = new BufferedReader(new InputStreamReader(stream, StandardCharsets.UTF_8));
+    StringBuilder contents = new StringBuilder();
+    String tmp;
+
+    while( (tmp = br.readLine()) != null) contents.append(tmp);
+    br.close();
+    stream.close();
+
+    return contents.toString();
+    }
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+  private void debug(int level, long time, Static4D rot, int[] quats)
     {
-    /*
     StringBuilder quatStr = new StringBuilder();
 
     for(int c : quats)
@@ -79,28 +113,25 @@ public class RubikRememberedSolves
                                     "time: "+time+"\n"+
                                     "rotQuat: " +rot.get0()+" "+rot.get1()+" "+rot.get2()+" "+rot.get3()+"\n"+
                                     "quats: "+quatStr );
-*/
+    }
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+  public String addInfo(InputStream stream, int level, long time, Static4D rot, int[] quats)
+    {
     if( stream!=null )
       {
       try
         {
-        BufferedReader br = new BufferedReader(new InputStreamReader(stream, StandardCharsets.UTF_8));
-        StringBuilder contents = new StringBuilder();
-        String tmp;
-
-        while( (tmp = br.readLine()) != null) contents.append(tmp);
-        br.close();
-        stream.close();
-
-        JSONArray levels = new JSONArray(contents.toString());
+        String contents = readContents(stream);
+        JSONArray levels = new JSONArray(contents);
         JSONArray lvl = levels.getJSONArray(level);
         JSONObject data = createData(time,rot,quats);
         if( lvl.length()>MAXSOLVES ) lvl.remove(0);
         lvl.put(data);
-
         return levels.toString();
         }
-      catch(IOException iex)    { android.util.Log.e("D", "addInfo: failed to read file"); }
+      catch(IOException iex)    { android.util.Log.e("D", "addInfo: failed to read file" ); }
       catch(JSONException jex)  { android.util.Log.e("D", "addInfo: failed to parse file"); }
       }
     else
diff --git a/src/main/java/org/distorted/main/MainObjectPopup.java b/src/main/java/org/distorted/main/MainObjectPopup.java
index 582b20f4..6197fec3 100644
--- a/src/main/java/org/distorted/main/MainObjectPopup.java
+++ b/src/main/java/org/distorted/main/MainObjectPopup.java
@@ -79,7 +79,7 @@ public class MainObjectPopup
       public void run()
         {
         RubikRememberedSolves solves = RubikRememberedSolves.getInstance();
-        mRememberedSolves = solves.readFile(objname);
+        mRememberedSolves = solves.readFile(act,objname);
         }
       };
 
@@ -205,12 +205,12 @@ public class MainObjectPopup
     TextView levels = layout.findViewById(R.id.objectLevels);
     levels.setTextSize(TypedValue.COMPLEX_UNIT_PX, mMenuTextSize);
 
-    setupLevelButtons(act,object,layout,width,padding,marginH,darkC,passedC);
+    setupLevelButtons(act,object,layout,width,height,padding,marginH,darkC,passedC);
     }
 
 ///////////////////////////////////////////////////////////////////////////////////////////////////
 
-  private void setupLevelButtons(MainActivity act, RubikObject object, View layout, int width,int padding, int margin, int darkC, int passedC)
+  private void setupLevelButtons(MainActivity act, RubikObject object, View layout, int width, int height, int padding, int margin, int darkC, int passedC)
     {
     RubikScores scores = RubikScores.getInstance(act);
     Resources res = act.getResources();
@@ -265,7 +265,7 @@ public class MainObjectPopup
           if( ll<0 ) scores.setRecord(mObjectOrdinal,ll,0); // remember we've entered the 'Free'
                                                             // so that the button turns green
 
-          JSONArray json = null;
+          JSONArray json= null;
           int numSolves = 0;
 
           if( mRememberedSolves!=null )
@@ -277,12 +277,16 @@ public class MainObjectPopup
               }
             catch(JSONException jex)
               {
-              android.util.Log.e("D", "execption trying to parse file: "+jex.getMessage() );
+              android.util.Log.e("D", "exception trying to parse file: "+jex.getMessage() );
               }
             }
 
-          if( numSolves>0 ) act
-          act.switchToPlay(object,mObjectOrdinal,scrambles,ll);
+          if( numSolves>0 )
+            {
+            MainSolvesPopup popup = new MainSolvesPopup(act,object,json,width,height,darkC);
+            popup.show(v);
+            }
+          else act.switchToPlay(object,mObjectOrdinal,scrambles,ll);
           }
         });
       }
diff --git a/src/main/java/org/distorted/main/MainSolvesPopup.java b/src/main/java/org/distorted/main/MainSolvesPopup.java
new file mode 100644
index 00000000..fd4d29e3
--- /dev/null
+++ b/src/main/java/org/distorted/main/MainSolvesPopup.java
@@ -0,0 +1,49 @@
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// Copyright 2025 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.main;
+
+import android.view.Gravity;
+import android.view.View;
+import android.widget.PopupWindow;
+
+import org.distorted.objects.RubikObject;
+import org.json.JSONArray;
+
+import java.lang.ref.WeakReference;
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+public class MainSolvesPopup
+  {
+  private final int mWidth, mHeight;
+  private PopupWindow mPopup;
+  private WeakReference<MainActivity> mAct;
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+  MainSolvesPopup(MainActivity act, RubikObject object, JSONArray array, int popupWidth, int popupHeight, int darkC)
+    {
+    mAct = new WeakReference<>(act);
+
+    mWidth = popupWidth;
+    mHeight= popupHeight;
+
+    }
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+  void show(View v)
+    {
+    View popupView = mPopup.getContentView();
+    popupView.setSystemUiVisibility(MainActivity.FLAGS);
+    mPopup.showAtLocation(v, Gravity.CENTER, 0, 0);
+    }
+  }
+
