Project

General

Profile

« Previous | Next » 

Revision 35e32f0c

Added by Leszek Koltunski almost 2 years ago

More fixes for UI in case of extreme screen (w/h) ratios ( from 1.0 to 2.0 ).

View differences:

src/main/java/org/distorted/bandaged/BandagedCreatorActivity.java
43 43
    static final float RATIO_SCROLL= 0.30f;
44 44

  
45 45
    public static final float DIALOG_BUTTON_SIZE = 0.06f;
46
    public static final float MENU_BIG_TEXT_SIZE = 0.05f;
47 46
    public static final float SPINNER_TEXT_SIZE  = 0.03f;
48 47

  
49 48
    public static final int FLAGS =  View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
src/main/java/org/distorted/bandaged/BandagedCreatorObjectView.java
24 24

  
25 25
public class BandagedCreatorObjectView
26 26
{
27
  static final float RATIO_PANE = 0.36f;
28
  static final float RATIO_ICON = 0.15f;
27
  private static final float MARGIN    = 0.015f;
28
  private static final float TEXT_SIZE = 0.032f;
29
  private static final float RATIO_ICON= 0.15f;
29 30

  
30 31
  private final LinearLayout mPane;
31 32
  private final String mName;
......
38 39
    LayoutInflater inflater = act.getLayoutInflater();
39 40
    mPane = (LinearLayout) inflater.inflate(R.layout.bandaged_pane, null);
40 41

  
41
    int width    = act.getScreenWidthInPixels();
42
    int margin   = (int)(width*RubikActivity.LARGE_MARGIN);
43
    int textSize = (int)(width*RubikActivity.BUTTON_TEXT_SIZE);
44

  
45
    LinearLayout.LayoutParams params = new LinearLayout.LayoutParams( (int)(width*RATIO_PANE), LinearLayout.LayoutParams.MATCH_PARENT);
46
    params.bottomMargin = margin;
47
    params.topMargin    = margin;
48
    params.leftMargin   = leftmost ? margin : 0;
49
    params.rightMargin  = margin;
42
    int height   = act.getScreenHeightInPixels();
43
    int textSize = (int)(height*TEXT_SIZE);
50 44

  
45
    LinearLayout.LayoutParams params = createPaneParams(height,leftmost);
51 46
    mPane.setLayoutParams(params);
52 47

  
53 48
    LinearLayout bottom = mPane.findViewById(R.id.bandagedCreatorObjectLayout);
......
59 54
    LinearLayout.LayoutParams paramsB = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT,LinearLayout.LayoutParams.MATCH_PARENT,3.0f);
60 55
    TransparentImageButton delButton = new TransparentImageButton(act, icon, TransparentImageButton.GRAVITY_MIDDLE, paramsB);
61 56

  
62
    int height = act.getScreenHeightInPixels();
63 57
    int iconHeight = (int)(RATIO_ICON*(BandagedCreatorActivity.RATIO_SCROLL-2*RubikActivity.PADDING)*height);
64 58
    delButton.setIconSize(iconHeight);
65 59

  
......
89 83
      });
90 84
    }
91 85

  
86
///////////////////////////////////////////////////////////////////////////////////////////////////
87

  
88
  static LinearLayout.LayoutParams createPaneParams(int height, boolean leftmost)
89
    {
90
    int margin = (int)(height*MARGIN);
91
    int length = (int)(height*BandagedCreatorActivity.RATIO_SCROLL*0.66f);
92

  
93
    LinearLayout.LayoutParams params = new LinearLayout.LayoutParams( length, LinearLayout.LayoutParams.MATCH_PARENT);
94
    params.bottomMargin = margin;
95
    params.topMargin    = margin;
96
    params.leftMargin   = leftmost ? margin : 0;
97
    params.rightMargin  = margin;
98

  
99
    return params;
100
    }
101

  
92 102
///////////////////////////////////////////////////////////////////////////////////////////////////
93 103

  
94 104
  public LinearLayout getPane()
src/main/java/org/distorted/bandaged/BandagedCreatorScreen.java
258 258

  
259 259
        if( v==0 && mNumObjects>0 )
260 260
          {
261
          int width = act.getScreenWidthInPixels();
262 261
          BandagedCreatorObjectView v2 = mViews.get(v);
263 262
          LinearLayout p2 = v2.getPane();
264
          int margin = (int)(width*RubikActivity.LARGE_MARGIN);;
265
          int w = (int)(width*BandagedCreatorObjectView.RATIO_PANE);
266
          LinearLayout.LayoutParams params = new LinearLayout.LayoutParams( w, LinearLayout.LayoutParams.MATCH_PARENT);
267
          params.bottomMargin = margin;
268
          params.topMargin    = margin;
269
          params.leftMargin   = margin;
270
          params.rightMargin  = margin;
271

  
263
          int height = act.getScreenHeightInPixels();
264
          LinearLayout.LayoutParams params = BandagedCreatorObjectView.createPaneParams(height,true);
272 265
          p2.setLayoutParams(params);
273 266
          }
274 267

  

Also available in: Unified diff