Skip to content

A simple transition when search mode is on. This app uses android Transitions for smooth animation

Notifications You must be signed in to change notification settings

arnoldlaishram/SearchViewTransition

Repository files navigation

SearchViewTransition

A simple transition when search mode is on. This app uses android Transitions for smooth animation

It basically consist of 2 layouts, main and search view.

To animate from main to search view, use this transition

        TransitionSet transitionSet = new TransitionSet()
                .addTransition(new Fade()
                        .addTarget(R.id.alphaView))
                .addTransition(new TransitionSet() // For Shared element from homeCard to searchCard
                        .addTransition(new ChangeBounds())
                        .addTransition(new ChangeTransform())
                        .addTarget(homeCard)
                        .addTarget(R.id.searchCard));

        TransitionManager.beginDelayedTransition(mainLayout, transitionSet);

        mainLayout.addView(searchLayout);
        homeCardContainer.removeView(homeSearchCard);

And to animate from search view to main, use this transiton

        TransitionSet transitionSet = new TransitionSet()
                .addTransition(new Fade()
                        .addTarget(alphaView))
                .addTransition(new TransitionSet() // For Shared element from searchCard to homeCard
                        .addTransition(new ChangeBounds())
                        .addTransition(new ChangeTransform())
                        .addTarget(R.id.homeCard)
                        .addTarget(searchCard));

        TransitionManager.beginDelayedTransition(mainLayout, transitionSet);

        homeCardContainer.addView(homeCard);
        mainLayout.removeView(searchLayout);

Inspiration

About

A simple transition when search mode is on. This app uses android Transitions for smooth animation

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages