Skip to content

Commit

Permalink
Android: Rename A/B buttons to Z/X as this is what RPG_RT uses.
Browse files Browse the repository at this point in the history
Added an option to get the old behaviour back.

Fix EasyRPG#3311
  • Loading branch information
Ghabry committed Dec 20, 2024
1 parent b136e1a commit 3753c6e
Show file tree
Hide file tree
Showing 6 changed files with 38 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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")
;


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand All @@ -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());
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<String> imageSizeOption = Arrays.asList("nearest", "integer", "bilinear");
private static List<String> gameResolutionOption = Arrays.asList("original", "widescreen", "ultrawide");
Expand Down Expand Up @@ -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<String> getFavoriteGamesList() {
Expand Down Expand Up @@ -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();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,13 @@
android:text="@string/vibrate_when_sliding_direction"
android:textSize="20sp"/>

<CheckBox
android:id="@+id/settings_show_zx_as_ab"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/settings_input_show_zx_as_ab"
android:textSize="20sp"/>

<include layout="@layout/separator"/>

<RelativeLayout
Expand Down
1 change: 1 addition & 0 deletions builds/android/app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ Please tell us in detail what went wrong.\n\n
<string name="sound_volume">Sound effect volume</string>
<string name="input_layout_transparency">Input layout transparency:</string>
<string name="ignore_size_settings">Ignore button size settings and use this instead:</string>
<string name="settings_input_show_zx_as_ab">Display Z and X buttons as A and B</string>
<string name="no_read_access_on_dir">No read access on %1$s</string>
<string name="quick_access">Quick access</string>
<string name="fast_forward">Fast-forward button mode:</string>
Expand Down

0 comments on commit 3753c6e

Please sign in to comment.