Skip to content
This repository was archived by the owner on Apr 24, 2018. It is now read-only.

Commit be479c5

Browse files
committed
Fix incorrect start position of showcase animation
ShowcaseView#setShowcasePosition adjusts the given coordinates for the location of the ShowcaseView inside the window. When ObjectAnimator calls getShowcaseY to get the starting value for the animation, the already adjusted value was returned, thus basically incorrectly applying the adjustment twice when the ObjectAnimator sets that value at the start of the animation. As a fix, hide the fact that the fields showcaseX and showcaseY are adjusted by returning the un-adjusted values from their getters.
1 parent c35bb77 commit be479c5

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

library/src/main/java/com/github/amlcurran/showcaseview/ShowcaseView.java

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -225,19 +225,21 @@ public boolean hasShowcaseView() {
225225
}
226226

227227
public void setShowcaseX(int x) {
228-
setShowcasePosition(x, showcaseY);
228+
setShowcasePosition(x, getShowcaseY());
229229
}
230230

231231
public void setShowcaseY(int y) {
232-
setShowcasePosition(showcaseX, y);
232+
setShowcasePosition(getShowcaseX(), y);
233233
}
234234

235235
public int getShowcaseX() {
236-
return showcaseX;
236+
getLocationInWindow(positionInWindow);
237+
return showcaseX + positionInWindow[0];
237238
}
238239

239240
public int getShowcaseY() {
240-
return showcaseY;
241+
getLocationInWindow(positionInWindow);
242+
return showcaseY + positionInWindow[1];
241243
}
242244

243245
/**

0 commit comments

Comments
 (0)