Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit d7cc1244 authored by Xavier Ducrohet's avatar Xavier Ducrohet
Browse files

LayoutLib: fix moveChild again.

Change-Id: Ib69a06e44be1e332f0f43c36c795c86270cb1b71
parent 2c602e6a
Loading
Loading
Loading
Loading
+4 −1
Original line number Diff line number Diff line
@@ -150,7 +150,10 @@ public abstract class AnimationThread extends Thread {
            mListener.done(Status.SUCCESS.createResult());

        } catch (Throwable throwable) {
            Bridge.getLog().error(null, "Error playing animation", throwable);
            // can't use Bridge.getLog() as the exception might be thrown outside
            // of an acquire/release block.
            mSession.getLog().error(null, "Error playing animation", throwable);
            mListener.done(Status.ERROR_UNKNOWN.createResult("Error playing animation", throwable));

        } finally {
            postAnimation();
+21 −2
Original line number Diff line number Diff line
@@ -28,6 +28,7 @@ import static com.android.ide.common.rendering.api.Result.Status.SUCCESS;
import com.android.ide.common.rendering.api.IAnimationListener;
import com.android.ide.common.rendering.api.ILayoutPullParser;
import com.android.ide.common.rendering.api.IProjectCallback;
import com.android.ide.common.rendering.api.LayoutLog;
import com.android.ide.common.rendering.api.Params;
import com.android.ide.common.rendering.api.RenderSession;
import com.android.ide.common.rendering.api.ResourceDensity;
@@ -654,14 +655,20 @@ public class RenderSessionImpl {
                    previousParent.setLayoutTransition(removeTransition);

                    // no fade-out
                    removeTransition.setAnimator(LayoutTransition.DISAPPEARING, null);
                    // FIXME: set a non-null do-nothing Animator.
                    // setting a null animator doesn't work because the child gets its parent
                    // set to null too late.
                    //removeTransition.setAnimator(LayoutTransition.DISAPPEARING, null);

                    // now for the new parent, if different
                    if (previousParent != newParentView) {
                        LayoutTransition addTransition = new LayoutTransition();

                        // no fade-in
                        addTransition.setAnimator(LayoutTransition.APPEARING, null);
                        // FIXME: set a non-null do-nothing Animator.
                        // setting a null animator doesn't work because the child gets its parent
                        // set to null too late.
                        //addTransition.setAnimator(LayoutTransition.APPEARING, null);

                        newParentView.setLayoutTransition(addTransition);
                    }
@@ -826,6 +833,18 @@ public class RenderSessionImpl {
        }
    }

    /**
     * Returns the log associated with the session.
     * @return the log or null if there are none.
     */
    public LayoutLog getLog() {
        if (mParams != null) {
            return mParams.getLog();
        }

        return null;
    }

    /**
     * Checks that the lock is owned by the current thread and that the current context is the one
     * from this scene.