Skip to content

Commit

Permalink
Android: Don't clear vibrators in onStop
Browse files Browse the repository at this point in the history
Fixes issue where vibration would stop if you swapped between apps mid emulation.
  • Loading branch information
zackhow committed Jan 21, 2019
1 parent 3627ef8 commit b9e402e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
Expand Up @@ -309,7 +309,6 @@ protected void restoreState(Bundle savedInstanceState)
protected void onStop()
{
super.onStop();
Rumble.clear();
}

@Override
Expand Down
Expand Up @@ -18,18 +18,19 @@
public class Rumble
{
private static Vibrator phoneVibrator;
private static SparseArray<Vibrator> emuVibrators;
private static final SparseArray<Vibrator> emuVibrators = new SparseArray<>();

public static void initRumble(EmulationActivity activity)
{
clear();

if (activity.deviceHasTouchScreen() &&
PreferenceManager.getDefaultSharedPreferences(activity)
.getBoolean("phoneRumble", true))
{
setPhoneVibrator(true, activity);
}

emuVibrators = new SparseArray<>();
for (int i = 0; i < 8; i++)
{
StringSetting deviceName =
Expand Down Expand Up @@ -65,7 +66,7 @@ public static void setPhoneVibrator(boolean set, EmulationActivity activity)
}
}

public static void clear()
private static void clear()
{
phoneVibrator = null;
emuVibrators.clear();
Expand Down

0 comments on commit b9e402e

Please sign in to comment.