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

Demo for starting TWA #88

Closed
markasanchez opened this issue Apr 20, 2020 · 2 comments
Closed

Demo for starting TWA #88

markasanchez opened this issue Apr 20, 2020 · 2 comments

Comments

@markasanchez
Copy link

Hi is it possible to change the start and exit animation of trusted web activity? If yes is there an available demo?

Thank you

@PEConn
Copy link
Collaborator

PEConn commented Apr 20, 2020

It is possible - there's not a nicely available demo though - also it's not something that's particularly polished for developers to do.

What you would do is follow the launchWithCustomReferrer demo, and then on line 66 where you add the Intent.EXTRA_REFERRER extra, you should add the EXTRA_EXIT_ANIMATION_BUNDLE extra for the exit animation and pass the start animation to your call to startActivity. Something like this:

    Bundle startBundle = ActivityOptionsCompat.makeCustomAnimation(
            context, enterResourceId, exitResourceId).toBundle();
    Bundle exitBundle = ActivityOptionsCompat.makeCustomAnimation(
            context, enterResourceId, exitResourceId).toBundle();
    intent.putExtra(EXTRA_EXIT_ANIMATION_BUNDLE, exitBundle);
    startActivity(intent, startBundle);

@markasanchez
Copy link
Author

Thanks @PEConn

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants