Project

General

Profile

« Previous | Next » 

Revision 66cbab36

Added by Leszek Koltunski over 2 years ago

Bandaged 3x3 UI: minor.

View differences:

src/main/java/org/distorted/bandaged/BandagedCreatorObjectView.java
32 32

  
33 33
public class BandagedCreatorObjectView
34 34
{
35
  static final float RATIO_PANE = 0.36f;
36
  static final float RATIO_ICON = 0.15f;
37

  
35 38
  private final LinearLayout mPane;
36 39
  private final String mName;
37 40

  
......
44 47
    mPane = (LinearLayout) inflater.inflate(R.layout.bandaged_pane, null);
45 48

  
46 49
    int width    = act.getScreenWidthInPixels();
47
    int lMargin  = (int)(width*RubikActivity.LARGE_MARGIN);
50
    int margin   = (int)(width*RubikActivity.LARGE_MARGIN);
48 51
    int textSize = (int)(width*RubikActivity.BUTTON_TEXT_SIZE);
49 52

  
50
    LinearLayout.LayoutParams params = new LinearLayout.LayoutParams( (int)(width*0.36f), LinearLayout.LayoutParams.MATCH_PARENT);
51
    params.bottomMargin = lMargin;
52
    params.topMargin    = lMargin;
53
    params.leftMargin   = leftmost ? lMargin : 0;
54
    params.rightMargin  = lMargin;
53
    LinearLayout.LayoutParams params = new LinearLayout.LayoutParams( (int)(width*RATIO_PANE), LinearLayout.LayoutParams.MATCH_PARENT);
54
    params.bottomMargin = margin;
55
    params.topMargin    = margin;
56
    params.leftMargin   = leftmost ? margin : 0;
57
    params.rightMargin  = margin;
55 58

  
56 59
    mPane.setLayoutParams(params);
57 60

  
......
65 68
    TransparentImageButton delButton = new TransparentImageButton(act, icon, TransparentImageButton.GRAVITY_MIDDLE, paramsB);
66 69

  
67 70
    int height = act.getScreenHeightInPixels();
68
    int iconHeight = (int)(0.15f*(BandagedCreatorActivity.RATIO_SCROLL-2*RubikActivity.PADDING)*height);
71
    int iconHeight = (int)(RATIO_ICON*(BandagedCreatorActivity.RATIO_SCROLL-2*RubikActivity.PADDING)*height);
69 72
    delButton.setIconSize(iconHeight);
70 73

  
71 74
    bottom.addView(plaButton);
......
99 102

  
100 103
///////////////////////////////////////////////////////////////////////////////////////////////////
101 104

  
102
  public boolean objectNameIs(String name)
105
  public String getName()
103 106
    {
104
    return mName.equals(name);
107
    return mName;
105 108
    }
106 109
}
src/main/java/org/distorted/bandaged/BandagedCreatorScreen.java
155 155
    for(int v=0; v<mNumObjects; v++)
156 156
      {
157 157
      BandagedCreatorObjectView view = mViews.get(v);
158
      String viewName = view.getName();
158 159

  
159
      if( view.objectNameIs(name) )
160
      if( viewName.equals(name) )
160 161
        {
161 162
        LinearLayout pane = view.getPane();
162 163
        mObjectView.removeView(pane);
......
168 169
          int width = act.getScreenWidthInPixels();
169 170
          BandagedCreatorObjectView v2 = mViews.get(v);
170 171
          LinearLayout p2 = v2.getPane();
171
          int lMargin = (int)(width*RubikActivity.LARGE_MARGIN);;
172

  
173
          LinearLayout.LayoutParams params = new LinearLayout.LayoutParams( (int)(width*0.36f), LinearLayout.LayoutParams.MATCH_PARENT);
174
          params.bottomMargin = lMargin;
175
          params.topMargin    = lMargin;
176
          params.leftMargin   = lMargin;
177
          params.rightMargin  = lMargin;
172
          int margin = (int)(width*RubikActivity.LARGE_MARGIN);;
173
          int w = (int)(width*BandagedCreatorObjectView.RATIO_PANE);
174
          LinearLayout.LayoutParams params = new LinearLayout.LayoutParams( w, LinearLayout.LayoutParams.MATCH_PARENT);
175
          params.bottomMargin = margin;
176
          params.topMargin    = margin;
177
          params.leftMargin   = margin;
178
          params.rightMargin  = margin;
178 179

  
179 180
          p2.setLayoutParams(params);
180 181
          }

Also available in: Unified diff