Improve Android keypad joystick selection routine

- Changes Skip button to not set anything
    - Adds a None button to explicitly choose that
    - Will dismiss selection routine instead of looping
This commit is contained in:
Aaron Culliney 2016-04-18 20:57:12 -07:00
parent 399617e77f
commit 2bf379aad4
2 changed files with 37 additions and 4 deletions

View File

@ -84,14 +84,22 @@ public class Apple2KeypadChooser implements Apple2MenuView {
break;
}
calibrationContinue();
}
private void calibrationContinue() {
final Handler handler = new Handler();
handler.postDelayed(new Runnable() {
@Override
public void run() {
mChooserState = mChooserState.next();
mCurrentChoicePrompt.setText(getNextChoiceString());
Apple2Preferences.setJSONPref(Apple2SettingsMenu.SETTINGS.CURRENT_INPUT, Apple2SettingsMenu.TouchDeviceVariant.KEYBOARD.ordinal());
Apple2Preferences.sync(mActivity, Apple2Preferences.PREF_DOMAIN_TOUCHSCREEN);
if (mChooserState.ordinal() == 0) {
dismiss();
} else {
mCurrentChoicePrompt.setText(getNextChoiceString());
Apple2Preferences.setJSONPref(Apple2SettingsMenu.SETTINGS.CURRENT_INPUT, Apple2SettingsMenu.TouchDeviceVariant.KEYBOARD.ordinal());
Apple2Preferences.sync(mActivity, Apple2Preferences.PREF_DOMAIN_TOUCHSCREEN);
}
}
}, 1000);
}
@ -149,7 +157,17 @@ public class Apple2KeypadChooser implements Apple2MenuView {
skipButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Apple2KeypadChooser.this.onKeyTapCalibrationEvent((char) Apple2KeyboardSettingsMenu.ICONTEXT_NONACTION, -1);
Apple2Preferences.setJSONPref(Apple2SettingsMenu.SETTINGS.CURRENT_INPUT, Apple2SettingsMenu.TouchDeviceVariant.JOYSTICK_KEYPAD.ordinal());
Apple2Preferences.sync(mActivity, Apple2Preferences.PREF_DOMAIN_TOUCHSCREEN);
calibrationContinue();
}
});
Button noneButton = (Button) mSettingsView.findViewById(R.id.noneButton);
noneButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
onKeyTapCalibrationEvent((char) Apple2KeyboardSettingsMenu.ICONTEXT_NONACTION, -1);
}
});

View File

@ -20,11 +20,26 @@
android:layout_marginLeft="@dimen/preference_margin_left"
android:layout_marginStart="@dimen/preference_margin_left"
android:layout_marginTop="@dimen/preference_margin_top"
android:background="@color/white"
android:textColor="@color/black"
android:text="@string/keypad_choose_current" />
<Button
android:id="@+id/noneButton"
style="?android:attr/buttonStyleSmall"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:layout_marginEnd="@dimen/preference_margin_right"
android:layout_marginRight="@dimen/preference_margin_right"
android:layout_marginTop="@dimen/preference_margin_top"
android:text="@string/key_none" />
<Button
android:id="@+id/skipButton"
style="?android:attr/buttonStyleSmall"
android:layout_below="@id/noneButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"