For anyone else interested, I have now found the solution.

While I'm still improving my solution the problem was that the old
child was placed in mDisappearingChildren and was therefor painted by
the main view even after I thought it was removed.


Send me a message if you have a similar problem and like to get more
details.


Regards,

//Erik

On Sep 1, 11:00 pm, Erik Calissendorff <[EMAIL PROTECTED]>
wrote:
> Hi again Romain and thanks for your quick responses,
>
> Let me try to explain the setup further:
>
> I have a rootView which contains a few ViewGroups. When an item is
> dragged it is removed from the ViewGroup which it originally belonged
> to and added to the rootView instead, the dragged item is then what is
> called the mEditView in my code. When the dragged item is released it
> is added to the ViewGroup which it is currently positioned over or if
> not accepted there returned to it's original location and ViewGroup.
>
> As long as the item is dragged around the rootView.getChildSta... is
> responsible for drawing it in the right place, this is acheived with
> the help class of mEditTransformationHelper which enables some simple
> animation of the movements. By implementing this simple form of
> private animation I can at any time locate where the View is drawn,
> which I need to know when the dragged item is released.
>
> The tricky part is when the view gets released, it then is removed
> from the rootView and reinserted into one of the ViewGroups. My custom
> animation is responsible for smoothly moving the dragged view from the
> drop location to the actual location that it is assigned to (currently
> using a grid layout so some adjustment will be made from the actual
> drop location). The custom animation is given the absolute location of
> the dragged view before it is removed from the rootView. Once the
> animation is initiated it will recalculate the coordinates to
> correspond with the new assigned location of the view, this works
> really well with the exception following.
>
> The problem is that if the dragged view is partially (or even fully)
> over another ViewGroup than the one it will be assigned to after the
> drop, that other ViewGroup is not invalidated and the part of the view
> that was visible over the other ViewGroup will remain visible while
> and after the animation is finished.
>
> The question is therefor how I can ensure that either the entire
> rootView is invalidated (during animation) or which other approach
> that could be advised.
>
> Below are the relevant code snippets from the key functions and
> classes:
>
>         rootView.getChildStaticTransformation(View child, Transformation t) {
>                 [...]
>                 if(child == this.mEditView)     {
>                         Transformation tr=new Transformation();
>                         tr.set(this.mEditTransformation);
>                         [...]
>                         //Update the tr transformation
>                         this.mEditTransformationHelper.apply(tr);
>                         this.invalidate();
>                         [...]
>                         t.compose(tr);
>                         this.mEditTransformation.set(t);
>                         returnValue=true;
>                 }
>                 [...]
>         }
>
>         customAnimation.applyTransformation(float interpolatedTime,
> Transformation t) {
>                 super.applyTransformation(interpolatedTime, t);
>                 Misc.updateTransformation(t,this.mWork,interpolatedTime,true);
>         }
>
>         mEditTransactionHelper.apply(Transformation source)
>         {
>                 [...]
>                 for(...)
>                 {
>                         [...]
>                         //Update the source transformation
>
> Misc.updateTransformation(source,tr.mTargetTransformation,completed);
>                         [...]
>                 }
>         }
>
>         Misc.updateTransformation(Transformation source,Transformation
> target,float progress,boolean reverse)
>         {
>                 [...]
>                 if(target.getTransformationType() == Transformation.TYPE_BOTH 
> ||
> target.getTransformationType() == Transformation.TYPE_MATRIX)
>                 {
>                         [...]
>                         float [] sourceMatrix=new float[9];
>                         source.getMatrix().getValues(sourceMatrix);
>
>                         float[] targetMatrix=new float[9];
>                         target.getMatrix().getValues(targetMatrix);
>
>                         for(int i=0;i<9;i++)
>                         {
>                                 
> sourceMatrix[i]=sourceMatrix[i]+(targetMatrix[i]-
> sourceMatrix[i])*progress;
>                         }
>
>                         source.getMatrix().setValues(sourceMatrix);
>                         [...]
>                 }
>         }
>
> On Sep 1, 9:50 pm, "Romain Guy" <[EMAIL PROTECTED]> wrote:
>
> > Hi,
>
> > It's hard to tell what's going on with such a succinct description.
> > Could you show some code if possible? It looks like you are simply not
> > invalidating the drop parent correctly.
>
> > On Mon, Sep 1, 2008 at 10:37 AM, Erik Calissendorff
>
> > <[EMAIL PROTECTED]> wrote:
>
> > > I'm creating a custom animation which extends Animation and overrides
> > > applyTransformation(float interpolatedTime, Transformation t)
>
> > > I'm also overriding getChildStaticTransformation(View child,
> > > Transformation t) in a rootView which I use for drag'n'drop.
>
> > > When I move a view outside of the drop parent before I initiate my
> > > custom animation the original position of the view is not cleared. If
> > > I modify my custom Animation so it doesn't modify the Transformation
> > > the original location is cleared as expected.
>
> > > So my question, how should I implement my custom animation so it will
> > > invalidate the area correctly?
>
> > --
> > Romain Guywww.curious-creature.org
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
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