Android: Exit emulation by long pressing Back
This commit is contained in:
parent
a03f40ab15
commit
1fdabc7481
|
@ -375,6 +375,18 @@ public final class EmulationActivity extends AppCompatActivity
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean onKeyLongPress(int keyCode, @NonNull KeyEvent event)
|
||||||
|
{
|
||||||
|
if (keyCode == KeyEvent.KEYCODE_BACK)
|
||||||
|
{
|
||||||
|
mEmulationFragment.stopEmulation();
|
||||||
|
finish();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return super.onKeyLongPress(keyCode, event);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onActivityResult(int requestCode, int resultCode, Intent result)
|
protected void onActivityResult(int requestCode, int resultCode, Intent result)
|
||||||
{
|
{
|
||||||
|
@ -697,7 +709,7 @@ public final class EmulationActivity extends AppCompatActivity
|
||||||
@Override
|
@Override
|
||||||
public boolean dispatchKeyEvent(KeyEvent event)
|
public boolean dispatchKeyEvent(KeyEvent event)
|
||||||
{
|
{
|
||||||
if (mMenuVisible)
|
if (mMenuVisible || event.getKeyCode() == KeyEvent.KEYCODE_BACK)
|
||||||
{
|
{
|
||||||
return super.dispatchKeyEvent(event);
|
return super.dispatchKeyEvent(event);
|
||||||
}
|
}
|
||||||
|
@ -707,14 +719,6 @@ public final class EmulationActivity extends AppCompatActivity
|
||||||
switch (event.getAction())
|
switch (event.getAction())
|
||||||
{
|
{
|
||||||
case KeyEvent.ACTION_DOWN:
|
case KeyEvent.ACTION_DOWN:
|
||||||
// Handling the case where the back button is pressed.
|
|
||||||
if (event.getKeyCode() == KeyEvent.KEYCODE_BACK)
|
|
||||||
{
|
|
||||||
onBackPressed();
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Normal key events.
|
|
||||||
action = NativeLibrary.ButtonState.PRESSED;
|
action = NativeLibrary.ButtonState.PRESSED;
|
||||||
break;
|
break;
|
||||||
case KeyEvent.ACTION_UP:
|
case KeyEvent.ACTION_UP:
|
||||||
|
|
|
@ -355,7 +355,7 @@
|
||||||
<string name="emulation_control_joystick_rel_center">Relative Stick Center</string>
|
<string name="emulation_control_joystick_rel_center">Relative Stick Center</string>
|
||||||
<string name="emulation_control_rumble">Rumble</string>
|
<string name="emulation_control_rumble">Rumble</string>
|
||||||
<string name="emulation_choose_controller">Choose Controller</string>
|
<string name="emulation_choose_controller">Choose Controller</string>
|
||||||
<string name="emulation_menu_help">Press Back to access the menu.</string>
|
<string name="emulation_menu_help">Press Back to access the menu.\nLong press Back to exit emulation.</string>
|
||||||
<string name="emulation_touch_overlay_reset">Reset Overlay</string>
|
<string name="emulation_touch_overlay_reset">Reset Overlay</string>
|
||||||
<string name="emulation_ir_group">Touch IR Pointer</string>
|
<string name="emulation_ir_group">Touch IR Pointer</string>
|
||||||
<string name="emulation_ir_sensitivity">IR Sensitivity</string>
|
<string name="emulation_ir_sensitivity">IR Sensitivity</string>
|
||||||
|
|
Loading…
Reference in New Issue