This commit is contained in:
Neo Kim 2015-08-27 17:10:33 +09:00
parent 30d6c82da6
commit 30d52d1394
1 changed files with 13 additions and 3 deletions

View File

@ -108,6 +108,7 @@ public abstract class Cocos2dxActivity extends Activity implements Cocos2dxHelpe
private Cocos2dxVideoHelper mVideoHelper = null;
private Cocos2dxWebViewHelper mWebViewHelper = null;
private Cocos2dxEditBoxHelper mEditBoxHelper = null;
private boolean hasFocus = false;
public Cocos2dxGLSurfaceView getGLSurfaceView(){
return mGLSurfaceView;
@ -338,21 +339,30 @@ public abstract class Cocos2dxActivity extends Activity implements Cocos2dxHelpe
@Override
protected void onResume() {
Log.d(TAG, "onResume()");
super.onResume();
resumeIfHasFocus();
}
@Override
public void onWindowFocusChanged(boolean hasFocus) {
Log.d(TAG, "onWindowFocusChanged() hasFocus=" + hasFocus);
super.onWindowFocusChanged(hasFocus);
if (hasFocus) {
Cocos2dxHelper.onResume();
mGLSurfaceView.onResume();
this.hasFocus = hasFocus;
resumeIfHasFocus();
}
private void resumeIfHasFocus() {
if(hasFocus) {
Cocos2dxHelper.onResume();
mGLSurfaceView.onResume();
}
}
@Override
protected void onPause() {
Log.d(TAG, "onPause()");
super.onPause();
Cocos2dxHelper.onPause();
mGLSurfaceView.onPause();