- Prevent app not responding (ANR) in NativeLib.buttonUp().

- Fix a KML folder issue.
This commit is contained in:
dgis 2020-09-03 00:12:42 +02:00
parent 85d8a6bb3e
commit 161b1207c9
6 changed files with 25 additions and 16 deletions

View file

@ -69,6 +69,7 @@ Version 1.9 (2020-09-XX)
- If the memory card file for the port 2 cannot be found, prompt the user to choose a new memory card file.
- Move the KML folder in the JSON settings embedded in the state file because Windows cannot open the state file with KML url longer than 256 byte.
- Prevent to auto save before launching the "Open...", "Save As...", "Load Object...", "Save Object...", etc...
- Prevent app not responding (ANR) in NativeLib.buttonUp().
Version 1.8 (2020-05-24)
@ -204,13 +205,10 @@ The Eric's Real scripts ("real*.kml" and "real*.bmp/png") are embedded in this a
TODO
- Android 11 new storage issues :-(
- ANR in NativeLib.buttonUp(), should make Win32::InvalidateRect() asynchronous (may be the cause of the lag and freeze).
- Add the name of the file in the toast "State saved".
- 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).
- Bug: In Xiaomi mi A3 under Android10, the haptic feedback does not work (add an intensity setting).
- 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...
I think it might have something to do with the "/" sign on the Shifted-7-key.
- 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).
- The clock seems unsynchronized sometimes (Michael P).
- Retain a key by right clicking if it is from a mouse.
- Add the possibility to load and save the flash in another file.

View file

@ -33,8 +33,8 @@ android {
applicationId "org.emulator.forty.eight"
minSdkVersion 19
targetSdkVersion 29
versionCode 15
versionName "1.8"
versionCode 16
versionName "1.9"
setProperty("archivesBaseName", "Emu48-v$versionName")
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
externalNativeBuild {
@ -80,12 +80,12 @@ android {
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'androidx.appcompat:appcompat:1.2.0-beta01'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
implementation 'androidx.appcompat:appcompat:1.2.0'
implementation 'androidx.constraintlayout:constraintlayout:2.0.1'
implementation 'androidx.preference:preference:1.1.1'
implementation 'com.google.android.material:material:1.1.0'
implementation 'com.google.android.material:material:1.2.1'
implementation 'androidx.documentfile:documentfile:1.0.1'
testImplementation 'junit:junit:4.13-beta-3'
androidTestImplementation 'androidx.test:runner:1.2.0'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0-alpha02'
testImplementation 'junit:junit:4.13'
androidTestImplementation 'androidx.test:runner:1.3.0'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
}

View file

@ -63,6 +63,15 @@ LINKS
CHANGES
Version 1.9 (2020-09-XX)
- If the KML folder does not exist (like the first time), prompt the user to choose a new KML folder.
- If the memory card file for the port 2 cannot be found, prompt the user to choose a new memory card file.
- Move the KML folder in the JSON settings embedded in the state file because Windows cannot open the state file with KML url longer than 256 byte.
- Prevent to auto save before launching the "Open...", "Save As...", "Load Object...", "Save Object...", etc...
- Prevent app not responding (ANR) in NativeLib.buttonUp().
Version 1.8 (2020-05-24)
- Intercept the ESC keyboard key to allow the use of the BACK soft key.

View file

@ -125,7 +125,7 @@ HANDLE CreateFile(LPCTSTR lpFileName, DWORD dwDesiredAccess, DWORD dwShareMode,
BOOL foundDocumentScheme = _tcsncmp(lpFileName, documentScheme, documentSchemeLength) == 0;
BOOL urlContentSchemeFound = _tcsncmp(lpFileName, contentScheme, contentSchemeLength) == 0;
if(chooseCurrentKmlMode == ChooseKmlMode_FILE_OPEN /*|| chooseCurrentKmlMode == ChooseKmlMode_CHANGE_KML*/) {
if(chooseCurrentKmlMode == ChooseKmlMode_FILE_OPEN || chooseCurrentKmlMode == ChooseKmlMode_FILE_OPEN_WITH_FOLDER) {
// A E48 state file can contain a path to the KML script.
if(foundDocumentScheme) {
// Keep for compatibility:

View file

@ -215,7 +215,9 @@ public class MainScreenView extends PanAndScaleView {
break;
case MotionEvent.ACTION_UP:
case MotionEvent.ACTION_POINTER_UP:
NativeLib.buttonUp((int) ((event.getX(actionIndex) - viewPanOffsetX) / viewScaleFactorX), (int) ((event.getY(actionIndex) - viewPanOffsetY) / viewScaleFactorY));
post(() -> {
NativeLib.buttonUp((int) ((event.getX(actionIndex) - viewPanOffsetX) / viewScaleFactorX), (int) ((event.getY(actionIndex) - viewPanOffsetY) / viewScaleFactorY));
});
currentButtonTouched.remove(actionIndex);
preventToScroll = currentButtonTouched.size() > 0;
if (debug) Log.d(TAG, "onTouchEvent() ACTION_UP, actionIndex: " + actionIndex + ", currentButtonTouched: " + currentButtonTouched.size() + ", preventToScroll: " + preventToScroll);

View file

@ -1322,11 +1322,11 @@ public class MainActivity extends AppCompatActivity implements NavigationView.On
// Copy the port1 settings from the state file to the settings (for the UI).
setPort1Settings(NativeLib.getPort1Plugged(), NativeLib.getPort1Writable());
// State file successfully opened.
if(kmlScriptFolder == null) {
String currentKml = NativeLib.getCurrentKml();
if(kmlScriptFolder == null || currentKml.startsWith("document:")) {
// Needed for compatibility:
// The KML folder is not in the JSON settings embedded in the state file,
// so, we need to extract it and change the variable szCurrentKml.
String currentKml = NativeLib.getCurrentKml();
Pattern patternKMLDocumentURL = Pattern.compile("document:([^|]+)\\|(.+)");
Matcher m = patternKMLDocumentURL.matcher(currentKml);
if (m.find() && m.groupCount() == 2) {