Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I turn my makeSceneTransitionAnimation to a circle, and not rectangle?

I am currently trying to create a circular transition between my FAB and another Activity.

From what I understodd in the documentation, I should use makeSceneTransitionAnimation in a similar way to this:

public void onFabClicked(View v){
    try {
        Intent intent = new Intent(this, SearchActivity.class);
        ActivityOptions options = ActivityOptions
                .makeSceneTransitionAnimation(this, v, "reveal");
        startActivity(intent, options.toBundle());
    } catch (Exception e) {
        // makeSceneTransitionAnimation not supported, maybe a check of SDK level is enough to avoid catching an error?
        Intent intent = new Intent(this, SearchActivity.class);
        startActivity(intent);
        e.printStackTrace();
    }
}

Unfortunately, the current animation displays a rectangle during the animation.

How is it possible to turn this into the beautiful circular reveal that we love in Lollipop?

Thanks.

EDIT:

I am trying to achieve this (except that the color should be fullscreen, but you got the point..)): enter image description here

What I actually get:

enter image description here

like image 284
Waza_Be Avatar asked Oct 20 '22 16:10

Waza_Be


1 Answers

OK, I used this as an example: it's working fine:

Code on Github from saulmm

But.... Yes, that's simple and works fine, but this is not really the most efficient way to achieve the effect, I guess. Adding an extra view to your layout and playing with visibility is maybe not the optimal way.

It had a lot of trouble implemented George Mount's solution. But as this solution is written by a Software Engineer at Google, working in the Android UI Toolkit team, and suggested by Alex, an other Google engineer, I guess that I should spend more time with it as it doesn't require an extra view in my layout...

The second one is a little bit harder for me, but will work on it.

In any way, the problem is solved.

like image 118
Waza_Be Avatar answered Oct 31 '22 17:10

Waza_Be