Skip to content

Commit 7bed07c

Browse files
committed
Added setter for speed
1 parent e134de9 commit 7bed07c

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

library/src/main/java/com/q42/android/scrollingimageview/ScrollingImageView.java

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ public void onDraw(Canvas canvas) {
122122
left += width;
123123
}
124124

125-
if (isStarted) {
125+
if (isStarted && speed != 0) {
126126
offset -= abs(speed);
127127
postInvalidateOnAnimation();
128128
}
@@ -159,4 +159,11 @@ public void stop() {
159159
invalidate();
160160
}
161161
}
162+
163+
public void setSpeed(float speed) {
164+
this.speed = speed;
165+
if (isStarted) {
166+
postInvalidateOnAnimation();
167+
}
168+
}
162169
}

0 commit comments

Comments
 (0)