Prepare version 2.7

This commit is contained in:
dgis 2024-06-12 13:07:28 +02:00
parent 8a8f2d8ce7
commit dac669dac4
23 changed files with 55 additions and 37 deletions

View file

@ -58,14 +58,13 @@ LINKS
CHANGES
Version 2.7 (2024-06-XX)
Version 2.7 (2024-06-12)
- 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 haptic feedback with Android 12 (API deprecation).
- Patch the ROM files to prevent the calculator to sleep, but not for HP 48gII/49G/50g (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)
@ -269,8 +268,8 @@ FAQ
TODO
- Test XSEND.
- Haptic feedback does not seems to work on Android 13, should check (J. Majors).
- NDK 26 does not compile
- Patching 49G to disable 10 min auto off causes a reset when touching the Recent button and coming back to the app.
- Add an "haptic" feedback with a sound instead of a vibration (F. Giampietro).
- Add a Cancel button to the HP48 memory card creator dialog.
- Manage the HP 48 port 2 with the same kind of interface for the memory card.
@ -285,7 +284,7 @@ TODO
BUILD
Emu48 for Android is built with Android Studio 2021.1.1 (2022).
Emu48 for Android is built with Android Studio 2023.3.1 (2024).
And to generate an installable APK file with a real Android device, it MUST be signed.
Either use Android Studio:

View file

@ -3,7 +3,7 @@
# Sets the minimum version of CMake required to build the native library.
cmake_minimum_required(VERSION 3.4.1)
cmake_minimum_required(VERSION 3.6.0)
#add_compile_options(-DDEBUG_DISPLAY)
#add_compile_options(-DDEBUG_SOUND)
@ -31,6 +31,10 @@ add_compile_options(-DLODEPNG_NO_COMPILE_CPP)
add_compile_options(-DEMUXX=48)
#add_compile_options(-Wno-error=implicit-function-declaration)
add_compile_options(-fpermissive)
add_compile_options(-Wno-error=incompatible-pointer-types)
if(CMAKE_BUILD_TYPE STREQUAL Release)
message("RELEASE BUILD")
add_compile_options(-Ofast)
@ -103,4 +107,4 @@ target_link_libraries( # Specifies the target library.
android
jnigraphics
OpenSLES
log)
log)

View file

@ -33,11 +33,24 @@ android {
defaultConfig {
applicationId "org.emulator.forty.eight"
minSdk 21
//targetSdk 33
targetSdk 34
versionCode 26
versionName "2.7"
setProperty("archivesBaseName", "Emu48-v$versionName")
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
externalNativeBuild {
cmake {
// cppFlags '-std=c++11'
// cppFlags '-std=gnu99'
// cppFlags '-std=c99'
// cppFlags '-std=c++11 -std=gnu99'
// cppFlags '-std=c++11 -Wno-error=implicit-function-declaration'
// add_compile_options(-fpermissive)
cppFlags '-std=c++11 -fpermissive -Wno-error=incompatible-pointer-types'
}
}
}
if (canSign) {
@ -75,6 +88,7 @@ android {
//version '3.18.1'
}
}
ndkVersion '25.1.8937393'
}
dependencies {

View file

@ -58,11 +58,11 @@ LINKS
CHANGES
Version 2.7 (2024-06-09)
Version 2.7 (2024-06-12)
- 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).
- Patch the ROM files to prevent the calculator to sleep, but not for HP 48gII/49G/50g (Fix #22).
- Fix a potential crash about the permission to access the files.
- Require at least Android 5.0 (4.4 previously).

View file

@ -11,7 +11,6 @@ Global
Model "Q"
Class 50
Rom "rom.49g"
Patch "patch.49g"
Bitmap "calypso2k.png"
Color 0 0 0 0
#Scale 3 9

View file

@ -11,7 +11,6 @@ Global
Model "Q"
Class 50
Rom "rom.49g"
Patch "patch.49g"
Bitmap "calypso4k.png"
Color 0 0 0 0
#Scale 3 18

View file

@ -14,7 +14,6 @@ Global
Author "Eric Rechlin"
Model "2"
Rom "rom.49g"
Patch "patch.49g"
Bitmap "real48gii-l.png"
Icon "48gii.ico"
Color 0 190 190 190

View file

@ -14,7 +14,6 @@ Global
Author "Eric Rechlin"
Model "2"
Rom "rom.49g"
Patch "patch.49g"
Bitmap "real48gii-lc.png"
Icon "48gii.ico"
Color 0 190 190 190

View file

@ -14,7 +14,6 @@ Global
Author "Eric Rechlin"
Model "X"
Rom "rom.49g"
Patch "patch.49g"
Bitmap "real49g-l.png"
Icon "49g.ico"
Color 0 190 190 190

View file

@ -14,7 +14,6 @@ Global
Author "Eric Rechlin"
Model "X"
Rom "rom.49g"
Patch "patch.49g"
Bitmap "real49g-lc.png"
Icon "49g.ico"
Color 0 190 190 190

View file

@ -14,7 +14,6 @@ Global
Author "Eric Rechlin"
Model "Q"
Rom "rom.49g"
Patch "patch.49g"
Bitmap "real49gp-l.png"
Icon "49gp.ico"
Color 0 190 190 190

View file

@ -14,7 +14,6 @@ Global
Author "Eric Rechlin"
Model "Q"
Rom "rom.49g"
Patch "patch.49g"
Bitmap "real49gp-lc.png"
Icon "49gp.ico"
Color 0 190 190 190

View file

@ -14,7 +14,6 @@ Global
Model "Q"
Class 50
Rom "rom.49g"
Patch "patch.49g"
Bitmap "real50g-blue-l.png"
Icon "50g.ico"
Color 0 190 190 190

View file

@ -14,7 +14,6 @@ Global
Model "Q"
Class 50
Rom "rom.49g"
Patch "patch.49g"
Bitmap "real50g-blue-lc.png"
Icon "50g.ico"
Color 0 190 190 190

View file

@ -15,7 +15,6 @@ Global
Model "Q"
Class 50
Rom "rom.49g"
Patch "patch.49g"
Bitmap "real50g-l.png"
Icon "50g.ico"
Color 0 190 190 190

View file

@ -15,7 +15,6 @@ Global
Model "Q"
Class 50
Rom "rom.49g"
Patch "patch.49g"
Bitmap "real50g-lc.png"
Icon "50g.ico"
Color 0 190 190 190

View file

@ -7,6 +7,7 @@ import android.content.Intent;
import android.hardware.usb.UsbDevice;
import android.hardware.usb.UsbDeviceConnection;
import android.hardware.usb.UsbManager;
import android.os.Build;
import android.os.Handler;
import android.os.Looper;
import android.os.SystemClock;
@ -156,7 +157,8 @@ public class Serial {
}
if(usbConnection == null && usbPermission == UsbPermission.Unknown && !usbManager.hasPermission(driver.getDevice())) {
usbPermission = UsbPermission.Requested;
PendingIntent usbPermissionIntent = PendingIntent.getBroadcast(context, 0, new Intent(INTENT_ACTION_GRANT_USB), 0);
int flags = Build.VERSION.SDK_INT >= Build.VERSION_CODES.M ? PendingIntent.FLAG_MUTABLE : 0;
PendingIntent usbPermissionIntent = PendingIntent.getBroadcast(context, 0, new Intent(INTENT_ACTION_GRANT_USB), flags);
usbManager.requestPermission(driver.getDevice(), usbPermissionIntent);
if(debug) Log.d(TAG, "Request permission");
connectionStatus = "serial_connection_failed_user_has_not_given_permission";

View file

@ -220,14 +220,11 @@ public class Utils {
public static void vibrate(Vibrator vibrator, int durationInMilliSecond) {
if(vibrator != null && durationInMilliSecond > 0) {
if (Build.VERSION.SDK_INT >= 33)
// https://developer.android.com/reference/android/os/Vibrator#vibrate(android.os.VibrationEffect,%20android.os.VibrationAttributes)
vibrator.vibrate(VibrationEffect.createOneShot(durationInMilliSecond, VibrationAttributes.USAGE_TOUCH));
else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O)
// https://developer.android.com/reference/android/os/Vibrator#vibrate(android.os.VibrationEffect,%20android.media.AudioAttributes)
vibrator.vibrate(VibrationEffect.createOneShot(durationInMilliSecond, VibrationEffect.DEFAULT_AMPLITUDE));
long[] vibratePattern = { 0, durationInMilliSecond, 1000 };
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O)
vibrator.vibrate(VibrationEffect.createWaveform(vibratePattern, -1));
else
//deprecated in API 26
// Deprecated in API 26
vibrator.vibrate(durationInMilliSecond);
}
}

View file

@ -30,6 +30,7 @@ import android.os.Build;
import android.os.Bundle;
import android.os.ParcelFileDescriptor;
import android.os.Vibrator;
import android.os.VibratorManager;
import android.util.Log;
import android.util.SparseArray;
import android.view.LayoutInflater;
@ -165,7 +166,12 @@ public class MainActivity extends AppCompatActivity implements NavigationView.On
settings = EmuApplication.getSettings();
settings.setIsDefaultSettings(true);
vibrator = (Vibrator) getSystemService(Context.VIBRATOR_SERVICE);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) {
vibrator = ((VibratorManager)getSystemService(Context.VIBRATOR_MANAGER_SERVICE)).getDefaultVibrator();
} else {
// Deprecated in API 31
vibrator = (Vibrator) getSystemService(Context.VIBRATOR_SERVICE);
}
ViewGroup mainScreenContainer = findViewById(R.id.main_screen_container);
mainScreenView = new MainScreenView(this);

View file

@ -20,8 +20,10 @@ import android.content.Context;
import android.content.Intent;
import android.content.res.Configuration;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
import android.os.Vibrator;
import android.os.VibratorManager;
import android.text.InputType;
import android.util.Log;
import android.view.LayoutInflater;
@ -214,7 +216,13 @@ public class SettingsFragment extends AppCompatDialogFragment {
// Haptic feedback settings
Vibrator vibrator = (Vibrator) requireContext().getSystemService(Context.VIBRATOR_SERVICE);
Vibrator vibrator;
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) {
vibrator = ((VibratorManager)requireContext().getSystemService(Context.VIBRATOR_MANAGER_SERVICE)).getDefaultVibrator();
} else {
vibrator = (Vibrator) requireContext().getSystemService(Context.VIBRATOR_SERVICE);
}
SeekBarPreference preferenceHapticFeedbackDuration = findPreference("settings_haptic_feedback_duration");
if(preferenceHapticFeedbackDuration != null) {
preferenceHapticFeedbackDuration.setOnPreferenceChangeListener((preference, newValue) -> {

View file

@ -88,7 +88,7 @@
android:summary="@string/settings_haptic_feedback_summary"
android:defaultValue="25"
android:min="0"
android:max="50"
android:max="100"
app:showSeekBarValue="true" />
</PreferenceCategory>

View file

@ -7,7 +7,7 @@ buildscript {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:8.3.2'
classpath 'com.android.tools.build:gradle:8.4.2'
// NOTE: Do not place your application dependencies here; they belong

View file

@ -1,6 +1,6 @@
#Sat Jan 28 21:16:38 CET 2023
distributionBase=GRADLE_USER_HOME
distributionUrl=https\://services.gradle.org/distributions/gradle-8.4-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.6-bin.zip
distributionPath=wrapper/dists
zipStorePath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME