i put a bit of a hack into my version as follows;
i added virtual void ComponentPeer::textInputNotRequired(); and then implemented this in juce_android_Windowing.cpp
right now i'm triggering this from the Label
- Code: Select all
void Label::editorAboutToBeHidden (TextEditor*)
{
ComponentPeer* const peer = getPeer();
if (peer)
peer->textInputNotRequired();
}
probably not the ideal place, but it gets there.
here's also the code to do the soft keyboard,
juce_android_Windowing.cpp:
- Code: Select all
void textInputRequired (const Point<int>& position)
{
view.callVoidMethod (ComponentPeerView.showKeyboard, true);
}
void textInputNotRequired ()
{
view.callVoidMethod (ComponentPeerView.showKeyboard, false);
}
void dismissPendingTextInput()
{
view.callVoidMethod (ComponentPeerView.showKeyboard, false);
}
Java activity,
- Code: Select all
import android.view.inputmethod.InputMethodManager;
public void showKeyboard(boolean v)
{
InputMethodManager imm = (InputMethodManager)getSystemService(Context.INPUT_METHOD_SERVICE);
if (v)
imm.showSoftInput(this, InputMethodManager.SHOW_FORCED);
else
imm.hideSoftInputFromWindow(getWindowToken(), 0);
}
There are probably many problems left with this. firstly, forcing the keyboard on and off is probably not the best way and secondly, i'm not yet checking for the existence of a real keyboard.
also, it's still wobbly. the keyboard can keep popping up and down if you've got a panel with several entry boxes. not ideal.
-- hugh.
