1 package com.android.mail.utils; 2 3 import android.animation.Animator; 4 import android.animation.AnimatorListenerAdapter; 5 import android.view.View; 6 import android.view.ViewPropertyAnimator; 7 8 /** 9 * A backwards-compatible substitute for {@link ViewPropertyAnimator#withLayer()}. 10 * 11 */ 12 public class HardwareLayerEnabler extends AnimatorListenerAdapter { 13 14 private final View mTarget; 15 16 public HardwareLayerEnabler(View target) { 17 mTarget = target; 18 } 19 20 @Override 21 public void onAnimationStart(Animator animation) { 22 mTarget.setLayerType(View.LAYER_TYPE_HARDWARE, null); 23 } 24 25 @Override 26 public void onAnimationEnd(Animator animation) { 27 mTarget.setLayerType(View.LAYER_TYPE_NONE, null); 28 } 29 30 } 31