[Feature request] Option to change 'openApp' transition
Currently the app opened with openApp method slides in. It will be great to provide functionality to customize this transition somehow - for example, make opened app scale up.
Also trying to figure out how to do that..
Normally overridePendingTransition is used on Android, but I dont know yet how it applies to flutter.
@cgestes I've also tried to implement this solution, but it didn't work either... Currently I'm stuck with disabling any animation at all, which is clumsy, but still better than standard slide-in transition in my opinion.
I did use overridePendingTransition with success.
Opening: I call it just after startActivity Coming back from the launched app: I call it in onResume
Took me a long time to figure it out!
@cgestes And what animation did you passed there? And where it was stored?
I did:
overridePendingTransition(android.R.anim.fade_in, android.R.anim.fade_out);
@cgestes
Sounds great!
But in my case console complains that it can't resolve method overridePendingTransition. Maybe I miss some imports?
It seems to be a method of the Activity android java class.
@cgestes
Well, seems I already had this imported in the file..

Maybe you forgot to mention some extra steps that you did to make it work?
@cgestes Well, seems I already had this imported in the file..
Maybe you forgot to mention some extra steps that you did to make it work?
Little bit late with a reply to this, but I did the following and the animations changed as per the overridePendingTransitions value.
Import the following
import android.app.Activity;
import android.app.ActivityOptions;
Amend the openApp to the following
private boolean openApp(@NonNull String packageName) {
if (!isAppInstalled(packageName)) {
Log.w(LOG_TAG, "Application with package name \"" + packageName + "\" is not installed on this device");
return false;
}
Intent launchIntent = context.getPackageManager().getLaunchIntentForPackage(packageName);
if (IntentUtils.isIntentOpenable(launchIntent, context)) {
ActivityOptions options =
ActivityOptions.makeCustomAnimation(context, android.R.anim.fade_in, android.R.anim.fade_out);
context.startActivity(launchIntent, options.toBundle());
return true;
}
return false;
}
When testing the animation now fades in on launching another application.
I've found a bit of a hack to be able to get the clipRevealAnimation to work, by passing the data of the scale, height and width down to the function, it works with the animation, but the offset on the screen doesn't always match up to where the onPress is being generated (in my case below I always want it to render from the middle of the screen, but the Y axis offset sometimes is a bit off when passing down the renderBox offset.
private boolean openApp(@NonNull String packageName, int startX, int startY, int height, int width) {
if (!isAppInstalled(packageName)) {
Log.w(LOG_TAG, "Application with package name \"" + packageName + "\" is not installed on this device");
return false;
}
Intent launchIntent = context.getPackageManager().getLaunchIntentForPackage(packageName);
if (IntentUtils.isIntentOpenable(launchIntent, context)) {
View view = new View(context);
view.setLayoutParams(new LayoutParams(height, width));
int startingX = width / 2;
int startingY = startY;
ActivityOptions options = ActivityOptions.makeClipRevealAnimation(view, startingX, startingY, 0, 0);
context.startActivity(launchIntent, options.toBundle());
return true;
}
return false;
}
Will see if I can improve this to get it to work as intended, and also as mentioned before getting the reverse animation to work when calling onResume