From 8a8f2d8ce747586e704b83b866208a5dc8821167 Mon Sep 17 00:00:00 2001 From: dgis Date: Mon, 10 Jun 2024 08:27:31 +0200 Subject: [PATCH] Put back Serial slowdown setting. --- ReadMe.txt | 8 +++++--- app/build.gradle | 12 ++++++------ app/src/main/assets/ReadMe.txt | 7 ++++--- app/src/main/cpp/win32-layer.c | 2 +- .../emulator/calculator/PanAndScaleView.java | 4 ++-- .../calculator/usbserial/DevicesFragment.java | 9 +++++---- app/src/main/res/xml/pref_general.xml | 10 +++++----- build.gradle | 18 ++++++++++-------- gradle.properties | 6 +++--- gradle/wrapper/gradle-wrapper.properties | 2 +- 10 files changed, 42 insertions(+), 36 deletions(-) diff --git a/ReadMe.txt b/ReadMe.txt index 3952936..a7976e9 100644 --- a/ReadMe.txt +++ b/ReadMe.txt @@ -17,7 +17,7 @@ QUICK START 1. From the left side, slide your finger to open the menu. 2. Touch the "New..." menu item. -3. Select a default calculator (or with Android >= 5.0, "[Select a Custom KML script folder...]" where you have copied the KML scripts and ROM files (Android 11 cannot use the folder Download)). +3. Select a default calculator (or "[Select a Custom KML script folder...]" where you have copied the KML scripts and ROM files (Android 11 may not be able to use the Download folder)). 4. And the calculator should now be opened. @@ -37,7 +37,7 @@ NOTES without the need to be root. If it is not automatic, please, activate the OTG mode in your Android device, and then, you should be able to see it in the Emu48 settings. It is still experimental and I see some issues when sending characters from the emulator to a real HP48 or HP49 with the kermit protocol. - For the moment, the communication has been artificially slowed down in this direction. + The communication can be artificially slowed down in this direction using an option. If the adapter is unplugged then plugged back in, you may need to call OPENIO/CLOSEIO. @@ -58,12 +58,14 @@ LINKS CHANGES -Version 2.7 (2023-07-XX) +Version 2.7 (2024-06-XX) - Updated source code with Emu48 version 1.65+. This new version improve the serial communication. - Attempt to fix haptic feedback with Android 13 (API deprecation). - Patch the ROM files to prevent the calculator to sleep (Fix #22). - Fix a potential crash about the permission to access the files. +- Require at least Android 5.0 (4.4 previously). +BUG: In Emu48 with HP49 FlashCard, click on Android RECENT button, and comes back in the APP -> we lost the FlashCard! Version 2.6 (2022-08-19) diff --git a/app/build.gradle b/app/build.gradle index bf20d42..57629ff 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -29,11 +29,11 @@ if (keystorePropertiesFile.exists()) { android { namespace 'org.emulator.forty.eight' - compileSdk 33 + compileSdk 34 defaultConfig { applicationId "org.emulator.forty.eight" - minSdk 19 - targetSdk 33 + minSdk 21 + //targetSdk 33 versionCode 26 versionName "2.7" setProperty("archivesBaseName", "Emu48-v$versionName") @@ -79,10 +79,10 @@ android { dependencies { implementation fileTree(dir: 'libs', include: ['*.jar']) - implementation 'androidx.appcompat:appcompat:1.6.1' + implementation 'androidx.appcompat:appcompat:1.7.0' implementation 'androidx.constraintlayout:constraintlayout:2.1.4' - implementation 'com.google.android.material:material:1.9.0' - implementation 'androidx.preference:preference:1.2.0' + implementation 'com.google.android.material:material:1.12.0' + implementation 'androidx.preference:preference:1.2.1' implementation 'androidx.documentfile:documentfile:1.0.1' testImplementation 'junit:junit:4.13.2' androidTestImplementation 'androidx.test:runner:1.5.2' diff --git a/app/src/main/assets/ReadMe.txt b/app/src/main/assets/ReadMe.txt index 26508c2..f0bac64 100644 --- a/app/src/main/assets/ReadMe.txt +++ b/app/src/main/assets/ReadMe.txt @@ -17,7 +17,7 @@ QUICK START 1. From the left side, slide your finger to open the menu. 2. Touch the "New..." menu item. -3. Select a default calculator (or with Android >= 5.0, "[Select a Custom KML script folder...]" where you have copied the KML scripts and ROM files (Android 11 cannot use the folder Download)). +3. Select a default calculator (or "[Select a Custom KML script folder...]" where you have copied the KML scripts and ROM files (Android 11 may not be able to use the Download folder)). 4. And the calculator should now be opened. @@ -37,7 +37,7 @@ NOTES without the need to be root. If it is not automatic, please, activate the OTG mode in your Android device, and then, you should be able to see it in the Emu48 settings. It is still experimental and I see some issues when sending characters from the emulator to a real HP48 or HP49 with the kermit protocol. - For the moment, the communication has been artificially slowed down in this direction. + The communication can be artificially slowed down in this direction using an option. If the adapter is unplugged then plugged back in, you may need to call OPENIO/CLOSEIO. @@ -58,12 +58,13 @@ LINKS CHANGES -Version 2.7 (2023-07-XX) +Version 2.7 (2024-06-09) - Updated source code with Emu48 version 1.65+. This new version improve the serial communication. - Attempt to fix haptic feedback with Android 13 (API deprecation). - Patch the ROM files to prevent the calculator to sleep (Fix #22). - Fix a potential crash about the permission to access the files. +- Require at least Android 5.0 (4.4 previously). Version 2.6 (2022-08-19) diff --git a/app/src/main/cpp/win32-layer.c b/app/src/main/cpp/win32-layer.c index 60de078..d293411 100644 --- a/app/src/main/cpp/win32-layer.c +++ b/app/src/main/cpp/win32-layer.c @@ -342,7 +342,7 @@ BOOL WriteFile(HANDLE hFile, LPCVOID lpBuffer, DWORD nNumberOfBytesToWrite,LPDWO free(hexAsciiDump); #endif if(serialPortSlowDown) - Sleep(4); // Seems to be needed else the kermit packet does not fully reach the genuine calculator. + Sleep(4); // Seems to be needed else kermit/XSend packets do not fully reach the genuine calculator. if(lpNumberOfBytesWritten) *lpNumberOfBytesWritten = (DWORD) writenByteCount; return writenByteCount >= 0; diff --git a/app/src/main/java/org/emulator/calculator/PanAndScaleView.java b/app/src/main/java/org/emulator/calculator/PanAndScaleView.java index 6b23df0..26d1c2e 100644 --- a/app/src/main/java/org/emulator/calculator/PanAndScaleView.java +++ b/app/src/main/java/org/emulator/calculator/PanAndScaleView.java @@ -306,7 +306,7 @@ public class PanAndScaleView extends View { public boolean onDown(MotionEvent e) { if(debug) Log.d(TAG, "onDown() actionIndex: " + e.getActionIndex() + ", X: " + e.getX() + ", Y: " + e.getY()); scroller.forceFinished(true); - ViewCompat.postInvalidateOnAnimation(PanAndScaleView.this); + PanAndScaleView.this.postInvalidateOnAnimation(); if(onTapDownListener != null) { float scaleAndPanX = (e.getX() - viewPanOffsetX) / viewScaleFactorX; float scaleAndPanY = (e.getY() - viewPanOffsetY) / viewScaleFactorY; @@ -386,7 +386,7 @@ public class PanAndScaleView extends View { (int)(velocityFactor * velocityX), (int)(velocityFactor * velocityY), 0, -(int)viewPanMinX, 0, -(int)viewPanMinY); - ViewCompat.postInvalidateOnAnimation(PanAndScaleView.this); + PanAndScaleView.this.postInvalidateOnAnimation(); return true; } }); diff --git a/app/src/main/java/org/emulator/calculator/usbserial/DevicesFragment.java b/app/src/main/java/org/emulator/calculator/usbserial/DevicesFragment.java index d6a1010..f78d28b 100644 --- a/app/src/main/java/org/emulator/calculator/usbserial/DevicesFragment.java +++ b/app/src/main/java/org/emulator/calculator/usbserial/DevicesFragment.java @@ -20,6 +20,7 @@ import org.emulator.calculator.usbserial.driver.UsbSerialProber; import java.util.ArrayList; import java.util.Locale; +import java.util.Objects; import java.util.regex.Matcher; import java.util.regex.Pattern; @@ -43,14 +44,14 @@ public class DevicesFragment extends ListFragment { @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); - setHasOptionsMenu(true); - listAdapter = new ArrayAdapter(getActivity(), 0, listItems) { + //setHasOptionsMenu(true); + listAdapter = new ArrayAdapter(requireActivity(), 0, listItems) { @NonNull @Override public View getView(int position, View view, @NonNull ViewGroup parent) { ListItem item = listItems.get(position); if (view == null) - view = getActivity().getLayoutInflater().inflate(Utils.resId(DevicesFragment.this, "layout", "device_list_item"), parent, false); + view = requireActivity().getLayoutInflater().inflate(Utils.resId(DevicesFragment.this, "layout", "device_list_item"), parent, false); TextView text1 = view.findViewById(Utils.resId(DevicesFragment.this, "id", "text1")); TextView text2 = view.findViewById(Utils.resId(DevicesFragment.this, "id", "text2")); if(item.driver == null) @@ -73,7 +74,7 @@ public class DevicesFragment extends ListFragment { public void onActivityCreated(Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); setListAdapter(null); - View header = getActivity().getLayoutInflater().inflate(Utils.resId(DevicesFragment.this, "layout", "device_list_header"), null, false); + View header = requireActivity().getLayoutInflater().inflate(Utils.resId(DevicesFragment.this, "layout", "device_list_header"), null, false); getListView().addHeaderView(header, null, false); setEmptyText(getString(Utils.resId(this, "string", "serial_no_device"))); ((TextView) getListView().getEmptyView()).setTextSize(18); diff --git a/app/src/main/res/xml/pref_general.xml b/app/src/main/res/xml/pref_general.xml index b3d8577..e2078d2 100644 --- a/app/src/main/res/xml/pref_general.xml +++ b/app/src/main/res/xml/pref_general.xml @@ -188,11 +188,11 @@ android:title="@string/settings_serial_ports_ir_title" android:summary="" /> - - - - - + diff --git a/build.gradle b/build.gradle index a7c0f53..242f4a6 100644 --- a/build.gradle +++ b/build.gradle @@ -4,10 +4,10 @@ buildscript { repositories { google() - jcenter() + mavenCentral() } dependencies { - classpath 'com.android.tools.build:gradle:8.0.2' + classpath 'com.android.tools.build:gradle:8.3.2' // NOTE: Do not place your application dependencies here; they belong @@ -18,14 +18,16 @@ buildscript { allprojects { repositories { google() - jcenter() + mavenCentral() } - tasks.withType(JavaCompile) { - options.compilerArgs << "-Xlint:unchecked" << "-Xlint:deprecation" + tasks.withType(JavaCompile).tap { + configureEach { + options.compilerArgs << "-Xlint:unchecked" << "-Xlint:deprecation" + } } } -task clean(type: Delete) { - delete rootProject.buildDir -} +//task clean(type: Delete) { +// delete rootProject.buildDir +//} diff --git a/gradle.properties b/gradle.properties index 837d298..0471563 100644 --- a/gradle.properties +++ b/gradle.properties @@ -6,10 +6,10 @@ # http://www.gradle.org/docs/current/userguide/build_environment.html # Specifies the JVM arguments used for the daemon process. # The setting is particularly useful for tweaking memory settings. -android.defaults.buildfeatures.buildconfig=true +#android.defaults.buildfeatures.buildconfig=true android.enableJetifier=true -android.nonFinalResIds=false -android.nonTransitiveRClass=false +android.nonFinalResIds=true +android.nonTransitiveRClass=true android.useAndroidX=true org.gradle.jvmargs=-Xmx1536m org.gradle.unsafe.configuration-cache=true diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 3a4aa84..12817ef 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ #Sat Jan 28 21:16:38 CET 2023 distributionBase=GRADLE_USER_HOME -distributionUrl=https\://services.gradle.org/distributions/gradle-8.0-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.4-bin.zip distributionPath=wrapper/dists zipStorePath=wrapper/dists zipStoreBase=GRADLE_USER_HOME