+#include <android/input.h>
+#include <msp/graphics/window_private.h>
+#include "keyboard.h"
+#include "keys_private.h"
+
+using namespace std;
+
+namespace Msp {
+namespace Input {
+
+string Keyboard::get_button_name(unsigned btn) const
+{
+ return Device::get_button_name(btn);
+}
+
+void Keyboard::input_event(const Graphics::Window::Event &event)
+{
+ int type = AInputEvent_getType(event.aevent);
+ if(type!=AINPUT_EVENT_TYPE_KEY)
+ return;
+
+ int action = AKeyEvent_getAction(event.aevent);
+ switch(action)
+ {
+ case AKEY_EVENT_ACTION_DOWN:
+ case AKEY_EVENT_ACTION_UP:
+ if(unsigned key = key_from_sys(AKeyEvent_getKeyCode(event.aevent)))
+ set_button_state(key, action==AKEY_EVENT_ACTION_DOWN, true);
+ break;
+ default:;
+ }
+}
+
+} // namespace Input
+} // namespace Msp