Android: Prevent showing mapping dialog with no device selected

This commit is contained in:
JosJuice 2022-10-30 19:06:04 +01:00
parent a1cc19f443
commit ea3200d4ba
2 changed files with 10 additions and 0 deletions

View File

@ -312,6 +312,15 @@ public final class SettingsAdapter extends RecyclerView.Adapter<SettingViewHolde
public void onInputMappingClick(final InputMappingControlSetting item, final int position)
{
if (item.getController().getDefaultDevice().isEmpty() && !mView.isMappingAllDevices())
{
new MaterialAlertDialogBuilder(mView.getActivity())
.setMessage(R.string.input_binding_no_device)
.setPositiveButton(R.string.ok, this)
.show();
return;
}
final MotionAlertDialog dialog = new MotionAlertDialog(mView.getActivity(), item,
mView.isMappingAllDevices());

View File

@ -33,6 +33,7 @@
<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>
<!-- Main Preference Fragment -->
<string name="settings">Settings</string>