| 12 |
12 |
import static org.distorted.objectlib.main.TwistyObject.MODE_NORM;
|
| 13 |
13 |
|
| 14 |
14 |
import android.app.Activity;
|
| 15 |
|
import android.content.SharedPreferences;
|
| 16 |
15 |
import android.os.Bundle;
|
| 17 |
16 |
import android.view.View;
|
| 18 |
17 |
import android.widget.AdapterView;
|
| ... | ... | |
| 21 |
20 |
import android.widget.TextView;
|
| 22 |
21 |
import android.widget.Toast;
|
| 23 |
22 |
|
| 24 |
|
import androidx.preference.PreferenceManager;
|
| 25 |
|
|
| 26 |
23 |
import org.distorted.library.main.DistortedLibrary;
|
| 27 |
24 |
import org.distorted.objectlib.helpers.ObjectMove;
|
| 28 |
25 |
import org.distorted.objectlib.solvers.implemented.PhasedSolverList;
|
| ... | ... | |
| 39 |
36 |
public class SolverActivity extends Activity implements SolutionListener, AdapterView.OnItemSelectedListener
|
| 40 |
37 |
{
|
| 41 |
38 |
private InitAssets mAsset;
|
| 42 |
|
private SharedPreferences mPreferences;
|
| 43 |
39 |
private SolverLowerPane mLowerPane;
|
| 44 |
40 |
private TextView mTextView;
|
| 45 |
41 |
private SolvedObject mObject;
|
| ... | ... | |
| 54 |
50 |
protected void onCreate(Bundle icicle)
|
| 55 |
51 |
{
|
| 56 |
52 |
super.onCreate(icicle);
|
| 57 |
|
mPreferences = PreferenceManager.getDefaultSharedPreferences(this);
|
| 58 |
53 |
DistortedLibrary.onCreate();
|
| 59 |
54 |
setContentView(R.layout.mainlayout);
|
| 60 |
55 |
SolverSurfaceView view = findViewById(R.id.solverView);
|
| ... | ... | |
| 92 |
87 |
SolverSurfaceView view = findViewById(R.id.solverView);
|
| 93 |
88 |
view.onPause();
|
| 94 |
89 |
DistortedLibrary.onPause();
|
| 95 |
|
|
| 96 |
|
savePreferences();
|
| 97 |
90 |
}
|
| 98 |
91 |
|
| 99 |
92 |
///////////////////////////////////////////////////////////////////////////////////////////////////
|
| ... | ... | |
| 106 |
99 |
view.onResume();
|
| 107 |
100 |
DistortedLibrary.onResume();
|
| 108 |
101 |
|
| 109 |
|
restorePreferences();
|
| 110 |
|
|
| 111 |
102 |
int ordinal = getObjectOrdinal();
|
| 112 |
103 |
ObjectControl control = getControl();
|
| 113 |
104 |
control.changeObject(ordinal, MODE_NORM, mAsset);
|
| ... | ... | |
| 201 |
192 |
return view.getObjectControl();
|
| 202 |
193 |
}
|
| 203 |
194 |
|
| 204 |
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
| 205 |
|
|
| 206 |
|
private void savePreferences()
|
| 207 |
|
{
|
| 208 |
|
SolverSurfaceView view = findViewById(R.id.solverView);
|
| 209 |
|
view.getObjectControl().savePreferences();
|
| 210 |
|
}
|
| 211 |
|
|
| 212 |
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
| 213 |
|
|
| 214 |
|
private void restorePreferences()
|
| 215 |
|
{
|
| 216 |
|
SolverSurfaceView view = findViewById(R.id.solverView);
|
| 217 |
|
view.getObjectControl().restorePreferences();
|
| 218 |
|
}
|
| 219 |
|
|
| 220 |
195 |
///////////////////////////////////////////////////////////////////////////////////////////////////
|
| 221 |
196 |
|
| 222 |
197 |
public void receiveSolution(int[] solution, int phase)
|
SharedPreferences