2

I have a custom 3d flip that needs to get the root view to access the two views that are flipped, like this: v.startAnimation(new Flip3D(v));

Then, I have a grid layout with a GridLayoutAnimationController that loads a simple scale animation.

What i'm trying, is to trigger the 3d flip on each child when the layout animation ends.

Is it possible? How can I get the view that has ended the animation to start the 3d animation?

What I tried is to attach an animation listener to the scale animation and count how many times onAnimationEnd gets called. Each time a view of the grid finish the animation I access the grid child at that position to start the 3d flip animation but, it has no effect.

Any idea?

Fernando Gallego
  • 4,064
  • 31
  • 50
  • 1
    if you could publish your flip3d code, I would love that... – Snicolas May 30 '11 at 14:58
  • @Snicolas : if you want a class for Flip3d Animation , i have it , but how i could publish it without anyQuestion or something ,??? @ferdy182 : you can setAnimationListener as Cata said , and on the method onAnimationEnd() , launch your flip3D Animation – Houcine May 30 '11 at 15:20
  • You can share your code on one of the services: http://blogs.sitepoint.com/top-5-places-to-share-code-quickly/ and paste link to snippet here :) – pawelzieba May 30 '11 at 15:31
  • Hi, my 3d flip code is based on this http://goo.gl/nrX1K On the other hand, what I need is a reference to the view that has ended the animation, in order to apply the 3d flip, because I need a reference to the view, to switch between views using the 3d flip, but only when it has ended – Fernando Gallego May 31 '11 at 07:34

1 Answers1

1

I think you can use onAnimationEnd() see here the doc : http://developer.android.com/reference/android/view/View.html#onAnimationEnd%28%29

Here is an example how to use it: android animation is not finished in onAnimationEnd

Something like:

mAnimation.setAnimationListener(new AnimationListener() {
    @Override
    public void onAnimationEnd(Animation arg0) {
                       //Functionality here
    }
Community
  • 1
  • 1
Cata
  • 11,133
  • 11
  • 65
  • 86
  • Hi, I'm already using onAnimationEnd, but it gets called for every cell of the grid view but without a reference to the view that has ended, but, even counting how many times it gets called, I can't start the 3d flip on the result view of the call grid.getChildAt(i) or grid.getAdapter().getView(i,null,null) – Fernando Gallego May 31 '11 at 07:37