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.
This commit is contained in:
JosJuice 2025-03-16 11:24:10 +01:00
parent 516c1314d2
commit 9e9faf3be1
2 changed files with 10 additions and 1 deletions

View File

@ -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() {

View File

@ -54,7 +54,8 @@
<string name="input_binding">Input Binding</string>
<string name="input_binding_description">Press or move an input to bind it to %1$s.</string>
<string name="input_binding_no_device">You need to select a device first!</string>
<string name="input_binding_no_device">You need to select a device first.</string>
<string name="input_binding_disconnected_device">The selected device is disconnected.\n\nPlease reconnect the device or select a different device.</string>
<string name="input_configure_input">Configure Input</string>
<string name="input_configure_output">Configure Output</string>
<string name="input_expression">Expression</string>