Skip to content

Commit

Permalink
Merge pull request #5378 from hieupham007/timob-16279
Browse files Browse the repository at this point in the history
[TIMOB-16279] convert life cycle sync events to async
  • Loading branch information
ayeung committed Mar 13, 2014
2 parents d8a1cf6 + 9c6c512 commit 2cef37e
Showing 1 changed file with 8 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -529,8 +529,7 @@ protected void onCreate(Bundle savedInstanceState)
windowCreated();

if (activityProxy != null) {
// Fire the sync event with a timeout, so the main thread won't be blocked too long to get an ANR. (TIMOB-13253)
activityProxy.fireSyncEvent(TiC.EVENT_CREATE, null, 4000);
activityProxy.fireEvent(TiC.EVENT_CREATE, null);
}

// set the current activity back to what it was originally
Expand Down Expand Up @@ -973,7 +972,7 @@ protected void onPause()
}

if (activityProxy != null) {
activityProxy.fireSyncEvent(TiC.EVENT_PAUSE, null);
activityProxy.fireEvent(TiC.EVENT_PAUSE, null);
}

synchronized (lifecycleListeners.synchronizedList()) {
Expand Down Expand Up @@ -1024,8 +1023,7 @@ protected void onResume()
TiApplication.updateActivityTransitionState(false);

if (activityProxy != null) {
// Fire the sync event with a timeout, so the main thread won't be blocked too long to get an ANR. (TIMOB-13253)
activityProxy.fireSyncEvent(TiC.EVENT_RESUME, null, 4000);
activityProxy.fireEvent(TiC.EVENT_RESUME, null);
}

synchronized (lifecycleListeners.synchronizedList()) {
Expand Down Expand Up @@ -1084,8 +1082,7 @@ protected void onStart()
Activity tempCurrentActivity = tiApp.getCurrentActivity();
tiApp.setCurrentActivity(this, this);

// Fire the sync event with a timeout, so the main thread won't be blocked too long to get an ANR. (TIMOB-13253)
activityProxy.fireSyncEvent(TiC.EVENT_START, null, 4000);
activityProxy.fireEvent(TiC.EVENT_START, null);

// set the current activity back to what it was originally
tiApp.setCurrentActivity(this, tempCurrentActivity);
Expand Down Expand Up @@ -1126,7 +1123,7 @@ protected void onStop()
}

if (activityProxy != null) {
activityProxy.fireSyncEvent(TiC.EVENT_STOP, null);
activityProxy.fireEvent(TiC.EVENT_STOP, null);
}

synchronized (lifecycleListeners.synchronizedList()) {
Expand Down Expand Up @@ -1170,7 +1167,7 @@ protected void onRestart()
Activity tempCurrentActivity = tiApp.getCurrentActivity();
tiApp.setCurrentActivity(this, this);

activityProxy.fireSyncEvent(TiC.EVENT_RESTART, null);
activityProxy.fireEvent(TiC.EVENT_RESTART, null);

// set the current activity back to what it was originally
tiApp.setCurrentActivity(this, tempCurrentActivity);
Expand All @@ -1194,7 +1191,7 @@ protected void onUserLeaveHint()
}

if (activityProxy != null) {
activityProxy.fireSyncEvent(TiC.EVENT_USER_LEAVE_HINT, null);
activityProxy.fireEvent(TiC.EVENT_USER_LEAVE_HINT, null);
}

super.onUserLeaveHint();
Expand Down Expand Up @@ -1312,7 +1309,7 @@ protected void fireOnDestroy()
{
if (!onDestroyFired) {
if (activityProxy != null) {
activityProxy.fireSyncEvent(TiC.EVENT_DESTROY, null);
activityProxy.fireEvent(TiC.EVENT_DESTROY, null);
}
onDestroyFired = true;
}
Expand Down

0 comments on commit 2cef37e

Please sign in to comment.