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()
|
More fixes for UI in case of extreme screen (w/h) ratios ( from 1.0 to 2.0 ).