diff --git a/apps/keymaps/keymap-android.c b/apps/keymaps/keymap-android.c index c822a64fc2..b7b93ac1f0 100644 --- a/apps/keymaps/keymap-android.c +++ b/apps/keymaps/keymap-android.c @@ -60,11 +60,21 @@ static const struct button_mapping button_context_wps[] = { { ACTION_WPS_BROWSE, BUTTON_BACK, BUTTON_NONE }, { ACTION_WPS_MENU, BUTTON_MENU|BUTTON_REL, BUTTON_MENU }, { ACTION_WPS_CONTEXT, BUTTON_MENU|BUTTON_REPEAT, BUTTON_MENU }, - + { ACTION_WPS_VOLUP, BUTTON_VOL_UP, BUTTON_NONE }, + { ACTION_WPS_VOLUP, BUTTON_VOL_UP|BUTTON_REPEAT, BUTTON_NONE }, + { ACTION_WPS_VOLDOWN, BUTTON_VOL_DOWN, BUTTON_NONE }, + { ACTION_WPS_VOLDOWN, BUTTON_VOL_DOWN|BUTTON_REPEAT, BUTTON_NONE }, + LAST_ITEM_IN_LIST }; /* button_context_wps */ static const struct button_mapping button_context_list[] = { +#ifdef HAVE_VOLUME_IN_LIST + { ACTION_LIST_VOLUP, BUTTON_VOL_UP|BUTTON_REPEAT, BUTTON_NONE }, + { ACTION_LIST_VOLUP, BUTTON_VOL_UP, BUTTON_NONE }, + { ACTION_LIST_VOLDOWN, BUTTON_VOL_DOWN, BUTTON_NONE }, + { ACTION_LIST_VOLDOWN, BUTTON_VOL_DOWN|BUTTON_REPEAT, BUTTON_NONE }, +#endif LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD) }; /* button_context_list */ diff --git a/firmware/export/config/android.h b/firmware/export/config/android.h index c9ae8ba191..ed1a283c7d 100644 --- a/firmware/export/config/android.h +++ b/firmware/export/config/android.h @@ -76,6 +76,9 @@ #define HAVE_MULTIMEDIA_KEYS #define CONFIG_KEYPAD ANDROID_PAD +/* define this if the target has volume keys which can be used in the lists */ +#define HAVE_VOLUME_IN_LIST + #define HAVE_SW_TONE_CONTROLS /* Define current usage levels. */ diff --git a/firmware/target/hosted/android/app/button-application.c b/firmware/target/hosted/android/app/button-application.c index 1586183f6f..65aff1a1a9 100644 --- a/firmware/target/hosted/android/app/button-application.c +++ b/firmware/target/hosted/android/app/button-application.c @@ -39,6 +39,10 @@ int key_to_button(int keyboard_key) return BUTTON_MENU; case KEYCODE_DPAD_CENTER: return BUTTON_DPAD_CENTER; + case KEYCODE_VOLUME_UP: + return BUTTON_VOL_UP; + case KEYCODE_VOLUME_DOWN: + return BUTTON_VOL_DOWN; default: return BUTTON_NONE; } diff --git a/firmware/target/hosted/android/app/button-target.h b/firmware/target/hosted/android/app/button-target.h index 3b6028739c..b532c94f47 100644 --- a/firmware/target/hosted/android/app/button-target.h +++ b/firmware/target/hosted/android/app/button-target.h @@ -40,6 +40,8 @@ void android_ignore_back_button(bool yes); #define BUTTON_DPAD_UP 0x00000010 #define BUTTON_DPAD_DOWN 0x00000020 #define BUTTON_DPAD_CENTER 0x00000040 +#define BUTTON_VOL_UP 0x00000080 +#define BUTTON_VOL_DOWN 0x00000100 /* Compatibility hacks for flipping. Needs a somewhat better fix. */ #define BUTTON_LEFT BUTTON_DPAD_LEFT