Android: Don't clear vibrators in onStop
Fixes issue where vibration would stop if you swapped between apps mid emulation.
This commit is contained in:
parent
3627ef8a04
commit
b9e402e8b0
|
@ -309,7 +309,6 @@ public final class EmulationActivity extends AppCompatActivity
|
||||||
protected void onStop()
|
protected void onStop()
|
||||||
{
|
{
|
||||||
super.onStop();
|
super.onStop();
|
||||||
Rumble.clear();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -18,10 +18,12 @@ import java.util.HashMap;
|
||||||
public class Rumble
|
public class Rumble
|
||||||
{
|
{
|
||||||
private static Vibrator phoneVibrator;
|
private static Vibrator phoneVibrator;
|
||||||
private static SparseArray<Vibrator> emuVibrators;
|
private static final SparseArray<Vibrator> emuVibrators = new SparseArray<>();
|
||||||
|
|
||||||
public static void initRumble(EmulationActivity activity)
|
public static void initRumble(EmulationActivity activity)
|
||||||
{
|
{
|
||||||
|
clear();
|
||||||
|
|
||||||
if (activity.deviceHasTouchScreen() &&
|
if (activity.deviceHasTouchScreen() &&
|
||||||
PreferenceManager.getDefaultSharedPreferences(activity)
|
PreferenceManager.getDefaultSharedPreferences(activity)
|
||||||
.getBoolean("phoneRumble", true))
|
.getBoolean("phoneRumble", true))
|
||||||
|
@ -29,7 +31,6 @@ public class Rumble
|
||||||
setPhoneVibrator(true, activity);
|
setPhoneVibrator(true, activity);
|
||||||
}
|
}
|
||||||
|
|
||||||
emuVibrators = new SparseArray<>();
|
|
||||||
for (int i = 0; i < 8; i++)
|
for (int i = 0; i < 8; i++)
|
||||||
{
|
{
|
||||||
StringSetting deviceName =
|
StringSetting deviceName =
|
||||||
|
@ -65,7 +66,7 @@ public class Rumble
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void clear()
|
private static void clear()
|
||||||
{
|
{
|
||||||
phoneVibrator = null;
|
phoneVibrator = null;
|
||||||
emuVibrators.clear();
|
emuVibrators.clear();
|
||||||
|
|
Loading…
Reference in New Issue