Skip to content

Commit

Permalink
sheduling stop instead of running directly
Browse files Browse the repository at this point in the history
  • Loading branch information
Shchvova committed Nov 12, 2023
1 parent a6f206d commit a774cdc
Showing 1 changed file with 19 additions and 11 deletions.
30 changes: 19 additions & 11 deletions platform/android/sdk/src/com/ansca/corona/Controller.java
Original file line number Diff line number Diff line change
Expand Up @@ -277,19 +277,27 @@ public synchronized void start() {
}

public synchronized void stop() {
stopTimer();
mySensorManager.pause();
if (myRuntimeState == RuntimeState.Starting || myRuntimeState == RuntimeState.Stopped) {
myRuntimeState = RuntimeState.Stopped;
} else {
myRuntimeState = RuntimeState.Stopping;
}
Handler handler = getHandler();
if(handler != null) {
handler.post(new Runnable() {
@Override
public void run() {
stopTimer();
mySensorManager.pause();
if (myRuntimeState == RuntimeState.Starting || myRuntimeState == RuntimeState.Stopped) {
myRuntimeState = RuntimeState.Stopped;
} else {
myRuntimeState = RuntimeState.Stopping;
}

// If we don't do this then there won't be one last onDrawFrame call which means the runtime won't be stopped!
requestEventRender();
// If we don't do this then there won't be one last onDrawFrame call which means the runtime won't be stopped!
requestEventRender();

myMediaManager.pauseAll();
internalSetIdleTimer(true);
myMediaManager.pauseAll();
internalSetIdleTimer(true);
}
});
}
}

public synchronized void destroy() {
Expand Down

0 comments on commit a774cdc

Please sign in to comment.