update heights & fix date parsing bug (#654)

This commit is contained in:
m2049r 2020-03-08 20:33:34 +01:00 committed by GitHub
parent 6c17b8bd87
commit c6aa04e986
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 6 additions and 2 deletions

View File

@ -8,7 +8,7 @@ android {
minSdkVersion 21
targetSdkVersion 28
versionCode 201
versionName "1.12.11 'Caerbannog'"
versionName "1.12.12 'Caerbannog'"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
externalNativeBuild {

View File

@ -438,7 +438,7 @@ public class GenerateFragment extends Fragment {
height = RestoreHeight.getInstance().getHeight(parser.parse(restoreHeight));
} catch (ParseException ex) {
}
if (height <= 0)
if ((height <= 0) && (restoreHeight.length() == 8))
try {
// is it a date without dashes?
SimpleDateFormat parser = new SimpleDateFormat("yyyyMMdd");

View File

@ -109,6 +109,10 @@ public class RestoreHeight {
blockheight.put("2019-09-01", 1913201L);
blockheight.put("2019-10-01", 1934732L);
blockheight.put("2019-11-01", 1957051L);
blockheight.put("2019-12-01", 1978433L);
blockheight.put("2020-01-01", 2001315L);
blockheight.put("2020-02-01", 2023656L);
blockheight.put("2020-03-01", 2044552L);
}
public long getHeight(String date) {