commit 65bc1da3defd043bb850ce3763a0f81398ec2817
Author: Leszek Koltunski <leszek@koltunski.pl>
Date:   Wed May 24 12:59:44 2023 +0200

    Improve the way we display time in the Scores dialog

diff --git a/src/main/java/org/distorted/dialogs/RubikDialogScoresPagerAdapter.java b/src/main/java/org/distorted/dialogs/RubikDialogScoresPagerAdapter.java
index 78ab07b4..534a3206 100644
--- a/src/main/java/org/distorted/dialogs/RubikDialogScoresPagerAdapter.java
+++ b/src/main/java/org/distorted/dialogs/RubikDialogScoresPagerAdapter.java
@@ -66,7 +66,7 @@ class RubikDialogScoresPagerAdapter extends PagerAdapter implements RubikNetwork
 
 ///////////////////////////////////////////////////////////////////////////////////////////////////
 
-  private void addSection(int tab, int level, int numLevels, final RubikDialogScoresView view, final String[] country, final String[] name, final float[] time)
+  private void addSection(int tab, int level, int numLevels, final RubikDialogScoresView view, final String[] country, final String[] name, final int[] time)
     {
     String title = level==numLevels ?
                    mAct.getString(R.string.levelM) :
@@ -120,7 +120,7 @@ class RubikDialogScoresPagerAdapter extends PagerAdapter implements RubikNetwork
 
 ///////////////////////////////////////////////////////////////////////////////////////////////////
 
-  public void receive(final String[][][] country, final String[][][] name, final float[][][] time)
+  public void receive(final String[][][] country, final String[][][] name, final int[][][] time)
     {
     prepareView();
     int toDo=0;
diff --git a/src/main/java/org/distorted/dialogs/RubikDialogScoresView.java b/src/main/java/org/distorted/dialogs/RubikDialogScoresView.java
index a152127d..444dd950 100644
--- a/src/main/java/org/distorted/dialogs/RubikDialogScoresView.java
+++ b/src/main/java/org/distorted/dialogs/RubikDialogScoresView.java
@@ -9,7 +9,6 @@
 
 package org.distorted.dialogs;
 
-import android.annotation.SuppressLint;
 import android.content.Context;
 import android.content.res.Resources;
 import androidx.fragment.app.FragmentActivity;
@@ -64,8 +63,7 @@ public class RubikDialogScoresView extends FrameLayout
 
 ///////////////////////////////////////////////////////////////////////////////////////////////////
 
-  @SuppressLint("DefaultLocale")
-  LinearLayout createSection(FragmentActivity act, int tab, String title, int level, final String[] country, final String[] name, final float[] time)
+  LinearLayout createSection(FragmentActivity act, int tab, String title, int level, final String[] country, final String[] name, final int[] time)
     {
     LinearLayout levelLayout = (LinearLayout)inflate(act, R.layout.dialog_scores_scramble_title, null);
     TextView text = levelLayout.findViewById(R.id.scoresScrambleTitle);
@@ -79,12 +77,11 @@ public class RubikDialogScoresView extends FrameLayout
     RubikScores scores = RubikScores.getInstance();
 
     boolean inserted = false;
-    long myRecordInMillis = scores.getRecord(tab, level);
-    float myRecordInSeconds = (myRecordInMillis/10)/100.0f;
+    int myRecordInMillis = scores.getRecord(tab, level);
+    String myRecord = ( myRecordInMillis<RubikScores.NO_RECORD ) ? formatRecord(myRecordInMillis) : "??";
     String myName = scores.getName();
     if( myName.length()==0 ) myName = act.getString(R.string.you);
     int myCountryID = res.getIdentifier( scores.getCountry(), "drawable", packageName);
-    String myRecord = ( myRecordInMillis<RubikScores.NO_RECORD ) ? String.format("%.2f", myRecordInSeconds) : "??";
     String theirTime;
     int theirCountryID;
 
@@ -97,7 +94,7 @@ public class RubikDialogScoresView extends FrameLayout
       {
       if( name[j] != null )
         {
-        if( myRecordInSeconds<time[j] && !inserted )
+        if( myRecordInMillis<time[j] && !inserted )
           {
           inserted = true;
           View row = createRow(act, myCountryID, myName, myRecord, height, red);
@@ -110,7 +107,7 @@ public class RubikDialogScoresView extends FrameLayout
           {
           if( equals ) inserted=true;
           theirCountryID = res.getIdentifier( country[j], "drawable", packageName);
-          theirTime = String.format("%.2f", time[j]);
+          theirTime = formatRecord(time[j]);
           View row = createRow(act, theirCountryID, name[j], theirTime, height, equals ? red:white);
           levelLayout.addView(row);
           }
@@ -126,6 +123,19 @@ public class RubikDialogScoresView extends FrameLayout
     return levelLayout;
     }
 
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+  private String formatRecord(int time)
+    {
+    time /= 10;
+    int millis = time%100;
+    time /= 100;
+    int seconds = time%60;
+    int minutes = time/60;
+
+    return minutes + (seconds<10 ? ":0" : ":") + seconds + (millis<10 ? ".0" : ".") + millis;
+    }
+
 ///////////////////////////////////////////////////////////////////////////////////////////////////
 
   private View createRow(FragmentActivity act, int countryID, String name, String time, int height, int color)
diff --git a/src/main/java/org/distorted/external/RubikNetwork.java b/src/main/java/org/distorted/external/RubikNetwork.java
index 30280eb9..1f5eb70c 100644
--- a/src/main/java/org/distorted/external/RubikNetwork.java
+++ b/src/main/java/org/distorted/external/RubikNetwork.java
@@ -39,7 +39,7 @@ public class RubikNetwork
   {
   public interface ScoresReceiver
     {
-    void receive(String[][][] country, String[][][] name, float[][][] time);
+    void receive(String[][][] country, String[][][] name, int[][][] time);
     void message(String mess);
     void error(String error);
     }
@@ -110,7 +110,7 @@ public class RubikNetwork
 
   private static String[][][] mCountry;
   private static String[][][] mName;
-  private static float[][][] mTime;
+  private static int[][][] mTime;
   private static int[][] mPlaces;
 
   private static RubikNetwork mThis;
@@ -130,7 +130,7 @@ public class RubikNetwork
 
     if( mCountry==null || newNum!=mNumObjects ) mCountry = new String[newNum][LEVELS_SHOWN+1][MAX_PLACES];
     if( mName==null    || newNum!=mNumObjects ) mName    = new String[newNum][LEVELS_SHOWN+1][MAX_PLACES];
-    if( mTime==null    || newNum!=mNumObjects ) mTime    = new  float[newNum][LEVELS_SHOWN+1][MAX_PLACES];
+    if( mTime==null    || newNum!=mNumObjects ) mTime    = new    int[newNum][LEVELS_SHOWN+1][MAX_PLACES];
     if( mPlaces==null  || newNum!=mNumObjects ) mPlaces  = new    int[newNum][LEVELS_SHOWN+1];
 
     if( mUpdates==null ) mUpdates = new RubikUpdates();
@@ -243,7 +243,7 @@ public class RubikNetwork
 
           mCountry[object][level][p] = country;
           mName   [object][level][p] = name;
-          mTime   [object][level][p] = ((float)(time/10))/100.0f;
+          mTime   [object][level][p] = time;
           }
         }
       }
diff --git a/src/main/java/org/distorted/external/RubikScores.java b/src/main/java/org/distorted/external/RubikScores.java
index 765785c9..d491e404 100644
--- a/src/main/java/org/distorted/external/RubikScores.java
+++ b/src/main/java/org/distorted/external/RubikScores.java
@@ -37,7 +37,7 @@ public class RubikScores
 
   public static final int MAX_RECORD = 10;
   public static final int MULT = 1000000;
-  public static final long NO_RECORD = Long.MAX_VALUE;
+  public static final int NO_RECORD = Integer.MAX_VALUE;
   private static RubikScores mThis;
 
   private String mName, mCountry;
@@ -50,10 +50,10 @@ public class RubikScores
 
   private static class MapValue
     {
-    long record;
+    int record;
     boolean submitted;
 
-    MapValue(long rec,int sub)
+    MapValue(int rec,int sub)
       {
       record    = rec;
       submitted = sub!=0;
@@ -286,7 +286,7 @@ public class RubikScores
 
 ///////////////////////////////////////////////////////////////////////////////////////////////////
 
-  public synchronized int setRecord(int object, int level, long record)
+  public synchronized int setRecord(int object, int level, int record)
     {
     int key = mapKey(object,level);
     MapValue oldValue = mMap.get(key);
@@ -312,7 +312,7 @@ public class RubikScores
 
 ///////////////////////////////////////////////////////////////////////////////////////////////////
 
-  public synchronized long getRecord(int object, int level)
+  public synchronized int getRecord(int object, int level)
     {
     int key = mapKey(object,level);
     MapValue value = mMap.get(key);
@@ -420,8 +420,7 @@ public class RubikScores
   public synchronized void restorePreferences(SharedPreferences preferences)
     {
     String recordStr, subStr, nameStr, timeStr, submStr, errorStr="";
-    int start, end, equals, comma, ordinal, subm;
-    long time;
+    int start, end, equals, comma, ordinal, subm, time;
     boolean thereWasError = false;
     int numObjects = RubikObjectList.getNumObjects();
 
@@ -453,7 +452,7 @@ public class RubikScores
 
           if( ordinal>=0 && ordinal<numObjects )
             {
-            time = Long.parseLong(timeStr);
+            time = Integer.parseInt(timeStr);
             subm = Integer.parseInt(submStr);
 
             if( subm>=0 && subm<=1 )
diff --git a/src/main/java/org/distorted/main/RubikActivity.java b/src/main/java/org/distorted/main/RubikActivity.java
index b0e60d6a..5ca000f6 100644
--- a/src/main/java/org/distorted/main/RubikActivity.java
+++ b/src/main/java/org/distorted/main/RubikActivity.java
@@ -75,7 +75,7 @@ public class RubikActivity extends AppCompatActivity
     public static final float PATTERN_GROUP_TEXT  = 0.03f;
     public static final float PATTERN_CHILD_TEXT  = 0.02f;
     public static final float SCORES_LEVEL_TEXT   = 0.035f;
-    public static final float SCORES_ITEM_TEXT    = 0.030f;
+    public static final float SCORES_ITEM_TEXT    = 0.025f;
     public static final float TAB_WIDTH           = 0.066f;
     public static final float TAB_HEIGHT          = 0.066f;
     public static final float POPUP_PADDING       = 0.028f;
diff --git a/src/main/java/org/distorted/screens/RubikScreenSolving.java b/src/main/java/org/distorted/screens/RubikScreenSolving.java
index 563a93c4..e43c2037 100644
--- a/src/main/java/org/distorted/screens/RubikScreenSolving.java
+++ b/src/main/java/org/distorted/screens/RubikScreenSolving.java
@@ -186,7 +186,7 @@ public class RubikScreenSolving extends RubikScreenBase
     RubikScreenPlay play = (RubikScreenPlay) ScreenList.PLAY.getScreenClass();
     int object = RubikObjectList.getCurrObject();
     int level = play.getLevel()-1;
-    return mScores.setRecord(object, level, mElapsed);
+    return mScores.setRecord(object, level, (int)mElapsed);
     }
 
 ///////////////////////////////////////////////////////////////////////////////////////////////////
diff --git a/src/main/res/layout/dialog_scores_scramble_row.xml b/src/main/res/layout/dialog_scores_scramble_row.xml
index 5d8a3571..79499f5b 100644
--- a/src/main/res/layout/dialog_scores_scramble_row.xml
+++ b/src/main/res/layout/dialog_scores_scramble_row.xml
@@ -31,11 +31,11 @@
         android:id="@+id/scoresScrambleRowTime"
         android:layout_width="match_parent"
         android:layout_height="match_parent"
-        android:layout_weight="1.5"
+        android:layout_weight="1.2"
         android:textSize="20sp"
         android:maxLines="1"
         android:gravity="end"
         android:background="@color/black"
-        android:paddingEnd="5dp"
+        android:paddingEnd="3dp"
         />
 </LinearLayout>
