@ReactMethod public void startRecordingFps() { if (mCatalystSettings == null || !mCatalystSettings.isAnimationFpsDebugEnabled()) { return; } if (mFrameCallback != null) { throw new JSApplicationCausedNativeException("Already recording FPS!"); } mFrameCallback = new FpsDebugFrameCallback( ChoreographerCompat.getInstance(), getReactApplicationContext()); mFrameCallback.startAndRecordFpsAtEachFrame(); }
@Override public void update() { for (int i = 0; i < mInputNodes.length; i++) { AnimatedNode animatedNode = mNativeAnimatedNodesManager.getNodeById(mInputNodes[i]); if (animatedNode != null && animatedNode instanceof ValueAnimatedNode) { double value = ((ValueAnimatedNode) animatedNode).getValue(); if (i == 0) { mValue = value; continue; } if (value == 0) { throw new JSApplicationCausedNativeException("Detected a division by zero in " + "Animated.divide node"); } mValue /= value; } else { throw new JSApplicationCausedNativeException("Illegal node ID set as an input for " + "Animated.divide node"); } } }
@ReactMethod public void startRecordingFps() { if (mCatalystSettings == null || !mCatalystSettings.isAnimationFpsDebugEnabled()) { return; } if (mFrameCallback != null) { throw new JSApplicationCausedNativeException("Already recording FPS!"); } checkAPILevel(); mFrameCallback = new FpsDebugFrameCallback( Choreographer.getInstance(), getReactApplicationContext()); mFrameCallback.startAndRecordFpsAtEachFrame(); }
@Override public void update() { for (int i = 0; i < mInputNodes.length; i++) { AnimatedNode animatedNode = mNativeAnimatedNodesManager.getNodeById(mInputNodes[i]); if (animatedNode != null && animatedNode instanceof ValueAnimatedNode) { double value = ((ValueAnimatedNode) animatedNode).mValue; if (i == 0) { mValue = value; continue; } if (value == 0) { throw new JSApplicationCausedNativeException("Detected a division by zero in " + "Animated.divide node"); } mValue /= value; } else { throw new JSApplicationCausedNativeException("Illegal node ID set as an input for " + "Animated.divide node"); } } }
@ReactMethod public synchronized void receiveOwnershipHierarchy( int requestId, int tag, @Nullable ReadableArray owners) { OwnerHierarchyCallback callback = mRequestIdToCallback.get(requestId); if (callback == null) { throw new JSApplicationCausedNativeException( "Got receiveOwnershipHierarchy for invalid request id: " + requestId); } mRequestIdToCallback.delete(requestId); callback.onOwnerHierarchyLoaded(tag, owners); }
@Override public void update() { mValue = 1; for (int i = 0; i < mInputNodes.length; i++) { AnimatedNode animatedNode = mNativeAnimatedNodesManager.getNodeById(mInputNodes[i]); if (animatedNode != null && animatedNode instanceof ValueAnimatedNode) { mValue *= ((ValueAnimatedNode) animatedNode).getValue(); } else { throw new JSApplicationCausedNativeException("Illegal node ID set as an input for " + "Animated.multiply node"); } } }
@Override public void update() { AnimatedNode animatedNode = mNativeAnimatedNodesManager.getNodeById(mInputNode); if (animatedNode != null && animatedNode instanceof ValueAnimatedNode) { mValue = ((ValueAnimatedNode) animatedNode).mValue % mModulus; } else { throw new JSApplicationCausedNativeException("Illegal node ID set as an input for " + "Animated.modulus node"); } }
@Override public void update() { mValue = 0; for (int i = 0; i < mInputNodes.length; i++) { AnimatedNode animatedNode = mNativeAnimatedNodesManager.getNodeById(mInputNodes[i]); if (animatedNode != null && animatedNode instanceof ValueAnimatedNode) { mValue += ((ValueAnimatedNode) animatedNode).getValue(); } else { throw new JSApplicationCausedNativeException("Illegal node ID set as an input for " + "Animated.Add node"); } } }
private double getInputNodeValue() { AnimatedNode animatedNode = mNativeAnimatedNodesManager.getNodeById(mInputNodeTag); if (animatedNode == null || !(animatedNode instanceof ValueAnimatedNode)) { throw new JSApplicationCausedNativeException("Illegal node ID set as an input for " + "Animated.DiffClamp node"); } return ((ValueAnimatedNode) animatedNode).getValue(); }
@Override public void update() { mValue = 1; for (int i = 0; i < mInputNodes.length; i++) { AnimatedNode animatedNode = mNativeAnimatedNodesManager.getNodeById(mInputNodes[i]); if (animatedNode != null && animatedNode instanceof ValueAnimatedNode) { mValue *= ((ValueAnimatedNode) animatedNode).mValue; } else { throw new JSApplicationCausedNativeException("Illegal node ID set as an input for " + "Animated.multiply node"); } } }
@Override public void update() { mValue = 0; for (int i = 0; i < mInputNodes.length; i++) { AnimatedNode animatedNode = mNativeAnimatedNodesManager.getNodeById(mInputNodes[i]); if (animatedNode != null && animatedNode instanceof ValueAnimatedNode) { mValue += ((ValueAnimatedNode) animatedNode).mValue; } else { throw new JSApplicationCausedNativeException("Illegal node ID set as an input for " + "Animated.Add node"); } } }
private double getInputNodeValue() { AnimatedNode animatedNode = mNativeAnimatedNodesManager.getNodeById(mInputNodeTag); if (animatedNode == null || !(animatedNode instanceof ValueAnimatedNode)) { throw new JSApplicationCausedNativeException("Illegal node ID set as an input for " + "Animated.DiffClamp node"); } return ((ValueAnimatedNode) animatedNode).mValue; }
private static void checkAPILevel() { if (Build.VERSION.SDK_INT < 16) { throw new JSApplicationCausedNativeException( "Animation debugging is not supported in API <16"); } }