Revision 9211042f
Added by Leszek Koltunski 2 months ago
src/main/java/org/distorted/config/ConfigScreenPane.java | ||
---|---|---|
24 | 24 |
|
25 | 25 |
import org.distorted.main.MainActivity; |
26 | 26 |
import org.distorted.main.R; |
27 |
import org.distorted.os.OSInterface; |
|
27 | 28 |
|
28 | 29 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
29 | 30 |
|
... | ... | |
187 | 188 |
|
188 | 189 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
189 | 190 |
|
190 |
int getCurrentBorders()
|
|
191 |
private int extractIndex(float val, float[] table)
|
|
191 | 192 |
{ |
192 |
return mCurrentBorders; |
|
193 |
} |
|
193 |
int len = table.length; |
|
194 | 194 |
|
195 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
195 |
for(int i=0; i<len; i++) |
|
196 |
if( table[i]==val ) return i; |
|
196 | 197 |
|
197 |
int getCurrentCorners() |
|
198 |
{ |
|
199 |
return mCurrentCorners; |
|
198 |
return len/2; |
|
200 | 199 |
} |
201 | 200 |
|
202 | 201 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
203 | 202 |
|
204 |
ConfigScreenPane(final ConfigActivity act, int objectOrdinal)
|
|
203 |
ConfigScreenPane(final ConfigActivity act, String key, OSInterface os)
|
|
205 | 204 |
{ |
206 | 205 |
mRow = 0; |
207 | 206 |
mCol = 0; |
... | ... | |
210 | 209 |
float textSize = height*TEXT_RATIO; |
211 | 210 |
int padding = (int)(height*PADDING_RATIO); |
212 | 211 |
|
212 |
float borders = os.getFloat(key+"_border",1.0f); |
|
213 |
float corners = os.getFloat(key+"_corner",1.0f); |
|
214 |
|
|
213 | 215 |
///// UPPER LAYOUT ///////////////////////////////// |
214 | 216 |
LinearLayout configLayoutU = act.findViewById(R.id.configLayoutUpper); |
215 | 217 |
configLayoutU.setPadding(padding,padding,padding,padding); |
... | ... | |
228 | 230 |
textCorner.setTextSize(TypedValue.COMPLEX_UNIT_PX, textSize); |
229 | 231 |
|
230 | 232 |
mSeekBarBorders = configLayoutU.findViewById(R.id.configSeekBarBorder); |
231 |
mCurrentBorders = mSeekBarBorders.getProgress(); |
|
233 |
mCurrentBorders = extractIndex(borders,BORDER_STEPS); |
|
234 |
|
|
235 |
if( mCurrentBorders!=mSeekBarBorders.getProgress() ) |
|
236 |
{ |
|
237 |
mSeekBarBorders.setProgress(mCurrentBorders); |
|
238 |
} |
|
232 | 239 |
|
233 | 240 |
mSeekBarBorders.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() |
234 | 241 |
{ |
... | ... | |
248 | 255 |
}); |
249 | 256 |
|
250 | 257 |
mSeekBarCorners = configLayoutU.findViewById(R.id.configSeekBarCorner); |
251 |
mCurrentCorners = mSeekBarCorners.getProgress(); |
|
258 |
mCurrentCorners = extractIndex(corners,CORNER_STEPS); |
|
259 |
|
|
260 |
if( mCurrentCorners!=mSeekBarCorners.getProgress() ) |
|
261 |
{ |
|
262 |
mSeekBarCorners.setProgress(mCurrentCorners); |
|
263 |
} |
|
252 | 264 |
|
253 | 265 |
mSeekBarCorners.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() |
254 | 266 |
{ |
Also available in: Unified diff
Restore the colors and sticker properties from Preferences.