File tree Expand file tree Collapse file tree 1 file changed +13
-6
lines changed
core/platform/android/java/src/org/cocos2dx/lib Expand file tree Collapse file tree 1 file changed +13
-6
lines changed Original file line number Diff line number Diff line change @@ -171,8 +171,9 @@ protected void onResume() {
171
171
Log .d (TAG , "onResume()" );
172
172
paused = false ;
173
173
super .onResume ();
174
- this .hideVirtualButton ();
175
- resumeIfHasFocus ();
174
+ if (this .hasFocus ) {
175
+ resume ();
176
+ }
176
177
}
177
178
178
179
@ Override
@@ -181,7 +182,15 @@ public void onWindowFocusChanged(boolean hasFocus) {
181
182
super .onWindowFocusChanged (hasFocus );
182
183
183
184
this .hasFocus = hasFocus ;
184
- resumeIfHasFocus ();
185
+ if (this .hasFocus && !paused ) {
186
+ resume ();
187
+ }
188
+ }
189
+
190
+ private void resume () {
191
+ this .hideVirtualButton ();
192
+ Cocos2dxHelper .onResume ();
193
+ mGLSurfaceView .onResume ();
185
194
}
186
195
187
196
private void resumeIfHasFocus () {
@@ -190,9 +199,7 @@ private void resumeIfHasFocus() {
190
199
boolean readyToPlay = !isDeviceLocked () && !isDeviceAsleep ();
191
200
192
201
if (hasFocus && readyToPlay ) {
193
- this .hideVirtualButton ();
194
- Cocos2dxHelper .onResume ();
195
- mGLSurfaceView .onResume ();
202
+ resume ();
196
203
}
197
204
}
198
205
You can’t perform that action at this time.
0 commit comments