Skip to content
Permalink
Browse files

Add copyFrom method to builder

Summary: Quality of life improvement, now its easy to replicate an existing shimmer object / tweak it.

Reviewed By: sjkirby

Differential Revision: D13661209

fbshipit-source-id: 043e4314ab832b77455fc45246cb8eda62993b05
  • Loading branch information...
xiphirx authored and facebook-github-bot committed Jan 15, 2019
1 parent 96f0893 commit b055bbca297736808afc0c9bf3ca54ba7743a1b4
Showing with 22 additions and 0 deletions.
  1. +22 −0 shimmer/src/main/java/com/facebook/shimmer/Shimmer.java
@@ -243,6 +243,28 @@ T consumeAttributes(TypedArray a) {
return getThis();
}

/** Copies the configuration of an already built Shimmer to this builder */
public T copyFrom(Shimmer other) {
setDirection(other.direction);
setShape(other.shape);
setFixedWidth(other.fixedWidth);
setFixedHeight(other.fixedHeight);
setWidthRatio(other.widthRatio);
setHeightRatio(other.heightRatio);
setIntensity(other.intensity);
setDropoff(other.dropoff);
setTilt(other.tilt);
setClipToChildren(other.clipToChildren);
setAutoStart(other.autoStart);
setRepeatCount(other.repeatCount);
setRepeatMode(other.repeatMode);
setRepeatDelay(other.repeatDelay);
setDuration(other.animationDuration);
mShimmer.baseColor = other.baseColor;
mShimmer.highlightColor = other.highlightColor;
return getThis();
}

/** Sets the direction of the shimmer's sweep. See {@link Direction}. */
public T setDirection(@Direction int direction) {
mShimmer.direction = direction;

0 comments on commit b055bbc

Please sign in to comment.
You can’t perform that action at this time.