diff options
author | Tom Marshall <tdm@cyngn.com> | 2016-02-15 15:36:06 -0800 |
---|---|---|
committer | Tom Marshall <tdm@cyngn.com> | 2016-03-07 15:16:25 -0800 |
commit | 6c20b00105e405823aa3ec12479e52cc30c0df9c (patch) | |
tree | 607a9223c74ea58e8d62bce4874ebc281846c134 /device.cpp | |
parent | d66f66eb72fc72c17d1a292cfbeaf2ec08721327 (diff) | |
download | bootable_recovery-6c20b00105e405823aa3ec12479e52cc30c0df9c.zip bootable_recovery-6c20b00105e405823aa3ec12479e52cc30c0df9c.tar.gz bootable_recovery-6c20b00105e405823aa3ec12479e52cc30c0df9c.tar.bz2 |
recovery: Implement sysbar
Add a system bar (navigation bar) similar to the main Android system
with back and home buttons. This makes it easier for users to figure
out how to go back on devices that lack hardware buttons, and also
provides a quick way to get back to the main menu.
Note only buttons that do not have a hardware equivalent are shown, in
order to prevent redundancy and confusion.
Change-Id: I7538749978837571a8c250c3c8e54ac127b39d84
Diffstat (limited to 'device.cpp')
-rw-r--r-- | device.cpp | 12 |
1 files changed, 10 insertions, 2 deletions
@@ -139,6 +139,12 @@ Device::BuiltinAction Device::InvokeMenuItem(int menu_position) { return entry->action.action; } +void Device::GoHome() { + while (menu_stack.size() > 1) { + menu_stack.pop(); + } +} + int Device::HandleMenuKey(int key, int visible) { if (!visible) { return kNoAction; @@ -164,8 +170,6 @@ int Device::HandleMenuKey(int key, int visible) { case KEY_ENTER: case KEY_POWER: case BTN_MOUSE: - case KEY_HOME: - case KEY_HOMEPAGE: case KEY_SEND: return kInvokeItem; @@ -173,6 +177,10 @@ int Device::HandleMenuKey(int key, int visible) { case KEY_BACK: return kGoBack; + case KEY_HOME: + case KEY_HOMEPAGE: + return kGoHome; + default: // If you have all of the above buttons, any other buttons // are ignored. Otherwise, any button cycles the highlight. |