Revision 3c39a2a0
Added by Leszek Koltunski 7 days ago
src/main/java/org/distorted/solverui/ScreenSolver.java | ||
---|---|---|
288 | 288 |
|
289 | 289 |
if( solverOrdinals!=null ) |
290 | 290 |
{ |
291 |
int len = solverOrdinals.length; |
|
291 |
SolvingList slvList = SolvingList.getSolver(solverOrdinals[0]); |
|
292 |
OperatingSystemInterface os = act.getInterface(); |
|
293 |
TwistyObject object = act.getObject(); |
|
294 |
SolverAbstract solver = slvList.create(os,object); |
|
292 | 295 |
|
293 |
if( len==1 ) // just one solver - simply launch it and start finding the solution
|
|
296 |
if( solver!=null )
|
|
294 | 297 |
{ |
295 |
SolvingList list = SolvingList.getSolver(solverOrdinals[0]); |
|
296 |
OperatingSystemInterface os = act.getInterface(); |
|
297 |
TwistyObject object = act.getObject(); |
|
298 |
SolverAbstract solver = list.create(os,object); |
|
298 |
int[] result = solver.validatePosition(object); |
|
299 | 299 |
|
300 |
if( solver!=null )
|
|
300 |
if( result[0]>=0 )
|
|
301 | 301 |
{ |
302 |
int[] result = solver.validatePosition(object); |
|
303 |
if( result[0]>=0 ) solver.solve(this,result); |
|
304 |
else displayImpossibleDialog(result,solver.getFaceColors()); |
|
302 |
if( solverOrdinals.length==1 ) // just one solver - simply launch it |
|
303 |
{ |
|
304 |
solver.solve(this,result); |
|
305 |
return true; |
|
306 |
} |
|
307 |
else // more than one solver - pop up a choosing dialog |
|
308 |
{ |
|
309 |
ListObjects objList = ListObjects.getObject(mObjectOrdinal); |
|
310 |
String upperName = objList.name(); |
|
311 |
Bundle bundle = new Bundle(); |
|
312 |
bundle.putString("argument", upperName ); |
|
313 |
RubikDialogSolvers solv = new RubikDialogSolvers(); |
|
314 |
solv.setArguments(bundle); |
|
315 |
solv.show( act.getSupportFragmentManager(), RubikDialogSolvers.getDialogTag() ); |
|
316 |
return false; |
|
317 |
} |
|
318 |
} |
|
319 |
else |
|
320 |
{ |
|
321 |
displayImpossibleDialog(result,solver.getFaceColors()); |
|
322 |
return false; |
|
305 | 323 |
} |
306 |
else displayErrorDialog(act.getString(R.string.solver_generic_not_implemented)); |
|
307 |
|
|
308 |
return true; |
|
309 | 324 |
} |
310 |
else // more than one solver - launch a choosing dialog
|
|
325 |
else |
|
311 | 326 |
{ |
312 |
ListObjects list = ListObjects.getObject(mObjectOrdinal); |
|
313 |
String upperName = list.name(); |
|
314 |
Bundle bundle = new Bundle(); |
|
315 |
bundle.putString("argument", upperName ); |
|
316 |
RubikDialogSolvers solv = new RubikDialogSolvers(); |
|
317 |
solv.setArguments(bundle); |
|
318 |
solv.show( act.getSupportFragmentManager(), RubikDialogSolvers.getDialogTag() ); |
|
327 |
displayErrorDialog(act.getString(R.string.solver_generic_not_implemented)); |
|
319 | 328 |
return false; |
320 | 329 |
} |
321 | 330 |
} |
322 | 331 |
else // no solvers? Impossible! |
323 | 332 |
{ |
324 |
android.util.Log.e("D", "No solvers found for object "+mObjectOrdinal);
|
|
333 |
displayErrorDialog("No solvers found for object "+mObjectOrdinal);
|
|
325 | 334 |
return false; |
326 | 335 |
} |
327 | 336 |
} |
Also available in: Unified diff
Launch the verifier first, and only then the solver selection dialog :)