public AnimatedVectorDrawableState(AnimatedVectorDrawableState copy) { if (copy != null) { mChangingConfigurations = copy.mChangingConfigurations; if (copy.mVectorDrawable != null) { mVectorDrawable = (VectorDrawable) copy.mVectorDrawable.getConstantState().newDrawable(); mVectorDrawable.mutate(); mVectorDrawable.setAllowCaching(false); mVectorDrawable.setBounds(copy.mVectorDrawable.getBounds()); } if (copy.mAnimators != null) { final int numAnimators = copy.mAnimators.size(); mAnimators = new ArrayList<Animator>(numAnimators); mTargetNameMap = new ArrayMap<Animator, String>(numAnimators); for (int i = 0; i < numAnimators; ++i) { Animator anim = copy.mAnimators.get(i); Animator animClone = anim.clone(); String targetName = copy.mTargetNameMap.get(anim); Object targetObject = mVectorDrawable.getTargetByName(targetName); animClone.setTarget(targetObject); mAnimators.add(animClone); mTargetNameMap.put(animClone, targetName); } } } else { mVectorDrawable = new VectorDrawable(); } }