1package com.android.mail.utils; 2 3import android.animation.Animator; 4import android.animation.AnimatorListenerAdapter; 5import android.view.View; 6import android.view.ViewPropertyAnimator; 7 8/** 9 * A backwards-compatible substitute for {@link ViewPropertyAnimator#withLayer()}. 10 * 11 */ 12public 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