Project

General

Profile

« Previous | Next » 

Revision 98e7cc0f

Added by Leszek Koltunski over 4 years ago

Improvements to the UI - make it proportional regardless of the physical screen size. (Part 4)

View differences:

src/main/java/org/distorted/states/RubikStatePlay.java
97 97
    LinearLayout layoutLeft = act.findViewById(R.id.mainBarLeft);
98 98
    layoutLeft.removeAllViews();
99 99

  
100
    setupSettingsButton(act,scale);
100
    setupSettingsButton(act,scale,width);
101 101
    layoutLeft.addView(mSettingsButton);
102 102
    setupSolveButton(act,scale);
103 103
    layoutLeft.addView(mSolveButton);
......
208 208

  
209 209
///////////////////////////////////////////////////////////////////////////////////////////////////
210 210

  
211
  private void setupSettingsButton(final RubikActivity act, final float scale)
211
  private void setupSettingsButton(final RubikActivity act, final float scale, final float width)
212 212
    {
213 213
    int padding = (int)(3*scale + 0.5f);
214
    LinearLayout.LayoutParams objectParams = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.WRAP_CONTENT,LinearLayout.LayoutParams.MATCH_PARENT);
214
    int widthBut = (int)(width/6);
215
    LinearLayout.LayoutParams objectParams = new LinearLayout.LayoutParams(widthBut,LinearLayout.LayoutParams.MATCH_PARENT);
215 216
    mSettingsButton = new ImageButton(act);
216 217
    mSettingsButton.setLayoutParams(objectParams);
217 218
    mSettingsButton.setPadding(padding,0,padding,0);
src/main/java/org/distorted/states/RubikStateSolving.java
114 114
    LinearLayout layoutLeft = act.findViewById(R.id.mainBarLeft);
115 115
    layoutLeft.removeAllViews();
116 116

  
117
    setupPrevMoveButtom(act,scale);
117
    setupPrevMoveButtom(act,scale,width);
118 118
    layoutLeft.addView(mPrevButton);
119 119

  
120 120
    LinearLayout layoutRight = act.findViewById(R.id.mainBarRight);
......
143 143

  
144 144
///////////////////////////////////////////////////////////////////////////////////////////////////
145 145

  
146
  private void setupPrevMoveButtom(final RubikActivity act, float scale)
146
  private void setupPrevMoveButtom(final RubikActivity act, float scale, float width)
147 147
    {
148 148
    int padding = (int)( 3*scale + 0.5f);
149
    int width   = (int)(60*scale + 0.5f);
150
    LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(width,LinearLayout.LayoutParams.MATCH_PARENT);
149
    int widthBut= (int)(width/6);
150

  
151
    LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(widthBut,LinearLayout.LayoutParams.MATCH_PARENT);
151 152
    mPrevButton = new ImageButton(act);
152 153
    mPrevButton.setLayoutParams(params);
153 154
    mPrevButton.setPadding(padding,0,padding,0);

Also available in: Unified diff