Revision 2dde8656
Added by Leszek Koltunski 1 day ago
| build.gradle | ||
|---|---|---|
| 47 | 47 |
mavenCentral() |
| 48 | 48 |
} |
| 49 | 49 |
dependencies{
|
| 50 |
classpath 'com.android.tools.build:gradle:8.13.0'
|
|
| 50 |
classpath 'com.android.tools.build:gradle:8.13.1'
|
|
| 51 | 51 |
classpath 'com.google.gms:google-services:4.4.2' |
| 52 | 52 |
classpath 'com.google.firebase:firebase-crashlytics-gradle:3.0.3' |
| 53 | 53 |
} |
| src/main/java/org/distorted/dialogs/DialogAbout.java | ||
|---|---|---|
| 33 | 33 |
public class DialogAbout extends DialogAbstract |
| 34 | 34 |
{
|
| 35 | 35 |
private static final String WHATS_NEW = |
| 36 |
"1. If you made at least 8 moves, then the solve attempt gets automatically remembered. You can resume your solve at any later time.\n" +
|
|
| 36 |
"1. If you made at least 7 moves, then the solve attempt gets automatically remembered. You can resume your solve at any later time.\n" +
|
|
| 37 | 37 |
"2. A fix to the solved-state detection of the Container.\n" + |
| 38 | 38 |
"3. Every tutorial has been checked and a few non-working ones have beed replaced.\n" + |
| 39 | 39 |
"4. Fixes for scrambling: now (almost!) every puzzle should scramble perfectly, i.e. every scramble in level N should be exactly N moves from the solved state." |
| src/main/java/org/distorted/helpers/RubikRememberedSolves.java | ||
|---|---|---|
| 18 | 18 |
import org.json.JSONObject; |
| 19 | 19 |
|
| 20 | 20 |
import java.io.BufferedReader; |
| 21 |
import java.io.BufferedWriter;
|
|
| 21 |
import java.io.File;
|
|
| 22 | 22 |
import java.io.FileOutputStream; |
| 23 | 23 |
import java.io.IOException; |
| 24 | 24 |
import java.io.InputStream; |
| 25 | 25 |
import java.io.InputStreamReader; |
| 26 |
import java.io.OutputStreamWriter; |
|
| 27 | 26 |
import java.nio.charset.StandardCharsets; |
| 28 | 27 |
|
| 29 | 28 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
| 30 | 29 |
|
| 31 | 30 |
public class RubikRememberedSolves |
| 32 | 31 |
{
|
| 33 |
private static final int MAXSOLVES = 8;
|
|
| 32 |
private static final int MAXSOLVES = 5;
|
|
| 34 | 33 |
private static RubikRememberedSolves mThis; |
| 35 | 34 |
|
| 36 | 35 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
| ... | ... | |
| 81 | 80 |
String contents = readContents(file); |
| 82 | 81 |
return new JSONArray(contents); |
| 83 | 82 |
} |
| 84 |
catch(IOException iex) { android.util.Log.e("D", "readFile: failed to read file" ); }
|
|
| 85 |
catch(JSONException jex) { android.util.Log.e("D", "readFile: failed to parse file"); }
|
|
| 83 |
catch(IOException iex) { android.util.Log.e("D", "readFile: failed to read file: "+iex.getMessage() ); }
|
|
| 84 |
catch(JSONException jex) { android.util.Log.e("D", "readFile: failed to parse file: "+jex.getMessage()); }
|
|
| 86 | 85 |
|
| 87 | 86 |
return null; |
| 88 | 87 |
} |
| ... | ... | |
| 108 | 107 |
{
|
| 109 | 108 |
String filename = objname.toLowerCase()+"_solves.json"; |
| 110 | 109 |
RubikFiles files = RubikFiles.getInstance(); |
| 111 |
InputStream file = files.openFile(act,filename);
|
|
| 112 |
RubikRememberedSolves solves = RubikRememberedSolves.getInstance();
|
|
| 113 |
String contents = solves.addInfo(file,level,time,rot,quats);
|
|
| 110 |
InputStream input= files.openFile(act,filename);
|
|
| 111 |
String contents = addInfo(input,level,time,rot,quats);
|
|
| 112 |
File file = new File(act.getFilesDir(), filename);
|
|
| 114 | 113 |
|
| 115 |
try |
|
| 114 |
try( FileOutputStream fos = new FileOutputStream(file) )
|
|
| 116 | 115 |
{
|
| 117 |
FileOutputStream fos = new FileOutputStream(filename); |
|
| 118 |
OutputStreamWriter osw = new OutputStreamWriter(fos, StandardCharsets.UTF_8); |
|
| 119 |
BufferedWriter bw = new BufferedWriter(osw); |
|
| 120 |
bw.write(contents); |
|
| 121 |
bw.flush(); |
|
| 116 |
fos.write(contents.getBytes(StandardCharsets.UTF_8)); |
|
| 122 | 117 |
} |
| 123 | 118 |
catch(IOException ex) |
| 124 | 119 |
{
|
| 125 |
android.util.Log.e("D", "failed to save file "+filename);
|
|
| 120 |
android.util.Log.e("D", "failed to save file "+filename+" : "+ex.getMessage());
|
|
| 126 | 121 |
} |
| 127 | 122 |
} |
| 128 | 123 |
|
| ... | ... | |
| 160 | 155 |
lvl.put(data); |
| 161 | 156 |
return levels.toString(); |
| 162 | 157 |
} |
| 163 |
catch(IOException iex) { android.util.Log.e("D", "addInfo: failed to read file" ); }
|
|
| 164 |
catch(JSONException jex) { android.util.Log.e("D", "addInfo: failed to parse file"); }
|
|
| 158 |
catch(IOException iex) { android.util.Log.e("D", "addInfo: failed to read file: "+iex.getMessage() ); }
|
|
| 159 |
catch(JSONException jex) { android.util.Log.e("D", "addInfo: failed to parse file: "+jex.getMessage()); }
|
|
| 165 | 160 |
} |
| 166 | 161 |
else |
| 167 | 162 |
{
|
| ... | ... | |
| 181 | 176 |
levels.put(save); |
| 182 | 177 |
} |
| 183 | 178 |
} |
| 184 |
catch(JSONException jex) { android.util.Log.e("D", "addInfo: failed to parse file"); }
|
|
| 179 |
catch(JSONException jex) { android.util.Log.e("D", "addInfo: failed to parse file: "+jex.getMessage()); }
|
|
| 185 | 180 |
|
| 186 | 181 |
return levels.toString(); |
| 187 | 182 |
} |
| src/main/java/org/distorted/main/MainObjectPopup.java | ||
|---|---|---|
| 264 | 264 |
mPopup.dismiss(); |
| 265 | 265 |
if( ll<0 ) scores.setRecord(mObjectOrdinal,ll,0); // remember we've entered the 'Free' |
| 266 | 266 |
// so that the button turns green |
| 267 |
|
|
| 268 | 267 |
JSONArray json= null; |
| 269 | 268 |
int numSolves = 0; |
| 270 | 269 |
|
| ... | ... | |
| 272 | 271 |
{
|
| 273 | 272 |
try |
| 274 | 273 |
{
|
| 275 |
json = mRememberedSolves.getJSONArray(ll); |
|
| 274 |
int lvl = ll==LEVELS_SHOWN ? ll : ll+1; |
|
| 275 |
json = mRememberedSolves.getJSONArray(lvl); |
|
| 276 | 276 |
numSolves = json.length(); |
| 277 | 277 |
} |
| 278 | 278 |
catch(JSONException jex) |
| src/main/java/org/distorted/play/ScreenSolving.java | ||
|---|---|---|
| 29 | 29 |
|
| 30 | 30 |
public class ScreenSolving extends ScreenBase |
| 31 | 31 |
{
|
| 32 |
private static final int MOVES_THRESHHOLD = 8;
|
|
| 32 |
private static final int MOVES_THRESHHOLD = 6;
|
|
| 33 | 33 |
|
| 34 | 34 |
private TextView mTime; |
| 35 | 35 |
private Timer mTimer; |
Also available in: Unified diff
Progress remembering solves.