Revision 41a5dd89
Added by Leszek Koltunski over 3 years ago
| src/main/java/org/distorted/main/RubikActivity.java | ||
|---|---|---|
| 661 | 661 |
Intent intent = new Intent(this, BandagedCreatorActivity.class); |
| 662 | 662 |
startActivity(intent); |
| 663 | 663 |
} |
| 664 |
|
|
| 665 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
| 666 |
|
|
| 667 |
public void reloadObject(String shortName) |
|
| 668 |
{
|
|
| 669 |
TwistyObject currObject = getObject(); |
|
| 670 |
String name = currObject.getShortName(); |
|
| 671 |
|
|
| 672 |
if( name.toLowerCase().equals(shortName) ) |
|
| 673 |
{
|
|
| 674 |
RubikObject object = RubikObjectList.getObject(name); |
|
| 675 |
|
|
| 676 |
if( object!=null ) |
|
| 677 |
{
|
|
| 678 |
int meshState = object.getMeshState(); |
|
| 679 |
int iconMode = TwistyObject.MODE_NORM; |
|
| 680 |
InputStream jsonStream = object.getObjectStream(this); |
|
| 681 |
InputStream meshStream = object.getMeshStream(this); |
|
| 682 |
ObjectControl control = getControl(); |
|
| 683 |
control.changeObject(-1,meshState,iconMode,jsonStream,meshStream); |
|
| 684 |
} |
|
| 685 |
} |
|
| 686 |
} |
|
| 664 | 687 |
} |
| src/main/java/org/distorted/objects/RubikObjectList.java | ||
|---|---|---|
| 219 | 219 |
|
| 220 | 220 |
if( SHOW_DOWNLOADED_DEBUG ) android.util.Log.e("D", "Updating downloaded object "+shortName+" icon="+obj.icon+" object="+obj.object+" extras="+obj.extras);
|
| 221 | 221 |
|
| 222 |
try |
|
| 223 |
{
|
|
| 224 |
RubikActivity ract = (RubikActivity)context; |
|
| 225 |
ract.reloadObject(shortName); |
|
| 226 |
} |
|
| 227 |
catch(Exception ex) |
|
| 228 |
{
|
|
| 229 |
android.util.Log.e("D", "exception trying to reload object: "+ex.getMessage() );
|
|
| 230 |
} |
|
| 231 |
|
|
| 222 | 232 |
return; |
| 223 | 233 |
} |
| 224 | 234 |
} |
| ... | ... | |
| 412 | 422 |
return ordinal>=0 && ordinal<mNumObjects ? mObjects.get(ordinal) : null; |
| 413 | 423 |
} |
| 414 | 424 |
|
| 425 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
| 426 |
|
|
| 427 |
public static RubikObject getObject(String shortUpperName) |
|
| 428 |
{
|
|
| 429 |
if( mThis==null ) mThis = new RubikObjectList(); |
|
| 430 |
|
|
| 431 |
for(int i=0; i<mNumObjects; i++) |
|
| 432 |
{
|
|
| 433 |
RubikObject object = mObjects.get(i); |
|
| 434 |
if( object.getUpperName().equals(shortUpperName) ) |
|
| 435 |
{
|
|
| 436 |
return object; |
|
| 437 |
} |
|
| 438 |
} |
|
| 439 |
|
|
| 440 |
return null; |
|
| 441 |
} |
|
| 442 |
|
|
| 415 | 443 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
| 416 | 444 |
|
| 417 | 445 |
public static int getNumObjects() |
Also available in: Unified diff
If we're updating an object, and it is the current object, reload it immediatelly so that the new version appears by itself.