From 80b4b3f68e364f4c27e99c19481a385486e3f895 Mon Sep 17 00:00:00 2001 From: U7484052 Date: Sat, 28 Oct 2023 12:11:35 +1100 Subject: [PATCH 1/3] Implemented API 31+ vibration service code to replace depreciated code --- CodenameOne/CodenameOne.iml | 20 -- CodenameOneDesigner/CodenameOneDesigner.iml | 41 ---- Ports/Android/CompatLibs/CompatLibs.iml | 20 -- .../impl/android/AndroidImplementation.java | 13 +- Ports/BlackBerryOS_5/BlackBerryOS_5.iml | 43 ---- Ports/J2ME/J2ME.iml | 43 ---- .../JavaSEWithSVGSupport.iml | 20 -- Ports/retro/retro.iml | 23 --- .../SampleProjectTemplate.iml | 43 ---- Samples/Samples.iml | 20 -- Samples/samples/samples.iml | 191 ------------------ .../TestNativeInterfaces.iml | 44 ---- tests/TestNativeInterfaces/native/native.iml | 24 --- 13 files changed, 12 insertions(+), 533 deletions(-) delete mode 100644 CodenameOne/CodenameOne.iml delete mode 100644 CodenameOneDesigner/CodenameOneDesigner.iml delete mode 100644 Ports/Android/CompatLibs/CompatLibs.iml delete mode 100644 Ports/BlackBerryOS_5/BlackBerryOS_5.iml delete mode 100644 Ports/J2ME/J2ME.iml delete mode 100644 Ports/JavaSEWithSVGSupport/JavaSEWithSVGSupport.iml delete mode 100644 Ports/retro/retro.iml delete mode 100644 Samples/SampleProjectTemplate/SampleProjectTemplate.iml delete mode 100644 Samples/Samples.iml delete mode 100644 Samples/samples/samples.iml delete mode 100644 tests/TestNativeInterfaces/TestNativeInterfaces.iml delete mode 100644 tests/TestNativeInterfaces/native/native.iml diff --git a/CodenameOne/CodenameOne.iml b/CodenameOne/CodenameOne.iml deleted file mode 100644 index 0708b640f8..0000000000 --- a/CodenameOne/CodenameOne.iml +++ /dev/null @@ -1,20 +0,0 @@ - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/CodenameOneDesigner/CodenameOneDesigner.iml b/CodenameOneDesigner/CodenameOneDesigner.iml deleted file mode 100644 index 2c160ddf08..0000000000 --- a/CodenameOneDesigner/CodenameOneDesigner.iml +++ /dev/null @@ -1,41 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/Ports/Android/CompatLibs/CompatLibs.iml b/Ports/Android/CompatLibs/CompatLibs.iml deleted file mode 100644 index 0708b640f8..0000000000 --- a/Ports/Android/CompatLibs/CompatLibs.iml +++ /dev/null @@ -1,20 +0,0 @@ - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/Ports/Android/src/com/codename1/impl/android/AndroidImplementation.java b/Ports/Android/src/com/codename1/impl/android/AndroidImplementation.java index bef52e0456..e6439b6138 100644 --- a/Ports/Android/src/com/codename1/impl/android/AndroidImplementation.java +++ b/Ports/Android/src/com/codename1/impl/android/AndroidImplementation.java @@ -2610,7 +2610,18 @@ public int getSoftkeyCount() { public void vibrate(int duration) { if (!this.vibrateInitialized) { try { - v = (Vibrator) getContext().getSystemService(Context.VIBRATOR_SERVICE); + /** + * Implementation takes into account for retrocompatability if the + * SDK ever needs to be reverted to pre 31 for some reason? + */ + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) { + // SDK >= 31 + VibratorManager vibratorManager = (VibratorManager) getSystemService(Context.VIBRATOR_MANAGER_SERVICE); + v = vibratorManager.getDefaultVibrator(); + } else { + // Backward compatability for SDK < 31 + v = (Vibrator) getContext().getSystemService(Context.VIBRATOR_SERVICE); + } } catch (Throwable e) { Log.e("Codename One", "problem with virbrator(0)", e); } finally { diff --git a/Ports/BlackBerryOS_5/BlackBerryOS_5.iml b/Ports/BlackBerryOS_5/BlackBerryOS_5.iml deleted file mode 100644 index 3b2dd56502..0000000000 --- a/Ports/BlackBerryOS_5/BlackBerryOS_5.iml +++ /dev/null @@ -1,43 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/Ports/J2ME/J2ME.iml b/Ports/J2ME/J2ME.iml deleted file mode 100644 index 3b2dd56502..0000000000 --- a/Ports/J2ME/J2ME.iml +++ /dev/null @@ -1,43 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/Ports/JavaSEWithSVGSupport/JavaSEWithSVGSupport.iml b/Ports/JavaSEWithSVGSupport/JavaSEWithSVGSupport.iml deleted file mode 100644 index 0708b640f8..0000000000 --- a/Ports/JavaSEWithSVGSupport/JavaSEWithSVGSupport.iml +++ /dev/null @@ -1,20 +0,0 @@ - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/Ports/retro/retro.iml b/Ports/retro/retro.iml deleted file mode 100644 index 4139b4f84b..0000000000 --- a/Ports/retro/retro.iml +++ /dev/null @@ -1,23 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/Samples/SampleProjectTemplate/SampleProjectTemplate.iml b/Samples/SampleProjectTemplate/SampleProjectTemplate.iml deleted file mode 100644 index 3b2dd56502..0000000000 --- a/Samples/SampleProjectTemplate/SampleProjectTemplate.iml +++ /dev/null @@ -1,43 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/Samples/Samples.iml b/Samples/Samples.iml deleted file mode 100644 index 0708b640f8..0000000000 --- a/Samples/Samples.iml +++ /dev/null @@ -1,20 +0,0 @@ - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/Samples/samples/samples.iml b/Samples/samples/samples.iml deleted file mode 100644 index 3a78ec2caf..0000000000 --- a/Samples/samples/samples.iml +++ /dev/null @@ -1,191 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/tests/TestNativeInterfaces/TestNativeInterfaces.iml b/tests/TestNativeInterfaces/TestNativeInterfaces.iml deleted file mode 100644 index d6bffb43d0..0000000000 --- a/tests/TestNativeInterfaces/TestNativeInterfaces.iml +++ /dev/null @@ -1,44 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/tests/TestNativeInterfaces/native/native.iml b/tests/TestNativeInterfaces/native/native.iml deleted file mode 100644 index 1fb8188b1b..0000000000 --- a/tests/TestNativeInterfaces/native/native.iml +++ /dev/null @@ -1,24 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file From 7104fa66afaeea3f8fd17ad734ca796ee7d15dc4 Mon Sep 17 00:00:00 2001 From: U7484052 Date: Sun, 29 Oct 2023 16:43:48 +1100 Subject: [PATCH 2/3] Fixed issues with VibratorManager --- .../com/codename1/impl/android/AndroidImplementation.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Ports/Android/src/com/codename1/impl/android/AndroidImplementation.java b/Ports/Android/src/com/codename1/impl/android/AndroidImplementation.java index e6439b6138..41c5abc597 100644 --- a/Ports/Android/src/com/codename1/impl/android/AndroidImplementation.java +++ b/Ports/Android/src/com/codename1/impl/android/AndroidImplementation.java @@ -52,6 +52,7 @@ import android.media.AudioManager; import android.net.Uri; import android.os.Vibrator; +import android.os.VibratorManager; import android.telephony.TelephonyManager; import android.util.DisplayMetrics; import android.util.Log; @@ -2614,7 +2615,7 @@ public void vibrate(int duration) { * Implementation takes into account for retrocompatability if the * SDK ever needs to be reverted to pre 31 for some reason? */ - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) { + if (Build.VERSION.SDK_INT >= 31) { // SDK >= 31 VibratorManager vibratorManager = (VibratorManager) getSystemService(Context.VIBRATOR_MANAGER_SERVICE); v = vibratorManager.getDefaultVibrator(); @@ -2623,7 +2624,7 @@ public void vibrate(int duration) { v = (Vibrator) getContext().getSystemService(Context.VIBRATOR_SERVICE); } } catch (Throwable e) { - Log.e("Codename One", "problem with virbrator(0)", e); + Log.e("Codename One", "problem with vibrator(0)", e); } finally { this.vibrateInitialized = true; } From 6ef7c1c5e4b1e66f46087192198b1da19916024c Mon Sep 17 00:00:00 2001 From: U7484052 Date: Sun, 29 Oct 2023 17:54:49 +1100 Subject: [PATCH 3/3] Removed extra files from PR --- CodenameOne/CodenameOne.iml | 20 ++ CodenameOneDesigner/CodenameOneDesigner.iml | 41 ++++ Ports/Android/CompatLibs/CompatLibs.iml | 20 ++ Ports/BlackBerryOS_5/BlackBerryOS_5.iml | 43 ++++ Ports/J2ME/J2ME.iml | 43 ++++ .../JavaSEWithSVGSupport.iml | 20 ++ Ports/retro/retro.iml | 23 +++ .../SampleProjectTemplate.iml | 43 ++++ Samples/Samples.iml | 20 ++ Samples/samples/samples.iml | 191 ++++++++++++++++++ .../TestNativeInterfaces.iml | 44 ++++ tests/TestNativeInterfaces/native/native.iml | 24 +++ 12 files changed, 532 insertions(+) create mode 100644 CodenameOne/CodenameOne.iml create mode 100644 CodenameOneDesigner/CodenameOneDesigner.iml create mode 100644 Ports/Android/CompatLibs/CompatLibs.iml create mode 100644 Ports/BlackBerryOS_5/BlackBerryOS_5.iml create mode 100644 Ports/J2ME/J2ME.iml create mode 100644 Ports/JavaSEWithSVGSupport/JavaSEWithSVGSupport.iml create mode 100644 Ports/retro/retro.iml create mode 100644 Samples/SampleProjectTemplate/SampleProjectTemplate.iml create mode 100644 Samples/Samples.iml create mode 100644 Samples/samples/samples.iml create mode 100644 tests/TestNativeInterfaces/TestNativeInterfaces.iml create mode 100644 tests/TestNativeInterfaces/native/native.iml diff --git a/CodenameOne/CodenameOne.iml b/CodenameOne/CodenameOne.iml new file mode 100644 index 0000000000..0708b640f8 --- /dev/null +++ b/CodenameOne/CodenameOne.iml @@ -0,0 +1,20 @@ + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/CodenameOneDesigner/CodenameOneDesigner.iml b/CodenameOneDesigner/CodenameOneDesigner.iml new file mode 100644 index 0000000000..2c160ddf08 --- /dev/null +++ b/CodenameOneDesigner/CodenameOneDesigner.iml @@ -0,0 +1,41 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Ports/Android/CompatLibs/CompatLibs.iml b/Ports/Android/CompatLibs/CompatLibs.iml new file mode 100644 index 0000000000..0708b640f8 --- /dev/null +++ b/Ports/Android/CompatLibs/CompatLibs.iml @@ -0,0 +1,20 @@ + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Ports/BlackBerryOS_5/BlackBerryOS_5.iml b/Ports/BlackBerryOS_5/BlackBerryOS_5.iml new file mode 100644 index 0000000000..3b2dd56502 --- /dev/null +++ b/Ports/BlackBerryOS_5/BlackBerryOS_5.iml @@ -0,0 +1,43 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Ports/J2ME/J2ME.iml b/Ports/J2ME/J2ME.iml new file mode 100644 index 0000000000..3b2dd56502 --- /dev/null +++ b/Ports/J2ME/J2ME.iml @@ -0,0 +1,43 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Ports/JavaSEWithSVGSupport/JavaSEWithSVGSupport.iml b/Ports/JavaSEWithSVGSupport/JavaSEWithSVGSupport.iml new file mode 100644 index 0000000000..0708b640f8 --- /dev/null +++ b/Ports/JavaSEWithSVGSupport/JavaSEWithSVGSupport.iml @@ -0,0 +1,20 @@ + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Ports/retro/retro.iml b/Ports/retro/retro.iml new file mode 100644 index 0000000000..4139b4f84b --- /dev/null +++ b/Ports/retro/retro.iml @@ -0,0 +1,23 @@ + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Samples/SampleProjectTemplate/SampleProjectTemplate.iml b/Samples/SampleProjectTemplate/SampleProjectTemplate.iml new file mode 100644 index 0000000000..3b2dd56502 --- /dev/null +++ b/Samples/SampleProjectTemplate/SampleProjectTemplate.iml @@ -0,0 +1,43 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Samples/Samples.iml b/Samples/Samples.iml new file mode 100644 index 0000000000..0708b640f8 --- /dev/null +++ b/Samples/Samples.iml @@ -0,0 +1,20 @@ + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Samples/samples/samples.iml b/Samples/samples/samples.iml new file mode 100644 index 0000000000..3a78ec2caf --- /dev/null +++ b/Samples/samples/samples.iml @@ -0,0 +1,191 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/tests/TestNativeInterfaces/TestNativeInterfaces.iml b/tests/TestNativeInterfaces/TestNativeInterfaces.iml new file mode 100644 index 0000000000..d6bffb43d0 --- /dev/null +++ b/tests/TestNativeInterfaces/TestNativeInterfaces.iml @@ -0,0 +1,44 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/tests/TestNativeInterfaces/native/native.iml b/tests/TestNativeInterfaces/native/native.iml new file mode 100644 index 0000000000..1fb8188b1b --- /dev/null +++ b/tests/TestNativeInterfaces/native/native.iml @@ -0,0 +1,24 @@ + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file