Remove legacy AnimationManagerModule

Summary: This code was shipped as part of the initial open-source release but was never used.

Reviewed By: sahrens

Differential Revision: D14649389

fbshipit-source-id: 0c068ca69b91d275008f4a7af77a23a4f1470c18
This commit is contained in:
Pieter De Baets
2019-04-03 04:38:50 -07:00
committed by Facebook Github Bot
parent d9711e2693
commit a333c2b202
23 changed files with 5 additions and 786 deletions

View File

@@ -1,62 +0,0 @@
/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
package com.facebook.react.animation;
import android.view.View;
/**
* Base class for {@link AnimationPropertyUpdater} subclasses that updates a pair of float property
* values. It helps to handle conversion from animation progress to the actual values as
* well as the quite common case when no starting value is provided.
*/
public abstract class AbstractFloatPairPropertyUpdater implements AnimationPropertyUpdater {
private final float[] mFromValues = new float[2];
private final float[] mToValues = new float[2];
private final float[] mUpdateValues = new float[2];
private boolean mFromSource;
protected AbstractFloatPairPropertyUpdater(float toFirst, float toSecond) {
mToValues[0] = toFirst;
mToValues[1] = toSecond;
mFromSource = true;
}
protected AbstractFloatPairPropertyUpdater(
float fromFirst,
float fromSecond,
float toFirst,
float toSecond) {
this(toFirst, toSecond);
mFromValues[0] = fromFirst;
mFromValues[1] = fromSecond;
mFromSource = false;
}
protected abstract void getProperty(View view, float[] returnValues);
protected abstract void setProperty(View view, float[] propertyValues);
@Override
public void prepare(View view) {
if (mFromSource) {
getProperty(view, mFromValues);
}
}
@Override
public void onUpdate(View view, float progress) {
mUpdateValues[0] = mFromValues[0] + (mToValues[0] - mFromValues[0]) * progress;
mUpdateValues[1] = mFromValues[1] + (mToValues[1] - mFromValues[1]) * progress;
setProperty(view, mUpdateValues);
}
@Override
public void onFinish(View view) {
setProperty(view, mToValues);
}
}

View File

@@ -1,52 +0,0 @@
/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
package com.facebook.react.animation;
import android.view.View;
/**
* Base class for {@link AnimationPropertyUpdater} subclasses that updates a single float property
* value. It helps to handle conversion from animation progress to the actual value as well as the
* quite common case when no starting value is provided.
*/
public abstract class AbstractSingleFloatProperyUpdater implements AnimationPropertyUpdater {
private float mFromValue, mToValue;
private boolean mFromSource;
protected AbstractSingleFloatProperyUpdater(float toValue) {
mToValue = toValue;
mFromSource = true;
}
protected AbstractSingleFloatProperyUpdater(float fromValue, float toValue) {
this(toValue);
mFromValue = fromValue;
mFromSource = false;
}
protected abstract float getProperty(View view);
protected abstract void setProperty(View view, float propertyValue);
@Override
public final void prepare(View view) {
if (mFromSource) {
mFromValue = getProperty(view);
}
}
@Override
public final void onUpdate(View view, float progress) {
setProperty(view, mFromValue + (mToValue - mFromValue) * progress);
}
@Override
public void onFinish(View view) {
setProperty(view, mToValue);
}
}

View File

@@ -1,105 +0,0 @@
/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
package com.facebook.react.animation;
import javax.annotation.Nullable;
import android.view.View;
import com.facebook.infer.annotation.Assertions;
/**
* Base class for various catalyst animation engines. Subclasses of this class should implement
* {@link #run} method which should bootstrap the animation. Then in each animation frame we expect
* animation engine to call {@link #onUpdate} with a float progress which then will be transferred
* to the underlying {@link AnimationPropertyUpdater} instance.
*
* Animation engine should support animation cancelling by monitoring the returned value of
* {@link #onUpdate}. In case of returning false, animation should be considered cancelled and
* engine should not attempt to call {@link #onUpdate} again.
*/
public abstract class Animation {
private final int mAnimationID;
private final AnimationPropertyUpdater mPropertyUpdater;
private volatile boolean mCancelled = false;
private volatile boolean mIsFinished = false;
private @Nullable AnimationListener mAnimationListener;
private @Nullable View mAnimatedView;
public Animation(int animationID, AnimationPropertyUpdater propertyUpdater) {
mAnimationID = animationID;
mPropertyUpdater = propertyUpdater;
}
public void setAnimationListener(AnimationListener animationListener) {
mAnimationListener = animationListener;
}
public final void start(View view) {
mAnimatedView = view;
mPropertyUpdater.prepare(view);
run();
}
public abstract void run();
/**
* Animation engine should call this method for every animation frame passing animation progress
* value as a parameter. Animation progress should be within the range 0..1 (the exception here
* would be a spring animation engine which may slightly exceed start and end progress values).
*
* This method will return false if the animation has been cancelled. In that case animation
* engine should not attempt to call this method again. Otherwise this method will return true
*/
protected final boolean onUpdate(float value) {
Assertions.assertCondition(!mIsFinished, "Animation must not already be finished!");
if (!mCancelled) {
mPropertyUpdater.onUpdate(Assertions.assertNotNull(mAnimatedView), value);
}
return !mCancelled;
}
/**
* Animation engine should call this method when the animation is finished. Should be called only
* once
*/
protected final void finish() {
Assertions.assertCondition(!mIsFinished, "Animation must not already be finished!");
mIsFinished = true;
if (!mCancelled) {
if (mAnimatedView != null) {
mPropertyUpdater.onFinish(mAnimatedView);
}
if (mAnimationListener != null) {
mAnimationListener.onFinished();
}
}
}
/**
* Cancels the animation.
*
* It is possible for this to be called after finish() and should handle that gracefully.
*/
public final void cancel() {
if (mIsFinished || mCancelled) {
// If we were already finished, ignore
return;
}
mCancelled = true;
if (mAnimationListener != null) {
mAnimationListener.onCancel();
}
}
public int getAnimationID() {
return mAnimationID;
}
}

View File

@@ -1,25 +0,0 @@
/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
package com.facebook.react.animation;
/**
* Interface for getting animation lifecycle updates. It is guaranteed that for a given animation,
* only one of onFinished and onCancel will be called, and it will be called exactly once.
*/
public interface AnimationListener {
/**
* Called once animation is finished
*/
public void onFinished();
/**
* Called in case when animation was cancelled
*/
public void onCancel();
}

View File

@@ -1,44 +0,0 @@
/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
package com.facebook.react.animation;
import android.view.View;
/**
* Interface used to update particular property types during animation. While animation is in
* progress {@link Animation} instance will call {@link #onUpdate} several times with a value
* representing animation progress. Normally value will be from 0..1 range, but for spring animation
* it can slightly exceed that limit due to bounce effect at the start/end of animation.
*/
public interface AnimationPropertyUpdater {
/**
* This method will be called before animation starts.
*
* @param view view that will be animated
*/
public void prepare(View view);
/**
* This method will be called for each animation frame
*
* @param view view to update property
* @param progress animation progress from 0..1 range (may slightly exceed that limit in case of
* spring engine) retrieved from {@link Animation} engine.
*/
public void onUpdate(View view, float progress);
/**
* This method will be called at the end of animation. It should be used to set the final values
* for animated properties in order to avoid floating point inaccuracy calculated in
* {@link #onUpdate} by passing value close to 1.0 or in a case some frames got dropped.
*
* @param view view to update property
*/
public void onFinish(View view);
}

View File

@@ -1,41 +0,0 @@
/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
package com.facebook.react.animation;
import android.util.SparseArray;
import com.facebook.react.bridge.UiThreadUtil;
/**
* Coordinates catalyst animations driven by {@link UIManagerModule} and
* {@link AnimationManagerModule}
*/
public class AnimationRegistry {
private final SparseArray<Animation> mRegistry = new SparseArray<Animation>();
public void registerAnimation(Animation animation) {
UiThreadUtil.assertOnUiThread();
mRegistry.put(animation.getAnimationID(), animation);
}
public Animation getAnimation(int animationID) {
UiThreadUtil.assertOnUiThread();
return mRegistry.get(animationID);
}
public Animation removeAnimation(int animationID) {
UiThreadUtil.assertOnUiThread();
Animation animation = mRegistry.get(animationID);
if (animation != null) {
mRegistry.delete(animationID);
}
return animation;
}
}

View File

@@ -1,14 +0,0 @@
load("//tools/build_defs/oss:rn_defs.bzl", "react_native_dep", "react_native_target", "rn_android_library")
rn_android_library(
name = "animation",
srcs = glob(["**/*.java"]),
visibility = [
"PUBLIC",
],
deps = [
react_native_dep("third-party/java/infer-annotations:infer-annotations"),
react_native_dep("third-party/java/jsr-305:jsr-305"),
react_native_target("java/com/facebook/react/bridge:bridge"),
],
)

View File

@@ -1,26 +0,0 @@
/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
package com.facebook.react.animation;
/**
* Ignores duration and immediately jump to the end of animation. This is a temporal solution for
* the lack of real animation engines implemented.
*/
public class ImmediateAnimation extends Animation {
public ImmediateAnimation(int animationID, AnimationPropertyUpdater propertyUpdater) {
super(animationID, propertyUpdater);
}
@Override
public void run() {
onUpdate(1.0f);
finish();
}
}

View File

@@ -1,28 +0,0 @@
/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
package com.facebook.react.animation;
import android.view.View;
/**
* Empty {@link AnimationPropertyUpdater} that can be used as a stub for unsupported property types
*/
public class NoopAnimationPropertyUpdater implements AnimationPropertyUpdater {
@Override
public void prepare(View view) {
}
@Override
public void onUpdate(View view, float value) {
}
@Override
public void onFinish(View view) {
}
}

View File

@@ -1,34 +0,0 @@
/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
package com.facebook.react.animation;
import android.view.View;
/**
* Subclass of {@link AnimationPropertyUpdater} for animating view's opacity
*/
public class OpacityAnimationPropertyUpdater extends AbstractSingleFloatProperyUpdater {
public OpacityAnimationPropertyUpdater(float toOpacity) {
super(toOpacity);
}
public OpacityAnimationPropertyUpdater(float fromOpacity, float toOpacity) {
super(fromOpacity, toOpacity);
}
@Override
protected float getProperty(View view) {
return view.getAlpha();
}
@Override
protected void setProperty(View view, float propertyValue) {
view.setAlpha(propertyValue);
}
}

View File

@@ -1,40 +0,0 @@
/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
package com.facebook.react.animation;
import android.view.View;
/**
* Subclass of {@link AnimationPropertyUpdater} for animating center position of a view
*/
public class PositionAnimationPairPropertyUpdater extends AbstractFloatPairPropertyUpdater {
public PositionAnimationPairPropertyUpdater(float toFirst, float toSecond) {
super(toFirst, toSecond);
}
public PositionAnimationPairPropertyUpdater(
float fromFirst,
float fromSecond,
float toFirst,
float toSecond) {
super(fromFirst, fromSecond, toFirst, toSecond);
}
@Override
protected void getProperty(View view, float[] returnValues) {
returnValues[0] = view.getX() + 0.5f * view.getWidth();
returnValues[1] = view.getY() + 0.5f * view.getHeight();
}
@Override
protected void setProperty(View view, float[] propertyValues) {
view.setX(propertyValues[0] - 0.5f * view.getWidth());
view.setY(propertyValues[1] - 0.5f * view.getHeight());
}
}

View File

@@ -1,30 +0,0 @@
/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
package com.facebook.react.animation;
import android.view.View;
/**
* Subclass of {@link AnimationPropertyUpdater} for animating view's rotation
*/
public class RotationAnimationPropertyUpdater extends AbstractSingleFloatProperyUpdater {
public RotationAnimationPropertyUpdater(float toValue) {
super(toValue);
}
@Override
protected float getProperty(View view) {
return view.getRotation();
}
@Override
protected void setProperty(View view, float propertyValue) {
view.setRotation((float) Math.toDegrees(propertyValue));
}
}

View File

@@ -1,34 +0,0 @@
/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
package com.facebook.react.animation;
import android.view.View;
/**
* Subclass of {@link AnimationPropertyUpdater} for animating view's X scale
*/
public class ScaleXAnimationPropertyUpdater extends AbstractSingleFloatProperyUpdater {
public ScaleXAnimationPropertyUpdater(float toValue) {
super(toValue);
}
public ScaleXAnimationPropertyUpdater(float fromValue, float toValue) {
super(fromValue, toValue);
}
@Override
protected float getProperty(View view) {
return view.getScaleX();
}
@Override
protected void setProperty(View view, float propertyValue) {
view.setScaleX(propertyValue);
}
}

View File

@@ -1,40 +0,0 @@
/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
package com.facebook.react.animation;
import android.view.View;
/**
* Subclass of {@link AnimationPropertyUpdater} for animating view's X and Y scale
*/
public class ScaleXYAnimationPairPropertyUpdater extends AbstractFloatPairPropertyUpdater {
public ScaleXYAnimationPairPropertyUpdater(float toFirst, float toSecond) {
super(toFirst, toSecond);
}
public ScaleXYAnimationPairPropertyUpdater(
float fromFirst,
float fromSecond,
float toFirst,
float toSecond) {
super(fromFirst, fromSecond, toFirst, toSecond);
}
@Override
protected void getProperty(View view, float[] returnValues) {
returnValues[0] = view.getScaleX();
returnValues[1] = view.getScaleY();
}
@Override
protected void setProperty(View view, float[] propertyValues) {
view.setScaleX(propertyValues[0]);
view.setScaleY(propertyValues[1]);
}
}

View File

@@ -1,34 +0,0 @@
/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
package com.facebook.react.animation;
import android.view.View;
/**
* Subclass of {@link AnimationPropertyUpdater} for animating view's Y scale
*/
public class ScaleYAnimationPropertyUpdater extends AbstractSingleFloatProperyUpdater {
public ScaleYAnimationPropertyUpdater(float toValue) {
super(toValue);
}
public ScaleYAnimationPropertyUpdater(float fromValue, float toValue) {
super(fromValue, toValue);
}
@Override
protected float getProperty(View view) {
return view.getScaleY();
}
@Override
protected void setProperty(View view, float propertyValue) {
view.setScaleY(propertyValue);
}
}

View File

@@ -29,7 +29,6 @@ rn_android_library(
react_native_dep("third-party/java/infer-annotations:infer-annotations"),
react_native_target("java/com/facebook/debug/tags:tags"),
react_native_target("java/com/facebook/debug/holder:holder"),
react_native_target("java/com/facebook/react/animation:animation"),
react_native_target("java/com/facebook/react/bridge:bridge"),
react_native_target("java/com/facebook/react/common:common"),
react_native_target("java/com/facebook/react/config:config"),

View File

@@ -21,9 +21,6 @@ import android.widget.PopupMenu;
import com.facebook.common.logging.FLog;
import com.facebook.infer.annotation.Assertions;
import com.facebook.react.R;
import com.facebook.react.animation.Animation;
import com.facebook.react.animation.AnimationListener;
import com.facebook.react.animation.AnimationRegistry;
import com.facebook.react.bridge.Callback;
import com.facebook.react.bridge.JSApplicationIllegalArgumentException;
import com.facebook.react.bridge.ReactContext;
@@ -68,7 +65,6 @@ public class NativeViewHierarchyManager {
private static final String TAG = NativeViewHierarchyManager.class.getSimpleName();
private final AnimationRegistry mAnimationRegistry;
private final SparseArray<View> mTagsToViews;
private final SparseArray<ViewManager> mTagsToViewManagers;
private final SparseBooleanArray mRootTags;
@@ -86,7 +82,6 @@ public class NativeViewHierarchyManager {
}
public NativeViewHierarchyManager(ViewManagerRegistry viewManagers, RootViewManager manager) {
mAnimationRegistry = new AnimationRegistry();
mViewManagers = viewManagers;
mTagsToViews = new SparseArray<>();
mTagsToViewManagers = new SparseArray<>();
@@ -111,10 +106,6 @@ public class NativeViewHierarchyManager {
return viewManager;
}
public AnimationRegistry getAnimationRegistry() {
return mAnimationRegistry;
}
public void setLayoutAnimationEnabled(boolean enabled) {
mLayoutAnimationEnabled = enabled;
}
@@ -746,45 +737,6 @@ public class NativeViewHierarchyManager {
mLayoutAnimator.reset();
}
/* package */ synchronized void startAnimationForNativeView(
int reactTag,
Animation animation,
@Nullable final Callback animationCallback) {
UiThreadUtil.assertOnUiThread();
View view = mTagsToViews.get(reactTag);
final int animationId = animation.getAnimationID();
if (view != null) {
animation.setAnimationListener(new AnimationListener() {
@Override
public void onFinished() {
Animation removedAnimation = mAnimationRegistry.removeAnimation(animationId);
// There's a chance that there was already a removeAnimation call enqueued on the main
// thread when this callback got enqueued on the main thread, but the Animation class
// should handle only calling one of onFinished and onCancel exactly once.
Assertions.assertNotNull(removedAnimation, "Animation was already removed somehow!");
if (animationCallback != null) {
animationCallback.invoke(true);
}
}
@Override
public void onCancel() {
Animation removedAnimation = mAnimationRegistry.removeAnimation(animationId);
Assertions.assertNotNull(removedAnimation, "Animation was already removed somehow!");
if (animationCallback != null) {
animationCallback.invoke(false);
}
}
});
animation.start(view);
} else {
// TODO(5712813): cleanup callback in JS callbacks table in case of an error
throw new IllegalViewOperationException("View with tag " + reactTag + " not found");
}
}
public synchronized void dispatchCommand(
int reactTag,
int commandId,

View File

@@ -11,7 +11,6 @@ import android.view.View;
import android.view.View.MeasureSpec;
import com.facebook.common.logging.FLog;
import com.facebook.infer.annotation.Assertions;
import com.facebook.react.animation.Animation;
import com.facebook.react.bridge.Arguments;
import com.facebook.react.bridge.Callback;
import com.facebook.react.bridge.ReactApplicationContext;
@@ -694,29 +693,6 @@ public class UIImplementation {
}
}
/**
* Registers a new Animation that can then be added to a View using {@link #addAnimation}.
*/
public void registerAnimation(Animation animation) {
mOperationsQueue.enqueueRegisterAnimation(animation);
}
/**
* Adds an Animation previously registered with {@link #registerAnimation} to a View and starts it
*/
public void addAnimation(int reactTag, int animationID, Callback onSuccess) {
assertViewExists(reactTag, "addAnimation");
mOperationsQueue.enqueueAddAnimation(reactTag, animationID, onSuccess);
}
/**
* Removes an existing Animation, canceling it if it was in progress.
*/
public void removeAnimation(int reactTag, int animationID) {
assertViewExists(reactTag, "removeAnimation");
mOperationsQueue.enqueueRemoveAnimation(animationID);
}
/**
* LayoutAnimation API on Android is currently experimental. Therefore, it needs to be enabled
* explicitly in order to avoid regression in existing application written for iOS using this API.

View File

@@ -20,7 +20,6 @@ import android.view.View;
import com.facebook.common.logging.FLog;
import com.facebook.debug.holder.PrinterHolder;
import com.facebook.debug.tags.ReactDebugOverlayTags;
import com.facebook.react.animation.Animation;
import com.facebook.react.bridge.Arguments;
import com.facebook.react.bridge.Callback;
import com.facebook.react.bridge.GuardedRunnable;
@@ -635,23 +634,6 @@ public class UIManagerModule extends ReactContextBaseJavaModule
mUIImplementation.viewIsDescendantOf(reactTag, ancestorReactTag, callback);
}
/** Registers a new Animation that can then be added to a View using {@link #addAnimation}. */
public void registerAnimation(Animation animation) {
mUIImplementation.registerAnimation(animation);
}
/**
* Adds an Animation previously registered with {@link #registerAnimation} to a View and starts it
*/
public void addAnimation(int reactTag, int animationID, Callback onSuccess) {
mUIImplementation.addAnimation(reactTag, animationID, onSuccess);
}
/** Removes an existing Animation, canceling it if it was in progress. */
public void removeAnimation(int reactTag, int animationID) {
mUIImplementation.removeAnimation(reactTag, animationID);
}
@Override
@ReactMethod
public void setJSResponder(int reactTag, boolean blockNativeResponder) {

View File

@@ -10,8 +10,6 @@ package com.facebook.react.uimanager;
import android.os.SystemClock;
import android.view.View;
import com.facebook.common.logging.FLog;
import com.facebook.react.animation.Animation;
import com.facebook.react.animation.AnimationRegistry;
import com.facebook.react.bridge.Callback;
import com.facebook.react.bridge.GuardedRunnable;
import com.facebook.react.bridge.ReactApplicationContext;
@@ -33,9 +31,9 @@ import javax.annotation.Nullable;
import javax.annotation.concurrent.GuardedBy;
/**
* This class acts as a buffer for command executed on {@link NativeViewHierarchyManager} or on
* {@link AnimationRegistry}. It expose similar methods as mentioned classes but instead of
* executing commands immediately it enqueues those operations in a queue that is then flushed from
* This class acts as a buffer for command executed on {@link NativeViewHierarchyManager}.
* It expose similar methods as mentioned classes but instead of executing commands
* immediately it enqueues those operations in a queue that is then flushed from
* {@link UIManagerModule} once JS batch of ui operations is finished. This is to make sure that we
* execute all the JS operation coming from a single batch a single loop of the main (UI) android
* looper.
@@ -356,63 +354,6 @@ public class UIViewOperationQueue {
}
}
private class RegisterAnimationOperation extends AnimationOperation {
private final Animation mAnimation;
private RegisterAnimationOperation(Animation animation) {
super(animation.getAnimationID());
mAnimation = animation;
}
@Override
public void execute() {
mAnimationRegistry.registerAnimation(mAnimation);
}
}
private class AddAnimationOperation extends AnimationOperation {
private final int mReactTag;
private final Callback mSuccessCallback;
private AddAnimationOperation(int reactTag, int animationID, Callback successCallback) {
super(animationID);
mReactTag = reactTag;
mSuccessCallback = successCallback;
}
@Override
public void execute() {
Animation animation = mAnimationRegistry.getAnimation(mAnimationID);
if (animation != null) {
mNativeViewHierarchyManager.startAnimationForNativeView(
mReactTag,
animation,
mSuccessCallback);
} else {
// node or animation not found
// TODO(5712813): cleanup callback in JS callbacks table in case of an error
throw new IllegalViewOperationException("Animation with id " + mAnimationID
+ " was not found");
}
}
}
private final class RemoveAnimationOperation extends AnimationOperation {
private RemoveAnimationOperation(int animationID) {
super(animationID);
}
@Override
public void execute() {
Animation animation = mAnimationRegistry.getAnimation(mAnimationID);
if (animation != null) {
animation.cancel();
}
}
}
private class SetLayoutAnimationEnabledOperation implements UIOperation {
private final boolean mEnabled;
@@ -604,7 +545,6 @@ public class UIViewOperationQueue {
}
private final NativeViewHierarchyManager mNativeViewHierarchyManager;
private final AnimationRegistry mAnimationRegistry;
private final Object mDispatchRunnablesLock = new Object();
private final Object mNonBatchedOperationsLock = new Object();
private final DispatchUIFrameCallback mDispatchUIFrameCallback;
@@ -637,7 +577,6 @@ public class UIViewOperationQueue {
NativeViewHierarchyManager nativeViewHierarchyManager,
int minTimeLeftInFrameForNonBatchedOperationMs) {
mNativeViewHierarchyManager = nativeViewHierarchyManager;
mAnimationRegistry = nativeViewHierarchyManager.getAnimationRegistry();
mDispatchUIFrameCallback =
new DispatchUIFrameCallback(
reactContext,
@@ -795,21 +734,6 @@ public class UIViewOperationQueue {
new SetChildrenOperation(reactTag, childrenTags));
}
public void enqueueRegisterAnimation(Animation animation) {
mOperations.add(new RegisterAnimationOperation(animation));
}
public void enqueueAddAnimation(
final int reactTag,
final int animationID,
final Callback onSuccess) {
mOperations.add(new AddAnimationOperation(reactTag, animationID, onSuccess));
}
public void enqueueRemoveAnimation(int animationID) {
mOperations.add(new RemoveAnimationOperation(animationID));
}
public void enqueueSetLayoutAnimationEnabled(
final boolean enabled) {
mOperations.add(new SetLayoutAnimationEnabledOperation(enabled));

View File

@@ -3,8 +3,7 @@ load("//tools/build_defs/oss:rn_defs.bzl", "YOGA_TARGET", "react_native_dep", "r
rn_robolectric_test(
name = "react",
srcs = glob(["*.java"]),
# Please change the contact to the oncall of your team
contacts = ["oncall+fbandroid_sheriff@xmail.facebook.com"],
contacts = ["oncall+react_native@xmail.facebook.com"],
deps = [
YOGA_TARGET,
react_native_dep("libraries/fbcore/src/test/java/com/facebook/powermock:powermock"),
@@ -17,7 +16,6 @@ rn_robolectric_test(
react_native_dep("third-party/java/okio:okio"),
react_native_dep("third-party/java/robolectric3/robolectric:robolectric"),
react_native_target("java/com/facebook/react:react"),
react_native_target("java/com/facebook/react/animation:animation"),
react_native_target("java/com/facebook/react/bridge:bridge"),
react_native_target("java/com/facebook/react/common:common"),
react_native_target("java/com/facebook/react/touch:touch"),

View File

@@ -3,8 +3,7 @@ load("//tools/build_defs/oss:rn_defs.bzl", "YOGA_TARGET", "react_native_dep", "r
rn_robolectric_test(
name = "modules",
srcs = glob(["**/*.java"]),
# Please change the contact to the oncall of your team
contacts = ["oncall+fbandroid_sheriff@xmail.facebook.com"],
contacts = ["oncall+react_native@xmail.facebook.com"],
visibility = [
"PUBLIC",
],
@@ -20,7 +19,6 @@ rn_robolectric_test(
react_native_dep("third-party/java/okio:okio"),
react_native_dep("third-party/java/robolectric3/robolectric:robolectric"),
react_native_target("java/com/facebook/react:react"),
react_native_target("java/com/facebook/react/animation:animation"),
react_native_target("java/com/facebook/react/bridge:bridge"),
react_native_target("java/com/facebook/react/common:common"),
react_native_target("java/com/facebook/react/common/network:network"),

View File

@@ -27,7 +27,6 @@ rn_robolectric_test(
react_native_dep("third-party/java/okio:okio"),
react_native_dep("third-party/java/robolectric3/robolectric:robolectric"),
react_native_target("java/com/facebook/react:react"),
react_native_target("java/com/facebook/react/animation:animation"),
react_native_target("java/com/facebook/react/bridge:bridge"),
react_native_target("java/com/facebook/react/common:common"),
react_native_target("java/com/facebook/react/touch:touch"),