Android: Allow device vibration with external controller

This commit is contained in:
Connor McLaughlin 2021-03-06 15:49:15 +10:00
parent a6e497cf62
commit 491e3a36df
2 changed files with 6 additions and 5 deletions

View File

@ -682,19 +682,20 @@ public class EmulationActivity extends AppCompatActivity implements SurfaceHolde
if (mTouchscreenController != null) {
activityLayout.removeView(mTouchscreenController);
mTouchscreenController = null;
mVibratorService = null;
}
} else {
if (mTouchscreenController == null) {
mTouchscreenController = new TouchscreenControllerView(this);
if (vibration)
mVibratorService = (Vibrator) getSystemService(VIBRATOR_SERVICE);
activityLayout.addView(mTouchscreenController);
}
mTouchscreenController.init(0, controllerType, viewType, hapticFeedback);
}
if (vibration)
mVibratorService = (Vibrator) getSystemService(VIBRATOR_SERVICE);
else
mVibratorService = null;
}
private InputManager.InputDeviceListener mInputDeviceListener;

View File

@ -66,7 +66,7 @@
<string name="settings_summary_auto_hide_touchscreen_controller">Hides the touchscreen controller when an external controller is detected.</string>
<string name="settings_vibrate_on_press">Vibrate On Press</string>
<string name="settings_summary_vibrate_on_press">Enables a short vibration when a touchscreen button is pressed. Requires \"Vibrate on Touch\" to be enabled on your device.</string>
<string name="settings_enable_vibration">Enable Vibration</string>
<string name="settings_enable_vibration">Device Vibration</string>
<string name="settings_summary_enable_vibration">Forwards rumble from the game to the phone\'s vibration motor.</string>
<string name="settings_memory_card_1_type">Memory Card 1 Type</string>
<string name="settings_memory_card_2_type">Memory Card 2 Type</string>