Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(android): splash open animation sometimes stutters on cold start #11139

Merged
merged 3 commits into from
Aug 20, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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