(Android) Implement all back behaviors

This commit is contained in:
twinaphex 2013-11-26 13:41:33 +01:00
parent ab735cb307
commit a7b34ec794
4 changed files with 21 additions and 1 deletions

View File

@ -1698,7 +1698,23 @@ static void android_input_poll(void *data)
&& input_state > 0)
{
}
else if (android->onBackPressed)
else if (g_settings.input.back_behavior == BACK_BUTTON_QUIT)
{
*lifecycle_state |= (1ULL << RARCH_QUIT_KEY);
AInputQueue_finishEvent(android_app->inputQueue, event, handled);
break;
}
else if (g_settings.input.back_behavior == BACK_BUTTON_GUI_TOGGLE)
{
int action = AKeyEvent_getAction(event);
if (action == AKEY_EVENT_ACTION_DOWN)
*lifecycle_state |= (1ULL << RARCH_MENU_TOGGLE);
else if (action == AKEY_EVENT_ACTION_UP)
*lifecycle_state &= ~(1ULL << RARCH_MENU_TOGGLE);
AInputQueue_finishEvent(android_app->inputQueue, event, handled);
break;
}
else if (android->onBackPressed && g_settings.input.back_behavior == BACK_BUTTON_MENU_TOGGLE)
{
RARCH_LOG("Invoke onBackPressed through JNI.\n");
JNIEnv *env = jni_thread_getenv();

View File

@ -2,12 +2,14 @@
<resources>
<string-array name="back_options" translatable="false">
<item>@string/quit</item>
<item>@string/gui_toggle</item>
<item>@string/menu_toggle</item>
</string-array>
<string-array name="back_options_values" translatable="false">
<item>0</item>
<item>1</item>
<item>2</item>
</string-array>
<string-array name="audio_latency_options" translatable="false">

View File

@ -85,6 +85,7 @@
<!-- Back Options -->
<string name="quit">Quit</string>
<string name="gui_toggle">GUI toggle</string>
<string name="menu_toggle">Menu toggle</string>
<!-- Audio Settings -->

View File

@ -54,6 +54,7 @@ bool input_translate_coord_viewport(int mouse_x, int mouse_y,
enum back_button_enums
{
BACK_BUTTON_QUIT = 0,
BACK_BUTTON_GUI_TOGGLE,
BACK_BUTTON_MENU_TOGGLE,
};
#endif