Let chooser interface handle skipping rather than native

This commit is contained in:
Aaron Culliney 2015-09-13 11:23:59 -07:00
parent 104c0bbe6e
commit c8d7f9cba3
4 changed files with 35 additions and 10 deletions

View File

@ -17,6 +17,7 @@ import android.util.Log;
import android.view.LayoutInflater;
import android.view.MotionEvent;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;
import java.util.ArrayList;
@ -62,7 +63,7 @@ public class Apple2KeypadChooser implements Apple2MenuView {
mChooserState.setValues(mActivity, ascii, scancode);
Apple2Preferences.nativeSetCurrentTouchDevice(Apple2Preferences.TouchDeviceVariant.JOYSTICK_KEYPAD.ordinal());
mCurrentChoicePrompt.setText(getNextChoiceString() + asciiStr);
switch(mChooserState) {
switch (mChooserState) {
case CHOOSE_TAP:
mActivity.nativeOnTouch(MotionEvent.ACTION_DOWN, 1, 0, new float[]{400.f}, new float[]{400.f});
mActivity.nativeOnTouch(MotionEvent.ACTION_UP, 1, 0, new float[]{400.f}, new float[]{400.f});
@ -135,6 +136,14 @@ public class Apple2KeypadChooser implements Apple2MenuView {
mCurrentChoicePrompt = (TextView) mSettingsView.findViewById(R.id.currentChoicePrompt);
mCurrentChoicePrompt.setText(getNextChoiceString());
Button skipButton = (Button) mSettingsView.findViewById(R.id.skipButton);
skipButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Apple2KeypadChooser.this.onKeyTapCalibrationEvent((char)Apple2KeyboardSettingsMenu.ICONTEXT_NONACTION, -1);
}
});
// temporarily undo these native touch settings while calibrating...
mTouchMenuEnabled = Apple2Preferences.TOUCH_MENU_ENABLED.booleanValue(mActivity);
Apple2Preferences.nativeSetTouchMenuEnabled(false);

View File

@ -2,21 +2,36 @@
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="0dp"
android:layout_marginStart="0dp"
android:layout_marginRight="0dp"
android:layout_marginEnd="0dp"
android:layout_marginTop="0dp"
android:layout_marginBottom="0dp"
android:layout_marginEnd="0dp"
android:layout_marginLeft="0dp"
android:layout_marginRight="0dp"
android:layout_marginStart="0dp"
android:layout_marginTop="0dp"
android:layout_weight="1"
android:background="#00ff0000">
<TextView
android:id="@+id/currentChoicePrompt"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/keypad_choose_current"
android:id="@+id/currentChoicePrompt"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true" />
android:layout_alignParentStart="true"
android:layout_marginLeft="@dimen/preference_margin_left"
android:layout_marginStart="@dimen/preference_margin_left"
android:layout_marginTop="@dimen/preference_margin_top"
android:text="@string/keypad_choose_current" />
<Button
android:id="@+id/skipButton"
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/skip" />
</RelativeLayout>

View File

@ -145,6 +145,7 @@
<string name="reboot_really">Reboot emulator?</string>
<string name="reboot_summary"></string>
<string name="reboot_warning">You will lose unsaved progress</string>
<string name="skip">Skip&#8594;</string>
<string name="spacer"></string>
<string name="speaker_disabled_title">Speaker disabled</string>
<string name="speaker_disabled_mesg">Speaker could not be enabled</string>

View File

@ -309,7 +309,7 @@ static inline int64_t _tap_key_at_point(float x, float y) {
case ICONTEXT_NONACTIONABLE:
scancode = 0;
handled = isCalibrating;
handled = false;
break;
case ICONTEXT_CTRL: