Steps to prevent accidentally leaving linked options enabled

This commit is contained in:
TwistedUmbrella 2014-03-25 10:40:24 -04:00
parent f8a18c3abe
commit a1a3d02d2c
3 changed files with 35 additions and 13 deletions

View File

@ -151,7 +151,11 @@ public class GL2JNIActivity extends Activity {
String id = pad.portId[playerNum];
pad.custom[playerNum] = prefs.getBoolean(Gamepad.pref_js_modified + id, false);
pad.compat[playerNum] = prefs.getBoolean(Gamepad.pref_js_compat + id, false);
pad.joystick[playerNum] = prefs.getBoolean(Gamepad.pref_js_separate + id, true);
if (pad.custom[playerNum] || pad.compat[playerNum]) {
pad.joystick[playerNum] = prefs.getBoolean(Gamepad.pref_js_separate + id, false);
} else {
pad.joystick[playerNum] = false;
}
if (!pad.compat[playerNum]) {
if (pad.custom[playerNum]) {
pad.map[playerNum] = pad.setModifiedKeys(id, playerNum, prefs);

View File

@ -162,7 +162,11 @@ public class GL2JNINative extends NativeActivity {
String id = pad.portId[playerNum];
pad.custom[playerNum] = prefs.getBoolean(Gamepad.pref_js_modified + id, false);
pad.compat[playerNum] = prefs.getBoolean(Gamepad.pref_js_compat + id, false);
pad.joystick[playerNum] = prefs.getBoolean(Gamepad.pref_js_separate + id, false);
if (pad.custom[playerNum] || pad.compat[playerNum]) {
pad.joystick[playerNum] = prefs.getBoolean(Gamepad.pref_js_separate + id, false);
} else {
pad.joystick[playerNum] = false;
}
if (InputDevice.getDevice(joy).getName()
.contains(Gamepad.controllers_play)) {
pad.playerNumX.put(joy, playerNum);

View File

@ -93,6 +93,13 @@ public class InputModFragment extends Fragment {
if (b != null) {
playerNum = b.getInt("portNumber", -1);
}
switchJoystickDpadEnabled = (Switch) getView().findViewById(
R.id.switchJoystickDpadEnabled);
switchModifiedLayoutEnabled = (Switch) getView().findViewById(
R.id.switchModifiedLayoutEnabled);
switchCompatibilityEnabled = (Switch) getView().findViewById(
R.id.switchCompatibilityEnabled);
OnCheckedChangeListener joystick_mode = new OnCheckedChangeListener() {
public void onCheckedChanged(CompoundButton buttonView,
@ -102,8 +109,7 @@ public class InputModFragment extends Fragment {
isChecked).commit();
}
};
switchJoystickDpadEnabled = (Switch) getView().findViewById(
R.id.switchJoystickDpadEnabled);
switchJoystickDpadEnabled.setOnCheckedChangeListener(joystick_mode);
OnCheckedChangeListener modified_layout = new OnCheckedChangeListener() {
@ -112,28 +118,36 @@ public class InputModFragment extends Fragment {
mPrefs.edit()
.putBoolean(Gamepad.pref_js_modified + player,
isChecked).commit();
if (isChecked) {
switchJoystickDpadEnabled.setEnabled(true);
} else if (!switchCompatibilityEnabled.isChecked()) {
switchJoystickDpadEnabled.setEnabled(false);
}
}
};
switchModifiedLayoutEnabled = (Switch) getView().findViewById(
R.id.switchModifiedLayoutEnabled);
switchModifiedLayoutEnabled.setOnCheckedChangeListener(modified_layout);
OnCheckedChangeListener compat_mode = new OnCheckedChangeListener() {
public void onCheckedChanged(CompoundButton buttonView,
boolean isChecked) {
if (isChecked) {
selectController();
} else {
mPrefs.edit().remove(Gamepad.pref_pad + player).commit();
}
mPrefs.edit()
.putBoolean(Gamepad.pref_js_compat + player, isChecked)
.commit();
if (isChecked) {
selectController();
switchJoystickDpadEnabled.setEnabled(true);
} else if (!switchCompatibilityEnabled.isChecked()) {
switchJoystickDpadEnabled.setEnabled(false);
}
}
};
switchCompatibilityEnabled = (Switch) getView().findViewById(
R.id.switchCompatibilityEnabled);
switchCompatibilityEnabled.setOnCheckedChangeListener(compat_mode);
if (!switchModifiedLayoutEnabled.isChecked() && !switchCompatibilityEnabled.isChecked()) {
switchJoystickDpadEnabled.setEnabled(false);
}
mKey = new mapKeyCode(getActivity());