Use GridView.setLayoutAnimationListener().

On Mon, Jun 8, 2009 at 4:30 PM, az9702<[email protected]> wrote:
>
> Romain,
>
> Thank you for the suggestion. I just tried but rotation still starts
> before GridView completes.
>
> Correct me if I misunderstand but here is what may happen:
>
> In GridView, a layoutAnimation is used.   This
> LayoutAnimationController in turns specifies animation for each child
> view.
>
> So what I need is an "onAnimationEnd"  for LayoutAnimationController -
> which should be "isDone()"  based on API documentation.
>
> ##--
> I applied  Listener onAnimationEnd as follow:
>
> LayoutAnimationController animControl = mImageView.getLayoutAnimation
> ();
> ...
> Animation anim = animControl.getAnimation() // or getAnimationForView
> (...);
> anim.setAnimationListener(this);
> ,,,
>
> The "anim" here is individual child view, instead of the entire
> GridView whose completion is what I need.
>
> Now if I count how many times onAnimationEnd is called & when count
> reaches my child view count,
> I can apply the 2nd animation. But that amounts to implementing my own
> "isDone()" with hard coded child view count.
>
> ##---------------------------------------------------------------
> In GridView, I specified a layoutAnimation (not android:anim which
> appears in layout_random_fade):
>
> <FrameLayout .../>
>        <GridView
>                android:layoutAnimation="@anim/layout_random_fade"   <--
> android:anim in layout_random_fade
>                android:layout_width="fill_parent"
>                android:layout_height="fill_parent"
>       />
>       <TextView
>        ...
>       />
>
> On Jun 8, 3:17 pm, Romain Guy <[email protected]> wrote:
>> Use a layout animation listener instead.
>>
>>
>>
>> On Mon, Jun 8, 2009 at 3:00 PM, az9702<[email protected]> wrote:
>>
>> > Hi,
>>
>> > I am implementing a two-step animation:
>> > (1) Displaying a set of images using Grid layout (similar to Api Demo
>> > LayoutAmination4)
>> > (2) Upon (1) completion, rotate out Grid layout around Y-axis & rotate
>> > in another layout
>>
>> > Step#2 is similar to Api Demo Rotate3dAnimation but it is triggered w/
>> > o any user input.
>> > As soon as (1) is completed, (2) should occur automatically.
>>
>> > To do that, I use  LayoutAnimationController isDone to detect if all
>> > child views of the grid layout are animated:
>>
>> > ...
>>
>> > LayoutAnimationController animControl = mImageView.getLayoutAnimation
>> > ();
>> > ...
>> >  if(animControl.isDone()) {
>> >                Toast.makeText(this, "Animation Done - start rotation",
>> > 2000).show();
>>
>> >                applyRotation(0.0f, 90.0f);
>> >        }
>>
>> > The above did not work  - rotation always starts before the Grid
>> > layout is completed.
>>
>> > As a workaround, I am using post with a delay - but I want to do w/o
>> > any guess delays.
>> > I also experiemented Animation "hasEnded()" but no effect.
>>
>> > Does anyone have similar experience with the controller ?  Is "IsDone
>> > ()" the correct way to detect the end of the first animation ?
>>
>> > Thanks in advance.
>>
>> > - Simon
>>
>> --
>> Romain Guy
>> Android framework engineer
>> [email protected]
>>
>> Note: please don't send private questions to me, as I don't have time
>> to provide private support.  All such questions should be posted on
>> public forums, where I and others can see and answer them
> >
>



-- 
Romain Guy
Android framework engineer
[email protected]

Note: please don't send private questions to me, as I don't have time
to provide private support.  All such questions should be posted on
public forums, where I and others can see and answer them

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to