Summary: | [Android] The softKeyboard should notify when it gets hidden with the Back button | ||
---|---|---|---|
Product: | [JogAmp] Newt | Reporter: | Eric Brayet <ericb> |
Component: | core | Assignee: | Sven Gothel <sgothel> |
Status: | RESOLVED FIXED | ||
Severity: | normal | ||
Priority: | --- | ||
Version: | 1 | ||
Hardware: | embedded_arm | ||
OS: | other | ||
Type: | --- | SCM Refs: |
3a4892c43be4a9dabba73d42175c2cfa39bd6d8d
|
Workaround: | --- |
Description
Eric Brayet
2013-01-28 13:08:40 CET
I sent a pull request for this issue: https://github.com/sgothel/jogl/pull/57 Instead of adding another listener, we shall feed the special menu bar events to the translator to generate NEWT key event as follows: Android.BACK: if( soft keyboard is up ) [1] return NEWT.VK_KEYBOARD_INVISIBLE; else [2] call WindowImpl.windowDestroyNotify(false) [1] will allow the app to be notified that the soft keyboard got invisible [2] will allow the user to utilize WindowClosingProtocol to decide whether real destruction is desired. However, the windowDestroyNotified(..) will always tell the app that such request has been made. <http://jogamp.org/git/?p=jogl.git;a=commit;h=2f63a43fd6ff9964251c43e248c51bc821f3ecbd> (In reply to comment #2) > [2] will allow the user to utilize WindowClosingProtocol to decide whether > real destruction is desired. However, the windowDestroyNotified(..) > will always tell the app that such request has been made. Note that our override of 'boolean View::dispatchKeyEventPreIme(KeyEvent event) {..}' must return TRUE here to ensure we have handled the event.. http://jogamp.org/git/?p=jogl.git;a=commit;h=3a4892c43be4a9dabba73d42175c2cfa39bd6d8d Fix Bug 677: NEWT/Android: Add support for Android's KeyEvent.KEYCODE_BACK Original author: Eric Brayet <ericb@daysofwonder.com> Revised by: Sven Gothel <sgothel@jausoft.com> I took the freedom to cleanup the three original patches from https://github.com/Pooouf/jogl.git branch 'bug_677': - 7449d4726633d524a3bb79efffd04cfd0ca25e58 (removed by followup patch!) - 68c739a4f03e46deecdbb71c125b4586aec08d63 (removes previous patch!) - c2813dfc325a1482d18b6fc304e4e483f5633964 Further more I was able to reduce the 'extra' code while utilizing - Window's isKeyboardVisible() and using keyboardVisibilityChanged(false) to update the hidden keyboard state. - Moving the key-handling code to the containing WindowDriver class avoiding passing a reference to the inner view. - Using AndroidNewtEventFactory for NEWT KeyEvent creation +++ - Handle KeyEvent.KEYCODE_BACK w/ jogamp.newt.driver.android.WindowDriver.MSurfaceView.onKeyPreIme(..): if( soft keyboard is up ) [1] Update keyboard visibility state and return NEWT KeyEvent.VK_KEYBOARD_INVISIBLE; else [2] call WindowImpl.windowDestroyNotify(true) [3] then cont. processing, i.e. return false; - Turns out respecting WindowClosingMode might be - too complicated - interfere w/ Android UI behavior - AndroidNewtEventFactory - createKeyEvent - static - adding boolean param 'inclSysKeys', if true, KEYCODE_BACK and KEYCODE_HOME are mapped |