Revision d433b50e
Added by Leszek Koltunski over 2 years ago
src/main/java/org/distorted/config/ConfigActivity.java | ||
---|---|---|
37 | 37 |
import org.distorted.library.main.DistortedLibrary; |
38 | 38 |
import org.distorted.main.R; |
39 | 39 |
import org.distorted.objectlib.main.ObjectControl; |
40 |
import org.distorted.objectlib.main.ObjectType; |
|
40 |
import org.distorted.objects.RubikObject; |
|
41 |
import org.distorted.objects.RubikObjectList; |
|
41 | 42 |
|
42 | 43 |
import java.io.InputStream; |
43 | 44 |
|
... | ... | |
188 | 189 |
ConfigSurfaceView view = findViewById(R.id.configSurfaceView); |
189 | 190 |
view.onResume(); |
190 | 191 |
|
191 |
if( mObjectOrdinal>=0 && mObjectOrdinal< ObjectType.NUM_OBJECTS )
|
|
192 |
if( mObjectOrdinal>=0 && mObjectOrdinal< RubikObjectList.getNumObjects() )
|
|
192 | 193 |
{ |
193 |
ObjectType obj = ObjectType.getObject(mObjectOrdinal);
|
|
194 |
changeIfDifferent(obj,view.getObjectControl()); |
|
194 |
RubikObject object = RubikObjectList.getObject(mObjectOrdinal);
|
|
195 |
changeIfDifferent(object,view.getObjectControl());
|
|
195 | 196 |
} |
196 | 197 |
} |
197 | 198 |
|
... | ... | |
214 | 215 |
|
215 | 216 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
216 | 217 |
|
217 |
private void changeIfDifferent(ObjectType type,ObjectControl control)
|
|
218 |
private void changeIfDifferent(RubikObject object,ObjectControl control)
|
|
218 | 219 |
{ |
219 |
InputStream jsonStream = ObjectJson.getStream(type,this); |
|
220 |
InputStream meshStream = ObjectMesh.getStream(type,this); |
|
221 |
control.changeIfDifferent(type.ordinal(),jsonStream,meshStream); |
|
220 |
if( object!=null ) |
|
221 |
{ |
|
222 |
int jsonID = object.getJsonID(); |
|
223 |
int meshID = object.getMeshID(); |
|
224 |
|
|
225 |
InputStream jsonStream = ObjectJson.getStream(jsonID,this); |
|
226 |
InputStream meshStream = ObjectMesh.getStream(meshID,this); |
|
227 |
control.changeIfDifferent(object.getOrdinal(),jsonStream,meshStream); |
|
228 |
} |
|
222 | 229 |
} |
223 | 230 |
|
224 | 231 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
... | ... | |
304 | 311 |
|
305 | 312 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
306 | 313 |
|
307 |
public void changeObject(ObjectType newObject)
|
|
314 |
public void changeObject(RubikObject object)
|
|
308 | 315 |
{ |
309 | 316 |
ConfigSurfaceView view = findViewById(R.id.configSurfaceView); |
310 | 317 |
ObjectControl control = view.getObjectControl(); |
311 |
changeIfDifferent(newObject,control);
|
|
318 |
changeIfDifferent(object,control);
|
|
312 | 319 |
} |
313 | 320 |
} |
Also available in: Unified diff
In the 'magic' app, ObjectType is now only used in RubikObject and RubikObjectList classes and nowhere else.
This is a major step towards being able to download objects from an online repository.