Java Code Examples for com.airbnb.lottie.LottieProperty#COLOR_FILTER

The following examples show how to use com.airbnb.lottie.LottieProperty#COLOR_FILTER . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: BaseStrokeContent.java    From lottie-android with Apache License 2.0 7 votes vote down vote up
@SuppressWarnings("unchecked")
@Override
@CallSuper
public <T> void addValueCallback(T property, @Nullable LottieValueCallback<T> callback) {
  if (property == LottieProperty.OPACITY) {
    opacityAnimation.setValueCallback((LottieValueCallback<Integer>) callback);
  } else if (property == LottieProperty.STROKE_WIDTH) {
    widthAnimation.setValueCallback((LottieValueCallback<Float>) callback);
  } else if (property == LottieProperty.COLOR_FILTER) {
    if (colorFilterAnimation != null) {
      layer.removeAnimation(colorFilterAnimation);
    }

    if (callback == null) {
      colorFilterAnimation = null;
    } else {
      colorFilterAnimation =
          new ValueCallbackKeyframeAnimation<>((LottieValueCallback<ColorFilter>) callback);
      colorFilterAnimation.addUpdateListener(this);
      layer.addAnimation(colorFilterAnimation);
    }
  }
}
 
Example 2
Source File: StrokeContent.java    From lottie-android with Apache License 2.0 6 votes vote down vote up
@SuppressWarnings("unchecked")
@Override
public <T> void addValueCallback(T property, @Nullable LottieValueCallback<T> callback) {
  super.addValueCallback(property, callback);
  if (property == STROKE_COLOR) {
    colorAnimation.setValueCallback((LottieValueCallback<Integer>) callback);
  } else if (property == LottieProperty.COLOR_FILTER) {
    if (colorFilterAnimation != null) {
      layer.removeAnimation(colorFilterAnimation);
    }

    if (callback == null) {
      colorFilterAnimation = null;
    } else {
      colorFilterAnimation =
          new ValueCallbackKeyframeAnimation<>((LottieValueCallback<ColorFilter>) callback);
      colorFilterAnimation.addUpdateListener(this);
      layer.addAnimation(colorAnimation);
    }
  }
}
 
Example 3
Source File: FillContent.java    From lottie-android with Apache License 2.0 6 votes vote down vote up
@SuppressWarnings("unchecked")
@Override
public <T> void addValueCallback(T property, @Nullable LottieValueCallback<T> callback) {
  if (property == LottieProperty.COLOR) {
    colorAnimation.setValueCallback((LottieValueCallback<Integer>) callback);
  } else if (property == LottieProperty.OPACITY) {
    opacityAnimation.setValueCallback((LottieValueCallback<Integer>) callback);
  } else if (property == LottieProperty.COLOR_FILTER) {
    if (colorFilterAnimation != null) {
      layer.removeAnimation(colorFilterAnimation);
    }

    if (callback == null) {
      colorFilterAnimation = null;
    } else {
      colorFilterAnimation =
          new ValueCallbackKeyframeAnimation<>((LottieValueCallback<ColorFilter>) callback);
      colorFilterAnimation.addUpdateListener(this);
      layer.addAnimation(colorFilterAnimation);
    }
  }
}
 
Example 4
Source File: GradientFillContent.java    From lottie-android with Apache License 2.0 5 votes vote down vote up
@SuppressWarnings("unchecked")
@Override
public <T> void addValueCallback(T property, @Nullable LottieValueCallback<T> callback) {
  if (property == LottieProperty.OPACITY) {
    opacityAnimation.setValueCallback((LottieValueCallback<Integer>) callback);
  } else if (property == LottieProperty.COLOR_FILTER) {
    if (colorFilterAnimation != null) {
      layer.removeAnimation(colorFilterAnimation);
    }

     if (callback == null) {
       colorFilterAnimation = null;
     } else {
       colorFilterAnimation =
           new ValueCallbackKeyframeAnimation<>((LottieValueCallback<ColorFilter>) callback);
       colorFilterAnimation.addUpdateListener(this);
       layer.addAnimation(colorFilterAnimation);
     }
   } else if (property == LottieProperty.GRADIENT_COLOR) {
    if (colorCallbackAnimation != null) {
      layer.removeAnimation(colorCallbackAnimation);
    }

     if (callback == null) {
       colorCallbackAnimation = null;
     } else {
       //noinspection rawtypes
       colorCallbackAnimation = new ValueCallbackKeyframeAnimation<>(callback);
       colorCallbackAnimation.addUpdateListener(this);
       layer.addAnimation(colorCallbackAnimation);
     }
  }
}
 
Example 5
Source File: SolidLayer.java    From lottie-android with Apache License 2.0 5 votes vote down vote up
@SuppressWarnings("unchecked")
@Override
public <T> void addValueCallback(T property, @Nullable LottieValueCallback<T> callback) {
  super.addValueCallback(property, callback);
  if (property == LottieProperty.COLOR_FILTER) {
    if (callback == null) {
      colorFilterAnimation = null;
    } else {
      colorFilterAnimation =
          new ValueCallbackKeyframeAnimation<>((LottieValueCallback<ColorFilter>) callback);
    }
  }
}
 
Example 6
Source File: ImageLayer.java    From lottie-android with Apache License 2.0 5 votes vote down vote up
@SuppressWarnings("SingleStatementInBlock")
@Override
public <T> void addValueCallback(T property, @Nullable LottieValueCallback<T> callback) {
  super.addValueCallback(property, callback);
   if (property == LottieProperty.COLOR_FILTER) {
     if (callback == null) {
       colorFilterAnimation = null;
     } else {
       //noinspection unchecked
       colorFilterAnimation =
           new ValueCallbackKeyframeAnimation<>((LottieValueCallback<ColorFilter>) callback);
     }
  }
}