From 491e3a36df68e3b0bfeef5338e2ab0ebe75d07e4 Mon Sep 17 00:00:00 2001 From: Connor McLaughlin Date: Sat, 6 Mar 2021 15:49:15 +1000 Subject: [PATCH] Android: Allow device vibration with external controller --- .../github/stenzek/duckstation/EmulationActivity.java | 9 +++++---- android/app/src/main/res/values/strings.xml | 2 +- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/android/app/src/main/java/com/github/stenzek/duckstation/EmulationActivity.java b/android/app/src/main/java/com/github/stenzek/duckstation/EmulationActivity.java index 8cc180c6c..fdf97c557 100644 --- a/android/app/src/main/java/com/github/stenzek/duckstation/EmulationActivity.java +++ b/android/app/src/main/java/com/github/stenzek/duckstation/EmulationActivity.java @@ -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; diff --git a/android/app/src/main/res/values/strings.xml b/android/app/src/main/res/values/strings.xml index 6af7c5174..dd1dc3f18 100644 --- a/android/app/src/main/res/values/strings.xml +++ b/android/app/src/main/res/values/strings.xml @@ -66,7 +66,7 @@ Hides the touchscreen controller when an external controller is detected. Vibrate On Press Enables a short vibration when a touchscreen button is pressed. Requires \"Vibrate on Touch\" to be enabled on your device. - Enable Vibration + Device Vibration Forwards rumble from the game to the phone\'s vibration motor. Memory Card 1 Type Memory Card 2 Type