Project

General

Profile

« Previous | Next » 

Revision 9dfb553f

Added by Leszek Koltunski almost 2 years ago

Improve UI proportions on squarish screens.

View differences:

src/main/java/org/distorted/dialogs/RubikDialogAbout.java
46 46

  
47 47
    DisplayMetrics displaymetrics = new DisplayMetrics();
48 48
    act.getWindowManager().getDefaultDisplay().getMetrics(displaymetrics);
49
    final float titleSize= displaymetrics.widthPixels * RubikActivity.MENU_BIG_TEXT_SIZE;
49
    final float titleSize= displaymetrics.widthPixels * RubikActivity.BIG_TEXT_SIZE;
50 50
    final float okSize   = displaymetrics.widthPixels * RubikActivity.DIALOG_BUTTON_SIZE;
51
    final float textSize = displaymetrics.widthPixels * RubikActivity.MENU_SMALL_TEXT_SIZE;
51
    final float textSize = displaymetrics.widthPixels * RubikActivity.SMALL_TEXT_SIZE;
52 52

  
53 53
    TextView tv = (TextView) inflater.inflate(R.layout.dialog_title, null);
54 54
    tv.setTextSize(TypedValue.COMPLEX_UNIT_PX, titleSize);
src/main/java/org/distorted/dialogs/RubikDialogBandagedDelete.java
43 43

  
44 44
    DisplayMetrics displaymetrics = new DisplayMetrics();
45 45
    act.getWindowManager().getDefaultDisplay().getMetrics(displaymetrics);
46
    final float titleSize= displaymetrics.widthPixels * RubikActivity.MENU_BIG_TEXT_SIZE;
46
    final float titleSize= displaymetrics.widthPixels * RubikActivity.BIG_TEXT_SIZE;
47 47
    final float okSize   = displaymetrics.widthPixels * RubikActivity.DIALOG_BUTTON_SIZE;
48 48

  
49 49
    TextView tv = (TextView) inflater.inflate(R.layout.dialog_title, null);
src/main/java/org/distorted/dialogs/RubikDialogBandagedSave.java
17 17
import android.view.LayoutInflater;
18 18
import android.view.View;
19 19
import android.view.Window;
20
import android.view.WindowManager;
21 20
import android.widget.Button;
22 21
import android.widget.TextView;
23 22

  
......
45 44

  
46 45
    DisplayMetrics displaymetrics = new DisplayMetrics();
47 46
    act.getWindowManager().getDefaultDisplay().getMetrics(displaymetrics);
48
    final float titleSize= displaymetrics.widthPixels * RubikActivity.MENU_BIG_TEXT_SIZE;
47
    final float titleSize= displaymetrics.widthPixels * RubikActivity.BIG_TEXT_SIZE;
49 48
    final float okSize   = displaymetrics.widthPixels * RubikActivity.DIALOG_BUTTON_SIZE;
50 49

  
51 50
    TextView tv = (TextView) inflater.inflate(R.layout.dialog_title, null);
src/main/java/org/distorted/dialogs/RubikDialogEffects.java
213 213

  
214 214
    DisplayMetrics displaymetrics = new DisplayMetrics();
215 215
    act.getWindowManager().getDefaultDisplay().getMetrics(displaymetrics);
216
    final float titleSize= displaymetrics.widthPixels * RubikActivity.MENU_BIG_TEXT_SIZE;
216
    final float titleSize= displaymetrics.widthPixels * RubikActivity.BIG_TEXT_SIZE;
217 217
    final float okSize   = displaymetrics.widthPixels * RubikActivity.DIALOG_BUTTON_SIZE;
218 218

  
219
    mTextSize = displaymetrics.widthPixels * RubikActivity.MENU_SMALL_TEXT_SIZE;
219
    mTextSize = displaymetrics.widthPixels * RubikActivity.SMALL_TEXT_SIZE;
220 220

  
221 221
    tv.setTextSize(TypedValue.COMPLEX_UNIT_PX, titleSize);
222 222
    tv.setText(R.string.effects);
src/main/java/org/distorted/dialogs/RubikDialogError.java
17 17
import android.view.LayoutInflater;
18 18
import android.view.View;
19 19
import android.view.Window;
20
import android.view.WindowManager;
21 20
import android.widget.Button;
22 21
import android.widget.TextView;
23 22

  
......
43 42

  
44 43
    DisplayMetrics displaymetrics = new DisplayMetrics();
45 44
    act.getWindowManager().getDefaultDisplay().getMetrics(displaymetrics);
46
    final float titleSize= displaymetrics.widthPixels * RubikActivity.MENU_BIG_TEXT_SIZE;
45
    final float titleSize= displaymetrics.widthPixels * RubikActivity.BIG_TEXT_SIZE;
47 46
    final float okSize   = displaymetrics.widthPixels * RubikActivity.DIALOG_BUTTON_SIZE;
48 47

  
49 48
    TextView tv = (TextView) inflater.inflate(R.layout.dialog_title, null);
src/main/java/org/distorted/dialogs/RubikDialogNewRecord.java
45 45

  
46 46
    DisplayMetrics displaymetrics = new DisplayMetrics();
47 47
    act.getWindowManager().getDefaultDisplay().getMetrics(displaymetrics);
48
    final float titleSize= displaymetrics.widthPixels * RubikActivity.MENU_BIG_TEXT_SIZE;
48
    final float titleSize= displaymetrics.widthPixels * RubikActivity.BIG_TEXT_SIZE;
49 49
    final float okSize   = displaymetrics.widthPixels * RubikActivity.DIALOG_BUTTON_SIZE;
50
    final float textSize = displaymetrics.widthPixels * RubikActivity.MENU_BIG_TEXT_SIZE;
50
    final float textSize = displaymetrics.widthPixels * RubikActivity.BIG_TEXT_SIZE;
51 51

  
52 52
    TextView tv = (TextView) inflater.inflate(R.layout.dialog_title, null);
53 53
    tv.setTextSize(TypedValue.COMPLEX_UNIT_PX, titleSize);
src/main/java/org/distorted/dialogs/RubikDialogPattern.java
35 35
import org.distorted.objects.RubikObject;
36 36
import org.distorted.objects.RubikObjectList;
37 37
import org.distorted.patterns.RubikPatternList;
38
import org.distorted.screens.RubikScreenPlay;
39
import org.distorted.screens.ScreenList;
40 38

  
41 39
///////////////////////////////////////////////////////////////////////////////////////////////////
42 40

  
......
57 55
    act.getWindowManager().getDefaultDisplay().getMetrics(displaymetrics);
58 56

  
59 57
    int scrWidth = displaymetrics.widthPixels;
60
    final float titleSize= scrWidth*RubikActivity.MENU_BIG_TEXT_SIZE;
58
    final float titleSize= scrWidth*RubikActivity.BIG_TEXT_SIZE;
61 59
    final float okSize   = scrWidth*RubikActivity.DIALOG_BUTTON_SIZE;
62 60
    final int   tabHeight= (int)(scrWidth*RubikActivity.TAB_HEIGHT);
63 61
    final int   tabWidth = (int)(scrWidth*RubikActivity.TAB_WIDTH);
src/main/java/org/distorted/dialogs/RubikDialogPrivacy.java
46 46

  
47 47
    DisplayMetrics displaymetrics = new DisplayMetrics();
48 48
    act.getWindowManager().getDefaultDisplay().getMetrics(displaymetrics);
49
    final float titleSize= displaymetrics.widthPixels * RubikActivity.MENU_BIG_TEXT_SIZE;
49
    final float titleSize= displaymetrics.widthPixels * RubikActivity.BIG_TEXT_SIZE;
50 50
    final float butSize  = displaymetrics.widthPixels * RubikActivity.DIALOG_BUTTON_SIZE;
51 51

  
52 52
    TextView tv = (TextView) inflater.inflate(R.layout.dialog_title, null);
src/main/java/org/distorted/dialogs/RubikDialogScores.java
53 53
    act.getWindowManager().getDefaultDisplay().getMetrics(displaymetrics);
54 54

  
55 55
    int scrWidth = displaymetrics.widthPixels;
56
    final float titleSize= scrWidth*RubikActivity.MENU_BIG_TEXT_SIZE;
56
    final float titleSize= scrWidth*RubikActivity.BIG_TEXT_SIZE;
57 57
    final float okSize   = scrWidth*RubikActivity.DIALOG_BUTTON_SIZE;
58 58
    final int   tabHeight= (int)(scrWidth*RubikActivity.TAB_HEIGHT);
59 59
    final int   tabWidth = (int)(scrWidth*RubikActivity.TAB_WIDTH);
src/main/java/org/distorted/dialogs/RubikDialogSetName.java
74 74

  
75 75
    DisplayMetrics displaymetrics = new DisplayMetrics();
76 76
    act.getWindowManager().getDefaultDisplay().getMetrics(displaymetrics);
77
    final float titleSize= displaymetrics.widthPixels * RubikActivity.MENU_BIG_TEXT_SIZE;
77
    final float titleSize= displaymetrics.widthPixels * RubikActivity.BIG_TEXT_SIZE;
78 78
    final float okSize   = displaymetrics.widthPixels * RubikActivity.DIALOG_BUTTON_SIZE;
79
    final float textSize = displaymetrics.widthPixels * RubikActivity.MENU_SMALL_TEXT_SIZE;
79
    final float textSize = displaymetrics.widthPixels * RubikActivity.SMALL_TEXT_SIZE;
80 80

  
81 81
    Bundle args = getArguments();
82 82
    String name;
src/main/java/org/distorted/dialogs/RubikDialogSolved.java
43 43

  
44 44
    DisplayMetrics displaymetrics = new DisplayMetrics();
45 45
    act.getWindowManager().getDefaultDisplay().getMetrics(displaymetrics);
46
    final float titleSize= displaymetrics.widthPixels * RubikActivity.MENU_BIG_TEXT_SIZE;
46
    final float titleSize= displaymetrics.widthPixels * RubikActivity.BIG_TEXT_SIZE;
47 47
    final float okSize   = displaymetrics.widthPixels * RubikActivity.DIALOG_BUTTON_SIZE;
48
    final float textSize = displaymetrics.widthPixels * RubikActivity.MENU_BIG_TEXT_SIZE;
48
    final float textSize = displaymetrics.widthPixels * RubikActivity.BIG_TEXT_SIZE;
49 49

  
50 50
    TextView tv = (TextView) inflater.inflate(R.layout.dialog_title, null);
51 51
    tv.setTextSize(TypedValue.COMPLEX_UNIT_PX, titleSize);
src/main/java/org/distorted/dialogs/RubikDialogSolverError.java
42 42

  
43 43
    DisplayMetrics displaymetrics = new DisplayMetrics();
44 44
    act.getWindowManager().getDefaultDisplay().getMetrics(displaymetrics);
45
    final float titleSize= displaymetrics.widthPixels * RubikActivity.MENU_BIG_TEXT_SIZE;
45
    final float titleSize= displaymetrics.widthPixels * RubikActivity.BIG_TEXT_SIZE;
46 46
    final float okSize   = displaymetrics.widthPixels * RubikActivity.DIALOG_BUTTON_SIZE;
47
    final float textSize = displaymetrics.widthPixels * RubikActivity.MENU_BIG_TEXT_SIZE;
47
    final float textSize = displaymetrics.widthPixels * RubikActivity.BIG_TEXT_SIZE;
48 48

  
49 49
    TextView tv = (TextView) inflater.inflate(R.layout.dialog_title, null);
50 50
    tv.setTextSize(TypedValue.COMPLEX_UNIT_PX, titleSize);
src/main/java/org/distorted/dialogs/RubikDialogTutorial.java
55 55
    DisplayMetrics displaymetrics = new DisplayMetrics();
56 56
    act.getWindowManager().getDefaultDisplay().getMetrics(displaymetrics);
57 57
    int scrWidth = displaymetrics.widthPixels;
58
    final float titleSize= scrWidth*RubikActivity.MENU_BIG_TEXT_SIZE;
58
    final float titleSize= scrWidth*RubikActivity.BIG_TEXT_SIZE;
59 59
    final float okSize   = scrWidth*RubikActivity.DIALOG_BUTTON_SIZE;
60 60
    final int   tabHeight= (int)(scrWidth*RubikActivity.TAB_HEIGHT);
61 61
    final int   tabWidth = (int)(scrWidth*RubikActivity.TAB_WIDTH);
src/main/java/org/distorted/dialogs/RubikDialogUpdates.java
77 77
    act.getWindowManager().getDefaultDisplay().getMetrics(displaymetrics);
78 78
    int w= displaymetrics.widthPixels;
79 79
    int h= displaymetrics.heightPixels;
80
    final float titleSize= w*RubikActivity.MENU_BIG_TEXT_SIZE;
80
    final float titleSize= w*RubikActivity.BIG_TEXT_SIZE;
81 81
    final float okSize   = w*RubikActivity.DIALOG_BUTTON_SIZE;
82 82
    mMargin   = (int)(w*RubikActivity.MEDIUM_MARGIN);
83 83
    mSize     = (int)(h*0.14f);
src/main/java/org/distorted/main/RubikActivity.java
81 81
    public static final float SCORES_ITEM_TEXT    = 0.030f;
82 82
    public static final float TUTORIAL_ITEM_TEXT  = 0.100f;
83 83
    public static final float DIALOG_BUTTON_SIZE  = 0.06f;
84
    public static final float MENU_BIG_TEXT_SIZE  = 0.05f;
85
    public static final float MENU_MAIN_TEXT_SIZE = 0.047f;
86
    public static final float MENU_SMALL_TEXT_SIZE= 0.035f;
84
    public static final float BIG_TEXT_SIZE       = 0.05f;
85
    public static final float SMALL_TEXT_SIZE     = 0.035f;
87 86
    public static final float TAB_WIDTH           = 0.100f;
88 87
    public static final float TAB_HEIGHT          = 0.100f;
89
    public static final float MENU_BUTTON_HEIGHT  = 0.115f;
88

  
89
    public static final float MENU_BUTTON_HEIGHT  = 0.075f;
90
    public static final float MENU_TEXT_SIZE      = 0.032f;
90 91

  
91 92
    public static final int FLAGS =  View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
92 93
                                   | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
src/main/java/org/distorted/purchase/PurchaseScreenPane.java
38 38

  
39 39
public class PurchaseScreenPane implements ListenerOverlay
40 40
{
41
  public static final int UNLOCK_ALL_PRICE = 500;
41
  public static final int UNLOCK_ALL_PRICE = 600;
42 42

  
43 43
  private static final int[] IMAGES =
44 44
    {
......
50 50
    };
51 51

  
52 52
  private static final int NUM_IMAGES      = IMAGES.length;
53
  public  static final float PADDING_RATIO = 0.025f;
54
  private static final float TEXT_RATIO    = 0.050f;
53
  public  static final float PADDING_RATIO = 0.017f;
54
  private static final float TEXT_RATIO    = 0.032f;
55 55

  
56 56
  private final WeakReference<PurchaseActivity> mAct;
57 57
  private RubikObject mObject;
......
220 220
  PurchaseScreenPane(final PurchaseActivity act)
221 221
    {
222 222
    mAct = new WeakReference<>(act);
223
    int width = act.getScreenWidthInPixels();
224
    float textSize = width*TEXT_RATIO;
225
    int margin = (int)(width*PADDING_RATIO);
223
    int height = act.getScreenHeightInPixels();
224
    float textSize = height*TEXT_RATIO;
225
    int margin = (int)(height*PADDING_RATIO);
226 226
    int padding = margin/3;
227 227

  
228 228
    LinearLayout upperBar  = act.findViewById(R.id.upperBar);
src/main/java/org/distorted/screens/RubikScreenPlay.java
71 71
  private int mColCount, mRowCount, mMaxRowCount;
72 72
  private int mUpperBarHeight;
73 73
  private boolean mShouldReactToEndOfScrambling;
74
  private float mScreenWidth;
74
  private float mScreenWidth, mScreenHeight;
75 75
  private int mOldNumScramble;
76 76

  
77 77
///////////////////////////////////////////////////////////////////////////////////////////////////
......
86 86
  void enterScreen(final RubikActivity act)
87 87
    {
88 88
    mWeakAct = new WeakReference<>(act);
89
    mScreenWidth = act.getScreenWidthInPixels();
89
    mScreenWidth  = act.getScreenWidthInPixels();
90
    mScreenHeight = act.getScreenHeightInPixels();
90 91
    mUpperBarHeight = act.getHeightUpperBar();
91 92

  
92
    mMenuButtonHeight = (int)(mScreenWidth*RubikActivity.MENU_BUTTON_HEIGHT);
93
    mMenuTextSize     = (int)(mScreenWidth*RubikActivity.MENU_MAIN_TEXT_SIZE);
93
    mMenuButtonHeight = (int)(mScreenHeight*RubikActivity.MENU_BUTTON_HEIGHT);
94
    mMenuTextSize     = (int)(mScreenHeight*RubikActivity.MENU_TEXT_SIZE);
94 95

  
95 96
    mObjectPopup = null;
96 97
    mOldNumScramble = 1000; // used to remember which 'level' buttons are visible; initially all visible

Also available in: Unified diff