Add callback before hiding the soft keyboard
This commit is contained in:
@@ -22,6 +22,18 @@ public class SuperTuxKartActivity extends NativeActivity
|
||||
// ------------------------------------------------------------------------
|
||||
private native void saveKeyboardHeight(int height);
|
||||
// ------------------------------------------------------------------------
|
||||
private void hideKeyboardNative()
|
||||
{
|
||||
if (m_stk_edittext == null)
|
||||
return;
|
||||
|
||||
m_stk_edittext.beforeHideKeyboard();
|
||||
|
||||
InputMethodManager imm = (InputMethodManager)
|
||||
getSystemService(Context.INPUT_METHOD_SERVICE);
|
||||
imm.hideSoftInputFromWindow(m_stk_edittext.getWindowToken(), 0);
|
||||
}
|
||||
// ------------------------------------------------------------------------
|
||||
private void hideNavBar(View decor_view)
|
||||
{
|
||||
if (Build.VERSION.SDK_INT < 19)
|
||||
@@ -72,6 +84,13 @@ public class SuperTuxKartActivity extends NativeActivity
|
||||
}
|
||||
// ------------------------------------------------------------------------
|
||||
@Override
|
||||
public void onPause()
|
||||
{
|
||||
super.onPause();
|
||||
hideKeyboardNative();
|
||||
}
|
||||
// ------------------------------------------------------------------------
|
||||
@Override
|
||||
public void onWindowFocusChanged(boolean has_focus)
|
||||
{
|
||||
super.onWindowFocusChanged(has_focus);
|
||||
@@ -142,6 +161,7 @@ public class SuperTuxKartActivity extends NativeActivity
|
||||
});
|
||||
}
|
||||
// ------------------------------------------------------------------------
|
||||
/* Called by STK in JNI. */
|
||||
public void hideKeyboard()
|
||||
{
|
||||
runOnUiThread(new Runnable()
|
||||
@@ -149,16 +169,7 @@ public class SuperTuxKartActivity extends NativeActivity
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
if (m_stk_edittext == null)
|
||||
return;
|
||||
|
||||
m_stk_edittext.clearFocus();
|
||||
m_stk_edittext.setVisibility(View.GONE);
|
||||
|
||||
InputMethodManager imm = (InputMethodManager)
|
||||
getSystemService(Context.INPUT_METHOD_SERVICE);
|
||||
imm.hideSoftInputFromWindow(m_stk_edittext.getWindowToken(),
|
||||
0);
|
||||
hideKeyboardNative();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user