Fix initialization of pattern and strengths arrays
Vibrator.vibrate(long[] pattern, int repeat) and VibrationEffect.createWaveform(long[] timings, int[] amplitudes, int repeat) expect an array of off/on pairs for both timings and amplitudes. Add an initial off time of zero to achieve expected vibration behavior.
This commit is contained in:
parent
4ca1692174
commit
a28ea1e1c6
|
@ -47,8 +47,8 @@ public class RetroActivityCommon extends NativeActivity
|
||||||
{
|
{
|
||||||
Vibrator vibrator = null;
|
Vibrator vibrator = null;
|
||||||
int repeat = 0;
|
int repeat = 0;
|
||||||
long[] pattern = {16};
|
long[] pattern = {0, 16};
|
||||||
int[] strengths = {strength};
|
int[] strengths = {0, strength};
|
||||||
|
|
||||||
if (Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.JELLY_BEAN) {
|
if (Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.JELLY_BEAN) {
|
||||||
if (id == -1)
|
if (id == -1)
|
||||||
|
@ -73,7 +73,7 @@ public class RetroActivityCommon extends NativeActivity
|
||||||
if (oneShot > 0)
|
if (oneShot > 0)
|
||||||
repeat = -1;
|
repeat = -1;
|
||||||
else
|
else
|
||||||
pattern[0] = 1000;
|
pattern[1] = 1000;
|
||||||
|
|
||||||
if (Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.O) {
|
if (Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.O) {
|
||||||
if (id >= 0)
|
if (id >= 0)
|
||||||
|
|
Loading…
Reference in New Issue