Skip to content
This repository was archived by the owner on Aug 1, 2023. It is now read-only.

Commit b055bbc

Browse files
xiphirxfacebook-github-bot
authored andcommitted
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
1 parent 96f0893 commit b055bbc

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

shimmer/src/main/java/com/facebook/shimmer/Shimmer.java

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -243,6 +243,28 @@ T consumeAttributes(TypedArray a) {
243243
return getThis();
244244
}
245245

246+
/** Copies the configuration of an already built Shimmer to this builder */
247+
public T copyFrom(Shimmer other) {
248+
setDirection(other.direction);
249+
setShape(other.shape);
250+
setFixedWidth(other.fixedWidth);
251+
setFixedHeight(other.fixedHeight);
252+
setWidthRatio(other.widthRatio);
253+
setHeightRatio(other.heightRatio);
254+
setIntensity(other.intensity);
255+
setDropoff(other.dropoff);
256+
setTilt(other.tilt);
257+
setClipToChildren(other.clipToChildren);
258+
setAutoStart(other.autoStart);
259+
setRepeatCount(other.repeatCount);
260+
setRepeatMode(other.repeatMode);
261+
setRepeatDelay(other.repeatDelay);
262+
setDuration(other.animationDuration);
263+
mShimmer.baseColor = other.baseColor;
264+
mShimmer.highlightColor = other.highlightColor;
265+
return getThis();
266+
}
267+
246268
/** Sets the direction of the shimmer's sweep. See {@link Direction}. */
247269
public T setDirection(@Direction int direction) {
248270
mShimmer.direction = direction;

0 commit comments

Comments
 (0)