Advertisement
Guest User

Untitled

a guest
Mar 18th, 2017
139
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 2.79 KB | None | 0 0
  1. Change lines:
  2. mFloatingActionButton.hide(); -> LayoutXyScaleAnim.hide(mFloatingActionButton, this);
  3. mFloatingActionButton.show(); -> LayoutXyScaleAnim.show(mFloatingActionButton, this);
  4.  
  5. And the code for hide/show is actually:
  6.  
  7. public static void show(final View target, Context context) {
  8.         target.setVisibility(View.VISIBLE);
  9.         AnimatorSet layoutShownAnim = (AnimatorSet) AnimatorInflater.loadAnimator(context, R.animator.layout_xy_scale_show);
  10.         layoutShownAnim.setTarget(target);
  11.         layoutShownAnim.addListener(new Animator.AnimatorListener() {
  12.             @Override
  13.             public void onAnimationStart(Animator animation) { }
  14.             @Override
  15.             public void onAnimationEnd(Animator animation) { target.setVisibility(View.VISIBLE); }
  16.             @Override
  17.             public void onAnimationCancel(Animator animation) { }
  18.             @Override
  19.             public void onAnimationRepeat(Animator animation) {}
  20.         });
  21.         layoutShownAnim.start();
  22.     }
  23.  
  24.     public static void hide(final View target, Context context) {
  25.         AnimatorSet layoutHiddenAnim = (AnimatorSet) AnimatorInflater.loadAnimator(context, R.animator.layout_xy_scale_hide);
  26.         layoutHiddenAnim.setTarget(target);
  27.         layoutHiddenAnim.addListener(new Animator.AnimatorListener() {
  28.             @Override
  29.             public void onAnimationStart(Animator animation) { }
  30.             @Override
  31.             public void onAnimationEnd(Animator animation) { target.setVisibility(View.GONE); }
  32.             @Override
  33.             public void onAnimationCancel(Animator animation) { }
  34.             @Override
  35.             public void onAnimationRepeat(Animator animation) {}
  36.         });
  37.         layoutHiddenAnim.start();
  38.     }
  39.  
  40. layout_xy_scale_show:
  41.  
  42. <set xmlns:android="http://schemas.android.com/apk/res/android"
  43.     android:ordering="together">
  44.  
  45.     <objectAnimator
  46.         android:duration="200"
  47.         android:propertyName="scaleX"
  48.         android:valueType="floatType"
  49.         android:valueFrom="0.0f"
  50.         android:valueTo="1.0f" />
  51.  
  52.     <objectAnimator
  53.         android:duration="200"
  54.         android:propertyName="scaleY"
  55.         android:valueType="floatType"
  56.         android:valueFrom="0.0f"
  57.         android:valueTo="1.0f" />
  58. </set>
  59.  
  60. layout_xy_scale_hide
  61.  
  62. <set xmlns:android="http://schemas.android.com/apk/res/android"
  63.     android:ordering="together">
  64.     <objectAnimator
  65.         android:duration="200"
  66.         android:propertyName="scaleX"
  67.         android:valueType="floatType"
  68.         android:valueFrom="1.0f"
  69.         android:valueTo="0.0f" />
  70.  
  71.     <objectAnimator
  72.         android:duration="200"
  73.         android:propertyName="scaleY"
  74.         android:valueType="floatType"
  75.         android:valueFrom="1.0f"
  76.         android:valueTo="0.0f" />
  77. </set>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement