Advertisement
Guest User

Untitled

a guest
Apr 19th, 2019
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.70 KB | None | 0 0
  1. package com.costaemoura.luis.kanbanlauncher;
  2.  
  3. import android.util.Log;
  4. import android.view.View;
  5. import android.view.animation.Animation;
  6. import android.view.animation.Animation.AnimationListener;
  7. import android.view.animation.Transformation;
  8.  
  9. /**
  10. * Animation for opening and closing Views
  11. *
  12. */
  13. public class DropDownAnim extends Animation implements AnimationListener {
  14. private final int _targetHeight;
  15. private final View _view;
  16. private final boolean _down;
  17.  
  18. DropDownAnim(View view, int targetHeight) {
  19. _view = view;
  20. _targetHeight = targetHeight;
  21. _down = view.getLayoutParams().height==0;
  22.  
  23. setDuration(KanbanApp.animSpeed);
  24. setAnimationListener(this);
  25. }
  26.  
  27. @Override
  28. protected void applyTransformation(float interpolatedTime, Transformation t) {
  29. int newHeight;
  30. if (_down) {
  31. newHeight = (int) (_targetHeight * interpolatedTime);
  32. } else {
  33. newHeight = (int) (_targetHeight * (1 - interpolatedTime));
  34. }
  35. _view.getLayoutParams().height = newHeight;
  36. _view.requestLayout();
  37. }
  38.  
  39. @Override
  40. public void initialize(int width, int height, int parentWidth, int parentHeight) {
  41. super.initialize(width, height, parentWidth, parentHeight);
  42. }
  43.  
  44. @Override
  45. public boolean willChangeBounds() {
  46. return true;
  47. }
  48.  
  49. @Override
  50. public void onAnimationStart(Animation animation) {
  51. Log.e("DROPDOWNANIM", "STARTING!!");
  52. }
  53.  
  54. @Override
  55. public void onAnimationEnd(Animation animation) {
  56. Log.e("DROPDOWNANIM", "JÁ ESTÁ!!");
  57. }
  58.  
  59. @Override
  60. public void onAnimationRepeat(Animation animation) {
  61. Log.e("DROPDOWNANIM", "DOING IT!!");
  62. }
  63. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement