Skip to content

Commit

Permalink
fix(android): splash open animation sometimes stutters on cold start (#…
Browse files Browse the repository at this point in the history
…11140)

Fixed bug where opening a window while splash is in mid-transition causes splash to adopt child window's transition. Causes noticeable stutter.
  * Especially an issue as of Android Q beta 4.
  * Modified so that activity windows launched from splash override pending transition with fade-in transition instead. (Looks better than slide-up animation anyways.)

Fixes TIMOB-27328
  • Loading branch information
jquick-axway authored and sgtcoolguy committed Aug 20, 2019
1 parent c32ee14 commit 74f6e10
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import org.appcelerator.titanium.TiBaseActivity;
import org.appcelerator.titanium.TiBlob;
import org.appcelerator.titanium.TiC;
import org.appcelerator.titanium.TiRootActivity;
import org.appcelerator.titanium.proxy.TiWindowProxy;
import org.appcelerator.titanium.util.TiConvert;
import org.appcelerator.titanium.util.TiUIHelper;
Expand Down Expand Up @@ -388,6 +389,11 @@ protected void handleOpen(KrollDict options)
topActivity.overridePendingTransition(enterAnimation, exitAnimation);
} else {
topActivity.startActivity(intent);
if (topActivity instanceof TiRootActivity) {
// A fade-in transition from root splash screen to first window looks better than a slide-up.
// Also works-around issue where splash in mid-transition might do a 2nd transition on cold start.
topActivity.overridePendingTransition(android.R.anim.fade_in, android.R.anim.fade_out);
}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import org.appcelerator.titanium.TiBaseActivity;
import org.appcelerator.titanium.TiC;
import org.appcelerator.titanium.TiDimension;
import org.appcelerator.titanium.TiRootActivity;
import org.appcelerator.titanium.TiTranslucentActivity;
import org.appcelerator.titanium.proxy.ActivityProxy;
import org.appcelerator.titanium.proxy.TiWindowProxy;
Expand Down Expand Up @@ -56,6 +57,7 @@
import android.view.View;
import android.view.ViewGroup.LayoutParams;
import android.view.Window;

// clang-format off
@Kroll.proxy(creatableInModule = UIModule.class,
propertyAccessors = {
Expand Down Expand Up @@ -168,6 +170,11 @@ protected void handleOpen(KrollDict options)
topActivity.startActivity(intent, createActivityOptionsBundle(topActivity));
} else {
topActivity.startActivity(intent);
if (topActivity instanceof TiRootActivity) {
// A fade-in transition from root splash screen to first window looks better than a slide-up.
// Also works-around issue where splash in mid-transition might do a 2nd transition on cold start.
topActivity.overridePendingTransition(android.R.anim.fade_in, android.R.anim.fade_out);
}
}

if (options.containsKey(TiC.PROPERTY_SUSTAINED_PERFORMANCE_MODE)) {
Expand Down

0 comments on commit 74f6e10

Please sign in to comment.