commit 30667941ef594d71f3b6243ef2278fb4077dda1d
Author: leszek <leszek@koltunski.pl>
Date:   Sun Jan 21 20:56:12 2024 +0100

    improve the object popup in Config Activity.

diff --git a/src/main/java/org/distorted/config/ConfigScreen.java b/src/main/java/org/distorted/config/ConfigScreen.java
index 461f62b7..62e8d0f8 100644
--- a/src/main/java/org/distorted/config/ConfigScreen.java
+++ b/src/main/java/org/distorted/config/ConfigScreen.java
@@ -37,18 +37,14 @@ public class ConfigScreen
   private static final float TEXT_SIZE = 0.0310f;
   private static final float PADDING   = 0.0060f;
   private static final float MARGIN    = 0.0024f;
-  private static final int NUM_COLUMNS = 5;
   private static final int[] mLocation = new int[2];
-  private static final float POPUP_MARGIN  = 0.016f;
+  private static final float POPUP_W  = 0.8f;
 
   private TransparentImageButton mBackButton, mObjectButton, mPrevButton, mNextButton;
   private TextView mMovesText;
   private PopupWindow mObjectPopup;
   private ConfigScreenPane mPane;
   private int mObjectOrdinal;
-  private int mColCount, mRowCount, mMaxRowCount;
-  private int mObjectSize;
-  private int mBarHeight;
   private float mButtonSize;
 
 ///////////////////////////////////////////////////////////////////////////////////////////////////
@@ -56,14 +52,6 @@ public class ConfigScreen
   private void setupObjectWindow(final ConfigActivity act, final float width, final float height)
     {
     int numObjects= RubikObjectList.getNumObjects();
-    mRowCount = (numObjects + NUM_COLUMNS-1) / NUM_COLUMNS;
-    mColCount = NUM_COLUMNS;
-
-    int cubeSize  = (int)( (Math.min(width,(int)(height*0.7f))) / 9 );
-    int margin    = (int)(height*POPUP_MARGIN);
-    mObjectSize   = (int)(cubeSize + 2*margin + 0.5f);
-    mMaxRowCount  = (int)((height-mBarHeight)/mObjectSize);
-
     ScrollView view = (ScrollView)inflate( act, R.layout.popup_object_simple, null);
     GridLayout objectGrid = view.findViewById(R.id.objectGrid);
 
@@ -133,15 +121,10 @@ public class ConfigScreen
       @Override
       public void onClick(View view)
         {
-        if( mObjectPopup==null )
-          {
-          setupObjectWindow(act,width,height);
-          }
-
-        int rowCount = Math.min(mMaxRowCount,mRowCount);
+        if( mObjectPopup==null ) setupObjectWindow(act,width,height);
         View popupView = mObjectPopup.getContentView();
         popupView.setSystemUiVisibility(MainActivity.FLAGS);
-        displayPopup(act,view,mObjectPopup,mObjectSize*mColCount,mObjectSize*rowCount+5*margin,margin,margin);
+        displayPopup(act,view,mObjectPopup,width,height,margin,margin);
         }
       });
     }
@@ -279,7 +262,7 @@ public class ConfigScreen
     int numObjects = RubikObjectList.getNumObjects();
     int width = act.getScreenWidthInPixels();
     int height= act.getScreenHeightInPixels();
-    mBarHeight = act.getHeightBar();
+    int barHeight = act.getHeightBar();
     mButtonSize = height*TEXT_SIZE;
     mObjectOrdinal = objectOrdinal;
 
@@ -294,7 +277,10 @@ public class ConfigScreen
     LinearLayout layoutRight= new LinearLayout(act);
     layoutRight.setLayoutParams(paramsR);
 
-    setupObjectButton(act,width,height);
+    int popupW = (int)(POPUP_W*width);
+    int popupH = (int)(height-barHeight);
+
+    setupObjectButton(act,popupW,popupH);
     setupPrevButton(act);
     setupNextButton(act);
     setupTextView(act,height,numObjects);
