mirror of https://github.com/axmolengine/axmol.git
Fix EditBox turning black when soft keyboard hide.
I disable a optimization when users start to type, the resize layout's doLayout event should be stoped. But it has bugs. If we could find reliable soft keyboard show/hide event detection method, we could enable this optimization again.
This commit is contained in:
parent
271ab08b59
commit
b2bf8469f0
|
@ -348,7 +348,6 @@ public abstract class Cocos2dxActivity extends Activity implements Cocos2dxHelpe
|
|||
if (hasFocus) {
|
||||
Cocos2dxHelper.onResume();
|
||||
mGLSurfaceView.onResume();
|
||||
mGLSurfaceView.requestFocus();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -357,7 +356,6 @@ public abstract class Cocos2dxActivity extends Activity implements Cocos2dxHelpe
|
|||
super.onPause();
|
||||
Cocos2dxHelper.onPause();
|
||||
mGLSurfaceView.onPause();
|
||||
mGLSurfaceView.setSoftKeyboardShown(false);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -204,6 +204,7 @@ public class Cocos2dxEditBox extends EditText {
|
|||
switch (pKeyCode) {
|
||||
case KeyEvent.KEYCODE_BACK:
|
||||
Cocos2dxActivity activity = (Cocos2dxActivity)this.getContext();
|
||||
//To prevent program from going to background
|
||||
activity.getGLSurfaceView().requestFocus();
|
||||
return true;
|
||||
default:
|
||||
|
@ -211,6 +212,11 @@ public class Cocos2dxEditBox extends EditText {
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onKeyPreIme(int keyCode, KeyEvent event) {
|
||||
return super.onKeyPreIme(keyCode, event);
|
||||
}
|
||||
|
||||
public void setInputFlag(int inputFlag) {
|
||||
|
||||
switch (inputFlag) {
|
||||
|
|
|
@ -101,7 +101,9 @@ public class Cocos2dxEditBoxHelper {
|
|||
|
||||
@Override
|
||||
public void onTextChanged(final CharSequence s, int start, int before, int count) {
|
||||
mFrameLayout.setEnableForceDoLayout(false);
|
||||
//The optimization can't be turn on due to unknown keyboard hide in some custom keyboard
|
||||
// mFrameLayout.setEnableForceDoLayout(false);
|
||||
|
||||
mCocos2dxActivity.runOnGLThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
|
|
Loading…
Reference in New Issue