Revision 52d0a923
Added by Leszek Koltunski almost 4 years ago
src/main/java/org/distorted/dialogs/RubikDialogEffects.java | ||
---|---|---|
58 | 58 |
private void addSettingsSection(FragmentActivity act, LinearLayout layout, int index) |
59 | 59 |
{ |
60 | 60 |
BaseEffect.Type beType = BaseEffect.Type.getType(index); |
61 |
DisplayMetrics metrics = act.getResources().getDisplayMetrics(); |
|
62 |
final float scale = metrics.density; |
|
63 |
mTextSize = metrics.widthPixels * RubikActivity.MENU_SMALL_TEXT_SIZE; |
|
64 | 61 |
|
65 |
int textH= (int)(mTextSize); |
|
66 |
int layoH= (int)(1.2f*mTextSize);
|
|
67 |
int margH=10;
|
|
62 |
int textH= (int)(1.35f*mTextSize);
|
|
63 |
float A= 1.2f;
|
|
64 |
float B= 0.25f;
|
|
68 | 65 |
|
69 | 66 |
///// OUTER LAYOUT /////////////////////////////////////////////////////////////////// |
70 | 67 |
|
71 |
int margin = (int)(scale*margH + 0.5f);
|
|
68 |
int margin = (int)(B*textH);
|
|
72 | 69 |
int color = ContextCompat.getColor(act, R.color.grey); |
73 | 70 |
LinearLayout outerLayout = new LinearLayout(act); |
74 | 71 |
LinearLayout.LayoutParams outerLayoutParams = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT,LinearLayout.LayoutParams.MATCH_PARENT, 0.5f); |
... | ... | |
85 | 82 |
|
86 | 83 |
///// TEXT /////////////////////////////////////////////////////////////////////////// |
87 | 84 |
|
88 |
int layoutHeight = (int)(scale*textH + 0.5f);
|
|
89 |
int padding = (int)(scale*10 + 0.5f);
|
|
85 |
int layoutHeight = (int)(A*textH);
|
|
86 |
int padding = (int)(B*textH);
|
|
90 | 87 |
|
91 | 88 |
LinearLayout.LayoutParams textParams = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT,layoutHeight); |
92 | 89 |
|
... | ... | |
100 | 97 |
|
101 | 98 |
///// INNER LAYOUT1 ////////////////////////////////////////////////////////////////// |
102 | 99 |
|
103 |
int innerLayout1Height = (int)(scale*layoH + 0.5f);
|
|
100 |
int innerLayout1Height = (int)((A+B)*textH);
|
|
104 | 101 |
LinearLayout innerLayout1 = new LinearLayout(act); |
105 | 102 |
LinearLayout.LayoutParams innerLayout1Params = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT,innerLayout1Height); |
106 | 103 |
|
... | ... | |
111 | 108 |
|
112 | 109 |
///// STUFF INSIDE INNER LAYOUT1 ///////////////////////////////////////////////////// |
113 | 110 |
|
114 |
int text1Padding = (int)(scale*5 + 0.5f);
|
|
111 |
int text1Padding = (int)(B*textH);
|
|
115 | 112 |
LinearLayout.LayoutParams text1LayoutParams = new LinearLayout.LayoutParams(0,layoutHeight,0.25f); |
116 | 113 |
|
117 | 114 |
TextView text1View = new TextView(act); |
... | ... | |
122 | 119 |
text1View.setPadding(text1Padding,0,text1Padding,0); |
123 | 120 |
innerLayout1.addView(text1View); |
124 | 121 |
////////////////////////////////////////////////////////////////// |
125 |
int text2Padding = (int)(scale*5 + 0.5f);
|
|
122 |
int text2Padding = (int)(B*textH);
|
|
126 | 123 |
LinearLayout.LayoutParams text2LayoutParams = new LinearLayout.LayoutParams(0,layoutHeight,0.25f); |
127 | 124 |
|
128 | 125 |
mDurationText[index] = new TextView(act); |
... | ... | |
132 | 129 |
mDurationText[index].setPadding(text2Padding,0,text2Padding,0); |
133 | 130 |
innerLayout1.addView(mDurationText[index]); |
134 | 131 |
////////////////////////////////////////////////////////////////// |
135 |
int seekPadding = (int)(scale*10 + 0.5f);
|
|
132 |
int seekPadding = (int)(B*textH);
|
|
136 | 133 |
LinearLayout.LayoutParams seekLayoutParams = new LinearLayout.LayoutParams(0,LinearLayout.LayoutParams.MATCH_PARENT,0.5f); |
137 | 134 |
|
138 | 135 |
SeekBar seekBar = new SeekBar(act); |
... | ... | |
146 | 143 |
|
147 | 144 |
///// INNER LAYOUT2 ////////////////////////////////////////////////////////////////// |
148 | 145 |
|
149 |
int innerLayout2Height = (int)(scale*layoH + 0.5f);
|
|
146 |
int innerLayout2Height = (int)((A+B)*textH);
|
|
150 | 147 |
LinearLayout innerLayout2 = new LinearLayout(act); |
151 | 148 |
LinearLayout.LayoutParams innerLayout2Params = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT,innerLayout2Height); |
152 | 149 |
|
... | ... | |
157 | 154 |
|
158 | 155 |
///// STUFF INSIDE INNER LAYOUT2 ///////////////////////////////////////////////////// |
159 | 156 |
|
160 |
int text3Padding = (int)(scale*5 + 0.5f);
|
|
157 |
int text3Padding = (int)(B*textH);
|
|
161 | 158 |
LinearLayout.LayoutParams text3LayoutParams = new LinearLayout.LayoutParams(0,LinearLayout.LayoutParams.MATCH_PARENT,0.25f); |
162 | 159 |
|
163 | 160 |
TextView text3View = new TextView(act); |
... | ... | |
168 | 165 |
text3View.setPadding(text3Padding,0,text3Padding,0); |
169 | 166 |
innerLayout2.addView(text3View); |
170 | 167 |
////////////////////////////////////////////////////////////////// |
171 |
int spinnerPadding = (int)(scale*10 + 0.5f);
|
|
172 |
int spinnerMargin = (int)(scale* 3 + 0.5f);
|
|
168 |
int spinnerPadding = (int)(B*textH);
|
|
169 |
int spinnerMargin = (int)(B*0.5f*textH);
|
|
173 | 170 |
LinearLayout.LayoutParams spinnerLayoutParams = new LinearLayout.LayoutParams(0,LinearLayout.LayoutParams.MATCH_PARENT,0.75f); |
174 | 171 |
spinnerLayoutParams.topMargin = spinnerMargin; |
175 | 172 |
spinnerLayoutParams.bottomMargin = spinnerMargin; |
... | ... | |
218 | 215 |
final float titleSize= displaymetrics.widthPixels * RubikActivity.MENU_BIG_TEXT_SIZE; |
219 | 216 |
final float okSize = displaymetrics.widthPixels * RubikActivity.MENU_MEDIUM_TEXT_SIZE; |
220 | 217 |
|
218 |
mTextSize = displaymetrics.widthPixels * RubikActivity.MENU_SMALL_TEXT_SIZE; |
|
219 |
|
|
221 | 220 |
tv.setTextSize(TypedValue.COMPLEX_UNIT_PX, titleSize); |
222 | 221 |
tv.setText(R.string.effects); |
223 | 222 |
builder.setCustomTitle(tv); |
Also available in: Unified diff
Improvements to the UI - make it proportional regardless of the physical screen size. (Part 7 - last 2 Dialogs)