1 |
9530f6b0
|
Leszek Koltunski
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
2 |
da56b12f
|
Leszek Koltunski
|
// Copyright 2022 Leszek Koltunski //
|
3 |
9530f6b0
|
Leszek Koltunski
|
// //
|
4 |
|
|
// This file is part of Magic Cube. //
|
5 |
|
|
// //
|
6 |
44fec653
|
Leszek Koltunski
|
// Magic Cube is proprietary software licensed under an EULA which you should have received //
|
7 |
|
|
// along with the code. If not, check https://distorted.org/magic/License-Magic-Cube.html //
|
8 |
9530f6b0
|
Leszek Koltunski
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
9 |
|
|
|
10 |
|
|
package org.distorted.bandaged;
|
11 |
|
|
|
12 |
b9d062cf
|
Leszek Koltunski
|
import java.lang.ref.WeakReference;
|
13 |
d3d639b1
|
Leszek Koltunski
|
import java.util.ArrayList;
|
14 |
|
|
|
15 |
20b60ad9
|
Leszek Koltunski
|
import android.app.Activity;
|
16 |
b9d062cf
|
Leszek Koltunski
|
import android.content.SharedPreferences;
|
17 |
7cb8d4b0
|
Leszek Koltunski
|
import android.graphics.Bitmap;
|
18 |
39176a1f
|
Leszek Koltunski
|
import android.util.TypedValue;
|
19 |
9530f6b0
|
Leszek Koltunski
|
import android.view.View;
|
20 |
b9d062cf
|
Leszek Koltunski
|
import android.view.ViewGroup;
|
21 |
|
|
import android.widget.AdapterView;
|
22 |
|
|
import android.widget.ArrayAdapter;
|
23 |
7cb8d4b0
|
Leszek Koltunski
|
import android.widget.ImageView;
|
24 |
9530f6b0
|
Leszek Koltunski
|
import android.widget.LinearLayout;
|
25 |
b9d062cf
|
Leszek Koltunski
|
import android.widget.Spinner;
|
26 |
39176a1f
|
Leszek Koltunski
|
import android.widget.TextView;
|
27 |
9530f6b0
|
Leszek Koltunski
|
|
28 |
a41e3c94
|
Leszek Koltunski
|
import org.distorted.external.RubikFiles;
|
29 |
9530f6b0
|
Leszek Koltunski
|
import org.distorted.helpers.TransparentImageButton;
|
30 |
|
|
import org.distorted.main.R;
|
31 |
|
|
import org.distorted.main.RubikActivity;
|
32 |
|
|
|
33 |
ca280c3f
|
Leszek Koltunski
|
import static org.distorted.objectlib.scrambling.ScrambleStateBandagedCuboid.MAX_SUPPORTED_SIZE;
|
34 |
|
|
|
35 |
9530f6b0
|
Leszek Koltunski
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
36 |
|
|
|
37 |
b9d062cf
|
Leszek Koltunski
|
public class BandagedCreatorScreen implements AdapterView.OnItemSelectedListener
|
38 |
9530f6b0
|
Leszek Koltunski
|
{
|
39 |
b9d062cf
|
Leszek Koltunski
|
private WeakReference<BandagedCreatorActivity> mAct;
|
40 |
9530f6b0
|
Leszek Koltunski
|
private TransparentImageButton mBackButton, mResetButton, mDoneButton;
|
41 |
e48ad1af
|
Leszek Koltunski
|
private LinearLayout mObjectView;
|
42 |
b9d062cf
|
Leszek Koltunski
|
private int mNumObjects, mX, mY, mZ;
|
43 |
|
|
private final ArrayList<BandagedCreatorObjectView> mViews;
|
44 |
|
|
private Spinner mSpinnerX, mSpinnerY, mSpinnerZ;
|
45 |
|
|
private boolean mSpinnersReady;
|
46 |
39176a1f
|
Leszek Koltunski
|
private float mTextSize;
|
47 |
9530f6b0
|
Leszek Koltunski
|
|
48 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
49 |
|
|
|
50 |
|
|
public BandagedCreatorScreen()
|
51 |
|
|
{
|
52 |
b9d062cf
|
Leszek Koltunski
|
mSpinnersReady = false;
|
53 |
e48ad1af
|
Leszek Koltunski
|
mNumObjects = 0;
|
54 |
d3d639b1
|
Leszek Koltunski
|
mViews = new ArrayList<>();
|
55 |
9530f6b0
|
Leszek Koltunski
|
}
|
56 |
|
|
|
57 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
58 |
|
|
|
59 |
|
|
private void setupBackButton(final BandagedCreatorActivity act)
|
60 |
|
|
{
|
61 |
|
|
int icon = RubikActivity.getDrawable(R.drawable.ui_small_smallback,R.drawable.ui_medium_smallback, R.drawable.ui_big_smallback, R.drawable.ui_huge_smallback);
|
62 |
|
|
LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT,LinearLayout.LayoutParams.MATCH_PARENT);
|
63 |
|
|
mBackButton = new TransparentImageButton(act, icon, TransparentImageButton.GRAVITY_MIDDLE, params);
|
64 |
|
|
|
65 |
|
|
mBackButton.setOnClickListener( new View.OnClickListener()
|
66 |
|
|
{
|
67 |
|
|
@Override
|
68 |
|
|
public void onClick(View v)
|
69 |
|
|
{
|
70 |
|
|
act.finish();
|
71 |
|
|
}
|
72 |
|
|
});
|
73 |
|
|
}
|
74 |
|
|
|
75 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
76 |
|
|
|
77 |
|
|
private void setupDoneButton(final BandagedCreatorActivity act)
|
78 |
|
|
{
|
79 |
f802924b
|
Leszek Koltunski
|
int icon = RubikActivity.getDrawable(R.drawable.ui_small_done,R.drawable.ui_medium_done, R.drawable.ui_big_done, R.drawable.ui_huge_done);
|
80 |
9530f6b0
|
Leszek Koltunski
|
LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT,LinearLayout.LayoutParams.MATCH_PARENT);
|
81 |
|
|
mDoneButton = new TransparentImageButton(act, icon, TransparentImageButton.GRAVITY_MIDDLE, params);
|
82 |
|
|
|
83 |
|
|
mDoneButton.setOnClickListener( new View.OnClickListener()
|
84 |
|
|
{
|
85 |
|
|
@Override
|
86 |
|
|
public void onClick(View v)
|
87 |
|
|
{
|
88 |
e0b71e6e
|
Leszek Koltunski
|
BandagedCreatorRenderer renderer = act.getRenderer();
|
89 |
72e386ef
|
Leszek Koltunski
|
if( !renderer.isBusy() ) renderer.displaySavingDialog();
|
90 |
9530f6b0
|
Leszek Koltunski
|
}
|
91 |
|
|
});
|
92 |
|
|
}
|
93 |
|
|
|
94 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
95 |
|
|
|
96 |
|
|
private void setupResetButton(final BandagedCreatorActivity act)
|
97 |
|
|
{
|
98 |
1b185a91
|
Leszek Koltunski
|
int icon = RubikActivity.getDrawable(R.drawable.ui_small_reset,R.drawable.ui_medium_reset, R.drawable.ui_big_reset, R.drawable.ui_huge_reset);
|
99 |
9530f6b0
|
Leszek Koltunski
|
LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT,LinearLayout.LayoutParams.MATCH_PARENT);
|
100 |
|
|
mResetButton = new TransparentImageButton(act, icon, TransparentImageButton.GRAVITY_MIDDLE, params);
|
101 |
|
|
|
102 |
|
|
mResetButton.setOnClickListener( new View.OnClickListener()
|
103 |
|
|
{
|
104 |
|
|
@Override
|
105 |
|
|
public void onClick(View v)
|
106 |
|
|
{
|
107 |
50ec342b
|
Leszek Koltunski
|
BandagedCreatorRenderer renderer = act.getRenderer();
|
108 |
e0b71e6e
|
Leszek Koltunski
|
if( !renderer.isBusy() ) renderer.setupReset();
|
109 |
9530f6b0
|
Leszek Koltunski
|
}
|
110 |
|
|
});
|
111 |
|
|
}
|
112 |
|
|
|
113 |
b9d062cf
|
Leszek Koltunski
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
114 |
|
|
|
115 |
|
|
private String[] createSizes(String mark)
|
116 |
|
|
{
|
117 |
|
|
String[] ret = new String[MAX_SUPPORTED_SIZE];
|
118 |
|
|
|
119 |
|
|
for(int i=1; i<=MAX_SUPPORTED_SIZE; i++)
|
120 |
|
|
{
|
121 |
|
|
ret[i-1] = mark+" : "+i;
|
122 |
|
|
}
|
123 |
|
|
|
124 |
|
|
return ret;
|
125 |
|
|
}
|
126 |
|
|
|
127 |
|
|
|
128 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
129 |
|
|
|
130 |
|
|
private void changeObject()
|
131 |
|
|
{
|
132 |
|
|
if( mSpinnersReady )
|
133 |
|
|
{
|
134 |
|
|
BandagedCreatorActivity act = mAct.get();
|
135 |
|
|
if( act!=null ) act.changeObject(mX+1,mY+1,mZ+1);
|
136 |
|
|
}
|
137 |
|
|
}
|
138 |
|
|
|
139 |
9530f6b0
|
Leszek Koltunski
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
140 |
|
|
|
141 |
bebd7af5
|
Leszek Koltunski
|
void onAttachedToWindow(final BandagedCreatorActivity act)
|
142 |
9530f6b0
|
Leszek Koltunski
|
{
|
143 |
b9d062cf
|
Leszek Koltunski
|
mAct = new WeakReference<>(act);
|
144 |
e48ad1af
|
Leszek Koltunski
|
mObjectView = act.findViewById(R.id.bandagedCreatorView);
|
145 |
39176a1f
|
Leszek Koltunski
|
mTextSize = act.getScreenHeightInPixels()*BandagedCreatorActivity.SPINNER_TEXT_SIZE;
|
146 |
e48ad1af
|
Leszek Koltunski
|
|
147 |
b9d062cf
|
Leszek Koltunski
|
int width = act.getScreenWidthInPixels();
|
148 |
|
|
int height = act.getScreenHeightInPixels();
|
149 |
|
|
int padding= (int)(height*RubikActivity.PADDING/3);
|
150 |
9530f6b0
|
Leszek Koltunski
|
|
151 |
|
|
LinearLayout.LayoutParams paramsL = new LinearLayout.LayoutParams(width/4, LinearLayout.LayoutParams.MATCH_PARENT);
|
152 |
|
|
LinearLayout.LayoutParams paramsM = new LinearLayout.LayoutParams(width/2, LinearLayout.LayoutParams.MATCH_PARENT);
|
153 |
|
|
LinearLayout.LayoutParams paramsR = new LinearLayout.LayoutParams(width/4, LinearLayout.LayoutParams.MATCH_PARENT);
|
154 |
|
|
|
155 |
|
|
LinearLayout layoutLeft = new LinearLayout(act);
|
156 |
|
|
layoutLeft.setLayoutParams(paramsL);
|
157 |
|
|
LinearLayout layoutMid = new LinearLayout(act);
|
158 |
|
|
layoutMid.setLayoutParams(paramsM);
|
159 |
|
|
LinearLayout layoutRight= new LinearLayout(act);
|
160 |
|
|
layoutRight.setLayoutParams(paramsR);
|
161 |
|
|
|
162 |
|
|
setupBackButton(act);
|
163 |
|
|
layoutRight.addView(mBackButton);
|
164 |
|
|
setupDoneButton(act);
|
165 |
|
|
layoutMid.addView(mDoneButton);
|
166 |
|
|
setupResetButton(act);
|
167 |
|
|
layoutLeft.addView(mResetButton);
|
168 |
|
|
|
169 |
|
|
LinearLayout layout = act.findViewById(R.id.lowerBar);
|
170 |
|
|
layout.removeAllViews();
|
171 |
|
|
layout.addView(layoutLeft);
|
172 |
|
|
layout.addView(layoutMid);
|
173 |
|
|
layout.addView(layoutRight);
|
174 |
b9d062cf
|
Leszek Koltunski
|
|
175 |
|
|
mSpinnerX = act.findViewById(R.id.bandagedCreatorX);
|
176 |
|
|
mSpinnerX.setOnItemSelectedListener(this);
|
177 |
39176a1f
|
Leszek Koltunski
|
ArrayAdapter<String> adX = new ArrayAdapter<>(act, R.layout.spinner_item, createSizes("X") );
|
178 |
b9d062cf
|
Leszek Koltunski
|
mSpinnerX.setAdapter(adX);
|
179 |
|
|
|
180 |
|
|
mSpinnerY = act.findViewById(R.id.bandagedCreatorY);
|
181 |
|
|
mSpinnerY.setOnItemSelectedListener(this);
|
182 |
39176a1f
|
Leszek Koltunski
|
ArrayAdapter<String> adY = new ArrayAdapter<>(act, R.layout.spinner_item, createSizes("Y") );
|
183 |
b9d062cf
|
Leszek Koltunski
|
mSpinnerY.setAdapter(adY);
|
184 |
|
|
|
185 |
|
|
mSpinnerZ = act.findViewById(R.id.bandagedCreatorZ);
|
186 |
|
|
mSpinnerZ.setOnItemSelectedListener(this);
|
187 |
39176a1f
|
Leszek Koltunski
|
ArrayAdapter<String> adZ = new ArrayAdapter<>(act, R.layout.spinner_item, createSizes("Z") );
|
188 |
b9d062cf
|
Leszek Koltunski
|
mSpinnerZ.setAdapter(adZ);
|
189 |
|
|
|
190 |
|
|
ViewGroup.MarginLayoutParams paramsX = (ViewGroup.MarginLayoutParams) mSpinnerX.getLayoutParams();
|
191 |
|
|
paramsX.setMargins(0,0,2*padding,0);
|
192 |
|
|
ViewGroup.MarginLayoutParams paramsY = (ViewGroup.MarginLayoutParams) mSpinnerY.getLayoutParams();
|
193 |
|
|
paramsY.setMargins(padding,0,padding,0);
|
194 |
|
|
ViewGroup.MarginLayoutParams paramsZ = (ViewGroup.MarginLayoutParams) mSpinnerZ.getLayoutParams();
|
195 |
|
|
paramsZ.setMargins(2*padding,0,0,0);
|
196 |
9530f6b0
|
Leszek Koltunski
|
}
|
197 |
e48ad1af
|
Leszek Koltunski
|
|
198 |
a41e3c94
|
Leszek Koltunski
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
199 |
|
|
|
200 |
|
|
boolean objectDoesntExist(String name)
|
201 |
|
|
{
|
202 |
|
|
for( BandagedCreatorObjectView view : mViews )
|
203 |
|
|
{
|
204 |
|
|
String viewName = view.getName();
|
205 |
|
|
if( viewName.equals(name) ) return false;
|
206 |
|
|
}
|
207 |
|
|
|
208 |
|
|
return true;
|
209 |
|
|
}
|
210 |
|
|
|
211 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
212 |
|
|
|
213 |
b9d062cf
|
Leszek Koltunski
|
private void addObjects(BandagedCreatorActivity act, String objectString)
|
214 |
a41e3c94
|
Leszek Koltunski
|
{
|
215 |
|
|
if( objectString.length()>0 )
|
216 |
|
|
{
|
217 |
|
|
String[] objects = objectString.split(" ");
|
218 |
|
|
RubikFiles files = RubikFiles.getInstance();
|
219 |
|
|
|
220 |
|
|
for(String object : objects)
|
221 |
|
|
{
|
222 |
|
|
if( objectDoesntExist(object) )
|
223 |
|
|
{
|
224 |
|
|
addObject(act, object);
|
225 |
|
|
Bitmap bmp = files.getIcon(act, object + ".png");
|
226 |
|
|
iconCreationDone(act, bmp);
|
227 |
|
|
}
|
228 |
|
|
}
|
229 |
|
|
}
|
230 |
|
|
}
|
231 |
|
|
|
232 |
e48ad1af
|
Leszek Koltunski
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
233 |
|
|
|
234 |
|
|
void addObject(BandagedCreatorActivity act, String name)
|
235 |
|
|
{
|
236 |
|
|
BandagedCreatorObjectView view = new BandagedCreatorObjectView(act,name,mNumObjects==0);
|
237 |
|
|
LinearLayout pane = view.getPane();
|
238 |
|
|
mObjectView.addView(pane);
|
239 |
|
|
mNumObjects++;
|
240 |
d3d639b1
|
Leszek Koltunski
|
mViews.add(view);
|
241 |
|
|
}
|
242 |
|
|
|
243 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
244 |
|
|
|
245 |
|
|
void deleteObject(BandagedCreatorActivity act, String name)
|
246 |
|
|
{
|
247 |
|
|
for(int v=0; v<mNumObjects; v++)
|
248 |
|
|
{
|
249 |
|
|
BandagedCreatorObjectView view = mViews.get(v);
|
250 |
66cbab36
|
Leszek Koltunski
|
String viewName = view.getName();
|
251 |
d3d639b1
|
Leszek Koltunski
|
|
252 |
66cbab36
|
Leszek Koltunski
|
if( viewName.equals(name) )
|
253 |
d3d639b1
|
Leszek Koltunski
|
{
|
254 |
|
|
LinearLayout pane = view.getPane();
|
255 |
|
|
mObjectView.removeView(pane);
|
256 |
|
|
mViews.remove(view);
|
257 |
|
|
mNumObjects--;
|
258 |
|
|
|
259 |
|
|
if( v==0 && mNumObjects>0 )
|
260 |
|
|
{
|
261 |
|
|
int width = act.getScreenWidthInPixels();
|
262 |
|
|
BandagedCreatorObjectView v2 = mViews.get(v);
|
263 |
|
|
LinearLayout p2 = v2.getPane();
|
264 |
66cbab36
|
Leszek Koltunski
|
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 |
d3d639b1
|
Leszek Koltunski
|
|
272 |
|
|
p2.setLayoutParams(params);
|
273 |
|
|
}
|
274 |
|
|
|
275 |
|
|
break;
|
276 |
|
|
}
|
277 |
|
|
}
|
278 |
e48ad1af
|
Leszek Koltunski
|
}
|
279 |
7cb8d4b0
|
Leszek Koltunski
|
|
280 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
281 |
|
|
|
282 |
20b60ad9
|
Leszek Koltunski
|
void iconCreationDone(Activity act, Bitmap bmp)
|
283 |
7cb8d4b0
|
Leszek Koltunski
|
{
|
284 |
|
|
int numChildren = mObjectView.getChildCount();
|
285 |
|
|
|
286 |
83e021c5
|
Leszek Koltunski
|
if( numChildren>0 )
|
287 |
7cb8d4b0
|
Leszek Koltunski
|
{
|
288 |
83e021c5
|
Leszek Koltunski
|
LinearLayout pane = (LinearLayout)mObjectView.getChildAt(numChildren-1);
|
289 |
|
|
ImageView view = pane.findViewById(R.id.bandagedCreatorObjectIcon);
|
290 |
|
|
|
291 |
|
|
if( view!=null )
|
292 |
20b60ad9
|
Leszek Koltunski
|
{
|
293 |
83e021c5
|
Leszek Koltunski
|
act.runOnUiThread(new Runnable()
|
294 |
|
|
{
|
295 |
|
|
@Override
|
296 |
|
|
public void run()
|
297 |
20b60ad9
|
Leszek Koltunski
|
{
|
298 |
|
|
view.setImageBitmap(bmp);
|
299 |
|
|
}
|
300 |
83e021c5
|
Leszek Koltunski
|
});
|
301 |
|
|
}
|
302 |
|
|
else
|
303 |
|
|
{
|
304 |
|
|
android.util.Log.e("D", "ImageView not found!");
|
305 |
|
|
}
|
306 |
7cb8d4b0
|
Leszek Koltunski
|
}
|
307 |
|
|
}
|
308 |
a41e3c94
|
Leszek Koltunski
|
|
309 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
310 |
|
|
|
311 |
b9d062cf
|
Leszek Koltunski
|
private String generateObjectStrings()
|
312 |
a41e3c94
|
Leszek Koltunski
|
{
|
313 |
|
|
String result = "";
|
314 |
|
|
int numViews = mViews.size();
|
315 |
|
|
|
316 |
|
|
for( int v=0; v<numViews; v++ )
|
317 |
|
|
{
|
318 |
|
|
BandagedCreatorObjectView view = mViews.get(v);
|
319 |
|
|
String name = view.getName();
|
320 |
|
|
|
321 |
|
|
if( v>0 ) result += " ";
|
322 |
|
|
result += name;
|
323 |
|
|
}
|
324 |
|
|
|
325 |
|
|
return result;
|
326 |
|
|
}
|
327 |
b9d062cf
|
Leszek Koltunski
|
|
328 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
329 |
|
|
|
330 |
|
|
@Override
|
331 |
|
|
public void onItemSelected(AdapterView<?> parent, View view, int pos, long id)
|
332 |
|
|
{
|
333 |
|
|
int spinnerID = parent.getId();
|
334 |
|
|
|
335 |
9685735b
|
Leszek Koltunski
|
if( view!=null ) ((TextView) view).setTextSize(TypedValue.COMPLEX_UNIT_PX,mTextSize);
|
336 |
39176a1f
|
Leszek Koltunski
|
|
337 |
b9d062cf
|
Leszek Koltunski
|
if( spinnerID==R.id.bandagedCreatorX )
|
338 |
|
|
{
|
339 |
|
|
mX = pos;
|
340 |
|
|
}
|
341 |
|
|
else if( spinnerID==R.id.bandagedCreatorY )
|
342 |
|
|
{
|
343 |
|
|
mY = pos;
|
344 |
|
|
}
|
345 |
|
|
else if( spinnerID==R.id.bandagedCreatorZ )
|
346 |
|
|
{
|
347 |
|
|
mZ = pos;
|
348 |
|
|
}
|
349 |
|
|
|
350 |
|
|
changeObject();
|
351 |
|
|
}
|
352 |
|
|
|
353 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
354 |
|
|
|
355 |
|
|
@Override
|
356 |
|
|
public void onNothingSelected(AdapterView<?> parent) { }
|
357 |
|
|
|
358 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
359 |
|
|
|
360 |
|
|
public void savePreferences(SharedPreferences.Editor editor)
|
361 |
|
|
{
|
362 |
|
|
String objects = generateObjectStrings();
|
363 |
|
|
editor.putString("bandagedObjects", objects );
|
364 |
|
|
|
365 |
|
|
editor.putInt("bandagedX", mX);
|
366 |
|
|
editor.putInt("bandagedY", mY);
|
367 |
|
|
editor.putInt("bandagedZ", mZ);
|
368 |
|
|
}
|
369 |
|
|
|
370 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
371 |
|
|
|
372 |
|
|
public void restorePreferences(BandagedCreatorActivity act, SharedPreferences preferences)
|
373 |
|
|
{
|
374 |
|
|
String objects = preferences.getString("bandagedObjects","");
|
375 |
|
|
addObjects(act,objects);
|
376 |
|
|
|
377 |
|
|
mX = preferences.getInt("bandagedX", 2);
|
378 |
|
|
mY = preferences.getInt("bandagedY", 2);
|
379 |
|
|
mZ = preferences.getInt("bandagedZ", 2);
|
380 |
|
|
|
381 |
|
|
mSpinnerX.setSelection(mX);
|
382 |
|
|
mSpinnerY.setSelection(mY);
|
383 |
|
|
mSpinnerZ.setSelection(mZ);
|
384 |
|
|
|
385 |
|
|
mSpinnersReady = true;
|
386 |
|
|
changeObject();
|
387 |
|
|
}
|
388 |
9530f6b0
|
Leszek Koltunski
|
}
|