Skip to content

Commit

Permalink
Implemented API 31+ vibration service code to replace depreciated code
Browse files Browse the repository at this point in the history
  • Loading branch information
U7484052 committed Oct 28, 2023
1 parent 39f3132 commit 80b4b3f
Show file tree
Hide file tree
Showing 13 changed files with 12 additions and 533 deletions.
20 changes: 0 additions & 20 deletions CodenameOne/CodenameOne.iml

This file was deleted.

41 changes: 0 additions & 41 deletions CodenameOneDesigner/CodenameOneDesigner.iml

This file was deleted.

20 changes: 0 additions & 20 deletions Ports/Android/CompatLibs/CompatLibs.iml

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
43 changes: 0 additions & 43 deletions Ports/BlackBerryOS_5/BlackBerryOS_5.iml

This file was deleted.

43 changes: 0 additions & 43 deletions Ports/J2ME/J2ME.iml

This file was deleted.

20 changes: 0 additions & 20 deletions Ports/JavaSEWithSVGSupport/JavaSEWithSVGSupport.iml

This file was deleted.

23 changes: 0 additions & 23 deletions Ports/retro/retro.iml

This file was deleted.

43 changes: 0 additions & 43 deletions Samples/SampleProjectTemplate/SampleProjectTemplate.iml

This file was deleted.

20 changes: 0 additions & 20 deletions Samples/Samples.iml

This file was deleted.

Loading

0 comments on commit 80b4b3f

Please sign in to comment.