From 9e9faf3be1582ac5cdcaa46dc60287b10c921aa2 Mon Sep 17 00:00:00 2001 From: JosJuice Date: Sun, 16 Mar 2025 11:24:10 +0100 Subject: [PATCH] Android: Show message when trying to map disconnected device Having the MotionAlertDialog immediately close is confusing for users. Let's show a message to tell them what went wrong. --- .../dolphinemu/features/input/ui/MotionAlertDialog.kt | 8 ++++++++ Source/Android/app/src/main/res/values/strings.xml | 3 ++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/input/ui/MotionAlertDialog.kt b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/input/ui/MotionAlertDialog.kt index c3b471899e..12f3ffb138 100644 --- a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/input/ui/MotionAlertDialog.kt +++ b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/input/ui/MotionAlertDialog.kt @@ -9,6 +9,8 @@ import android.view.InputDevice import android.view.KeyEvent import android.view.MotionEvent import androidx.appcompat.app.AlertDialog +import com.google.android.material.dialog.MaterialAlertDialogBuilder +import org.dolphinemu.dolphinemu.R import org.dolphinemu.dolphinemu.features.input.model.ControllerInterface import org.dolphinemu.dolphinemu.features.input.model.InputDetector import org.dolphinemu.dolphinemu.features.input.model.view.InputMappingControlSetting @@ -35,6 +37,12 @@ class MotionAlertDialog( running = true inputDetector.start(setting.controller.getDefaultDevice(), allDevices) periodicUpdate() + if (running == false) { + MaterialAlertDialogBuilder(activity) + .setMessage(R.string.input_binding_disconnected_device) + .setPositiveButton(R.string.ok, null) + .show() + } } override fun onStop() { diff --git a/Source/Android/app/src/main/res/values/strings.xml b/Source/Android/app/src/main/res/values/strings.xml index e10a781114..c0b33237af 100644 --- a/Source/Android/app/src/main/res/values/strings.xml +++ b/Source/Android/app/src/main/res/values/strings.xml @@ -54,7 +54,8 @@ Input Binding Press or move an input to bind it to %1$s. - You need to select a device first! + You need to select a device first. + The selected device is disconnected.\n\nPlease reconnect the device or select a different device. Configure Input Configure Output Expression