commit 362807f013efc1ed946c7df9b7012686658fdbed
Author: Leszek Koltunski <leszek@koltunski.pl>
Date:   Mon Jul 6 21:34:06 2020 +0100

    Make the Scores Dialog screen-size invariant.

diff --git a/src/main/java/org/distorted/dialogs/RubikDialogScoresPagerAdapter.java b/src/main/java/org/distorted/dialogs/RubikDialogScoresPagerAdapter.java
index 0c89683a..9b87a024 100644
--- a/src/main/java/org/distorted/dialogs/RubikDialogScoresPagerAdapter.java
+++ b/src/main/java/org/distorted/dialogs/RubikDialogScoresPagerAdapter.java
@@ -24,6 +24,8 @@ import androidx.annotation.NonNull;
 import androidx.fragment.app.FragmentActivity;
 import androidx.viewpager.widget.PagerAdapter;
 import androidx.viewpager.widget.ViewPager;
+
+import android.util.DisplayMetrics;
 import android.view.View;
 import android.view.ViewGroup;
 import android.widget.LinearLayout;
@@ -198,7 +200,9 @@ class RubikDialogScoresPagerAdapter extends PagerAdapter implements RubikScoresD
   @NonNull
   public Object instantiateItem(@NonNull ViewGroup collection, int position)
     {
-    mViews[position] = new RubikDialogScoresView(mAct, mIsSubmitting);
+    DisplayMetrics metrics = mAct.getResources().getDisplayMetrics();
+
+    mViews[position] = new RubikDialogScoresView(mAct, metrics.heightPixels, mIsSubmitting);
     collection.addView(mViews[position]);
 
     boolean allCreated = true;
diff --git a/src/main/java/org/distorted/dialogs/RubikDialogScoresView.java b/src/main/java/org/distorted/dialogs/RubikDialogScoresView.java
index 53f91b84..0b334afb 100644
--- a/src/main/java/org/distorted/dialogs/RubikDialogScoresView.java
+++ b/src/main/java/org/distorted/dialogs/RubikDialogScoresView.java
@@ -23,6 +23,7 @@ import android.content.Context;
 import android.content.res.Resources;
 import androidx.fragment.app.FragmentActivity;
 import android.util.AttributeSet;
+import android.util.TypedValue;
 import android.view.View;
 import android.widget.FrameLayout;
 import android.widget.ImageView;
@@ -30,6 +31,7 @@ import android.widget.LinearLayout;
 import android.widget.TextView;
 
 import org.distorted.main.R;
+import org.distorted.main.RubikActivity;
 import org.distorted.objects.RubikObjectList;
 import org.distorted.scores.RubikScores;
 
@@ -39,7 +41,8 @@ import static org.distorted.scores.RubikScoresDownloader.MAX_PLACES;
 
 public class RubikDialogScoresView extends FrameLayout
   {
-  LinearLayout mLayout;
+  private LinearLayout mLayout;
+  private int mWidth;
 
 ///////////////////////////////////////////////////////////////////////////////////////////////////
 
@@ -57,10 +60,12 @@ public class RubikDialogScoresView extends FrameLayout
 
 ///////////////////////////////////////////////////////////////////////////////////////////////////
 
-  public RubikDialogScoresView(Context context, boolean isSubmitting)
+  public RubikDialogScoresView(Context context, int width, boolean isSubmitting)
     {
     super(context);
 
+    mWidth = width;
+
     View view = inflate(context, R.layout.dialog_scores_downloading, null);
     addView(view);
     TextView text = findViewById(R.id.message_text);
@@ -75,6 +80,9 @@ public class RubikDialogScoresView extends FrameLayout
     TextView text = levelLayout.findViewById(R.id.scoresScrambleTitle);
     text.setText(act.getString(R.string.lv_placeholder,level+1));
 
+    int size = (int)(mWidth* RubikActivity.SCORES_LEVEL_TEXT);
+    text.setTextSize(TypedValue.COMPLEX_UNIT_PX, size);
+
     Resources res = act.getResources();
     String packageName = act.getPackageName();
 
@@ -93,6 +101,7 @@ public class RubikDialogScoresView extends FrameLayout
     String theirTime;
     int theirCountryID;
 
+    int height = (int)(mWidth* RubikActivity.SCORES_ITEM_TEXT);
     int white = res.getColor(R.color.white);
     int red   = res.getColor(R.color.red);
     boolean equals;
@@ -104,7 +113,7 @@ public class RubikDialogScoresView extends FrameLayout
         if( !mySubmitted && myRecordInSeconds<time[j] && !inserted )
           {
           inserted = true;
-          View row = createRow(act, myCountryID, myName, myRecord, red);
+          View row = createRow(act, myCountryID, myName, myRecord, height, red);
           levelLayout.addView(row);
           }
 
@@ -115,7 +124,7 @@ public class RubikDialogScoresView extends FrameLayout
           if( equals ) inserted=true;
           theirCountryID = res.getIdentifier( country[j], "drawable", packageName);
           theirTime = Float.toString(time[j]);
-          View row = createRow(act, theirCountryID, name[j], theirTime, equals ? red:white);
+          View row = createRow(act, theirCountryID, name[j], theirTime, height, equals ? red:white);
           levelLayout.addView(row);
           }
         }
@@ -123,7 +132,7 @@ public class RubikDialogScoresView extends FrameLayout
 
     if( !inserted )
       {
-      View row = createRow(act, myCountryID, myName, myRecord, red);
+      View row = createRow(act, myCountryID, myName, myRecord, height, red);
       levelLayout.addView(row);
       }
 
@@ -132,7 +141,7 @@ public class RubikDialogScoresView extends FrameLayout
 
 ///////////////////////////////////////////////////////////////////////////////////////////////////
 
-  private View createRow(FragmentActivity act, int countryID, String name, String time, int color)
+  private View createRow(FragmentActivity act, int countryID, String name, String time, int height, int color)
     {
     View row = inflate(act, R.layout.dialog_scores_scramble_row, null);
 
@@ -147,6 +156,9 @@ public class RubikDialogScoresView extends FrameLayout
     textName.setTextColor(color);
     textTime.setTextColor(color);
 
+    textName.setTextSize(TypedValue.COMPLEX_UNIT_PX, height);
+    textTime.setTextSize(TypedValue.COMPLEX_UNIT_PX, height);
+
     return row;
     }
 
diff --git a/src/main/java/org/distorted/main/RubikActivity.java b/src/main/java/org/distorted/main/RubikActivity.java
index 7ab3f837..92e06039 100644
--- a/src/main/java/org/distorted/main/RubikActivity.java
+++ b/src/main/java/org/distorted/main/RubikActivity.java
@@ -52,6 +52,8 @@ public class RubikActivity extends AppCompatActivity
     public static final float MENU_ITEM_SIZE      = 0.12f;
     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 MENU_BIG_TEXT_SIZE   = 0.05f;
     public static final float MENU_MEDIUM_TEXT_SIZE= 0.04f;
diff --git a/src/main/res/layout/dialog_scores_scramble_row.xml b/src/main/res/layout/dialog_scores_scramble_row.xml
index c75a501a..9b7ecdda 100644
--- a/src/main/res/layout/dialog_scores_scramble_row.xml
+++ b/src/main/res/layout/dialog_scores_scramble_row.xml
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="utf-8"?>
 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
     android:layout_width="fill_parent"
-    android:layout_height="0dp"
+    android:layout_height="wrap_content"
     android:paddingBottom="2dp"
     android:paddingTop="2dp"
     android:orientation="horizontal" >
@@ -10,8 +10,9 @@
         android:id="@+id/scoresScrambleRowCountry"
         android:layout_width="match_parent"
         android:layout_height="match_parent"
+        android:paddingBottom="3dp"
+        android:paddingTop="3dp"
         android:layout_weight="1.5"
-        android:textSize="20sp"
         android:gravity="start"
         android:background="@color/black" />
 
diff --git a/src/main/res/layout/dialog_scores_scramble_title.xml b/src/main/res/layout/dialog_scores_scramble_title.xml
index 81a0fca4..cf71ec07 100644
--- a/src/main/res/layout/dialog_scores_scramble_title.xml
+++ b/src/main/res/layout/dialog_scores_scramble_title.xml
@@ -14,7 +14,7 @@
     <TextView
         android:id="@+id/scoresScrambleTitle"
         android:layout_width="match_parent"
-        android:layout_height="32dp"
+        android:layout_height="wrap_content"
         android:textSize="24sp"
         android:gravity="center"
         android:background="@color/grey"
