Mark classes of package uimanager/layoutanimation as @Nullsafe (#42857)

Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/42857

All these classes are NullSafe, let's mark them as NullSafe(Local) to ensure lint detect errors in the future

changelog: [internal] internal

Reviewed By: rshest

Differential Revision: D53393472

fbshipit-source-id: 717507391623d67d03d83bf344475a4a830504a7
This commit is contained in:
David Vacca
2024-02-05 18:05:24 -08:00
committed by Facebook GitHub Bot
parent 7c12e4fb8f
commit 942013dffa
10 changed files with 34 additions and 10 deletions
@@ -7,11 +7,14 @@
package com.facebook.react.uimanager.layoutanimation;
import com.facebook.infer.annotation.Nullsafe;
/**
* Enum representing the different view properties that can be used when animating layout for view
* creation.
*/
/* package */ enum AnimatedPropertyType {
/* package */ @Nullsafe(Nullsafe.Mode.LOCAL)
enum AnimatedPropertyType {
OPACITY,
SCALE_X,
SCALE_Y,
@@ -10,10 +10,12 @@ package com.facebook.react.uimanager.layoutanimation;
import android.view.View;
import android.view.animation.Animation;
import android.view.animation.ScaleAnimation;
import com.facebook.infer.annotation.Nullsafe;
import com.facebook.react.uimanager.IllegalViewOperationException;
/** Class responsible for default layout animation, i.e animation of view creation and deletion. */
/* package */ abstract class BaseLayoutAnimation extends AbstractLayoutAnimation {
/* package */ @Nullsafe(Nullsafe.Mode.LOCAL)
abstract class BaseLayoutAnimation extends AbstractLayoutAnimation {
abstract boolean isReverse();
@@ -7,12 +7,14 @@
package com.facebook.react.uimanager.layoutanimation;
import com.facebook.infer.annotation.Nullsafe;
import java.util.Locale;
/**
* Enum representing the different interpolators that can be used in layout animation configuration.
*/
/* package */ enum InterpolatorType {
/* package */ @Nullsafe(Nullsafe.Mode.LOCAL)
enum InterpolatorType {
LINEAR,
EASE_IN,
EASE_OUT,
@@ -7,10 +7,13 @@
package com.facebook.react.uimanager.layoutanimation;
import com.facebook.infer.annotation.Nullsafe;
/**
* Enum representing the different animation type that can be specified in layout animation config.
*/
/* package */ enum LayoutAnimationType {
/* package */ @Nullsafe(Nullsafe.Mode.LOCAL)
enum LayoutAnimationType {
CREATE,
UPDATE,
DELETE;
@@ -7,11 +7,14 @@
package com.facebook.react.uimanager.layoutanimation;
import com.facebook.infer.annotation.Nullsafe;
/**
* Class responsible for handling layout view creation animation, applied to view whenever a valid
* config was supplied for the layout animation of CREATE type.
*/
/* package */ class LayoutCreateAnimation extends BaseLayoutAnimation {
/* package */ @Nullsafe(Nullsafe.Mode.LOCAL)
class LayoutCreateAnimation extends BaseLayoutAnimation {
@Override
boolean isReverse() {
@@ -7,11 +7,14 @@
package com.facebook.react.uimanager.layoutanimation;
import com.facebook.infer.annotation.Nullsafe;
/**
* Class responsible for handling layout view deletion animation, applied to view whenever a valid
* config was supplied for the layout animation of DELETE type.
*/
/* package */ class LayoutDeleteAnimation extends BaseLayoutAnimation {
/* package */ @Nullsafe(Nullsafe.Mode.LOCAL)
class LayoutDeleteAnimation extends BaseLayoutAnimation {
@Override
boolean isReverse() {
@@ -11,12 +11,14 @@ import android.view.View;
import android.view.animation.Animation;
import android.view.animation.TranslateAnimation;
import androidx.annotation.Nullable;
import com.facebook.infer.annotation.Nullsafe;
/**
* Class responsible for handling layout update animation, applied to view whenever a valid config
* was supplied for the layout animation of UPDATE type.
*/
/* package */ class LayoutUpdateAnimation extends AbstractLayoutAnimation {
/* package */ @Nullsafe(Nullsafe.Mode.LOCAL)
class LayoutUpdateAnimation extends AbstractLayoutAnimation {
// We are currently not enabling translation GPU-accelerated animated, as it creates odd
// artifacts with native react scrollview. This needs to be investigated.
@@ -10,12 +10,14 @@ package com.facebook.react.uimanager.layoutanimation;
import android.view.View;
import android.view.animation.Animation;
import android.view.animation.Transformation;
import com.facebook.infer.annotation.Nullsafe;
/**
* Animation responsible for updating opacity of a view. It should ideally use hardware texture to
* optimize rendering performances.
*/
/* package */ class OpacityAnimation extends Animation {
/* package */ @Nullsafe(Nullsafe.Mode.LOCAL)
class OpacityAnimation extends Animation {
static class OpacityAnimationListener implements Animation.AnimationListener {
@@ -10,6 +10,7 @@ package com.facebook.react.uimanager.layoutanimation;
import android.view.View;
import android.view.animation.Animation;
import android.view.animation.Transformation;
import com.facebook.infer.annotation.Nullsafe;
/**
* Animation responsible for updating size and position of a view. We can't use scaling as view
@@ -17,7 +18,8 @@ import android.view.animation.Transformation;
* passes occurring on every frame. What we might want to try to do instead is use a combined
* ScaleAnimation and TranslateAnimation.
*/
/* package */ class PositionAndSizeAnimation extends Animation implements LayoutHandlingAnimation {
/* package */ @Nullsafe(Nullsafe.Mode.LOCAL)
class PositionAndSizeAnimation extends Animation implements LayoutHandlingAnimation {
private final View mView;
private float mStartX, mStartY, mDeltaX, mDeltaY;
@@ -8,12 +8,14 @@
package com.facebook.react.uimanager.layoutanimation;
import android.view.animation.Interpolator;
import com.facebook.infer.annotation.Nullsafe;
import com.facebook.react.bridge.ReadableMap;
import com.facebook.react.bridge.ReadableType;
/** Simple spring interpolator */
// TODO(7613736): Improve spring interpolator with friction and damping variable support
/* package */ class SimpleSpringInterpolator implements Interpolator {
/* package */ @Nullsafe(Nullsafe.Mode.LOCAL)
class SimpleSpringInterpolator implements Interpolator {
private static final float FACTOR = 0.5f;
public static final String PARAM_SPRING_DAMPING = "springDamping";