mirror of https://github.com/axmolengine/axmol.git
Merge pull request #637 from rh101/fix-screen-blank
Fix Android screen blank issue after unlocking device
This commit is contained in:
commit
0117dd5c7d
|
@ -171,8 +171,9 @@ public abstract class Cocos2dxActivity extends Activity implements Cocos2dxHelpe
|
||||||
Log.d(TAG, "onResume()");
|
Log.d(TAG, "onResume()");
|
||||||
paused = false;
|
paused = false;
|
||||||
super.onResume();
|
super.onResume();
|
||||||
this.hideVirtualButton();
|
if (this.hasFocus) {
|
||||||
resumeIfHasFocus();
|
resume();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -181,7 +182,15 @@ public abstract class Cocos2dxActivity extends Activity implements Cocos2dxHelpe
|
||||||
super.onWindowFocusChanged(hasFocus);
|
super.onWindowFocusChanged(hasFocus);
|
||||||
|
|
||||||
this.hasFocus = hasFocus;
|
this.hasFocus = hasFocus;
|
||||||
resumeIfHasFocus();
|
if (this.hasFocus && !paused) {
|
||||||
|
resume();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void resume() {
|
||||||
|
this.hideVirtualButton();
|
||||||
|
Cocos2dxHelper.onResume();
|
||||||
|
mGLSurfaceView.onResume();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void resumeIfHasFocus() {
|
private void resumeIfHasFocus() {
|
||||||
|
@ -190,9 +199,7 @@ public abstract class Cocos2dxActivity extends Activity implements Cocos2dxHelpe
|
||||||
boolean readyToPlay = !isDeviceLocked() && !isDeviceAsleep();
|
boolean readyToPlay = !isDeviceLocked() && !isDeviceAsleep();
|
||||||
|
|
||||||
if(hasFocus && readyToPlay) {
|
if(hasFocus && readyToPlay) {
|
||||||
this.hideVirtualButton();
|
resume();
|
||||||
Cocos2dxHelper.onResume();
|
|
||||||
mGLSurfaceView.onResume();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue