diff --git a/ReadMe.txt b/ReadMe.txt index 792cc15..79d76df 100644 --- a/ReadMe.txt +++ b/ReadMe.txt @@ -63,6 +63,12 @@ LINKS CHANGES + +Version 2.1 (2020-11-23) + +- Fix an issue which prevents to save all the settings (Save in onPause instead of onStop). + + Version 2.0 (2020-11-15) - Updated source code from Eric Rechlin's Emu48 version 1.62+ that was merged from Christoph Gießelink's Emu48 version 1.63. @@ -218,6 +224,9 @@ The Eric's Real scripts ("real*.kml" and "real*.bmp/png") are embedded in this a TODO +- Bug: Sometimes the haptic feedback is reset to its default! Actually, the full settings are gone!!! Searching a scenario to reproduce... +- Show KML log on request. +- Serial port support (via USB OTG and maybe Bluetooth). - Manage the HP 48 port 2 with the same kind of interface for the memory card. - The render pixels are very nice. A solution to obtain uniform pixel size could be a preset (a multiplier, auto) so the user could decide and upscale/downscale (Michael P). - Somehow LEFT (Shift on the keyboard) + 7 activates the DIVIDE-key (z-Key)..., but with the NUM-Key it can make it work without problems... diff --git a/app/build.gradle b/app/build.gradle index 416ad76..6ce3c99 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -33,8 +33,8 @@ android { applicationId "org.emulator.forty.eight" minSdkVersion 19 targetSdkVersion 29 - versionCode 17 - versionName "2.0" + versionCode 18 + versionName "2.1" setProperty("archivesBaseName", "Emu48-v$versionName") testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" externalNativeBuild { @@ -81,7 +81,7 @@ android { dependencies { implementation fileTree(dir: 'libs', include: ['*.jar']) implementation 'androidx.appcompat:appcompat:1.2.0' - implementation 'androidx.constraintlayout:constraintlayout:2.0.2' + implementation 'androidx.constraintlayout:constraintlayout:2.0.4' implementation 'androidx.preference:preference:1.1.1' implementation 'com.google.android.material:material:1.2.1' implementation 'androidx.documentfile:documentfile:1.0.1' diff --git a/app/src/main/assets/ReadMe.txt b/app/src/main/assets/ReadMe.txt index 119409b..a645ade 100644 --- a/app/src/main/assets/ReadMe.txt +++ b/app/src/main/assets/ReadMe.txt @@ -63,6 +63,12 @@ LINKS CHANGES + +Version 2.1 (2020-11-23) + +- Fix an issue which prevents to save all the settings (Save in onPause instead of onStop). + + Version 2.0 (2020-11-15) - Updated source code from Eric Rechlin's Emu48 version 1.62+ that was merged from Christoph Gießelink's Emu48 version 1.63. diff --git a/app/src/main/cpp/emu-jni.c b/app/src/main/cpp/emu-jni.c index 066f314..a286d7a 100644 --- a/app/src/main/cpp/emu-jni.c +++ b/app/src/main/cpp/emu-jni.c @@ -1020,7 +1020,7 @@ JNIEXPORT jboolean JNICALL Java_org_emulator_calculator_NativeLib_onLoadFlashROM BOOL result = MapRom(filenameUTF8); cCurrentRomType = cCurrentRomTypeBackup; if(result) { - UpdatePatches(true); // Apply the patch again if needed (not tested!) + UpdatePatches(TRUE); // Apply the patch again if needed (not tested!) if (!CrcRom(&wRomCrc)) // build patched ROM fingerprint and check for unpacked data result = FALSE; if (result && bDocumentAvail) { diff --git a/app/src/main/java/org/emulator/calculator/Settings.java b/app/src/main/java/org/emulator/calculator/Settings.java index 21716bc..b58a2af 100644 --- a/app/src/main/java/org/emulator/calculator/Settings.java +++ b/app/src/main/java/org/emulator/calculator/Settings.java @@ -251,10 +251,10 @@ public class Settings extends PreferenceDataStore { for (int i = 0; i < magic.length(); i++) { fileOutputStream.write(magic.charAt(i)); } - fileOutputStream.flush(); fileOutputStream.close(); } } catch (IOException e) { + if(debug) Log.d(TAG, "saveInStateFile() Error"); e.printStackTrace(); } } @@ -398,8 +398,8 @@ public class Settings extends PreferenceDataStore { @Nullable @Override public String getString(String key, @Nullable String defValue) { - if(debug) Log.d(TAG, "getString(key: '" + key + "')"); Object result = getValue(key); + if(debug) Log.d(TAG, "getString(key: '" + key + "') -> " + result); if(result instanceof String) return (String) result; return defValue; @@ -420,8 +420,8 @@ public class Settings extends PreferenceDataStore { @Override public int getInt(String key, int defValue) { - if(debug) Log.d(TAG, "getInt(key: '" + key + "')"); Object result = getValue(key); + if(debug) Log.d(TAG, "getInt(key: '" + key + "') -> " + result); if(result != null) try { return ((Number) result).intValue(); @@ -431,8 +431,8 @@ public class Settings extends PreferenceDataStore { @Override public long getLong(String key, long defValue) { - if(debug) Log.d(TAG, "getLong(key: '" + key + "')"); Object result = getValue(key); + if(debug) Log.d(TAG, "getLong(key: '" + key + "') -> " + result); if(result != null) try { return ((Number) result).longValue(); @@ -442,8 +442,8 @@ public class Settings extends PreferenceDataStore { @Override public float getFloat(String key, float defValue) { - if(debug) Log.d(TAG, "getFloat(key: '" + key + "')"); Object result = getValue(key); + if(debug) Log.d(TAG, "getFloat(key: '" + key + "') -> " + result); if(result != null) try { return ((Number) result).floatValue(); @@ -453,8 +453,8 @@ public class Settings extends PreferenceDataStore { @Override public boolean getBoolean(String key, boolean defValue) { - if(debug) Log.d(TAG, "getBoolean(key: '" + key + "')"); Object result = getValue(key); + if(debug) Log.d(TAG, "getBoolean(key: '" + key + "') -> " + result); if(result != null) try { return (Boolean) result; diff --git a/app/src/main/java/org/emulator/forty/eight/MainActivity.java b/app/src/main/java/org/emulator/forty/eight/MainActivity.java index 67fb21e..1834875 100644 --- a/app/src/main/java/org/emulator/forty/eight/MainActivity.java +++ b/app/src/main/java/org/emulator/forty/eight/MainActivity.java @@ -273,19 +273,12 @@ public class MainActivity extends AppCompatActivity implements NavigationView.On } } - @Override - protected void onResume() { - super.onResume(); - } - @Override protected void onPause() { - super.onPause(); - } - - @Override - protected void onStop() { - if(saveWhenLaunchingActivity) { + // Following the Activity lifecycle (https://developer.android.com/reference/android/app/Activity), + // the data must be saved in the onPause() event instead of onStop() simply because the onStop + // method is killable and may lead to the data half saved! + if(saveWhenLaunchingActivity) { settings.putStringSet("MRU", mruLinkedHashMap.keySet()); if (lcdOverlappingView != null) lcdOverlappingView.saveViewLayout(); @@ -301,7 +294,7 @@ public class MainActivity extends AppCompatActivity implements NavigationView.On clearFolderCache(); } - super.onStop(); + super.onPause(); } @Override @@ -1483,7 +1476,7 @@ public class MainActivity extends AppCompatActivity implements NavigationView.On } private void migrateDeprecatedSettings() { - if(settings.hasValue("settings_haptic_feedback")) { + if(!settings.hasValue("settings_haptic_feedback_duration") && settings.hasValue("settings_haptic_feedback")) { settings.removeValue("settings_haptic_feedback"); settings.putInt("settings_haptic_feedback_duration", 25); } diff --git a/build.gradle b/build.gradle index 20fe284..2a669de 100644 --- a/build.gradle +++ b/build.gradle @@ -7,7 +7,7 @@ buildscript { jcenter() } dependencies { - classpath 'com.android.tools.build:gradle:4.1.0' + classpath 'com.android.tools.build:gradle:4.1.1' // NOTE: Do not place your application dependencies here; they belong