From 3753c6e5508d4c4577b21ef270012b91d05f40c6 Mon Sep 17 00:00:00 2001 From: Ghabry Date: Fri, 20 Dec 2024 21:23:45 +0100 Subject: [PATCH] Android: Rename A/B buttons to Z/X as this is what RPG_RT uses. Added an option to get the old behaviour back. Fix #3311 --- .../player/button_mapping/VirtualButton.java | 12 ++++++++++-- .../org/easyrpg/player/settings/SettingsEnum.java | 1 + .../player/settings/SettingsInputActivity.java | 6 ++++++ .../easyrpg/player/settings/SettingsManager.java | 13 +++++++++++++ .../main/res/layout/activity_settings_inputs.xml | 7 +++++++ builds/android/app/src/main/res/values/strings.xml | 1 + 6 files changed, 38 insertions(+), 2 deletions(-) diff --git a/builds/android/app/src/main/java/org/easyrpg/player/button_mapping/VirtualButton.java b/builds/android/app/src/main/java/org/easyrpg/player/button_mapping/VirtualButton.java index 57ae8ebcdc..b2a2d40007 100644 --- a/builds/android/app/src/main/java/org/easyrpg/player/button_mapping/VirtualButton.java +++ b/builds/android/app/src/main/java/org/easyrpg/player/button_mapping/VirtualButton.java @@ -205,9 +205,17 @@ public char getAppropriateChar(int keyCode) { char charButton; if (keyCode == ENTER) { - charButton = 'A'; + if (SettingsManager.getShowZXasAB()) { + charButton = 'A'; + } else { + charButton = 'Z'; + } } else if (keyCode == CANCEL) { - charButton = 'B'; + if (SettingsManager.getShowZXasAB()) { + charButton = 'B'; + } else { + charButton = 'X'; + } } else if (keyCode == SHIFT) { charButton = 'S'; } else if (keyCode == KEY_0) { diff --git a/builds/android/app/src/main/java/org/easyrpg/player/settings/SettingsEnum.java b/builds/android/app/src/main/java/org/easyrpg/player/settings/SettingsEnum.java index 96d6947752..fd95651fc4 100644 --- a/builds/android/app/src/main/java/org/easyrpg/player/settings/SettingsEnum.java +++ b/builds/android/app/src/main/java/org/easyrpg/player/settings/SettingsEnum.java @@ -29,6 +29,7 @@ enum SettingsEnum { FONT1_SIZE("Font1Size"), FONT2_SIZE("Font2Size"), GAME_BROWSER_LABEL_MODE("GAME_BROWSER_LABEL_MODE"), + SHOW_ZX_AS_AB("SHOW_ZX_AS_AB") ; diff --git a/builds/android/app/src/main/java/org/easyrpg/player/settings/SettingsInputActivity.java b/builds/android/app/src/main/java/org/easyrpg/player/settings/SettingsInputActivity.java index 924c3b4d62..4c7bcbd3ee 100644 --- a/builds/android/app/src/main/java/org/easyrpg/player/settings/SettingsInputActivity.java +++ b/builds/android/app/src/main/java/org/easyrpg/player/settings/SettingsInputActivity.java @@ -37,6 +37,10 @@ public void onCreate(Bundle savedInstanceState) { enableVibrateWhenSlidingCheckbox.setChecked(SettingsManager.isVibrateWhenSlidingDirectionEnabled()); enableVibrateWhenSlidingCheckbox.setOnClickListener(this); + CheckBox showZXasABcheckbox = findViewById(R.id.settings_show_zx_as_ab); + showZXasABcheckbox.setChecked(SettingsManager.getShowZXasAB()); + showZXasABcheckbox.setOnClickListener(this); + configureFastForwardButton(); configureLayoutTransparencySystem(); configureLayoutSizeSystem(); @@ -57,6 +61,8 @@ public void onClick(View v) { enableVibrateWhenSlidingCheckbox.setEnabled(c.isChecked()); } else if (id == R.id.settings_vibrate_when_sliding){ SettingsManager.setVibrateWhenSlidingDirectionEnabled(((CheckBox) v).isChecked()); + } else if (id == R.id.settings_show_zx_as_ab) { + SettingsManager.setShowZXasAB(((CheckBox)v).isChecked()); } } diff --git a/builds/android/app/src/main/java/org/easyrpg/player/settings/SettingsManager.java b/builds/android/app/src/main/java/org/easyrpg/player/settings/SettingsManager.java index ca620c6ba0..b4052c858a 100644 --- a/builds/android/app/src/main/java/org/easyrpg/player/settings/SettingsManager.java +++ b/builds/android/app/src/main/java/org/easyrpg/player/settings/SettingsManager.java @@ -51,6 +51,7 @@ public class SettingsManager { FONTS_FOLDER_NAME = "fonts"; public static int FAST_FORWARD_MODE_HOLD = 0, FAST_FORWARD_MODE_TAP = 1; private static int gameBrowserLabelMode = 0; + private static boolean showZXasAB = false; private static List imageSizeOption = Arrays.asList("nearest", "integer", "bilinear"); private static List gameResolutionOption = Arrays.asList("original", "widescreen", "ultrawide"); @@ -105,6 +106,8 @@ private static void loadSettings(Context context) { } gameBrowserLabelMode = sharedPref.getInt(GAME_BROWSER_LABEL_MODE.toString(), 0); + + showZXasAB = sharedPref.getBoolean(SHOW_ZX_AS_AB.toString(), false); } public static Set getFavoriteGamesList() { @@ -501,4 +504,14 @@ public static void setGameBrowserLabelMode(int i) { editor.putInt(SettingsEnum.GAME_BROWSER_LABEL_MODE.toString(), i); editor.commit(); } + + public static boolean getShowZXasAB() { + return showZXasAB; + } + + public static void setShowZXasAB(boolean b) { + showZXasAB = b; + editor.putBoolean(SHOW_ZX_AS_AB.toString(), b); + editor.commit(); + } } diff --git a/builds/android/app/src/main/res/layout/activity_settings_inputs.xml b/builds/android/app/src/main/res/layout/activity_settings_inputs.xml index 0e28455957..3c17030c59 100644 --- a/builds/android/app/src/main/res/layout/activity_settings_inputs.xml +++ b/builds/android/app/src/main/res/layout/activity_settings_inputs.xml @@ -25,6 +25,13 @@ android:text="@string/vibrate_when_sliding_direction" android:textSize="20sp"/> + + Sound effect volume Input layout transparency: Ignore button size settings and use this instead: + Display Z and X buttons as A and B No read access on %1$s Quick access Fast-forward button mode: