1 /* 2 * Copyright (C) 2016 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 package android.view; 17 18 import android.animation.TimeInterpolator; 19 import com.android.internal.view.animation.FallbackLUTInterpolator; 20 import com.android.internal.view.animation.NativeInterpolatorFactory; 21 import com.android.internal.view.animation.NativeInterpolatorFactoryHelper; 22 23 /** 24 * This is a helper class to get access to methods and fields needed for RenderNodeAnimatorSet 25 * that are internal or package private to android.view package. 26 * 27 * @hide 28 */ 29 public class RenderNodeAnimatorSetHelper { 30 31 public static RenderNode getTarget(DisplayListCanvas recordingCanvas) { 32 return recordingCanvas.mNode; 33 } 34 35 public static long createNativeInterpolator(TimeInterpolator interpolator, long 36 duration) { 37 if (interpolator == null) { 38 // create LinearInterpolator 39 return NativeInterpolatorFactoryHelper.createLinearInterpolator(); 40 } else if (RenderNodeAnimator.isNativeInterpolator(interpolator)) { 41 return ((NativeInterpolatorFactory)interpolator).createNativeInterpolator(); 42 } else { 43 return FallbackLUTInterpolator.createNativeInterpolator(interpolator, duration); 44 } 45 } 46 47 } 48