Advertisement
Guest User

Untitled

a guest
Jun 22nd, 2017
44
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.32 KB | None | 0 0
  1. public class LinearPattern implements FabulousPattern {
  2. private static final int MAIN_FAB_ANIMATION_DURATION = 200;
  3.  
  4. @NotNull
  5. @Override
  6. public AnimatorSet getClosingAnimation(@NotNull View element, float destX, float destY) {
  7. AnimatorSet anim = new AnimatorSet();
  8. ObjectAnimator fabX = ObjectAnimator.ofFloat(element, View.X, destX);
  9. fabX.setDuration(MAIN_FAB_ANIMATION_DURATION);
  10. ObjectAnimator fabY = ObjectAnimator.ofFloat(element, View.Y, destY);
  11. fabY.setDuration(MAIN_FAB_ANIMATION_DURATION);
  12.  
  13. anim.play(fabX).with(fabY);
  14. return anim;
  15. }
  16.  
  17. @NotNull
  18. @Override
  19. public AnimatorSet getOpeningAnimation(@NotNull View element, float destX, float destY) {
  20. AnimatorSet anim = new AnimatorSet();
  21. ObjectAnimator fabX = ObjectAnimator.ofFloat(element, View.X, destX);
  22. fabX.setDuration(MAIN_FAB_ANIMATION_DURATION);
  23. ObjectAnimator fabY = ObjectAnimator.ofFloat(element, View.Y, destY);
  24. fabY.setDuration(MAIN_FAB_ANIMATION_DURATION);
  25.  
  26. anim.play(fabX).with(fabY);
  27. return anim;
  28. }
  29.  
  30. @NotNull
  31. @Override
  32. public FabulousPosition getFinalPosition(@NotNull View subMenu, float fabX, float fabY, int position, int menuSize) {
  33. return new FabulousPosition(fabX, fabY - ((position + 1) * 200));
  34. }
  35. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement